/* ==========================================
   SalmasFlix — Games · Salma's Icy Tower + Super Salma + Salma Invaders
   Extracted from games.css in Phase 7.3.

   Solo arcade games that share the `.icy-*` canvas-container,
   HUD, overlay, high-scores card, and touch-control conventions.
   Super Salma adds `.ssm-fire-btn` on top.

   Rules use theme tokens throughout (var(--primary) for gold,
   var(--secondary) for purple). The fire button stays literal red
   (#e74c3c) because it's the semantic "shoot/danger" color universal
   to arcade shooters.

   Canvas-rendered gameplay itself (stars, player sprite, score flashes)
   is painted from JS using computed-style lookups in
   public/js/games/icytower.js + super-salma.js + salma-invaders.js —
   those helpers read --primary-rgb / --secondary-rgb at draw time so
   canvas content retints with the active theme too.
   ========================================== */

@layer features {


.icytower-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.icy-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 9 / 16;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(var(--primary-rgb),0.35);
    box-shadow: 0 0 18px var(--accent-glow), 0 0 40px rgba(var(--primary-rgb),0.15);
}

.icy-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--bg-dark);
}

.icy-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    font-size: clamp(0.7rem, 1.4dvh, 0.88rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(180deg, rgba(10, 6, 24, 0.85) 0%, rgba(10, 6, 24, 0.6) 100%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(var(--secondary-rgb),0.2);
}

.icy-combo {
    color: var(--primary);
    min-width: 60px;
    text-align: center;
    transition: opacity 0.3s;
}

.icy-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 10%;
    gap: 10px;
    background: rgba(10, 6, 24, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 5;
    padding: 16px;
}
.icy-overlay.hidden { display: none; }

.icy-title {
    font-size: clamp(1.2rem, 3dvh, 1.8rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

.icy-subtitle {
    font-size: clamp(0.7rem, 1.4dvh, 0.95rem);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: 0;
}

.icy-highscores {
    width: 100%;
    max-width: 300px;
    margin: 8px auto;
    background: rgba(13, 11, 30, 0.6);
    border: 1px solid rgba(var(--secondary-rgb),0.25);
    border-radius: 12px;
    padding: 10px 12px;
    backdrop-filter: blur(8px);
}
.icy-highscores h3 {
    font-size: clamp(0.65rem, 1.2dvh, 0.8rem);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text; -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin: 0 0 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.icy-hs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    font-size: clamp(0.65rem, 1.3dvh, 0.8rem);
    color: rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background 0.15s;
}
/* Medal tiers — rank colors stay literal because gold/silver/bronze
   are universally-recognized semantic colors (same rule as medals in
   sports leaderboards). */
.icy-hs-row:nth-child(2) { color: rgba(var(--primary-rgb),0.9); } /* #1 gold -> theme primary */
.icy-hs-row:nth-child(3) { color: rgba(192, 192, 192, 0.85); } /* #2 silver */
.icy-hs-row:nth-child(4) { color: rgba(205, 127, 50, 0.8); } /* #3 bronze */
.icy-hs-row.current {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(var(--primary-rgb),0.25);
    box-shadow: 0 0 8px rgba(var(--primary-rgb),0.1);
}
.icy-hs-row .hs-rank {
    font-weight: 800;
    min-width: 24px;
    flex-shrink: 0;
    font-size: 0.9em;
}
.icy-hs-row .hs-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    min-width: 40px;
}
.icy-hs-row .hs-info {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    opacity: 0.5;
    font-size: 0.8em;
}
.icy-hs-row .hs-score {
    font-weight: 700;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
    min-width: 40px;
}

/* Mobile touch controls — visible buttons on phone only */
.icy-touch-zone {
    position: absolute;
    z-index: 6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: background 0.1s, transform 0.1s;
}
.icy-touch-zone:active { transform: scale(0.88); }

/* Left & Right buttons — bottom corners */
.icy-touch-left, .icy-touch-right {
    bottom: 14px;
    width: 52px;
    height: 52px;
    border: 2px solid rgba(var(--secondary-rgb),0.5);
    background: rgba(var(--secondary-rgb),0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.icy-touch-left { left: 14px; }
.icy-touch-right { left: 76px; }
.icy-touch-left:active, .icy-touch-right:active { background: rgba(var(--secondary-rgb),0.45); }

/* Jump button — bottom right */
.icy-touch-jump {
    bottom: 14px;
    right: 14px;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(var(--primary-rgb),0.5);
    background: rgba(var(--primary-rgb),0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.icy-touch-jump:active { background: rgba(var(--primary-rgb),0.4); }

/* Fire button (Super Salma) — red is the semantic "fire/danger" color */
.ssm-fire-btn {
    position: absolute;
    bottom: 80px;
    right: 14px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(231, 76, 60, 0.6);
    background: rgba(231, 76, 60, 0.2);
    color: #fff;
    font-size: 1.2rem;
    z-index: 6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.ssm-fire-btn.hidden { display: none; }
.ssm-fire-btn:active { background: rgba(231, 76, 60, 0.5); transform: scale(0.88); }

/* breakpoint snap 769px -> 768px (Phase 7.6 ladder — 1px overlap at 768
   resolved by source order; touch-zone/fire-btn are hidden on desktop) */
@media (min-width: 768px) {
    .icy-touch-zone { display: none; }
    .ssm-fire-btn { display: none; }
}
@media (max-width: 480px) {
    .icy-canvas-wrap { border-radius: var(--radius-md); }
}

/* Solo game start/gameover overlays — constrain button sizes.
   Phase 7.7: !important stripped — .icy-overlay .X (0,2,0) already
   beats the generic .ttt-btn / .solo-play-btn (0,1,0) base rules at
   higher specificity. .icy-overlay .ttt-btn.secondary is 0,3,0,
   also higher than the games.css compound rule. */
.icy-overlay .ttt-btn,
.icy-overlay .solo-play-btn,
.icy-overlay .solo-home-btn {
    padding: 14px 48px;
    font-size: 1.05rem;
    min-width: 160px;
    width: auto;
    flex: 0 0 auto;
    height: auto;
    min-height: 0;
    align-self: center;
    box-sizing: border-box;
    border-radius: var(--radius-lg);
}
.icy-overlay .solo-home-btn,
.icy-overlay .ttt-btn.secondary {
    transform: scale(0.85);
    margin-top: -2px;
}

/* Solo pause button (inside icy-canvas-wrap, below HUD).
   Moved from games.css in Wave 6. */
.icy-canvas-wrap > .solo-pause-btn {
    position: absolute;
    top: 30px;
    right: 6px;
    z-index: 10;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
}
.icy-canvas-wrap > .solo-pause-btn:hover,
.icy-canvas-wrap > .solo-pause-btn:active {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
}
/* breakpoint snap 600px -> 768px (Phase 7.6 ladder) */
@media (max-width: 768px) {
    .icy-canvas-wrap > .solo-pause-btn { top: 28px; right: 4px; }
}


} /* end @layer features */
