:root {
  --ink: #18261f;
  --muted: #708078;
  --paper: #f6f3eb;
  --card: #fffdf8;
  --line: #deded4;
  --green: #274a38;
  --green-soft: #dfe9df;
  --gold: #dcae46;
  --gold-soft: #f4ead0;
  --rose: #bb6658;
  --rose-soft: #f2dfdb;
  --blue: #5e7895;
  --shadow: 0 18px 42px rgba(37, 57, 46, .08);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "DM Sans", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.student-session [data-modal]:not([data-modal="liveGame"]):not([data-modal="game"]):not([data-modal="puzzle"]), .student-session #markAll, .student-session #markAllAway, .student-session #saveAttendance { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(340px, .9fr) 1.1fr; background: var(--card); }
.auth-art { min-height: 100vh; padding: 34px 42px; color: white; background: linear-gradient(145deg, #213c2d, #13241b); position: relative; overflow: hidden; display: flex; flex-direction: column; }
.auth-art::before { content: ""; position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(45deg, #fff 25%, transparent 25%), linear-gradient(-45deg, #fff 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #fff 75%), linear-gradient(-45deg, transparent 75%, #fff 75%); background-size: 90px 90px; background-position: 0 0, 0 45px, 45px -45px, -45px 0; }
.auth-brand { z-index: 1; padding: 0; }
.auth-message { max-width: 430px; margin: auto 0; position: relative; z-index: 1; }
.auth-message .eyebrow { color: var(--gold); }
.auth-message h1 { margin: 15px 0 12px; font-family: "Playfair Display"; font-size: clamp(42px, 6vw, 72px); line-height: .98; letter-spacing: -.05em; }
.auth-message p { max-width: 370px; color: #b7c3ba; font-size: 13px; line-height: 1.7; }
.auth-piece { position: absolute; right: -35px; bottom: -130px; color: rgba(255,255,255,.045); font-size: 430px; line-height: 1; }
.auth-panel { padding: 40px; display: grid; place-items: center; }
.auth-card { width: min(390px, 100%); }
.auth-card h2 { margin: 0; font-family: "Playfair Display"; font-size: 32px; letter-spacing: -.03em; }
.auth-card .auth-subtitle { margin: 7px 0 24px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-tabs { margin-bottom: 22px; padding: 4px; border-radius: 9px; background: #eeeee7; display: grid; grid-template-columns: repeat(3, 1fr); }
.auth-tabs button { padding: 8px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.auth-tabs button.active { color: var(--ink); background: white; box-shadow: 0 3px 10px #00000012; }
.auth-form { display: grid; gap: 13px; }
.auth-form .field input, .auth-form .field select { padding: 12px; font-size: 11px; }
.auth-form .primary-btn { width: 100%; margin-top: 3px; padding: 13px; }
.auth-link { padding: 2px; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 700; text-align: left; }
.auth-feedback { margin: 0; padding: 10px 12px; border-radius: 8px; color: #42644c; background: var(--green-soft); font-size: 10px; line-height: 1.5; }
.auth-feedback.error { color: #964d43; background: var(--rose-soft); }
.demo-credentials { padding: 11px 12px; border: 1px dashed #d7c58d; border-radius: 8px; color: #765e20; background: var(--gold-soft); font-size: 9px; line-height: 1.6; }
.demo-credentials strong { display: block; color: var(--ink); }
.auth-note { margin: 22px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: #9aa39d; font-size: 8px; line-height: 1.5; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 26px 18px 20px; color: #f9f6ec; background: var(--ink); display: flex; flex-direction: column; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 11px; padding: 0 8px 30px; }
.brand-mark { width: 39px; height: 39px; border-radius: 12px; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-size: 25px; }
.brand strong { display: block; font-family: "Playfair Display"; font-size: 20px; line-height: 1; }
.brand small { display: block; margin-top: 5px; color: #aeb9af; font-size: 8px; letter-spacing: .2em; }
.main-nav { display: grid; gap: 5px; }
.nav-item { border: 0; border-radius: 9px; padding: 11px 12px; background: transparent; color: #aeb9af; text-align: left; display: flex; align-items: center; gap: 12px; transition: .2s; }
.nav-item:hover, .nav-item.active { color: white; background: rgba(255,255,255,.08); }
.nav-item span { width: 18px; text-align: center; color: #d5c68c; }
.nav-item b { margin-left: auto; padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,.1); font-size: 10px; }
.sidebar-bottom { margin-top: auto; }
.next-meet { padding: 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.04); }
.next-meet strong, .next-meet small { display: block; margin-top: 7px; }
.next-meet strong { font-size: 13px; }
.next-meet small { color: #aeb9af; font-size: 10px; }
.eyebrow { margin: 0; color: #8b978e; font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.avatar-row { display: flex; margin-top: 13px; }
.avatar-row .avatar { margin-right: -6px; border: 2px solid var(--ink); }
.profile { width: 100%; border: 0; margin-top: 15px; padding: 12px 4px; color: white; background: transparent; display: flex; align-items: center; gap: 9px; text-align: left; }
.profile span:nth-child(2) { flex: 1; }
.profile strong, .profile small { display: block; font-size: 11px; }
.profile small { color: #8f9c94; margin-top: 2px; font-size: 9px; }

main { min-width: 0; }
.topbar { padding: 30px 38px 24px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 5px 0 2px; font-family: "Playfair Display"; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; }
.topbar p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.search { width: 190px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 11px; }
.icon-btn, .mobile-menu { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.icon-btn { position: relative; }
.icon-btn i { position: absolute; right: 7px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--rose); }
.primary-btn, .secondary-btn { border: 0; border-radius: 8px; padding: 11px 15px; font-size: 11px; font-weight: 700; }
.primary-btn { color: white; background: var(--green); }
.primary-btn:hover { background: #1d3b2b; }
.secondary-btn { border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.mobile-menu { display: none; }

#appContent { padding: 26px 38px 50px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.stat-card { min-height: 120px; padding: 17px; position: relative; overflow: hidden; }
.stat-card .stat-icon { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; margin-bottom: 14px; }
.stat-card strong { display: block; font-family: "Playfair Display"; font-size: 25px; }
.stat-card small { color: var(--muted); font-size: 10px; }
.stat-card .delta { position: absolute; right: 15px; top: 17px; padding: 4px 7px; border-radius: 10px; color: #53725c; background: var(--green-soft); font-size: 8px; font-weight: 700; }
.stat-card.gold { background: var(--gold-soft); border-color: #e9d9aa; }
.stat-card.gold::after { content: "♞"; position: absolute; right: -10px; bottom: -37px; color: rgba(107,78,25,.08); font-size: 125px; }
.stat-card.gold .stat-icon { background: rgba(255,255,255,.55); }
.stat-icon.green { background: var(--green-soft); }
.stat-icon.rose { background: var(--rose-soft); }
.stat-icon.blue { background: #e2e8ee; }

.dashboard-grid { margin-top: 16px; display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; }
.panel { padding: 18px; }
.panel-head { min-height: 30px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 12px; }
.panel-head h2 { margin: 0; font-family: "Playfair Display"; font-size: 17px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.panel-head button { margin-left: auto; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 700; }
.panel-head-actions { margin-left: auto; display: flex; gap: 7px; }
.panel-head-actions button { margin-left: 0; }
.admin-settings-card { grid-column: 1 / -1; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #faf9f3; }
.setting-row + .setting-row { margin-top: 10px; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.setting-row button { white-space: nowrap; }

.attendance-list { display: grid; gap: 8px; }
.attendance-meet { margin-bottom: 16px; border-color: var(--line); background: linear-gradient(135deg, #f9fbf5, #eef5ea); }
.attendance-meet strong { color: var(--ink); font-family: "Playfair Display"; font-size: 20px; }
.attendance-meet small { color: var(--muted); font-size: 10px; }
.attendance-meet .avatar-row { margin-top: 10px; }
.student-attendance-focus { border-color: #c8d8c7; background: linear-gradient(135deg, #f9fbf5, #eef5ea); }
.student-attendance-focus .student-row { background: white; }
.attendance-history { margin-top: 16px; }
.attendance-table-wrap { overflow-x: auto; }
.attendance-table-wrap .data-table { min-width: 680px; }
.attendance-filters { margin-bottom: 15px; display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 9px; align-items: end; }
.attendance-filters label { display: grid; gap: 4px; }
.attendance-filters label span { color: var(--muted); font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.attendance-filters input { width: 100%; padding: 9px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: white; font-size: 9px; }
.attendance-filters > div { padding: 8px 11px; border-radius: 8px; background: var(--green-soft); text-align: center; }
.attendance-filters strong, .attendance-filters small { display: block; }
.attendance-filters strong { font-family: "Playfair Display"; font-size: 15px; }
.attendance-filters small { color: var(--muted); font-size: 7px; }
.attendance-mark { display: inline-block; min-width: 58px; font-size: 8px; font-weight: 700; }
.attendance-mark.attended { color: #42644c; }
.attendance-mark.missed { color: #a06a61; }
.meeting-history { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.meeting-history article { padding: 10px; border: 1px solid var(--line); border-radius: 9px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px 10px; }
.meeting-history strong, .meeting-history small { display: block; }
.meeting-history strong { font-size: 9px; }
.meeting-history small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.meeting-history article > span { grid-column: 2; grid-row: 1 / 3; font-family: "Playfair Display"; font-size: 17px; color: var(--green); }
.meeting-history .avatar-row { margin-top: 2px; }
.meeting-history .avatar { width: 21px; height: 21px; font-size: 6px; border-color: var(--card); }
.student-row { padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; display: flex; align-items: center; gap: 10px; }
.student-row .student-info { flex: 1; }
.student-row strong, .student-row small { display: block; }
.student-row strong { font-size: 11px; }
.student-row small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.attendance-toggle { display: flex; padding: 3px; border-radius: 8px; background: #eeeee7; }
.attendance-toggle button { border: 0; border-radius: 6px; padding: 5px 8px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 700; }
.attendance-toggle button.active.present { color: #3f654d; background: white; box-shadow: 0 2px 8px #00000010; }
.attendance-toggle button.active.away { color: var(--rose); background: white; box-shadow: 0 2px 8px #00000010; }
.attendance-readonly { padding: 6px 9px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.attendance-readonly.present { color: #3f654d; background: #eaf0e8; }
.attendance-readonly.away { color: var(--rose); background: #f7e8e3; }
.avatar { flex: 0 0 auto; width: 29px; height: 29px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 8px; font-weight: 700; }
.avatar.large { width: 38px; height: 38px; font-size: 10px; }
.olive { background: #68785d; } .rust { background: #aa6b52; } .blue { background: #5b7489; } .plum { background: #80657c; } .sand { background: #b49361; } .teal { background: #4f7b73; }

.leader-list { display: grid; }
.leader-row { padding: 9px 2px; border-bottom: 1px solid #ebeae2; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; }
.leader-row:last-child { border-bottom: 0; }
.rank { color: #929b94; font-size: 10px; font-weight: 700; text-align: center; }
.rank.medal { color: #9a711b; }
.leader-person { display: flex; align-items: center; gap: 8px; }
.leader-person strong, .leader-person small { display: block; font-size: 10px; }
.leader-person small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.elo { text-align: right; }
.elo strong { display: block; font-family: "Playfair Display"; font-size: 13px; }
.elo small { color: #53725c; font-size: 8px; font-weight: 700; }
.elo-explainer { margin-top: 16px; }
.elo-explainer .panel-head > .badge { margin-left: auto; }
.leaderboard-toggle { margin: 0 0 14px; padding: 4px; border-radius: 10px; background: #eeeee7; display: inline-grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.leaderboard-toggle button { border: 0; border-radius: 8px; padding: 9px 18px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; }
.leaderboard-toggle button.active { color: var(--ink); background: white; box-shadow: 0 3px 10px #00000012; }
.elo-formula { padding: 14px 16px; border-radius: 10px; color: white; background: var(--green); }
.elo-formula strong { font-family: "Playfair Display"; font-size: 16px; }
.elo-formula p { margin: 5px 0 0; color: #c4d0c8; font-size: 9px; line-height: 1.5; }
.elo-steps { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.elo-steps > div { padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.elo-steps span { width: 20px; height: 20px; margin-bottom: 8px; border-radius: 6px; color: #71591e; background: var(--gold-soft); display: grid; place-items: center; font-size: 8px; font-weight: 700; }
.elo-steps strong { display: block; font-size: 10px; }
.elo-steps p { margin: 4px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.elo-example { margin-top: 12px; padding: 14px; border-radius: 10px; background: #f0f0e9; display: flex; align-items: center; gap: 18px; }
.elo-example > div:first-child { flex: 1; }
.elo-example h3 { margin: 5px 0 3px; font-family: "Playfair Display"; font-size: 15px; }
.elo-example p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.elo-score-legend { display: flex; gap: 5px; }
.elo-score-legend span { min-width: 42px; padding: 7px; border-radius: 8px; background: white; text-align: center; color: var(--muted); font-size: 7px; }
.elo-score-legend b { display: block; margin-bottom: 2px; font-family: "Playfair Display"; color: var(--ink); font-size: 15px; }

.activity-item { padding: 9px 0; display: flex; gap: 10px; }
.activity-dot { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.activity-item strong { display: block; font-size: 10px; }
.activity-item p { margin: 3px 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.activity-item time { color: #a2aaa3; font-size: 8px; }
.tournament-feature { min-height: 180px; padding: 20px; border-radius: 11px; color: white; background: linear-gradient(135deg, #294d3a, #17281f); position: relative; overflow: hidden; }
.tournament-feature::after { content: "♜"; position: absolute; right: -12px; bottom: -55px; color: rgba(255,255,255,.06); font-size: 190px; }
.tournament-feature > * { position: relative; z-index: 1; }
.tournament-feature .eyebrow { color: #c9b66d; }
.tournament-feature h3 { max-width: 260px; margin: 13px 0 6px; font-family: "Playfair Display"; font-size: 24px; }
.tournament-feature p { max-width: 310px; color: #bdc9c0; font-size: 10px; line-height: 1.6; }
.tournament-meta { display: flex; gap: 18px; margin: 17px 0; font-size: 9px; }
.tournament-feature button { color: var(--ink); background: var(--gold); }

.section-toolbar { margin-bottom: 16px; display: flex; align-items: end; gap: 12px; }
.section-toolbar > div:first-child { flex: 1; }
.section-toolbar h2 { margin: 0 0 4px; font-family: "Playfair Display"; font-size: 24px; }
.section-toolbar p { margin: 0; color: var(--muted); font-size: 11px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th { padding: 9px 10px; color: #8b978e; font-size: 8px; letter-spacing: .08em; text-align: left; border-bottom: 1px solid var(--line); }
.data-table td { padding: 11px 10px; border-bottom: 1px solid #ebeae2; }
.game-review-actions { min-width: 120px; display: grid; gap: 5px; }
.data-table tr:last-child td { border-bottom: 0; }
.person-cell { display: flex; align-items: center; gap: 8px; }
.profile-person-link { display: inline-flex; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.profile-person-link:hover strong { color: var(--green); text-decoration: underline; }
.person-cell strong, .person-cell small { display: block; }
.person-cell small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.badge { display: inline-block; padding: 4px 7px; border-radius: 10px; background: #eee; font-size: 8px; font-weight: 700; }
.badge.win { color: #42644c; background: var(--green-soft); }
.badge.loss { color: #9e4b41; background: var(--rose-soft); }
.badge.draw { color: #81671e; background: var(--gold-soft); }
.badge.online { color: #245f8f; background: #dfeef9; }
.mini-link { margin-left: 5px; color: var(--green); font-size: 8px; font-weight: 800; text-decoration: none; }
.action-link { border: 0; color: var(--green); background: transparent; font-size: 9px; font-weight: 700; }
.student-grid, .tournament-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.student-card { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.student-profile-trigger { width: 100%; padding: 0; border: 0; color: inherit; background: transparent; text-align: left; }
.student-card-head { display: flex; align-items: center; gap: 10px; }
.student-card-head > div:nth-child(2) { flex: 1; }
.student-card h3, .student-card p { margin: 0; }
.student-card h3 { font-family: "Playfair Display"; font-size: 15px; }
.student-card p { margin-top: 3px; color: var(--muted); font-size: 9px; }
.student-card .rating { font-family: "Playfair Display"; font-weight: 700; }
.student-card-actions { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-elo-btn, .delete-student-btn { width: 100%; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: 8px; font-weight: 700; }
.edit-elo-btn { color: var(--green); }
.edit-elo-btn:hover { background: var(--green-soft); }
.delete-student-btn { color: var(--rose); }
.delete-student-btn:hover { background: var(--rose-soft); }
.student-session .edit-elo-btn, .student-session .delete-student-btn { display: none; }
.view-profile-link { display: block; margin-top: 11px; color: var(--green); font-size: 8px; font-weight: 700; text-align: right; }
.mini-stats { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); }
.mini-stats div { text-align: center; }
.mini-stats strong, .mini-stats small { display: block; }
.mini-stats strong { font-size: 12px; }
.mini-stats small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.live-games-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.live-game-list { display: grid; gap: 8px; }
.live-game-search { display: grid; gap: 5px; margin-bottom: 4px; }
.live-game-search span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.live-game-search input { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; outline: none; background: white; font-size: 10px; }
.live-game-card { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfaf4; text-align: left; display: grid; gap: 6px; }
.live-game-card.active { border-color: #adc0b2; background: var(--green-soft); }
.live-game-card.your-turn { border: 2px solid var(--green); background: #edf6ed; box-shadow: 0 0 0 3px rgba(68, 112, 77, .12); }
.live-game-card.your-turn strong { color: var(--green); }
.live-game-card strong, .live-game-card small { display: block; }
.live-game-card strong { font-family: "Playfair Display"; font-size: 14px; }
.live-game-card small, .live-game-card div { color: var(--muted); font-size: 8px; }
.live-game-card div { display: flex; justify-content: space-between; gap: 8px; }
.hosted-game-head { margin-bottom: 14px; display: flex; align-items: flex-start; gap: 12px; }
.hosted-game-head > div { flex: 1; }
.hosted-game-head h2 { margin: 4px 0; font-family: "Playfair Display"; font-size: 25px; }
.hosted-game-head p { margin: 0; color: var(--muted); font-size: 10px; }
.hosted-game-body { display: grid; grid-template-columns: minmax(360px, 1fr) 250px; gap: 16px; align-items: start; }
.hosted-board { width: min(100%, 620px); aspect-ratio: 1 / 1; border: 6px solid var(--ink); display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); overflow: hidden; box-shadow: 0 14px 30px rgba(24,38,31,.18); }
.hosted-square { width: 100%; height: 100%; min-width: 0; min-height: 0; aspect-ratio: 1 / 1; padding: 0; border: 0; border-radius: 0; color: #17251e; position: relative; display: grid; place-items: center; appearance: none; -webkit-appearance: none; }
.hosted-square:disabled { cursor: default; opacity: 1; }
.hosted-square.light { background: #e7dfc8; }
.hosted-square.dark { background: #72846e; }
.hosted-square span { font-family: serif; font-size: clamp(24px, 5vw, 48px); line-height: 1; filter: drop-shadow(0 2px 1px rgba(255,255,255,.35)); }
.hosted-square small { position: absolute; left: 3px; bottom: 2px; color: rgba(24,38,31,.58); font-size: 7px; font-weight: 700; }
.hosted-square.selected { box-shadow: inset 0 0 0 5px var(--gold); }
.hosted-square.last-move { box-shadow: inset 0 0 0 5px rgba(214, 170, 55, .75); background: #f3d982; }
.hosted-square.last-move.dark { background: #b79a4e; }
.hosted-square.last-move.checkmate { box-shadow: inset 0 0 0 5px #b84848; background: #efaaa4; }
.hosted-square.last-move.checkmate.dark { background: #b85b55; }
.hosted-side { display: grid; gap: 10px; }
.player-strip, .hosted-status { padding: 11px; border-radius: 9px; background: #f0f0e9; }
.player-strip.white { background: #f7f3e7; }
.player-strip.black { color: white; background: var(--ink); }
.player-strip strong, .player-strip small, .hosted-status strong, .hosted-status small { display: block; }
.player-strip strong { font-family: "Playfair Display"; font-size: 14px; }
.player-strip small, .hosted-status small { margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.player-strip.black small { color: #aeb9af; }
.move-list { max-height: 170px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 9px; display: flex; flex-wrap: wrap; gap: 5px; background: white; }
.move-list span, .move-list em { padding: 4px 6px; border-radius: 8px; color: var(--muted); background: #f1f0e9; font-size: 8px; }
.move-list button { border: 0; padding: 4px 6px; border-radius: 8px; color: var(--muted); background: #f1f0e9; font: inherit; font-size: 8px; cursor: pointer; }
.move-list button:hover, .move-list button.active { color: var(--ink); background: var(--gold-soft); }
.live-review-controls { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #faf9f3; display: grid; gap: 8px; }
.live-review-controls strong, .live-review-controls small { display: block; }
.live-review-controls strong { font-size: 10px; }
.live-review-controls small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.review-button-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.move-list.archived { max-height: 330px; margin: 16px 0; align-content: flex-start; }
.record-move-actions { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.game-replay-detail { width: 100%; max-width: none; box-sizing: border-box; }
.replay-layout { display: grid; grid-template-columns: minmax(300px, 1fr) 220px; gap: 16px; align-items: start; }
.replay-board { width: min(100%, 470px); aspect-ratio: 1 / 1; justify-self: center; border: 5px solid var(--ink); display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); overflow: hidden; box-shadow: 0 12px 25px rgba(24,38,31,.15); }
.replay-square { min-width: 0; min-height: 0; position: relative; display: grid; place-items: center; }
.replay-square.light { background: #e7dfc8; }
.replay-square.dark { background: #72846e; }
.replay-square.last-move { box-shadow: inset 0 0 0 5px rgba(214, 170, 55, .8); background: #f3d982; }
.replay-square.last-move.dark { background: #b79a4e; }
.replay-square.last-move.checkmate { box-shadow: inset 0 0 0 5px #b84848; background: #efaaa4; }
.replay-square.last-move.checkmate.dark { background: #b85b55; }
.replay-square span { font-family: serif; font-size: clamp(22px, 5vw, 44px); line-height: 1; filter: drop-shadow(0 2px 1px rgba(255,255,255,.35)); }
.replay-square small { position: absolute; left: 3px; bottom: 2px; color: rgba(24,38,31,.58); font-size: 7px; font-weight: 700; }
.replay-side { display: grid; gap: 10px; }
.replay-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.muted-small { color: var(--muted); font-size: 8px; }
.hosted-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hosted-player-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hosted-note-form { display: grid; gap: 7px; }
.hosted-note-form label { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hosted-note-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; resize: vertical; background: white; font-size: 10px; }
.draw-offer { border: 1px solid #ead393; background: var(--gold-soft); }
.tourney-card { min-height: 220px; padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; position: relative; }
.tourney-card::after { content: "♜"; position: absolute; right: -8px; bottom: -35px; color: rgba(39,74,56,.06); font-size: 130px; }
.tourney-card .badge { align-self: flex-start; }
.tourney-card h3 { margin: 20px 0 5px; font-family: "Playfair Display"; font-size: 20px; }
.tourney-card p { margin: 0; color: var(--muted); font-size: 10px; }
.tourney-card footer { margin-top: auto; padding-top: 18px; display: flex; gap: 18px; color: var(--muted); font-size: 9px; position: relative; z-index: 1; }
.tourney-card.completed { min-height: 275px; }
.tourney-card.clickable { cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.tourney-card.clickable:hover, .tourney-card.clickable:focus { transform: translateY(-3px); border-color: #b9c7bb; box-shadow: 0 18px 35px rgba(37,57,46,.13); outline: none; }
.tourney-result { margin-top: 18px; padding: 10px; border-radius: 9px; background: var(--gold-soft); display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.tourney-result > span { color: #8d6b1d; font-size: 20px; }
.tourney-result small, .tourney-result strong { display: block; }
.tourney-result small { color: #987c3b; font-size: 7px; font-weight: 700; letter-spacing: .12em; }
.tourney-result strong { margin-top: 2px; font-family: "Playfair Display"; font-size: 13px; }
.podium { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 4px; position: relative; z-index: 1; }
.podium span { padding: 4px 6px; border-radius: 8px; color: var(--muted); background: #f1f0e9; font-size: 7px; font-weight: 700; }
.coach-hero { margin-bottom: 16px; color: white; background: linear-gradient(135deg, #294d3a, #17281f); display: flex; align-items: center; gap: 10px; overflow: hidden; position: relative; }
.coach-hero::after { content: "♧"; position: absolute; right: -22px; bottom: -95px; color: rgba(255,255,255,.06); font-size: 250px; }
.coach-hero > * { position: relative; z-index: 1; }
.coach-hero > div { flex: 1; }
.coach-hero h2 { margin: 6px 0 5px; font-family: "Playfair Display"; font-size: 28px; }
.coach-hero p { margin: 0; max-width: 520px; color: #c3cec7; font-size: 11px; line-height: 1.6; }
.coach-hero .primary-btn { color: var(--ink); background: var(--gold); }
.coach-hero .secondary-btn { color: white; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); }
.coach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.digest-card h3 { margin: 12px 0 6px; font-family: "Playfair Display"; font-size: 17px; }
.digest-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.coach-layout, .stats-layout { margin-top: 16px; display: grid; grid-template-columns: 1.35fr .85fr; gap: 16px; align-items: start; }
.coach-controls { grid-template-columns: 1fr 1fr; }
.coach-settings-form { display: grid; gap: 12px; }
.coach-settings-form .primary-btn { justify-self: start; }
.training-list { display: grid; gap: 9px; }
.training-item { padding: 10px; border: 1px solid var(--line); border-radius: 9px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; }
.training-item > span { width: 28px; height: 28px; border-radius: 8px; color: var(--green); background: var(--green-soft); display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.training-item strong, .training-item small { display: block; }
.training-item strong { font-size: 11px; }
.training-item small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.shortcut-list { display: grid; gap: 8px; }
.shortcut-list span { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #faf9f3; font-size: 9px; display: flex; align-items: center; gap: 8px; }
.shortcut-list b { width: 23px; height: 23px; border-radius: 7px; color: white; background: var(--green); display: grid; place-items: center; font-size: 10px; }
.modal-shortcuts { margin-top: 14px; grid-template-columns: repeat(2, 1fr); }
.study-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.study-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: var(--shadow); }
.study-card h3 { margin: 14px 0 5px; font-family: "Playfair Display"; font-size: 17px; }
.study-card p { margin: 0 0 12px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.study-card code { display: block; padding: 9px; border-radius: 8px; color: #765e20; background: var(--gold-soft); font-size: 9px; white-space: normal; }
.stats-grid-wide { margin-bottom: 16px; }
.activity-heatmap { height: 190px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; }
.activity-heatmap div { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 8px; align-items: end; text-align: center; }
.activity-heatmap span { border-radius: 9px 9px 3px 3px; background: linear-gradient(180deg, var(--gold), var(--green)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.activity-heatmap small { color: var(--muted); font-size: 8px; }
.opening-bars { display: grid; gap: 11px; }
.opening-bars > div { display: grid; grid-template-columns: 120px 1fr 28px; align-items: center; gap: 9px; font-size: 9px; }
.opening-bars strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opening-bars span { height: 9px; border-radius: 999px; background: #ebeae2; overflow: hidden; }
.opening-bars i { height: 100%; border-radius: inherit; background: var(--green); display: block; }
.opening-bars b { text-align: right; color: var(--muted); }
.stats-full { grid-column: 1 / -1; }
.quality-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quality-grid div { padding: 13px; border-radius: 10px; background: #f0f0e9; }
.quality-grid strong, .quality-grid small { display: block; }
.quality-grid strong { font-family: "Playfair Display"; font-size: 15px; }
.quality-grid small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.section-divider { margin: 30px 0 14px; padding-top: 24px; border-top: 1px solid var(--line); }
.section-divider h2 { margin: 0; font-family: "Playfair Display"; font-size: 20px; }
.section-divider p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.puzzle-tabs { margin-bottom: 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.puzzle-tabs button { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--card); display: flex; align-items: center; gap: 8px; text-align: left; }
.puzzle-tabs button > span { width: 25px; height: 25px; flex: 0 0 auto; border-radius: 7px; color: var(--green); background: var(--green-soft); display: grid; place-items: center; font-size: 9px; font-weight: 700; }
.puzzle-tabs button div { min-width: 0; }
.puzzle-tabs button strong, .puzzle-tabs button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.puzzle-tabs button strong { font-size: 9px; }
.puzzle-tabs button small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.puzzle-tabs button.active { color: white; border-color: var(--green); background: var(--green); }
.puzzle-tabs button.active > span { color: var(--ink); background: var(--gold); }
.puzzle-tabs button.active small { color: #bbc7bf; }
.puzzle-layout { display: grid; grid-template-columns: minmax(390px, 1.15fr) .85fr; gap: 16px; align-items: start; }
.puzzle-board-panel { padding: 14px; }
.puzzle-board { width: min(100%, 620px); aspect-ratio: 1; margin: auto; border: 6px solid var(--ink); display: grid; grid-template-columns: repeat(8, 1fr); box-shadow: 0 14px 30px rgba(24,38,31,.18); }
.puzzle-square { min-width: 0; aspect-ratio: 1; padding: 0; border: 0; color: #17251e; position: relative; display: grid; place-items: center; }
.puzzle-square.light { background: #e7dfc8; }
.puzzle-square.dark { background: #72846e; }
.puzzle-square span { font-family: serif; font-size: clamp(24px, 5vw, 48px); line-height: 1; filter: drop-shadow(0 2px 1px rgba(255,255,255,.35)); }
.puzzle-square small { position: absolute; left: 3px; bottom: 2px; color: rgba(24,38,31,.58); font-size: 7px; font-weight: 700; }
.puzzle-square.selected { box-shadow: inset 0 0 0 5px var(--gold); }
.puzzle-square.last-move { box-shadow: inset 0 0 0 4px var(--gold); }
.puzzle-square.last-move.checkmate { box-shadow: inset 0 0 0 4px #b84848; background: #efaaa4; }
.puzzle-square.hint-from { box-shadow: inset 0 0 0 4px var(--blue); }
.puzzle-square.hint-to { box-shadow: inset 0 0 0 4px #2f8a60; }
.puzzle-square.last-move.hint-from { box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 7px var(--blue); }
.puzzle-square.last-move.hint-to { box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 7px #2f8a60; }
.puzzle-promotion { margin: 12px auto 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #faf9f3; text-align: center; }
.puzzle-promotion > span { display: block; color: var(--muted); font-size: 9px; font-weight: 700; }
.puzzle-promotion > div { margin-top: 7px; display: flex; justify-content: center; gap: 7px; }
.puzzle-promotion button { min-width: 58px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--card); display: grid; place-items: center; gap: 2px; }
.puzzle-promotion button:hover { border-color: var(--gold); background: var(--gold-soft); }
.puzzle-promotion button { font-size: 22px; }
.puzzle-promotion small { color: var(--muted); font-size: 7px; }
.puzzle-side { display: grid; gap: 16px; }
.puzzle-brief h2 { margin: 16px 0 5px; font-family: "Playfair Display"; font-size: 24px; }
.puzzle-brief > p, .solve-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.puzzle-fen { margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #faf9f3; display: grid; gap: 4px; }
.puzzle-fen span { color: var(--muted); font-size: 8px; font-weight: 700; }
.puzzle-fen code { color: var(--green); font-size: 8px; line-height: 1.4; overflow-wrap: anywhere; }
.puzzle-meta { margin-top: 10px; display: grid; justify-items: start; gap: 3px; color: var(--muted); font-size: 9px; }
.puzzle-meta strong { color: var(--green); }
.puzzle-meta a { margin-top: 5px; color: var(--gold); font-size: 10px; text-decoration: none; }
.puzzle-meta a:hover { text-decoration: underline; }
.puzzle-notes { margin-top: 10px; padding: 9px 10px; border-left: 3px solid var(--gold); background: var(--gold-soft); }
.puzzle-notes span { display: block; color: var(--muted); font-size: 8px; font-weight: 700; }
.puzzle-notes p { margin: 4px 0 0; color: var(--ink); font-size: 9px; line-height: 1.45; white-space: pre-wrap; }
.puzzle-status { margin: 20px 0 12px; padding: 12px; border-radius: 9px; color: #765e20; background: var(--gold-soft); font-size: 10px; line-height: 1.5; }
.puzzle-status.solved { color: #42644c; background: var(--green-soft); }
.puzzle-last-move { margin-top: 12px; padding: 9px 11px; border-radius: 8px; background: var(--gold-soft); display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.puzzle-last-move span { color: var(--muted); }
.puzzle-solution { margin-top: 10px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #faf9f3; display: grid; gap: 4px; font-size: 10px; }
.puzzle-solution span { color: var(--green); font-weight: 700; line-height: 1.5; }
.puzzle-hint { border-color: var(--gold); background: var(--gold-soft); }
.puzzle-hint span { color: var(--ink); font-size: 15px; }
.puzzle-hint small { color: var(--muted); font-size: 8px; }
.solve-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.solve-number { font-family: "Playfair Display"; font-size: 50px; line-height: 1; color: var(--green); }
.solve-card h3 { margin: 0 0 4px; font-family: "Playfair Display"; font-size: 16px; }
.solve-card .avatar-row { grid-column: 1 / -1; }
.past-puzzle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.past-puzzle-card { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--card); display: flex; align-items: center; gap: 10px; text-align: left; }
.past-puzzle-card:hover, .past-puzzle-card.active { border-color: var(--green); box-shadow: 0 6px 18px rgba(37, 57, 46, .08); }
.past-puzzle-card > div { min-width: 0; flex: 1; }
.past-puzzle-card h3 { margin: 8px 0 2px; font-family: "Playfair Display"; font-size: 14px; }
.past-puzzle-card p { margin: 0; color: var(--muted); font-size: 8px; }
.past-puzzle-card > strong { font-family: "Playfair Display"; font-size: 25px; color: var(--green); text-align: center; }
.past-puzzle-card > strong small { display: block; font-family: "DM Sans"; color: var(--muted); font-size: 7px; text-transform: uppercase; }
.pagination { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pagination-summary { color: var(--muted); font-size: 9px; white-space: nowrap; }
.pagination-controls { display: flex; align-items: center; justify-content: flex-end; gap: 5px; flex-wrap: wrap; }
.pagination-page { min-width: 30px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--card); font: inherit; font-size: 8px; cursor: pointer; }
.pagination-page:hover, .pagination-page.active { border-color: var(--green); color: white; background: var(--green); }
.pagination-page:disabled { color: #a9aea7; background: #f1f1eb; cursor: default; }
.pagination-gap { padding: 0 2px; color: var(--muted); font-size: 10px; }

dialog { width: min(470px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 14px; color: var(--ink); background: var(--card); box-shadow: 0 30px 80px rgba(17,31,23,.25); }
dialog:has(.tournament-detail), dialog:has(.student-profile-detail), dialog:has(.move-history-detail), dialog:has(.game-replay-detail) { width: min(760px, calc(100% - 30px)); }
dialog:has(.admin-accounts-detail) { width: min(620px, calc(100% - 30px)); }
dialog::backdrop { background: rgba(13,25,18,.58); backdrop-filter: blur(3px); }
.modal-close { position: absolute; right: 13px; top: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: #f0eee8; font-size: 18px; }
.modal-inner { padding: 27px; }
.modal-inner h2 { margin: 0; font-family: "Playfair Display"; font-size: 23px; }
.modal-inner > p { margin: 5px 0 20px; color: var(--muted); font-size: 10px; }
.tournament-detail > h3 { margin: 20px 0 8px; font-family: "Playfair Display"; font-size: 15px; }
.result-summary { margin-top: 16px; display: grid; grid-template-columns: 1.4fr .7fr .7fr; gap: 8px; }
.result-summary > div { padding: 12px; border-radius: 9px; background: #f0f0e9; display: grid; gap: 3px; }
.result-summary > div:first-child { color: #71591e; background: var(--gold-soft); grid-template-columns: auto 1fr; }
.result-summary span { grid-row: 1 / 3; font-size: 23px; }
.result-summary small { color: var(--muted); font-size: 7px; font-weight: 700; letter-spacing: .1em; }
.result-summary strong { font-family: "Playfair Display"; font-size: 14px; }
.result-table-wrap { overflow-x: auto; }
.match-list { display: grid; gap: 5px; }
.match-list article { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; display: grid; grid-template-columns: 30px 1fr 45px 1fr; align-items: center; gap: 7px; font-size: 9px; }
.match-list article > span { color: var(--muted); font-size: 8px; font-weight: 700; }
.match-list article > strong:last-child { text-align: right; }
.match-list b { padding: 4px; border-radius: 7px; background: var(--green-soft); text-align: center; }
.result-note { margin-top: 12px !important; font-style: italic; }
.student-profile-detail > h3 { margin: 20px 0 8px; font-family: "Playfair Display"; font-size: 15px; }
.profile-hero { padding: 15px; border-radius: 11px; color: white; background: var(--green); display: flex; align-items: center; gap: 11px; }
.profile-hero > div { flex: 1; }
.profile-hero h2, .profile-hero p { margin: 0; }
.profile-hero h2 { margin-top: 3px; font-family: "Playfair Display"; font-size: 22px; }
.profile-hero p { margin-top: 2px; color: #bdc9c0; font-size: 8px; }
.chesscom-profile { display: inline-flex; margin-top: 8px; padding: 5px 8px; border-radius: 999px; color: #123127; background: #d7e8dd; font-size: 8px; font-weight: 800; text-decoration: none; }
.chesscom-profile.muted { color: #bdc9c0; background: rgba(255,255,255,.08); }
.profile-hero > strong { font-family: "Playfair Display"; font-size: 24px; text-align: center; }
.profile-hero > strong small { display: block; font-family: "DM Sans"; color: #bdc9c0; font-size: 7px; }
.profile-record { margin-top: 10px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.profile-live-setting { margin: 14px 0 18px; padding: 14px; border: 2px solid var(--gold); border-radius: 12px; background: var(--gold-soft); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.profile-live-setting strong, .profile-live-setting small { display: block; }
.profile-live-setting strong { margin-top: 4px; font-family: "Playfair Display"; font-size: 19px; }
.profile-live-setting small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.live-request-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.live-request-toolbar span { color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.live-request-toolbar button { padding: 8px 10px; font-size: 9px; }
.profile-record.chesscom-record { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-record div { padding: 9px; border-radius: 8px; background: #f0f0e9; text-align: center; }
.profile-record strong, .profile-record small { display: block; }
.profile-record strong { font-family: "Playfair Display"; font-size: 15px; }
.profile-record small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.danger-btn { border: 0; border-radius: 8px; padding: 11px 15px; color: white; background: var(--rose); font-size: 11px; font-weight: 700; }
.puzzle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.notification-count { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; padding: 2px 4px; border-radius: 9px; color: white; background: var(--rose); font-size: 8px; line-height: 12px; }
.icon-btn { position: relative; }
.notification-card { display: grid; gap: 7px; padding: 13px; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf4; }
.notification-card small { color: var(--muted); line-height: 1.5; }
.notification-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.table-action { border: 0; padding: 3px 5px; color: var(--green); background: transparent; font-size: 8px; font-weight: 700; }
.table-action.danger-text { color: var(--rose); }
.admin-account-list { margin: 15px 0 20px; display: grid; gap: 8px; }
.admin-account-row { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #faf9f3; display: flex; align-items: center; gap: 10px; }
.admin-account-row div { flex: 1; }
.admin-account-row strong, .admin-account-row small { display: block; }
.admin-account-row small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.admin-account-row .danger-btn { padding: 8px 10px; font-size: 9px; }
.admin-edit-row { display: block; }
.admin-edit-row form { display: grid; gap: 8px; width: 100%; }
.admin-row-actions { display: flex; justify-content: flex-end; gap: 8px; }
.admin-row-actions .secondary-btn, .admin-row-actions .danger-btn { padding: 8px 10px; font-size: 9px; }
.checkbox-field { display: flex; align-items: center; gap: 7px; margin: 9px 0; color: var(--ink); font-size: 10px; cursor: pointer; }
.checkbox-field input { width: 15px; height: 15px; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #637168; font-size: 9px; font-weight: 700; }
.field-help { color: var(--muted); font-size: 8px; line-height: 1.4; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; outline: none; background: white; font-size: 10px; }
.field textarea { min-height: 70px; resize: vertical; }
.form-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.elo-edit-summary { margin: 16px 0; padding: 11px; border-radius: 9px; background: var(--green-soft); display: flex; align-items: center; gap: 10px; }
.elo-edit-summary strong, .elo-edit-summary small { display: block; }
.elo-edit-summary strong { font-family: "Playfair Display"; font-size: 14px; }
.elo-edit-summary small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.elo-edit-note { margin: 12px 0 0 !important; padding: 9px; border-radius: 8px; color: #765e20 !important; background: var(--gold-soft); line-height: 1.5; }
.info-danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 7px; }
.info-danger-zone > div { flex: 1; }
.info-danger-zone strong, .info-danger-zone small { display: block; }
.info-danger-zone strong { font-size: 10px; }
.info-danger-zone small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 10; padding: 11px 15px; border-radius: 8px; color: white; background: var(--green); font-size: 10px; transform: translateY(80px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.empty { padding: 35px; color: var(--muted); text-align: center; font-size: 11px; }
.view-error { max-width: 520px; margin: 40px auto; text-align: center; }
.view-error h2 { margin: 0; font-family: "Playfair Display"; }
.view-error p { color: var(--muted); font-size: 10px; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .student-grid, .tournament-grid, .coach-grid, .study-grid { grid-template-columns: repeat(2, 1fr); }
  .puzzle-layout { grid-template-columns: 1fr; }
  .live-games-layout, .hosted-game-body { grid-template-columns: 1fr; }
  .puzzle-tabs { grid-template-columns: repeat(2, 1fr); }
  .past-puzzle-grid { grid-template-columns: repeat(2, 1fr); }
  .replay-layout { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .auth-screen { display: block; background: var(--paper); }
  .auth-art { min-height: 215px; padding: 25px; }
  .auth-message { margin: auto 0 0; }
  .auth-message h1 { margin: 8px 0 3px; font-size: 34px; }
  .auth-message p { display: none; }
  .auth-panel { padding: 30px 20px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; left: -250px; width: 238px; transition: .25s; }
  .sidebar.open { left: 0; }
  .mobile-menu { display: block; }
  .topbar { padding: 20px; align-items: flex-start; }
  .top-actions .search, .top-actions .icon-btn { display: none; }
  #appContent { padding: 20px; }
  .dashboard-grid, .coach-layout, .stats-layout { grid-template-columns: 1fr; }
  .coach-hero { display: grid; }
  .student-grid, .tournament-grid, .coach-grid, .study-grid { grid-template-columns: 1fr; }
  .attendance-filters { grid-template-columns: 1fr 1fr; }
  .elo-steps { grid-template-columns: 1fr; }
  .elo-example { display: block; }
  .elo-score-legend { margin-top: 10px; }
  .profile-record { grid-template-columns: repeat(3, 1fr); }
  .quality-grid, .modal-shortcuts { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .top-actions { margin-left: 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .panel { overflow-x: auto; }
  .puzzle-tabs, .past-puzzle-grid { grid-template-columns: 1fr; }
  .attendance-filters, .meeting-history { grid-template-columns: 1fr; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .pagination-controls { justify-content: flex-start; }
  .info-danger-zone { align-items: stretch; flex-direction: column; }
  .training-item, .opening-bars > div { grid-template-columns: 1fr; }
}
