/* tournaments screen styles. Loaded after the shared stylesheets so rules here can override them. */

/* ---- Friendly Four list ------------------------------------------------ */
#tournaments{display:flex;flex-direction:column;gap:14px;margin-top:14px;min-width:0}
#tournaments .tv-list{display:flex;flex-direction:column;gap:14px;min-width:0}
#tournaments .tv-empty{margin:4px 0}
#tournaments .tv-card{overflow-wrap:anywhere;font-size:14px;display:flex;flex-direction:column;gap:14px;margin:0;padding:16px;min-width:0;border:1px solid var(--realm-border,#82918a);border-radius:12px;background:color-mix(in srgb,var(--realm-panel,#14232a) 92%,transparent);color:var(--realm-text,#f4edda);box-sizing:border-box}
#tournaments .tv-card[data-member=true]{border-color:var(--realm-gold,#d8b76c)}
#tournaments .tv-card[data-status=cancelled]{opacity:.72}
#tournaments .tv-card-head{margin:0;padding:0;background:none;border:0;display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
#tournaments .tv-title{font-size:18px;line-height:1.25}
#tournaments .tv-meta{margin:2px 0 0;font-size:13px;color:var(--realm-muted,#c4cfc9)}
#tournaments .tv-chip{display:inline-flex;align-items:center;gap:6px;flex:none;padding:3px 10px;border-radius:999px;border:1px solid #e0705a;background:#3a1f1c;color:#ffd9cf;font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
#tournaments h4{margin:0 0 8px;font-size:13px;letter-spacing:.08em;text-transform:uppercase;color:var(--realm-gold,#d8b76c)}
#tournaments .tv-block{min-width:0}

/* Names with portraits */
.tv-name{display:inline-flex;align-items:center;gap:8px;min-width:0;max-width:100%}
.tv-name>span:not(.tv-you):not(.player-portrait){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.tv-name .player-portrait{flex:none;width:26px;height:26px}
.tv-you{flex:none;padding:1px 6px;border-radius:999px;background:var(--realm-gold,#d8b76c);color:#201c12;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}

/* Waiting room */
#tournaments .tv-entrants{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:8px}
#tournaments .tv-entrants li{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:44px;padding:6px 10px;border:1px solid #ffffff22;border-radius:8px;background:#0b1d22;min-width:0}
#tournaments .tv-entrants li small{color:var(--realm-muted,#c4cfc9);flex:none}
#tournaments .tv-entrants .tv-open-seat{justify-content:center;border-style:dashed;color:var(--realm-muted,#c4cfc9)}
#tournaments .tv-hint{margin:0;font-size:13px;color:var(--realm-muted,#c4cfc9)}
#tournaments .tv-actions{display:flex;flex-wrap:wrap;gap:8px}
#tournaments .tv-actions button{min-height:44px;margin:0}

/* Standings */
#tournaments .tv-table-wrap{overflow-x:auto;border:1px solid #ffffff22;border-radius:10px}
#tournaments .tv-standings{width:100%;border-collapse:collapse;font-size:14px;overflow-wrap:normal}
#tournaments .tv-standings th,#tournaments .tv-standings td{padding:7px 8px;text-align:left;vertical-align:middle;border-bottom:1px solid #ffffff14;font-weight:400}
#tournaments .tv-standings thead th{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--realm-muted,#c4cfc9);background:#0b1d22}
#tournaments .tv-standings abbr{text-decoration:none;cursor:help}
#tournaments .tv-standings tbody tr:last-child>*{border-bottom:0}
#tournaments .tv-standings tr[data-me=true]{background:#d8b76c1f}
#tournaments .tv-standings tbody th{max-width:0;width:100%}
#tournaments .tv-standings .tv-num{text-align:center;width:2.6em;white-space:nowrap;font-variant-numeric:tabular-nums}
#tournaments .tv-standings .tv-points{font-weight:800;color:var(--realm-gold,#d8b76c)}
#tournaments .tv-rank{white-space:nowrap;width:3.2em;font-variant-numeric:tabular-nums}
#tournaments .tv-award{width:20px;height:20px;margin-left:4px;vertical-align:middle}

/* Pairings */
#tournaments .tv-rounds{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
#tournaments .tv-round{min-width:0;padding:10px;border:1px solid #ffffff22;border-radius:10px;background:#0b1d22}
#tournaments .tv-round[data-state=current]{border-color:var(--realm-gold,#d8b76c);box-shadow:0 0 0 1px var(--realm-gold,#d8b76c) inset}
#tournaments .tv-round[data-state=upcoming]{opacity:.8}
#tournaments .tv-round h5{display:flex;justify-content:space-between;align-items:baseline;gap:8px;margin:0 0 8px;font-size:14px}
#tournaments .tv-round h5 small{font-size:11px;font-weight:600;color:var(--realm-muted,#c4cfc9);text-transform:uppercase;letter-spacing:.06em}
#tournaments .tv-round ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
#tournaments .tv-pairing{display:flex;flex-direction:column;gap:4px;padding:8px 10px;border:1px solid #ffffff1a;border-radius:8px;background:#ffffff08;font-size:13px;min-width:0}
#tournaments .tv-pairing[data-mine=true]{border-color:#d8b76c99;background:#d8b76c14}
#tournaments .tv-pairing[data-phase=live]{border-color:#e0705a;background:#e0705a1a}
#tournaments .tv-pairing[data-phase=checkin],#tournaments .tv-pairing[data-phase=starting]{border-color:#7fb6d8;background:#7fb6d81a}
#tournaments .tv-line{display:flex;align-items:center;gap:6px;min-width:0;min-height:28px}
#tournaments .tv-line .tv-name{flex:1 1 auto}
#tournaments .tv-line[data-me=true] .tv-name>span:last-child{color:var(--realm-gold,#d8b76c);font-weight:700}
#tournaments .tv-line[data-won=true] .tv-name>span:last-child{font-weight:700}
#tournaments .tv-pairing .player-portrait{width:22px;height:22px}
#tournaments .tv-piece{flex:none;width:16px;font-size:15px;line-height:1;opacity:.85;text-align:center}
#tournaments .tv-pts{flex:none;min-width:1.4em;text-align:right;font-weight:800;font-variant-numeric:tabular-nums;color:var(--realm-gold,#d8b76c)}
#tournaments .tv-note{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding-top:4px;border-top:1px solid #ffffff12;font-size:12px;color:var(--realm-muted,#c4cfc9)}
#tournaments .tv-pairing[data-phase=live] .tv-note{color:#ffd9cf;font-weight:700}
#tournaments .tv-pairing .tv-play{min-height:40px;margin:4px 0 0;width:100%;text-align:center}

/* Live markers */
.tv-dot{color:#ff6b52;display:inline-block;flex:none;width:8px;height:8px;border-radius:50%;background:#ff6b52;box-shadow:0 0 0 0 #ff6b5299;animation:tv-ping 1.6s ease-out infinite}
.tv-countdown{font-weight:800;font-variant-numeric:tabular-nums;color:var(--realm-text,#f4edda)}

/* The viewer's current game: in the list ... */
.tv-callout{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 16px;border:2px solid var(--realm-gold,#d8b76c);border-radius:12px;background:linear-gradient(135deg,#2c2611,#13262a);color:var(--realm-text,#f4edda)}
.tv-callout-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.tv-callout-copy strong{font-size:16px;line-height:1.3}
.tv-callout-copy span,.tv-callout-copy small{font-size:13px;color:var(--realm-muted,#c4cfc9)}
.tv-callout-copy small{color:#ffe6ad}
.tv-callout .tv-callout-button{min-height:48px;min-width:140px;margin:0;font-size:15px}
.tv-pulse{color:var(--realm-gold,#d8b76c);width:14px;height:14px;border-radius:50%;background:var(--realm-gold,#d8b76c);box-shadow:0 0 0 0 #d8b76c99;animation:tv-ping 1.6s ease-out infinite}
[data-phase=live]>.tv-pulse{color:#ff6b52;background:#ff6b52;box-shadow:0 0 0 0 #ff6b5299}

/* ... and as a banner on every other screen */
.tv-call{position:fixed;z-index:60;left:50%;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(640px,calc(100vw - 32px));box-sizing:border-box;display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:10px;padding:10px 10px 10px 14px;border:2px solid var(--realm-gold,#d8b76c);border-radius:14px;background:#13262af5;color:var(--realm-text,#f4edda);box-shadow:0 12px 32px #000a}
.tv-call[hidden]{display:none}
.tv-call-copy{display:flex;flex-direction:column;gap:2px;min-width:0}
.tv-call-copy strong{font-size:14px;line-height:1.3}
.tv-call-copy small{font-size:12px;color:#ffe6ad}
.tv-call .tv-play{min-height:44px;margin:0;white-space:nowrap}
.tv-call .tv-play:not(.primary),.tv-callout .tv-play:not(.primary){background:var(--realm-control,#243a3e);color:var(--realm-text,#f4edda);border:1px solid var(--realm-frame,#9c8757)}
.tv-call .tv-call-close{min-width:44px;min-height:44px;margin:0;padding:0;border:0;background:transparent;color:var(--realm-muted,#c4cfc9);font-size:22px;line-height:1}
/* Inside the result screen (a modal dialog) the banner sits under its buttons */
.tv-call[data-docked]{position:relative;z-index:3;left:auto;bottom:auto;transform:none;width:auto;margin:6px 24px 22px;box-shadow:none;text-align:left}

/* Board veil while a round game waits for its players */
.tv-wait{position:fixed;z-index:30;display:grid;place-items:center;padding:12px;box-sizing:border-box;background:#06161ab8;pointer-events:none;border-radius:4px}
.tv-wait[hidden],.tv-wait[data-offscreen]{display:none}
.tv-wait-card{display:flex;flex-direction:column;align-items:center;gap:6px;max-width:min(92%,420px);padding:16px 18px;border:2px solid var(--realm-gold,#d8b76c);border-radius:12px;background:#13262af2;color:var(--realm-text,#f4edda);text-align:center;box-shadow:0 10px 28px #0009}
.tv-wait-card strong{font-size:17px;line-height:1.3}
.tv-wait-card span:not(.tv-pulse):not(.tv-countdown){font-size:14px;color:#ffe6ad}
.tv-wait-card .tv-countdown{font-size:16px}

@keyframes tv-ping{0%{box-shadow:0 0 0 0 currentColor}70%{box-shadow:0 0 0 8px transparent}100%{box-shadow:0 0 0 0 transparent}}
@media (prefers-reduced-motion:reduce) and (scripting:none){.tv-dot,.tv-pulse{animation:none}}

@media (max-width:900px){#tournaments .tv-rounds{grid-template-columns:minmax(0,1fr)}}
@media (max-width:600px){
 #tournaments .tv-card{padding:12px}
 #tournaments .tv-standings th,#tournaments .tv-standings td{padding:6px 5px}
 #tournaments .tv-standings .tv-num{width:1.9em;padding-left:3px;padding-right:3px}
 #tournaments .tv-standings thead th{letter-spacing:0}
 .tv-callout{grid-template-columns:auto minmax(0,1fr);padding:12px}
 .tv-callout .tv-callout-button{grid-column:1/-1;width:100%}
 .tv-call{grid-template-columns:auto minmax(0,1fr) auto;bottom:max(10px,env(safe-area-inset-bottom));width:calc(100vw - 20px)}
 .tv-call .tv-play{grid-column:1/3;grid-row:2;width:100%}
 .tv-call .tv-call-close{grid-column:3;grid-row:1}
 .tv-wait-card{padding:10px 12px}
 .tv-wait-card strong{font-size:15px}
}

/* ======================================================================
   Tournament Hall redesign: one page for Live Cups and the Friendly Four.
   Dark emerald cards, gold borders, Georgia headings, medallions.
   Motion only under html[data-motion=full].
   ====================================================================== */
#cupsView{--th-gold:#d8b76c;--th-gold-hi:#f3dc9c;--th-ink:#f4edda;--th-muted:#b9c8c1;--th-line:rgba(216,183,108,.42);--th-panel:linear-gradient(180deg,#123a38 0%,#0d2a2c 60%,#0a2124 100%);display:flex;flex-direction:column;gap:22px;min-width:0;max-width:100%;overflow-x:clip}
#cupsView[hidden]{display:none}
#cupsView>#cups{order:-2}
#cupsView>.card:has(#tournaments){order:-1}
#cupsView>#scheduled{order:1}
#cupsView>.card:has(#tournaments)>:not(#tournaments){display:none!important}
#cupsView>.card:has(#tournaments),#cupsView>#cups.th-hall{margin:0!important;padding:22px!important;border:1px solid var(--th-line)!important;border-radius:20px!important;background:radial-gradient(120% 60% at 0% 0%,rgba(216,183,108,.12),transparent 55%),var(--th-panel)!important;color:var(--th-ink)!important;box-shadow:0 24px 60px rgba(0,0,0,.35),inset 0 1px 0 rgba(255,255,255,.06)!important;min-width:0;max-width:100%;box-sizing:border-box}
#cupsView h2,#cupsView h3{font-family:Georgia,'Times New Roman',serif;color:var(--th-gold-hi);letter-spacing:.01em}
#cupsView button{cursor:pointer}
#cupsView button:disabled{cursor:not-allowed;opacity:.55}
#cupsView .primary,#cupsView button.primary{background:linear-gradient(180deg,#f0d58c,#c99c45)!important;color:#22180a!important;border:1px solid #f6e3a6!important;font-weight:800;box-shadow:0 6px 18px rgba(201,156,69,.28)}
#cupsView .th-quiet,#cupsView .tv-quiet{background:rgba(255,255,255,.04)!important;color:var(--th-ink)!important;border:1px solid var(--th-line)!important}
#cupsView .th-danger,#cupsView .tv-danger{background:linear-gradient(180deg,#7a2a22,#5a1c17)!important;color:#ffe9e2!important;border:1px solid #d4604c!important;font-weight:700}

/* ---- hero ---- */
.th-hall .th-hero{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:18px;margin:0 0 18px;padding:0 0 18px;border-bottom:1px solid var(--th-line)}
.th-medallion,.th-medal,.tv-medal{display:grid;place-items:center;flex:none;border-radius:50%;background:radial-gradient(circle at 35% 30%,#fff3c8,#dcb65e 46%,#8a6420 100%);color:#2a1d05;font:700 30px/1 'Segoe UI Symbol','Noto Sans Symbols 2','Apple Symbols',serif;box-shadow:0 0 0 5px rgba(216,183,108,.16),0 8px 20px rgba(0,0,0,.45),0 0 26px rgba(255,214,120,.28)}
.th-medallion{width:64px;height:64px;font-size:34px}
.th-medal,.tv-medal{width:42px;height:42px;font-size:22px;box-shadow:0 0 0 3px rgba(216,183,108,.16),0 6px 14px rgba(0,0,0,.4)}
.th-hero-text{min-width:0}
.th-eyebrow,.tv-eyebrow{margin:0;font-size:11px;font-weight:800;letter-spacing:.2em;text-transform:uppercase;color:var(--th-gold)}
.th-hall .th-hero h2{margin:2px 0 4px;font-size:clamp(26px,3.2vw,38px);line-height:1.1}
.th-sub{margin:0;color:var(--th-muted);font-size:14px;line-height:1.5}
.th-balance{display:grid;justify-items:end;gap:2px;padding:10px 14px;border:1px solid var(--th-line);border-radius:14px;background:rgba(0,0,0,.22)}
.th-balance small{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--th-muted)}
.th-balance strong{font:700 20px/1.1 Georgia,serif;color:var(--th-gold-hi)}
.th-notice{margin:0 0 12px;color:#ffe6ad;font-size:13px}
.th-notice:empty{display:none}

/* ---- create panel ---- */
.th-create{display:grid;gap:14px;margin:0 0 22px;padding:18px;border:1px solid var(--th-line);border-radius:16px;background:rgba(3,18,20,.38);min-width:0}
.th-create h3{margin:0;font-size:20px}
.th-formats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#cupsView .th-format{display:flex;align-items:center;gap:12px;min-height:72px;margin:0;padding:12px 14px;text-align:left;border:1px solid rgba(216,183,108,.3)!important;border-radius:14px;background:rgba(255,255,255,.03)!important;color:var(--th-ink)!important;box-shadow:none;min-width:0;transition:transform .2s ease,box-shadow .2s ease}
#cupsView .th-format[data-active=true]{border-color:var(--th-gold)!important;background:linear-gradient(180deg,rgba(216,183,108,.2),rgba(216,183,108,.06))!important;box-shadow:0 0 0 1px var(--th-gold) inset,0 8px 22px rgba(0,0,0,.25)}
.th-format-icon{display:grid;place-items:center;flex:none;width:40px;height:40px;border-radius:50%;background:rgba(216,183,108,.16);color:var(--th-gold-hi);font:700 22px/1 'Segoe UI Symbol','Noto Sans Symbols 2',serif}
.th-format[data-active=true] .th-format-icon{background:radial-gradient(circle at 35% 30%,#fff3c8,#dcb65e 46%,#8a6420 100%);color:#2a1d05}
.th-format-copy{display:grid;gap:2px;min-width:0}
.th-format-copy strong{font:700 16px/1.2 Georgia,serif;color:var(--th-gold-hi)}
.th-format-copy small{font-size:12px;color:var(--th-muted);line-height:1.35}
.th-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;min-width:0}
.th-field{display:grid;gap:6px;min-width:0;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--th-muted)}
.th-field[data-disabled=true]{opacity:.45}
.th-hall select{box-sizing:border-box;width:100%;max-width:100%;min-height:44px;padding:8px 10px;border:1px solid rgba(216,183,108,.45);border-radius:10px;background:#0c2427;color:var(--th-ink);font-size:14px;font-weight:600;letter-spacing:0;text-transform:none}
.th-fee-hint{margin:0;font-size:13px;color:#ffe6ad;line-height:1.45}
.th-create-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px}
.th-accept{display:inline-flex;align-items:center;gap:8px;font-size:13px;color:var(--th-ink);min-width:0}
.th-accept input{width:20px;height:20px;accent-color:#d8b76c;flex:none;margin:0}
#cupsView .th-create-button{min-height:48px;min-width:200px;margin:0;padding:0 22px;border-radius:12px;font-size:15px}
.th-rules summary{cursor:pointer;color:var(--th-gold);font-weight:700;font-size:13px}
.th-rules p{margin:8px 0 0;font-size:13px;line-height:1.55;color:var(--th-muted)}

/* ---- sections, cards ---- */
.th-section{display:grid;gap:14px;min-width:0}
.th-section-head,.tv-section-head{display:flex;align-items:center;gap:12px;min-width:0}
.th-section-head h3,.tv-section-head h3{margin:0;font-size:22px}
.th-count,.tv-count{display:grid;place-items:center;min-width:28px;height:28px;padding:0 8px;border-radius:999px;background:rgba(216,183,108,.18);border:1px solid var(--th-line);color:var(--th-gold-hi);font-weight:800;font-size:13px;margin-left:auto;box-sizing:border-box}
.th-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,330px),1fr));gap:16px;min-width:0}
.th-grid:empty{display:none}
.th-card,#tournaments .tv-card{position:relative;display:flex;flex-direction:column;gap:14px;margin:0;padding:18px;min-width:0;box-sizing:border-box;border:1px solid rgba(216,183,108,.38);border-radius:16px;background:radial-gradient(120% 80% at 100% 0%,rgba(216,183,108,.1),transparent 50%),linear-gradient(180deg,#14403d,#0e2c2e);color:var(--th-ink);box-shadow:0 14px 34px rgba(0,0,0,.32),inset 0 1px 0 rgba(255,255,255,.06);overflow-wrap:anywhere;transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease}
.th-card[data-member=true],#tournaments .tv-card[data-member=true]{border-color:var(--th-gold);box-shadow:0 14px 34px rgba(0,0,0,.32),0 0 0 1px rgba(216,183,108,.5) inset}
.th-card[data-status=cancelled],#tournaments .tv-card[data-status=cancelled]{opacity:.72;filter:saturate(.6)}
.th-card-top,#tournaments .tv-card-head{display:flex;align-items:center;gap:12px;min-width:0}
.th-card-title,.tv-head-copy{flex:1 1 auto;min-width:0}
.th-card-title h3,#tournaments .tv-title{display:block;margin:0;font:700 19px/1.2 Georgia,serif;color:var(--th-gold-hi)}
.th-card-sub,#tournaments .tv-meta{margin:3px 0 0;font-size:13px;color:var(--th-muted)}
.th-badge,.tv-badge{flex:none;padding:4px 10px;border-radius:999px;border:1px solid var(--th-line);background:rgba(216,183,108,.14);color:var(--th-gold-hi);font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}
.th-badge[data-status=active],.tv-badge[data-status=active]{border-color:#e0705a;background:#3a1f1c;color:#ffd9cf}
.th-badge[data-status=cancelled],.tv-badge[data-status=cancelled]{border-color:#ffffff33;background:#ffffff0d;color:var(--th-muted)}
.th-stats,.tv-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;margin:0;min-width:0}
.th-stat,.tv-stat{display:grid;align-content:start;gap:3px;padding:9px 11px;border:1px solid rgba(255,255,255,.08);border-radius:12px;background:rgba(0,0,0,.2);min-width:0}
.th-stat dt,.tv-stat dt{font-size:10px;font-weight:800;letter-spacing:.12em;text-transform:uppercase;color:var(--th-muted)}
.th-stat dd,.tv-stat dd{margin:0;font:700 16px/1.25 Georgia,serif;color:var(--th-ink);min-width:0}
.th-stat-pot dd,.tv-stat-pot dd{color:var(--th-gold-hi)}
.th-stat-start dd,.tv-stat-start dd{color:#ffe6ad}
.th-start-note{font:600 13px/1.3 system-ui,sans-serif;color:var(--th-muted)}
.th-countdown,.tv-countdown{font-variant-numeric:tabular-nums;font-weight:800}
.th-big,.tv-big{font-size:22px;color:var(--th-gold-hi)}
.th-hall .avatar-participants{display:flex;flex-wrap:wrap;gap:8px;min-width:0}
.th-hall .avatar-identity{display:inline-flex;align-items:center;gap:7px;max-width:100%;min-width:0;box-sizing:border-box;padding:4px 10px 4px 4px;border:1px solid rgba(255,255,255,.12);border-radius:999px;background:rgba(0,0,0,.22);font-size:13px}
.th-hall .avatar-identity>span:not(.player-portrait):not(.th-you){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.th-hall .avatar-identity .player-portrait{width:26px;height:26px;flex:none}
.th-hall .th-empty-seat{padding:4px 12px;border-style:dashed;border-color:rgba(216,183,108,.35);color:var(--th-muted);background:transparent;min-height:36px}
.th-you,.tv-you{flex:none;padding:1px 6px;border-radius:999px;background:var(--th-gold);color:#201c12;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.05em}
.th-min,.th-reason{margin:0;font-size:13px;color:var(--th-muted)}
.th-entry,.tv-entry{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:10px 12px;border:1px dashed rgba(216,183,108,.4);border-radius:12px;background:rgba(216,183,108,.06);font-size:13px}
.th-entry strong,.tv-entry strong{color:var(--th-gold-hi)}
.th-entry [data-state=staked],.tv-entry [data-state=staked]{color:#a8e6b4}
.th-pay,.tv-pay{margin-left:auto;padding:2px 9px;border-radius:999px;background:rgba(0,0,0,.25);font-size:12px;font-weight:700}
.th-entry small,.tv-entry small{flex:1 0 100%;color:var(--th-muted)}
.th-entry-error,.tv-entry-error{color:#ffb4a6!important}
.th-actions,#tournaments .tv-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.th-actions button,#tournaments .tv-actions button{min-height:44px;margin:0;padding:0 18px;border-radius:12px}
.th-actions:empty{display:none}
.th-champion{display:grid;gap:8px;justify-items:start;padding:12px;border-radius:12px;background:radial-gradient(100% 120% at 0% 0%,rgba(243,220,156,.22),transparent 60%);border:1px solid var(--th-line)}
.th-champion p{margin:0;font:700 15px/1.2 Georgia,serif;color:var(--th-gold-hi)}
.th-cta{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;padding:14px 16px;border:2px solid var(--th-gold);border-radius:14px;background:linear-gradient(120deg,rgba(216,183,108,.2),rgba(216,183,108,.04))}
.th-cta-copy{display:grid;gap:2px;min-width:0}
.th-cta-copy strong{font:700 17px/1.2 Georgia,serif;color:var(--th-gold-hi)}
.th-cta-copy span,.th-cta-copy small{font-size:13px;color:var(--th-muted)}
.th-cta-copy small:first-of-type{color:#ffe6ad}
.th-cta button{min-height:46px;margin:0;padding:0 18px;border-radius:12px}
.th-pulse{display:block;width:14px;height:14px;border-radius:50%;background:var(--th-gold);color:var(--th-gold)}
.th-empty,#tournaments .tv-empty{display:grid;justify-items:center;gap:6px;margin:0;padding:28px 18px;text-align:center;border:1px dashed rgba(216,183,108,.4);border-radius:16px;background:radial-gradient(80% 100% at 50% 0%,rgba(216,183,108,.1),transparent 70%)}
.th-empty-icon,.tv-empty-icon{display:grid;place-items:center;width:56px;height:56px;border-radius:50%;border:1px solid var(--th-line);background:rgba(216,183,108,.1);color:var(--th-gold-hi);font:700 28px/1 'Segoe UI Symbol','Noto Sans Symbols 2',serif}
.th-empty strong,.tv-empty strong{font:700 18px/1.2 Georgia,serif;color:var(--th-gold-hi)}
.th-empty p,.tv-empty p{margin:0;max-width:440px;font-size:14px;color:var(--th-muted);line-height:1.5}
.th-signin{margin:0 0 16px;color:var(--th-muted)}

/* ---- bracket ---- */
.cup-round-picker{display:none;gap:6px;font-size:12px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--th-muted)}
.th-bracket{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(200px,1fr);gap:18px;overflow-x:auto;padding:4px 2px 8px;min-width:0;scrollbar-color:#d8b76c55 transparent}
.th-bracket .cup-round-card{display:flex;flex-direction:column;min-width:0}
.th-bracket .cup-round-card h4{margin:0 0 10px;font:700 13px/1.2 Georgia,serif;letter-spacing:.12em;text-transform:uppercase;color:var(--th-gold);text-align:center}
.th-bracket ol{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;justify-content:space-around;gap:12px;flex:1}
.th-bracket .cup-match-card{position:relative;display:grid;gap:6px;padding:10px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:rgba(0,0,0,.24)}
.th-bracket .cup-round-card:not(:last-child) .cup-match-card::after{content:"";position:absolute;top:50%;right:-19px;width:18px;border-top:1px solid rgba(216,183,108,.55)}
.th-bracket .cup-match-card[data-mine=true]{border-color:var(--th-gold);background:rgba(216,183,108,.1)}
.th-bracket .cup-match-card[data-status=playing]{border-color:#e0705a}
.th-bracket .cup-match-card[data-status=check_in]{border-color:#7fb6d8}
.th-match-label{display:flex;justify-content:space-between;gap:8px;margin:0;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--th-muted)}
.th-match-state{color:#ffe6ad}
.th-slots{display:grid;gap:4px}
.th-slot{display:flex;align-items:center;gap:7px;min-height:32px;padding:3px 8px 3px 3px;border-radius:8px;background:rgba(255,255,255,.04);min-width:0;font-size:13px}
.th-slot .player-portrait{width:24px;height:24px;flex:none}
.th-slot-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.th-tbd{color:var(--th-muted);font-style:italic}
.th-slot[data-won=true]{background:rgba(216,183,108,.2);font-weight:800;color:var(--th-gold-hi)}
.th-slot[data-lost=true]{opacity:.55}
.th-slot[data-lost=true] .th-slot-name{text-decoration:line-through}
.th-tag{flex:none;padding:0 6px;border-radius:999px;background:#5a1c17;color:#ffd9cf;font-size:10px;font-weight:800;text-transform:uppercase}
.th-match-reason,.th-match-deadline{margin:0;font-size:12px;color:var(--th-muted)}
.th-bracket .cup-match-card button{min-height:38px;margin:0;border-radius:10px;font-size:13px}
#cupsView .th-game{background:rgba(255,255,255,.05)!important;color:var(--th-ink)!important;border:1px solid var(--th-line)!important}

/* ---- Friendly Four section (string rendered) ---- */
#cupsView #tournaments{margin-top:0}
.tv-section-head .tv-medal{width:48px;height:48px;font-size:26px}
.tv-section-head h3{font-size:24px}
#tournaments .tv-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,330px),1fr));gap:16px}
#tournaments .tv-card[data-status=active],#tournaments .tv-card[data-status=finished]{grid-column:1/-1}
#tournaments .tv-entrants{grid-template-columns:repeat(auto-fill,minmax(min(100%,150px),1fr))}
#tournaments .tv-entrants li{border-color:rgba(216,183,108,.25);background:rgba(0,0,0,.22);border-radius:12px}
#tournaments .tv-entrants .tv-open-seat{justify-content:center;border-style:dashed;color:var(--th-muted)}
#tournaments .tv-hint{margin:0;font-size:13px;line-height:1.5;color:var(--th-muted)}
#tournaments .tv-warn{color:#ffe6ad}
#tournaments .tv-out{flex:none;margin-left:8px;padding:0 6px;border-radius:999px;background:#5a1c17;color:#ffd9cf;font-size:10px;font-weight:800;text-transform:uppercase;vertical-align:middle}
#tournaments .tv-standings tr[data-out=true]{opacity:.6}
#tournaments .tv-table-wrap{border-color:rgba(216,183,108,.3);background:rgba(0,0,0,.18)}
#tournaments .tv-standings thead th{background:rgba(216,183,108,.12);color:var(--th-gold-hi)}
#tournaments .tv-round{background:rgba(0,0,0,.22);border-color:rgba(216,183,108,.25);border-radius:12px}
#tournaments h4{font-family:Georgia,serif}
#tournaments .tv-withdraw{justify-content:flex-end}

/* ---- motion (respects the site switch) ---- */
html[data-motion=full] #cupsView .th-card,html[data-motion=full] #tournaments .tv-card,html[data-motion=full] .th-create{animation:th-rise .5s cubic-bezier(.2,.8,.2,1) both}
html[data-motion=full] .th-grid>.th-card:nth-child(2),html[data-motion=full] #tournaments .tv-list>.tv-card:nth-child(2){animation-delay:.06s}
html[data-motion=full] .th-grid>.th-card:nth-child(3),html[data-motion=full] #tournaments .tv-list>.tv-card:nth-child(3){animation-delay:.12s}
html[data-motion=full] .th-card:hover,html[data-motion=full] #tournaments .tv-card:hover,html[data-motion=full] #cupsView .th-format:hover{transform:translateY(-3px);box-shadow:0 20px 44px rgba(0,0,0,.4),0 0 24px rgba(216,183,108,.16)}
html[data-motion=full] .th-medallion{animation:th-glow 3.2s ease-in-out infinite}
html[data-motion=full] .th-pulse{animation:tv-ping 1.6s ease-out infinite}
html[data-motion=full] .th-stat-start .th-countdown,html[data-motion=full] .tv-stat-start .tv-countdown{animation:th-beat 1s ease-in-out infinite}
html:not([data-motion=full]) .tv-dot,html:not([data-motion=full]) .tv-pulse{animation:none}
@keyframes th-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes th-glow{0%,100%{box-shadow:0 0 0 5px rgba(216,183,108,.16),0 8px 20px rgba(0,0,0,.45),0 0 18px rgba(255,214,120,.2)}50%{box-shadow:0 0 0 7px rgba(216,183,108,.22),0 8px 20px rgba(0,0,0,.45),0 0 36px rgba(255,214,120,.45)}}
@keyframes th-beat{0%,100%{opacity:1}50%{opacity:.72}}

/* ---- phones ---- */
@media (max-width:700px){
 #cupsView{gap:16px}
 #cupsView>.card:has(#tournaments),#cupsView>#cups.th-hall{padding:16px!important;border-radius:16px!important}
 .th-hall .th-hero{grid-template-columns:auto minmax(0,1fr);gap:12px}
 .th-balance{grid-column:1/-1;justify-items:start;grid-auto-flow:column;align-items:baseline;justify-content:start;gap:10px}
 .th-medallion{width:52px;height:52px;font-size:28px}
 .th-formats{grid-template-columns:minmax(0,1fr)}
 #cupsView .th-format{min-height:60px}
 .th-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
 .th-create{padding:14px}
 .th-create-foot{flex-direction:column;align-items:stretch}
 #cupsView .th-create-button{width:100%;min-width:0}
 .th-card,#tournaments .tv-card{padding:14px}
 .th-stats,.tv-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .th-cta{grid-template-columns:auto minmax(0,1fr)}
 .th-cta button{grid-column:1/-1;width:100%}
 .cup-round-picker{display:grid}
 .th-bracket{grid-auto-flow:row;grid-auto-columns:auto;overflow:visible}
 .th-bracket .cup-round-card[data-selected=false]{display:none}
 .th-bracket .cup-match-card::after{display:none}
 .th-actions button,#tournaments .tv-actions button{flex:1 1 auto}
}
@media (max-width:380px){.th-fields{grid-template-columns:minmax(0,1fr)}}

/* Field labels sit above their selects (the shared label rule lays them out in a row). */
#cupsView .th-hall .th-field,#cups.th-hall label.th-field{display:grid!important;grid-template-columns:minmax(0,1fr)!important;align-items:start;gap:6px}
#cups.th-hall .th-field>span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Polish after review: Cup size only for cups; a single table or cup uses the full width with its stats in one row;
   roster names stay whole next to the YOU and Host tags. */
.th-field[data-disabled=true]{display:none!important}
.tv-list,.th-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr))!important}
.tv-list>.tv-card,.th-grid>*{container-type:inline-size}
@container (min-width:620px){
 .tv-stats,.th-stats{grid-template-columns:repeat(4,minmax(0,1fr))!important}
 .tv-entrants{grid-template-columns:repeat(4,minmax(0,1fr))!important}
}
.tv-entrants>li{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}
.tv-entrants>li>small{margin-left:auto;color:var(--th-gold-hi,#f0d483);font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.tv-entrants .tv-name{flex:1 1 auto;min-width:0}
.tv-entrants .tv-name>span:not(.tv-you):not(.player-portrait){overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}
#cupsView .th-hall .th-field[data-disabled=true],#cups.th-hall label.th-field[data-disabled=true]{display:none!important}

/* Tournament Hall banner. It is a <header>, so it first undoes the site's generic header rules, then becomes a framed
   emerald banner: glowing crown medallion inside its own space, gold eyebrow with a rule, shimmering title, a crown
   watermark, and the WGC wallet as a gold-edged card. */
html body #cups.th-hall>.th-hero,html body .th-hall>.th-hero{position:relative;overflow:hidden;isolation:isolate;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:24px;margin:0 0 22px!important;padding:26px 30px!important;border:1px solid rgba(215,180,90,.6)!important;border-radius:20px!important;background:radial-gradient(110% 150% at 0% 0%,rgba(215,180,90,.24),rgba(215,180,90,0) 55%),radial-gradient(80% 120% at 100% 100%,rgba(47,210,126,.16),rgba(47,210,126,0) 60%),linear-gradient(135deg,#14403c 0%,#0c2a2b 58%,#081d1f 100%)!important;box-shadow:0 18px 40px rgba(0,0,0,.35),inset 0 1px 0 rgba(255,255,255,.07)!important;color:#efe6cf;min-height:0;height:auto;width:auto;inset:auto}
html body .th-hall>.th-hero::before{content:'\265B';position:absolute;right:220px;bottom:-62px;z-index:-1;color:rgba(215,180,90,.07);font:400 230px/1 'Segoe UI Symbol','Noto Sans Symbols 2',serif;pointer-events:none}
html body .th-hall>.th-hero::after{content:'';position:absolute;left:30px;right:30px;bottom:0;height:2px;background:linear-gradient(90deg,rgba(215,180,90,0),rgba(243,214,138,.85),rgba(215,180,90,0));pointer-events:none}
html body .th-hall>.th-hero .th-medallion{width:78px;height:78px;font-size:40px;box-shadow:0 0 0 6px rgba(215,180,90,.14),0 0 0 7px rgba(215,180,90,.55),0 12px 26px rgba(0,0,0,.5),0 0 34px rgba(255,214,120,.35)}
html body .th-hall>.th-hero .th-eyebrow{display:flex;align-items:center;gap:10px;margin:0 0 4px;color:#e7c672;font:800 11.5px/1 system-ui,sans-serif;letter-spacing:.32em}
html body .th-hall>.th-hero .th-eyebrow::after{content:'';flex:0 0 46px;height:1px;background:linear-gradient(90deg,rgba(231,198,114,.9),rgba(231,198,114,0))}
html body .th-hall>.th-hero h2{margin:2px 0 6px!important;background:linear-gradient(100deg,#d4a94e 0%,#f6dd94 30%,#fff6d8 44%,#f6dd94 58%,#d4a94e 100%);background-size:260% 100%;-webkit-background-clip:text;background-clip:text;color:transparent!important;-webkit-text-fill-color:transparent;font:700 clamp(30px,3.4vw,44px)/1.08 Georgia,'Noto Serif KR',serif!important;filter:drop-shadow(0 2px 8px rgba(0,0,0,.45))}
html[data-motion=full] body .th-hall>.th-hero h2{animation:realm-text-shine 6s linear infinite}
html body .th-hall>.th-hero .th-sub{margin:0;max-width:52ch;color:#cfdcd5;font:500 15px/1.5 system-ui,sans-serif}
html body .th-hall>.th-hero .th-balance{display:grid;justify-items:end;gap:4px;min-width:170px;padding:14px 18px;border:1px solid rgba(215,180,90,.65);border-radius:16px;background:linear-gradient(180deg,rgba(6,22,24,.75),rgba(6,22,24,.55));box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 8px 20px rgba(0,0,0,.3)}
html body .th-hall>.th-hero .th-balance small{color:#e7c672;font:800 10.5px/1 system-ui,sans-serif;letter-spacing:.22em}
html body .th-hall>.th-hero .th-balance strong{display:flex;align-items:baseline;gap:6px;color:#fff1c1;font:700 28px/1.05 Georgia,serif;white-space:nowrap}
html body .th-hall>.th-hero .th-balance strong::before{content:'\25C8';color:#e7c672;font-size:17px}
@media (max-width:760px){
 html body .th-hall>.th-hero{grid-template-columns:auto minmax(0,1fr);gap:14px 16px;padding:20px 18px!important}
 html body .th-hall>.th-hero::before{right:-20px;bottom:-50px;font-size:170px}
 html body .th-hall>.th-hero .th-medallion{width:58px;height:58px;font-size:30px}
 html body .th-hall>.th-hero .th-sub{font-size:14px}
 html body .th-hall>.th-hero .th-balance{grid-column:1/-1;justify-items:start;grid-auto-flow:column;align-items:center;justify-content:space-between;min-width:0;padding:12px 16px}
 html body .th-hall>.th-hero .th-balance strong{font-size:22px}
}
@media (max-width:760px){
 html body .th-hall>.th-hero h2{font-size:clamp(24px,7.4vw,30px)!important;overflow-wrap:normal;word-break:normal;hyphens:none}
 html body .th-hall>.th-hero .th-medallion{width:52px;height:52px;font-size:27px;align-self:start;margin-top:4px}
 html body .th-hall>.th-hero .th-balance small{white-space:nowrap}
}
html body .th-hall>.th-hero .th-sub{max-width:64ch}
@media (max-width:760px){
 html body .th-hall>.th-hero{grid-template-columns:minmax(0,1fr)!important;padding:20px 18px 18px!important}
 html body .th-hall>.th-hero .th-medallion{position:absolute;top:16px;right:16px;width:46px;height:46px;font-size:24px;margin:0;box-shadow:0 0 0 4px rgba(215,180,90,.14),0 0 0 5px rgba(215,180,90,.5),0 8px 18px rgba(0,0,0,.45)}
 html body .th-hall>.th-hero .th-hero-text{padding-right:58px}
 html body .th-hall>.th-hero h2{font-size:clamp(26px,8vw,32px)!important}
 html body .th-hall>.th-hero .th-eyebrow{letter-spacing:.26em}
 html body .th-hall>.th-hero .th-balance{grid-column:1}
}
@media (max-width:380px){
 html body .th-hall>.th-hero h2{font-size:25px!important}
 html body .th-hall>.th-hero .th-hero-text{padding-right:50px}
 html body .th-hall>.th-hero .th-balance{gap:8px;padding:10px 12px}
 html body .th-hall>.th-hero .th-balance small{font-size:9.5px;letter-spacing:.16em}
 html body .th-hall>.th-hero .th-balance strong{font-size:19px}
}
@media (max-width:340px){
 html body .th-hall>.th-hero h2{font-size:22px!important}
 html body .th-hall>.th-hero .th-balance{flex-wrap:wrap}
 html body .th-hall>.th-hero .th-balance strong{font-size:17px}
 html body .th-hall>.th-hero .th-balance small{letter-spacing:.1em}
}
