/* Screens — extra styles for matchmaking, tournaments, puzzles, leaderboard, watch, profile, result */

/* Matchmaking */
.mm-hero { display: grid; grid-template-columns: 280px 1fr; gap: 32px; padding: 28px; border: 1px solid var(--ink-4); border-radius: var(--radius-xl); background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265)); margin-top: 8px; align-items: center; box-shadow: var(--shadow-pop); }
.mm-radar { position: relative; width: 280px; height: 280px; }
.mm-radar__ring { position: absolute; inset: 50%; border-radius: 50%; border: 1px solid oklch(0.5 0.18 var(--hue-chess) / 0.3); transform: translate(-50%,-50%); }
.mm-radar__ring--1 { width: 100px; height: 100px; }
.mm-radar__ring--2 { width: 180px; height: 180px; opacity: 0.7; }
.mm-radar__ring--3 { width: 260px; height: 260px; opacity: 0.4; }
.mm-radar__ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--amber); opacity: 0.5; animation: radar 2.4s infinite var(--tap); }
@keyframes radar { 0%{transform:scale(0.6); opacity:0.6} 100%{transform:scale(1.4); opacity:0} }
.mm-radar__core { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; border-radius: 50%; transform: translate(-50%,-50%); background: linear-gradient(135deg, var(--amber), var(--amber-lo)); display: grid; place-items: center; font-size: 28px; color: oklch(0.18 0.04 55); box-shadow: 0 0 30px var(--amber-glow); z-index: 2; }
.mm-radar__node { position: absolute; padding: 4px 8px; border-radius: 999px; background: var(--ink-3); border: 1px solid var(--ink-4); font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--text-2); transform: translate(-50%,-50%); }
.mm-radar__node--match { background: var(--amber); color: oklch(0.2 0.04 55); border-color: var(--amber); animation: pulse 1.4s infinite; }
.mm-info__title { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 8px 0 12px; }
.mm-info__title em { font-style: normal; color: var(--brand-hi); }
.mm-info__bar { height: 5px; border-radius: 3px; background: var(--ink-3); overflow: hidden; margin-bottom: 10px; }
.mm-info__bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-lo), var(--amber)); border-radius: inherit; }
.mm-info__time { display: flex; align-items: baseline; gap: 10px; }
.mm-info__time small { color: var(--text-3); font-size: 12px; }
.mm-info__counts { display: flex; gap: 16px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.mm-info__counts b { color: var(--text-1); font-weight: 700; }
.mm-params { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 8px; }
.mm-param { padding: 12px 14px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.mm-param__k { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; }
.mm-param__v { font-family: var(--font-display); font-size: 17px; font-weight: 700; margin-top: 4px; }
.mm-param__v small { font-size: 11px; color: var(--text-3); font-family: var(--font-body); font-weight: 500; margin-left: 4px; }

/* Tournaments */
.t-feature { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; padding: 24px; background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265)); border: 1px solid var(--ink-4); border-radius: var(--radius-xl); margin: 8px 0; box-shadow: var(--shadow-pop); position: relative; overflow: hidden; }
.t-feature::before { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 80% at 0% 0%, oklch(0.4 0.18 var(--hue-chess) / 0.15), transparent 60%); pointer-events: none; }
.t-feature__main { position: relative; z-index: 1; }
.t-feature__leaders { background: var(--ink-1); border: 1px solid var(--ink-4); border-radius: var(--radius-md); padding: 14px; }
.t-feature__progress { margin-top: 10px; }
.t-feature__steps { display: flex; gap: 4px; }
.t-step { flex: 1; padding: 8px 4px; background: var(--ink-3); border-radius: 6px; text-align: center; font-size: 11px; color: var(--text-3); }
.t-step--on { background: oklch(0.28 0.1 var(--hue-primary) / 0.5); color: var(--brand-hi); }
.t-step--now { background: var(--amber); color: oklch(0.2 0.04 55); font-weight: 700; }
.t-step__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 auto 4px; }
.t-leader { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ink-3); }
.t-leader:last-of-type { border: 0; }
.t-leader__p { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 12px; }
.t-leader__p--top { background: linear-gradient(135deg, var(--amber), var(--amber-lo)); color: oklch(0.2 0.04 55); }
.t-leader__p--rest { background: var(--ink-3); color: var(--text-3); }

.t-list { display: flex; flex-direction: column; gap: 8px; }
.t-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.t-row__icon { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; background: var(--ink-3); color: var(--text-2); }
.t-row--live .t-row__icon { background: oklch(0.28 0.1 150 / 0.4); color: var(--live); }
.t-row--amber .t-row__icon { background: oklch(0.3 0.08 var(--hue-chess) / 0.4); color: var(--amber); }
.t-row--hot .t-row__icon { background: oklch(0.3 0.1 var(--hue-accent-hot) / 0.35); color: var(--hot); }
.t-row--brand .t-row__icon { background: oklch(0.28 0.1 var(--hue-primary) / 0.4); color: var(--brand-hi); }
.t-row__cell { min-width: 80px; }
.t-row__k { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.t-row__v { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 2px; }

/* Puzzles */
.puzz-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; margin-top: 8px; }
.puzz-board { display: flex; flex-direction: column; gap: 10px; }
.puzz-board__hud { display: flex; gap: 8px; flex-wrap: wrap; }
.puzz-prompt { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.puzz-side { display: flex; flex-direction: column; gap: 12px; }
.puzz-stat-card { padding: 16px; background: linear-gradient(135deg, oklch(0.22 0.05 var(--hue-chess) / 0.25), oklch(0.16 0.025 265)); border: 1px solid oklch(0.5 0.15 var(--hue-chess) / 0.25); border-radius: var(--radius-md); }
.puzz-rating { display: flex; flex-direction: column; align-items: flex-start; }
.puzz-chart { width: 100%; margin-top: 10px; }

/* Leaderboard */
.podium { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 12px; align-items: end; margin: 16px 0 24px; }
.podium__col { display: flex; flex-direction: column; align-items: center; }
.podium__avatar { position: relative; width: 64px; height: 64px; border-radius: 16px; background: linear-gradient(135deg, oklch(0.5 0.15 var(--hue-primary)), oklch(0.32 0.1 var(--hue-primary))); color: white; display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.podium__avatar--king { width: 80px; height: 80px; background: linear-gradient(135deg, var(--amber), var(--amber-lo)); color: oklch(0.2 0.04 55); box-shadow: 0 8px 30px -8px var(--amber-glow); }
.podium__crown { position: absolute; top: -16px; font-size: 20px; color: var(--amber); }
.podium__name { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.podium__rating { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--brand-hi); margin-top: 2px; }
.podium__col--1 .podium__rating { color: var(--amber); }
.podium__stats { font-size: 11px; font-family: var(--font-mono); color: var(--text-3); margin-top: 2px; }
.podium__plinth { width: 100%; padding: 16px 0; margin-top: 10px; border-radius: 12px 12px 0 0; background: var(--ink-2); border: 1px solid var(--ink-4); border-bottom: 0; text-align: center; }
.podium__plinth--1 { padding: 28px 0; background: linear-gradient(180deg, oklch(0.3 0.08 var(--hue-chess) / 0.3), oklch(0.18 0.025 265)); border-color: oklch(0.5 0.15 var(--hue-chess) / 0.3); }
.podium__plinth--2 { padding: 22px 0; }
.podium__place { font-family: var(--font-display); font-weight: 800; font-size: 18px; color: var(--text-3); }
.podium__col--1 .podium__place { color: var(--amber); font-size: 22px; }

.lb-table { background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); overflow: hidden; }
.lb-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--ink-1); border-bottom: 1px solid var(--ink-4); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--text-3); }
.lb-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--ink-3); }
.lb-row:last-child { border: 0; }
.lb-row:hover { background: oklch(1 0 0 / 0.02); }
.lb-row--you { background: oklch(0.28 0.1 var(--hue-primary) / 0.15); }
.lb-avatar { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, oklch(0.4 0.1 var(--hue-primary)), oklch(0.28 0.08 var(--hue-primary))); color: white; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.lb-avatar--big { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }

/* Watch */
.watch-feature { display: grid; grid-template-columns: 1fr 360px; gap: 20px; margin: 8px 0; padding: 16px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); }
.watch-feature__board { position: relative; border-radius: var(--radius-md); overflow: hidden; }
.watch-feature__live { position: absolute; top: 12px; left: 12px; z-index: 2; padding: 4px 10px; background: oklch(0 0 0 / 0.6); backdrop-filter: blur(8px); border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--text-1); display: inline-flex; align-items: center; gap: 6px; }
.watch-feature__nudge { position: absolute; bottom: 12px; right: 12px; z-index: 2; padding: 6px 10px; background: oklch(0 0 0 / 0.6); backdrop-filter: blur(8px); border-radius: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--amber); }
.watch-feature__side { padding: 6px; }

.watch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.watch-card { background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); overflow: hidden; cursor: pointer; transition: transform .2s var(--tap), border-color .15s; }
.watch-card:hover { transform: translateY(-2px); border-color: oklch(0.45 0.15 var(--hue-primary) / 0.5); }
.watch-card__board { position: relative; }
.watch-card__live { position: absolute; top: 8px; left: 8px; z-index: 2; padding: 3px 8px; background: oklch(0 0 0 / 0.7); backdrop-filter: blur(6px); border-radius: 999px; font-size: 10px; font-weight: 700; color: var(--text-1); display: inline-flex; align-items: center; gap: 4px; }
.watch-card__body { padding: 12px; }
.watch-card__pair { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.watch-card__pair b { font-weight: 700; }
.watch-card__pair small { font-family: var(--font-mono); color: var(--text-3); font-size: 11px; }

/* Profile */
.prof-hero { display: grid; grid-template-columns: 88px 1fr 200px; gap: 20px; align-items: center; padding: 24px; background: linear-gradient(135deg, oklch(0.2 0.04 265), oklch(0.15 0.025 265)); border: 1px solid var(--ink-4); border-radius: var(--radius-xl); margin-top: 8px; box-shadow: var(--shadow-pop); }
.prof-hero__avatar { position: relative; width: 88px; height: 88px; border-radius: 22px; background: linear-gradient(135deg, var(--hot), oklch(0.5 0.22 40)); color: white; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 36px; box-shadow: 0 10px 28px -8px oklch(0 0 0 / 0.5); }
.prof-hero__rating { text-align: right; }
.prof-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; margin: 20px 0; }
.achv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.achv { padding: 10px 8px; background: var(--ink-3); border: 1px solid var(--ink-4); border-radius: 10px; text-align: center; opacity: 0.4; }
.achv--on { opacity: 1; background: linear-gradient(135deg, var(--ink-2), var(--ink-3)); }
.achv__icon { font-size: 22px; margin-bottom: 4px; color: var(--text-3); }
.achv--on .achv__icon { color: var(--text-1); }
.achv__n { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* Result */
.result { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 16px; padding: 24px; background: linear-gradient(135deg, oklch(0.22 0.06 var(--hue-primary) / 0.4), oklch(0.16 0.025 265)); border: 1px solid oklch(0.45 0.15 var(--hue-primary) / 0.3); border-radius: var(--radius-xl); margin-top: 8px; box-shadow: var(--shadow-pop); align-items: center; }
.result__badge { text-align: center; }
.result__crown { font-size: 56px; color: var(--amber); text-shadow: 0 6px 20px var(--amber-glow); }
.result__verb { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.025em; margin-top: 4px; background: linear-gradient(135deg, var(--amber), var(--brand-hi)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result__how { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.result__delta { padding: 14px 18px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-md); }
.result__ribbons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ribbon { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--ink-2); border: 1px solid var(--ink-4); border-radius: var(--radius-sm); }
.ribbon__ic { font-size: 18px; }
.ribbon__t { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.ribbon__s { font-family: var(--font-display); font-weight: 700; font-size: 14px; margin-top: 2px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }


/* === PUZZLE BOARD SIZE FIX v3 (root cause: .screen is flex) === */
/* Real cause: #puzzle-screen has display:flex from main.css (.screen rule).
   Its child wrapper had max-width:1200px but no width, so flex shrank it
   to ~594px. The 1fr column inside .puzz-grid then collapsed to min-content
   (single piece glyph), giving us a 158x158 board.

   Fix philosophy: don't touch legacy .screen rule globally. Override it
   only for new TGC-redesigned screens — they all use the same wrapper
   pattern (a single .tgc.screen with .page__inner-style children). */

#puzzle-screen.screen.active {
    display: block !important;
}

/* Direct child wrapper of puzzle-screen — make it full-width up to 1200px */
#puzzle-screen > div {
    width: 100% !important;
    box-sizing: border-box;
}

/* Now the actual board sizing inside the unblocked wrapper */
#puzzle-screen .puzz-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 360px !important;
    align-items: start !important;
    width: 100% !important;
}
#puzzle-screen .puzz-board {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 640px !important;
}
#puzzle-screen #puzzle-board-container {
    width: 100% !important;
    max-width: 640px !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#puzzle-screen #puzzle-board {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 900px) {
    #puzzle-screen .puzz-grid {
        grid-template-columns: 1fr !important;
    }
    #puzzle-screen .puzz-board {
        max-width: min(560px, 92vw) !important;
        margin: 0 auto !important;
    }
}

/* === RATING PLATE STYLES (result-screen) === */
.result__delta-k {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}
#result-screen .rating-change {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 6px;
    flex-wrap: wrap;
}
#result-screen .rating-new {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--brand-hi);
    line-height: 1;
}
#result-screen .rating-old {
    font-size: 18px;
    color: var(--text-3);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: oklch(0.5 0.05 265 / 0.6);
}
#result-screen .rating-pill {
    padding: 3px 9px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
    align-self: center;
}
#result-screen .rating-pill--up {
    background: oklch(0.28 0.1 150 / 0.4);
    color: var(--live);
}
#result-screen .rating-pill--down {
    background: oklch(0.3 0.12 25 / 0.3);
    color: var(--hot);
}
#result-screen .rating-change.hidden { display: none !important; }


/* === GAME SCREEN SIZE FIX (.screen flex root + .game-grid) === */
/* Same root cause as puzzle-screen had: .screen is display:flex from
   main.css, child wrapper shrinks. Plus .game-center has max-width:600px
   which artificially caps the board on desktop. */

#game-screen.screen.active {
    display: block !important;
}
#game-screen > .game-grid {
    width: 100% !important;
    box-sizing: border-box;
}
#game-screen.tgc .game-grid {
    grid-template-columns: minmax(0, 1fr) 340px !important;
    align-items: start !important;
}
#game-screen.tgc .game-center {
    max-width: 720px !important;
    min-width: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    justify-self: stretch !important;
}
#game-screen #board-container {
    width: 100% !important;
    aspect-ratio: 1 !important;
    height: auto !important;
}
#game-screen #chess-board {
    width: 100% !important;
    height: 100% !important;
}
@media (max-width: 900px) {
    #game-screen.tgc .game-grid {
        grid-template-columns: 1fr !important;
    }
    #game-screen.tgc .game-center {
        max-width: min(640px, 96vw) !important;
        margin: 0 auto !important;
    }
}
