/* Cake Clash: 3D stage + overlay UI. Everything is prefixed .gt- */
.gt-root { position: relative; color: #1f2a44; font-family: inherit; }
.gt-root *, .gt-root *::before, .gt-root *::after { box-sizing: border-box; }

.gt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- stage (may break out of the article column on wide screens) ---------- */
.gt-wrap { position: relative; left: 50%; width: min(1100px, calc(100vw - 32px)); transform: translateX(-50%); }
.gt-stage {
  position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 18px;
  background: #2a2766; box-shadow: 0 10px 34px rgba(20, 24, 70, .35); isolation: isolate; user-select: none; -webkit-user-select: none;
}
.gt-stage:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; border-radius: 0; }
.gt-scene { position: absolute; inset: 0; z-index: 0; }
.gt-canvas { display: block; width: 100%; height: 100%; touch-action: manipulation; outline: none; }
.gt-scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, rgba(20, 16, 70, 0) 58%, rgba(20, 16, 70, .42) 100%); }
.gt-ui { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.gt-ui > * { pointer-events: auto; }

.gt-nowebgl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: #fff; font-weight: 600; font-size: 1.05rem; background: #2a2766; z-index: 5; }

/* ---------- panels ---------- */
.gt-panel { background: rgba(20, 40, 84, .78); color: #fff; border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 4px 14px rgba(8, 12, 40, .25); }

/* ---------- player cards ---------- */
.gt-cards { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; width: clamp(176px, 21%, 236px); margin: 0; padding: 0; list-style: none; }
.gt-card { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 24px; background: rgba(20, 40, 84, .78); border: 1px solid rgba(255, 255, 255, .2); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none; }
.gt-card.gt-me { border-color: #F4B942; box-shadow: 0 0 0 2px rgba(244, 185, 66, .35); }
.gt-avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .95rem; color: #fff; border: 2px solid rgba(255, 255, 255, .85); }
.gt-pwrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.gt-pname { min-width: 0; font-weight: 700; font-size: .88rem; line-height: 1.12; white-space: normal; overflow-wrap: anywhere; }
.gt-total { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.gt-cakeicon { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe08a, #e8a82a 70%, #b97626); border: 1.5px solid #8a5316; display: inline-block; }
.gt-total.gt-bump { animation: gt-bump .5s ease-out; }
@keyframes gt-bump { 0% { transform: scale(1); } 40% { transform: scale(1.45); color: #F4B942; } 100% { transform: scale(1); } }

/* ---------- top bar: round + timer ---------- */
.gt-top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 8px; border-radius: 999px; font-weight: 700; font-size: .95rem; white-space: nowrap; }
.gt-timer { position: relative; width: 38px; height: 38px; flex: 0 0 auto; }
.gt-timer svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.gt-timer .gt-ring-bg { fill: none; stroke: rgba(255, 255, 255, .22); stroke-width: 4; }
.gt-timer .gt-ring-fg { fill: none; stroke: #F4B942; stroke-width: 4; stroke-linecap: round; }
.gt-timer.gt-urgent .gt-ring-fg { stroke: #ff7a6b; }
.gt-timer-num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }

/* ---------- hint + actions ---------- */
.gt-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: calc(100% - 200px); padding: 7px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem; text-align: center; pointer-events: none; }
.gt-hint:empty { display: none; }
.gt-actions { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 10px; }
.gt-btn { appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 1rem; padding: 11px 24px; border-radius: 999px; color: #fff; background: linear-gradient(#2d6bd0, #1F4E8C); box-shadow: 0 4px 0 #14376a, 0 8px 16px rgba(8, 12, 40, .3); transition: transform .08s; }
.gt-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #14376a, 0 4px 10px rgba(8, 12, 40, .3); }
.gt-btn.gt-gold { color: #4a2c00; background: linear-gradient(#ffd25e, #E8A82A); box-shadow: 0 4px 0 #a9741a, 0 8px 16px rgba(8, 12, 40, .3); }
.gt-btn.gt-ghost { color: #fff; background: rgba(255, 255, 255, .16); border: 1.5px solid rgba(255, 255, 255, .6); box-shadow: none; }
.gt-btn[hidden] { display: none; }
.gt-btn:disabled { opacity: .5; cursor: not-allowed; }
.gt-root button:focus-visible, .gt-root select:focus-visible, .gt-root summary:focus-visible { outline: 3px solid #F4B942; outline-offset: 2px; }

.gt-fs { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 12px; cursor: pointer; color: #fff; font: inherit; }
.gt-fs svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.gt-toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); padding: 10px 20px; border-radius: 14px; font-weight: 700; text-align: center; max-width: 80%; pointer-events: none; }
.gt-toast[hidden] { display: none; }

/* keyboard / screen-reader tile buttons: visually hidden, still focusable */
.gt-tilebtns { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gt-tilebtns button { position: absolute; width: 1px; height: 1px; }

/* ---------- overlays (intro / results) ---------- */
.gt-overlay { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(14, 18, 60, .42); overflow-y: auto; pointer-events: auto; }
.gt-overlay[hidden] { display: none; }
.gt-modal { width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 22px 24px; text-align: center; margin: auto; }
.gt-modal h2 { margin: 0 0 8px; font-size: 1.45rem; line-height: 1.2; color: #fff; }
.gt-modal p { margin: 0 0 14px; color: #eaf0ff; font-size: 1rem; }
.gt-modal h2:focus { outline: none; }
.gt-scores { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; text-align: left; }
.gt-scores li { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-weight: 700; }
.gt-scores .gt-pname { font-size: 1rem; }
.gt-winner { font-weight: 700; color: #ffe08a !important; }
.gt-who { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px solid rgba(255, 255, 255, .22); text-align: left; }
.gt-who h3 { margin: 0 0 8px; font-size: 1.05rem; color: #fff; text-align: center; }
.gt-legend { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 3px; font-size: .76rem; line-height: 1.3; color: #dfe8ff; text-align: left; }
.gt-legend b { color: #fff; }
.gt-guess-row { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; color: #fff; font-weight: 700; }
.gt-guess-row select { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .5); background: #fff; color: #1f2a44; font: inherit; font-size: .92rem; }
.gt-reveal-cards { display: grid; gap: 8px; margin: 8px 0 4px; text-align: left; }
.gt-rcard { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .12); border-left: 6px solid var(--c, #fff); color: #fff; font-size: .92rem; }
.gt-rcard b { font-size: 1rem; }
.gt-rcard .gt-tell { display: block; margin-top: 4px; color: #dfe8ff; }
.gt-mark { font-weight: 800; margin-left: 4px; }
.gt-mark.gt-ok { color: #7be6a0; }
.gt-mark.gt-no { color: #ff9a8f; }
.gt-modal .gt-btn { margin-top: 6px; }
.gt-row-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }

/* ---------- live table: card states, lobby panel ---------- */
.gt-psub { font-size: .66rem; font-weight: 700; color: #ffd98a; line-height: 1.1; text-transform: uppercase; letter-spacing: .04em; }
.gt-psub:empty { display: none; }
.gt-card { transition: opacity .2s; }
.gt-card.gt-away { opacity: .5; }
.gt-modal-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.gt-btn.gt-big { font-size: 1.25rem; padding: 14px 44px; }
.gt-mm .gt-slots { list-style: none; margin: 4px 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.gt-slot { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 999px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); font-weight: 700; min-width: 0; }
.gt-slot.gt-slot-me { border-color: #F4B942; box-shadow: 0 0 0 2px rgba(244, 185, 66, .35); }
.gt-slot .gt-avatar { width: 38px; height: 38px; }
.gt-slot-anon .gt-avatar { background: #6b7a99; }
.gt-slot-anon .gt-slot-name { color: #dfe8ff; font-weight: 600; }
.gt-slot-empty .gt-avatar { background: transparent; border: 2px dashed rgba(255, 255, 255, .5); animation: gt-pulse 1.4s ease-in-out infinite; }
.gt-slot-empty .gt-slot-name { color: #b9c6ea; font-weight: 600; }
.gt-slot-name { flex: 1 1 auto; min-width: 0; line-height: 1.12; overflow-wrap: anywhere; }
.gt-slot-ok { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #2fb85f; color: #fff; font-size: .95rem; font-weight: 800; border: 2px solid #fff; }
@keyframes gt-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.gt-bar { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .2); overflow: hidden; margin: 0 0 8px; }
.gt-bar-fill { display: block; height: 100%; width: 100%; border-radius: 999px; background: linear-gradient(#ffd25e, #E8A82A); }
.gt-bar-label { display: block; margin-bottom: 10px; color: #eaf0ff; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.gt-bar-indet .gt-bar-fill { width: 35%; animation: gt-indet 1.6s ease-in-out infinite; }
@keyframes gt-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.gt-mm-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .14); font-weight: 700; font-size: .92rem; color: #ffe08a; }
.gt-recon { z-index: 6; background: rgba(14, 18, 60, .6); }

/* ---------- identity: intro line, profile panel ---------- */
.gt-ident { margin: 0 0 12px; min-height: 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .92rem; }
.gt-link, .gt-linkbtn { appearance: none; background: none; border: 0; padding: 2px 4px; font: inherit; font-size: .92rem; font-weight: 600; color: #cfe0ff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.gt-link:hover, .gt-linkbtn:hover { color: #fff; }
.gt-playing { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1rem; }
.gt-playing canvas { border-radius: 50%; flex: 0 0 auto; }
.gt-ident-btns { display: flex; gap: 14px; }
.gt-ident-note { color: #eaf0ff; }
.gt-prof { z-index: 5; }
.gt-profile { text-align: left; }
.gt-profile h2 { text-align: center; }
.gt-field-label { display: block; margin: 10px 0 4px; font-weight: 700; font-size: .92rem; color: #fff; }
.gt-profile input[type=text] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .5); background: #fff; color: #1f2a44; font: inherit; font-size: 1rem; }
.gt-root input:focus-visible, .gt-root a:focus-visible { outline: 3px solid #F4B942; outline-offset: 2px; }
.gt-profile .gt-field-hint { margin: 6px 0 0; font-size: .78rem; color: #dfe8ff; }
.gt-profile .gt-field-err { margin: 6px 0 0; min-height: 1.2em; font-size: .88rem; font-weight: 700; color: #ffb4a8; }
.gt-avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 8px; }
.gt-avpick { appearance: none; padding: 4px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .1); cursor: pointer; display: grid; place-items: center; }
.gt-avpick.gt-on { border-color: #F4B942; background: rgba(244, 185, 66, .22); box-shadow: 0 0 0 2px rgba(244, 185, 66, .35); }
.gt-avpick canvas { display: block; max-width: 100%; height: auto !important; aspect-ratio: 1; }

/* ---------- round history (below the stage) ---------- */
.gt-history { margin-top: 16px; border: 1px solid #d6dff0; border-radius: 12px; background: #fff; }
.gt-history summary { cursor: pointer; padding: 11px 16px; font-weight: 700; color: #1F4E8C; }
.gt-history .gt-table-wrap { overflow-x: auto; padding: 0 12px 12px; }
.gt-history table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
.gt-history th, .gt-history td { padding: 7px 10px; text-align: center; border-bottom: 1px solid #e6ebf5; }
.gt-history th:first-child, .gt-history td:first-child { text-align: left; font-weight: 700; }
.gt-history td.gt-clash { color: #9a3a2a; font-weight: 600; }
.gt-history .gt-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }

/* ---------- phones: compact top row of players, 3:4 stage ---------- */
@media (max-width: 720px) {
  .gt-stage { aspect-ratio: 3 / 4; border-radius: 14px; }
  .gt-stage:fullscreen { aspect-ratio: auto; }
  .gt-cards { left: 8px; right: 56px; top: 8px; width: auto; flex-direction: row; gap: 5px; }
  .gt-card { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 1px; padding: 5px 4px 4px; border-radius: 12px; text-align: center; }
  .gt-avatar { width: 26px; height: 26px; font-size: .78rem; }
  .gt-pname { font-size: .66rem; flex: none; max-width: 100%; }
  .gt-total { font-size: .82rem; gap: 3px; }
  .gt-cakeicon { width: 12px; height: 12px; }
  .gt-top { top: 82px; padding: 3px 11px 3px 5px; font-size: .85rem; }
  .gt-timer { width: 30px; height: 30px; }
  .gt-timer-num { font-size: .8rem; }
  .gt-fs { right: 8px; top: 8px; width: 36px; height: 36px; }
  .gt-hint { bottom: 62px; max-width: calc(100% - 24px); font-size: .74rem; padding: 4px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gt-actions { left: 12px; right: 12px; bottom: 10px; justify-content: center; }
  .gt-btn { padding: 10px 22px; }
  .gt-modal { padding: 18px 16px; }
  .gt-psub { font-size: .6rem; }
  .gt-mm .gt-slots { gap: 6px; }
  .gt-slot { padding: 6px 8px 6px 6px; gap: 6px; }
  .gt-slot .gt-avatar { width: 30px; height: 30px; }
  .gt-slot-name { font-size: .82rem; }
  .gt-btn.gt-big { padding: 12px 36px; font-size: 1.1rem; }
}
@media (max-width: 720px) { .gt-stage:fullscreen .gt-top { top: 82px; } }

.gt-root [hidden] { display: none !important; }

/* between phone and tablet widths the compact layout keeps a slightly wider stage */
@media (min-width: 601px) and (max-width: 720px) {
  .gt-stage { aspect-ratio: 4 / 5; }
  .gt-stage:fullscreen { aspect-ratio: auto; }
}

/* ---------- season ladder (sits in the white article, so light colours) ---------- */
.gt-ladder { color: #374151; }
.gt-ladder *, .gt-ladder *::before, .gt-ladder *::after { box-sizing: border-box; }
.gt-lad-prize { margin: 0 0 18px; font-size: .98rem; line-height: 1.55; }
.gt-lad-tabs { display: flex; gap: 6px; border-bottom: 2px solid #e5e7eb; }
.gt-lad-tab { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 10px 18px; font: inherit; font-weight: 700; color: #6b7280; cursor: pointer; border-radius: 8px 8px 0 0; }
.gt-lad-tab:hover { color: #1F4E8C; }
.gt-lad-tab.gt-on { color: #1F4E8C; border-bottom-color: #1F4E8C; }
.gt-ladder button:focus-visible, .gt-ladder select:focus-visible, .gt-lad-panel:focus-visible { outline: 3px solid #F4B942; outline-offset: 2px; }
.gt-lad-panel { padding-top: 14px; }
.gt-lad-rule { margin: 0 0 12px; font-weight: 600; color: #1F4E8C; }
.gt-lad-pickers { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 14px; }
.gt-lad-field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 700; color: #4b5563; min-width: 0; }
.gt-lad-select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #1f2a44; font: inherit; font-size: .95rem; max-width: 100%; }
.gt-lad-select:disabled { opacity: .6; }
.gt-lad-status { margin: 0; min-height: 1.2em; font-size: .9rem; color: #6b7280; }
.gt-lad-wrap { overflow-x: auto; border: 1px solid #e5e7eb; border-radius: 12px; background: #fff; max-width: 100%; }
.gt-lad-wrap:empty, .gt-lad-pinwrap:empty { display: none; }
.gt-lad-pinwrap { margin-top: 10px; border-color: #F4B942; }
.gt-lad-table { width: 100%; border-collapse: collapse; font-size: .95rem; font-variant-numeric: tabular-nums; }
.gt-lad-table th, .gt-lad-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid #eef0f4; white-space: nowrap; }
.gt-lad-table thead th { background: #f3f6fb; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #4b5563; }
.gt-lad-table tbody tr:last-child td { border-bottom: 0; }
.gt-lad-table .gt-lad-num { text-align: right; }
.gt-lad-table .gt-lad-rank { width: 3.2rem; text-align: right; font-weight: 700; }
.gt-lad-name { font-weight: 600; color: #1f2a44; }
.gt-lad-nm { display: flex; align-items: center; gap: 10px; }
.gt-lad-name canvas { border-radius: 50%; flex: 0 0 auto; }
.gt-lad-table td.gt-neg { color: #9a3a2a; }
tr.gt-lad-you td { background: #fff6dd; font-weight: 700; }
tr.gt-lad-you td:first-child { box-shadow: inset 4px 0 0 #F4B942; }
.gt-lad-empty, .gt-lad-msg { margin: 0; padding: 22px 16px; text-align: center; color: #4b5563; }
.gt-lad-msg p { margin: 0 0 10px; }
.gt-lad-more, .gt-lad-retry { appearance: none; margin-top: 12px; padding: 10px 22px; border-radius: 999px; border: 1.5px solid #1F4E8C; background: #fff; color: #1F4E8C; font: inherit; font-weight: 700; cursor: pointer; }
.gt-lad-retry { margin-top: 0; }
.gt-lad-more:hover, .gt-lad-retry:hover { background: #1F4E8C; color: #fff; }
.gt-lad-more[hidden] { display: none; }
.gt-lad-more:disabled { opacity: .6; cursor: wait; }
@media (max-width: 600px) {
  .gt-lad-tab { flex: 1 1 0; padding: 10px 6px; }
  .gt-lad-table th, .gt-lad-table td { padding: 7px 5px; font-size: .84rem; }
  .gt-lad-table thead th { font-size: .64rem; white-space: normal; line-height: 1.15; vertical-align: bottom; }
  .gt-lad-table td.gt-lad-name { white-space: normal; min-width: 0; }
  .gt-lad-nm { gap: 6px; }
  .gt-lad-name canvas { width: 22px !important; height: 22px !important; }
  .gt-lad-table .gt-lad-rank { width: 2rem; }
  .gt-lad-field { flex: 1 1 100%; }
  .gt-lad-select { width: 100%; }
}
