/* 탁구 대회 화면(app/tt_tournaments_view.py, tt/tournaments/*.js).
 *
 * 색·글꼴·간격·둥근 모서리·그림자는 /design.css 의 토큰을 쓴다 — 다른 탁구 화면(기록·탁구장)과 한 벌로 바뀌게.
 * 여기서 새로 정하는 색은 탁구 소품(공·탁구대·트로피)과 「진행 중」 표시뿐이다.
 *
 * 움직임은 transform·opacity·stroke-dashoffset 만 쓴다(레이아웃을 다시 계산하지 않게). 맨 아래의
 * prefers-reduced-motion 블록이 전부 멈춘다. 누를 수 있는 것은 모두 44px 이상이다.
 */
:root {
  --tto-gold: #f2b23c;
  --tto-silver: #b8bcc6;
  --tto-bronze: #c98552;
  --tto-live: #d6113f;
  --tto-win: var(--accent);
  --tto-link: var(--border-2);
  --tto-ready: #1f7a4d;
  --tto-ready-bg: color-mix(in srgb, #1f7a4d 12%, var(--surface));
  --tto-spring: cubic-bezier(.34, 1.56, .64, 1);
}
[data-theme="dark"] {
  --tto-live: #ff5c7f;
  --tto-ready: #5fd39a;
  --tto-ready-bg: color-mix(in srgb, #5fd39a 14%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) { --tto-live: #ff5c7f; --tto-ready: #5fd39a; }
}

/* display 를 정한 칸도 hidden 이면 숨는다 — 로그인 관문·내 대회 칸이 빈 상자로 남지 않게. */
.ttoGate[hidden], .ttoMine[hidden], .ttoHistory[hidden], .ttoVenueFind[hidden], .ttoVenueText[hidden], .ttoGroupOpts[hidden] { display: none !important; }
.ttoSr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 머리 ─────────────────────────────────────────────────── */
.ttoHero { display: flex; align-items: center; gap: var(--sp-4); margin: 0 0 var(--sp-5); position: relative; }
.ttoHero h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); margin: 0 0 var(--sp-2); overflow-wrap: anywhere; }
.ttoHero .lead { color: var(--dim); font-size: var(--fs-lg); margin: 0; }
.ttoHero .tpPongi { width: 96px; }
.ttoHero .pongi { width: 96px; height: auto; }
.ttoHeroBtns { margin: var(--sp-4) 0 0; }
.ttoTrophy { position: absolute; right: -16px; top: -10px; width: 40px; height: 40px; transform-origin: 50% 100%; animation: ttoWiggle 2.8s ease-in-out infinite; }
.ttoHeroDetail { align-items: flex-start; }
.ttoKicker { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 var(--sp-2); }
.ttoMeta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 var(--sp-3); color: var(--text); font-size: var(--fs-md); }
.ttoAction { margin-top: var(--sp-4); display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; min-height: 44px; }
.ttoAction .btn, .ttoHeroBtns .btn { min-height: 44px; }
.ttoAgree { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); color: var(--dim); max-width: 460px; flex-basis: 100%; }
.ttoAgree input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.ttoMine { border: 1px solid var(--border); background: var(--surface); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); margin: 0 0 var(--sp-5); box-shadow: var(--shadow-xs); }
.ttoMine h2 { font-size: var(--fs-lg); margin: 0 0 var(--sp-2); display: flex; align-items: center; gap: 8px; }
.ttoMine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ttoMine li a { display: flex; gap: 8px; align-items: center; min-height: 44px; text-decoration: none; color: var(--text); border-radius: var(--r-sm); padding: 0 6px; }
.ttoMine li a:hover { background: var(--surface-2); }
.ttoMine .unread::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.ttoBadge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-full); background: var(--accent); color: var(--on-accent, #fff); font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* ── 칩·정원 막대 ─────────────────────────────────────────── */
.ttoChips { display: flex; flex-wrap: wrap; gap: 6px; }
.ttoChip, .ttoStatus, .ttoDday { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-semibold); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.ttoStatus.s-open { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.ttoStatus.s-drawn { background: var(--accent-bg); color: var(--accent-text); border-color: transparent; }
.ttoStatus.s-drawn::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tto-live); margin-right: 6px; animation: ttoPulse 1.6s ease-in-out infinite; }
.ttoStatus.s-finished { background: var(--surface-3); color: var(--text); }
.ttoStatus.s-canceled { background: var(--err-bg); color: var(--err); border-color: transparent; }
.ttoDday { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.ttoDday.off { background: var(--surface-3); color: var(--dim); }
.ttoCap { display: flex; align-items: center; gap: var(--sp-2); max-width: 360px; }
.ttoCapBar { flex: 1; height: 10px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.ttoCapBar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--tp-orange, #ff8a3d)); transform-origin: left; animation: ttoGrow .9s var(--tto-spring) both; }
.ttoCapNum { font-size: var(--fs-sm); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── 목록 ─────────────────────────────────────────────────── */
.ttoTabs { display: flex; gap: 4px; margin: 0 0 var(--sp-3); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.ttoTab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-4); text-decoration: none; color: var(--dim); font-weight: var(--fw-semibold); border-bottom: 3px solid transparent; white-space: nowrap; }
.ttoTab[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.ttoFilter { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-5); }
.ttoFilter input[type="search"] { flex: 1 1 200px; min-width: 0; }
.ttoFilter input, .ttoFilter select, .ttoFilter .btn { min-height: 44px; }
.ttoFilter select { flex: 0 1 200px; min-width: 0; }
.ttoCards { list-style: none; margin: 0 0 var(--sp-6); padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.ttoCard { animation: ttoPop .5s var(--tto-spring) both; animation-delay: calc(var(--i, 0) * 50ms); }
.ttoCard a { display: flex; gap: var(--sp-3); height: 100%; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); transition: transform var(--t-fast) var(--tto-spring), border-color var(--t-fast); }
.ttoCard a:hover { transform: translateY(-3px); border-color: var(--accent); }
.ttoCardBody { display: grid; gap: 6px; min-width: 0; flex: 1; }
.ttoCardName { font-size: var(--fs-lg); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.ttoCardPlace { color: var(--dim); font-size: var(--fs-sm); }
.ttoCal { flex: none; display: grid; justify-items: center; align-content: start; width: 56px; padding: 6px 0 8px; border-radius: var(--r); background: var(--accent-bg); color: var(--accent-text); line-height: 1.1; }
.ttoCal b { font-size: var(--fs-xs); }
.ttoCal i { font-style: normal; font-size: 24px; font-weight: var(--fw-black); }
.ttoCal span { font-size: var(--fs-xs); }
.ttoPager { display: flex; gap: var(--sp-3); justify-content: center; margin: 0 0 var(--sp-6); }
.ttoPager .btn { min-height: 44px; }
.ttoFoot { margin-top: var(--sp-6); }

/* ── 상태 화면(비어 있음·불러오는 중·오류) ────────────────── */
.ttoEmpty { display: grid; justify-items: center; text-align: center; gap: var(--sp-2); padding: var(--sp-7) var(--sp-4); border: 2px dashed var(--border-2); border-radius: var(--r-xl); background: var(--surface); margin: 0 0 var(--sp-6); }
.ttoEmpty.small { padding: var(--sp-5) var(--sp-4); }
.ttoEmpty p { margin: 0; max-width: 460px; }
.ttoEmpty .btn { min-height: 44px; }
.ttoSkel { display: grid; gap: var(--sp-3); }
.ttoSkel i { display: block; height: 18px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: ttoShimmer 1.3s linear infinite; }
.ttoSkel i:nth-child(2) { width: 82%; }
.ttoSkel i:nth-child(3) { width: 64%; }
.ttoError { border: 1px solid var(--err); background: var(--err-bg); color: var(--err); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.ttoGate { border: 1px solid var(--accent); background: var(--accent-bg); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); margin: 0 0 var(--sp-5); display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.ttoGate .btn { min-height: 44px; }

/* ── 바로 가기 ────────────────────────────────────────────── */
.ttoJump { position: sticky; top: calc(var(--topbar-h, 56px) + 4px); z-index: 3; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 6px; margin: 0 0 var(--sp-5); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--r-full); box-shadow: var(--shadow-sm); }
.ttoJump a { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-4); border-radius: var(--r-full); text-decoration: none; color: var(--text); font-weight: var(--fw-semibold); font-size: var(--fs-md); }
.ttoJump a:hover { background: var(--accent-bg); color: var(--accent-text); }
.ttoSection { margin: 0 0 var(--sp-7); scroll-margin-top: calc(var(--topbar-h, 56px) + 72px); }
.ttoSection > h2 { font-size: var(--fs-2xl); margin: 0 0 var(--sp-4); display: flex; align-items: baseline; gap: var(--sp-2); }

/* ── 대진표 SVG ───────────────────────────────────────────── */
.ttoTreeWrap, .ttoDuoWrap { margin: 0 0 var(--sp-4); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-xl); background:
  radial-gradient(circle at 10px 10px, color-mix(in srgb, var(--accent) 7%, transparent) 2.5px, transparent 3px) 0 0 / 24px 24px, var(--surface); box-shadow: var(--shadow-xs); }
.ttoTree, .ttoDuo { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-sans); }
.ttoDuoWrap { display: none; }
.ttoColHead { fill: var(--dim); font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.ttoBox { fill: var(--surface); stroke: var(--border-2); stroke-width: 1.5; }
.ttoDiv { stroke: var(--border); stroke-width: 1; }
.ttoM { transform-box: fill-box; animation: ttoSlide .5s var(--tto-spring) both; animation-delay: calc(var(--c, 0) * 90ms); }
.ttoM.ready .ttoBox { stroke: var(--tto-ready); stroke-width: 2.5; fill: var(--tto-ready-bg); }
.ttoM.bye .ttoBox { fill: var(--surface-2); stroke-dasharray: 5 4; }
.ttoM.done .ttoBox { stroke: var(--border-2); }
.ttoM.just .ttoBox { stroke: var(--accent); stroke-width: 3; }
.ttoName { fill: var(--text); font-size: 17px; font-weight: 600; }
.ttoSeed { fill: var(--dim); font-size: 13px; font-weight: 700; }
.ttoSet { fill: var(--text); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ttoP.win .ttoName, .ttoP.win .ttoSet { fill: var(--accent-text); font-weight: 800; }
.ttoP.lose .ttoName, .ttoP.lose .ttoSet { fill: var(--dim); }
.ttoP.lose .ttoName { text-decoration: line-through; text-decoration-thickness: 1px; }
.ttoP.empty .ttoName { fill: var(--dim); font-style: italic; font-weight: 500; }
.ttoP.guest .ttoName { font-style: italic; }
.ttoLink { fill: none; stroke: var(--tto-link); stroke-width: 2; stroke-linejoin: round; }
.ttoLink.won { stroke: var(--tto-win); stroke-width: 3.5; stroke-dasharray: 100; stroke-dashoffset: 0; animation: ttoDraw 1s ease-out both; animation-delay: calc(var(--c, 0) * 90ms + .3s); }
.ttoChamp rect { fill: var(--surface-2); stroke: var(--border-2); stroke-width: 1.5; stroke-dasharray: 6 5; }
.ttoChamp.on rect { fill: color-mix(in srgb, var(--tto-gold) 22%, var(--surface)); stroke: var(--tto-gold); stroke-width: 3; stroke-dasharray: none; }
.ttoChampHead { fill: var(--dim); font-size: 13px; font-weight: 700; }
.ttoChamp.on .ttoChampHead { fill: var(--text); }
.ttoChampName { fill: var(--text); font-size: 17px; font-weight: 900; }
.ttoChamp.on { animation: ttoBounceIn .8s var(--tto-spring) both .6s; transform-box: fill-box; transform-origin: 50% 50%; }
.ttoLiveTag rect { fill: var(--tto-live); }
.ttoLiveTag text { fill: #fff; font-size: 10px; font-weight: 800; }
.ttoLiveTag { animation: ttoPulse 1.6s ease-in-out infinite; }
.ttoBall { fill: #fffaf2; stroke: #2a2326; stroke-width: 2; pointer-events: none; }

/* 라운드 탭 — 좁은 화면의 주 보기. 넓은 화면에서는 전체 대진 아래에서 경기 목록을 고르는 탭이다. */
.ttoRoundTabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 var(--sp-3); padding: 2px; }
.ttoRoundTab { flex: none; min-height: 44px; min-width: 64px; padding: 0 var(--sp-4); border-radius: var(--r-full); border: 1.5px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-weight: var(--fw-semibold); cursor: pointer; }
.ttoRoundTab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
html.ttoJs .ttoPane:not(.on) { display: none; }
html.ttoJs .ttoPane.on { animation: ttoFadeUp .35s ease both; }
.ttoPaneHead { font-size: var(--fs-lg); margin: var(--sp-3) 0 var(--sp-2); }

@media (max-width: 719px) {
  .ttoTreeWrap { display: none; }
  .ttoDuoWrap { display: block; padding: var(--sp-2); }
  html:not(.ttoJs) .ttoDuoWrap { display: none; }      /* 탭 없이 다 펼쳐질 때는 목록만 — 그림이 겹겹이 쌓이지 않게 */
  .ttoHero { gap: var(--sp-3); }
  .ttoHero h1 { font-size: var(--fs-2xl); }
  .ttoHero .tpPongi, .ttoHero .pongi { width: 68px; }
  .ttoTrophy { right: -10px; top: -8px; width: 30px; height: 30px; }
  .ttoCards { grid-template-columns: 1fr; }
}

/* ── 경기 목록 ────────────────────────────────────────────── */
.ttoList { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.ttoRow { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "a mid b" "act act act"; align-items: center; gap: 4px var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.ttoRow.ready { border-color: var(--tto-ready); box-shadow: inset 4px 0 0 var(--tto-ready); }
.ttoRow.bye { background: var(--surface-2); }
.ttoRow.just { animation: ttoFlash 1.6s ease both; }
.ttoSide { min-width: 0; }
.ttoSide.a { grid-area: a; }
.ttoSide.b { grid-area: b; text-align: right; }
.ttoSide.b .ttoWho { justify-content: flex-end; }
.ttoSide.win { font-weight: var(--fw-bold); }
.ttoSide.win { color: var(--accent-text); }
.ttoWho { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; overflow-wrap: anywhere; }
.ttoWho a { color: inherit; }
.ttoWho.empty { color: var(--dim); font-style: italic; }
.ttoSeedNo { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: var(--fw-bold); }
.ttoGuest { font-size: 11px; padding: 1px 6px; border-radius: var(--r-full); background: var(--warn-bg); color: var(--warn); font-weight: var(--fw-semibold); }
.ttoMid { grid-area: mid; display: grid; justify-items: center; gap: 2px; text-align: center; }
.ttoSets { font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }
.ttoGames { display: flex; gap: 6px; font-size: var(--fs-xs); color: var(--dim); font-variant-numeric: tabular-nums; }
.ttoState { font-size: var(--fs-xs); color: var(--dim); }
.ttoRow.ready .ttoState { color: var(--tto-ready); font-weight: var(--fw-bold); }
.ttoFlag { font-size: var(--fs-xs); color: var(--warn); font-weight: var(--fw-bold); }
.ttoLive { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--tto-live); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; animation: ttoPulse 1.6s ease-in-out infinite; }
.ttoAct { grid-area: act; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ttoAct:empty { display: none; }
.ttoAct .btn { min-height: 44px; }

/* ── 조별 ─────────────────────────────────────────────────── */
.ttoGroups { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ttoGroup { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); padding: var(--sp-4); box-shadow: var(--shadow-xs); animation: ttoPop .5s var(--tto-spring) both; animation-delay: calc(var(--i, 0) * 60ms); min-width: 0; }
.ttoGroup h3 { margin: 0 0 var(--sp-2); font-size: var(--fs-lg); }
.ttoTableWrap { overflow-x: auto; }
.ttoStand { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.ttoStand th, .ttoStand td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.ttoStand thead th { color: var(--dim); font-size: var(--fs-xs); font-weight: var(--fw-semibold); }
.ttoStand tbody th { font-weight: var(--fw-semibold); white-space: normal; overflow-wrap: anywhere; }
.ttoStand tr.adv { background: var(--accent-bg); }
.ttoRank { font-weight: var(--fw-black); width: 2.2em; text-align: center !important; }
.ttoAdv { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: var(--r-full); background: var(--accent); color: var(--on-accent, #fff); }
.ttoTie { margin-left: 6px; font-size: 11px; color: var(--dim); border: 1px dashed var(--border-2); border-radius: var(--r-full); padding: 0 6px; }
.ttoGroupMatches { margin-top: var(--sp-3); }
.ttoGroupMatches summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: var(--fw-semibold); }
.ttoRule { margin-top: var(--sp-3); }
@media (max-width: 480px) {
  .ttoGroups { grid-template-columns: 1fr; }
  .ttoPts, .ttoMp { display: none; }
}

/* ── 참가자 ───────────────────────────────────────────────── */
.ttoPlayers { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.ttoPlayers li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 48px; padding: 6px var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); animation: ttoPop .45s var(--tto-spring) both; animation-delay: calc(var(--i, 0) * 30ms); }
.ttoPlayers a { color: inherit; }
.ttoRating { margin-left: auto; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--accent-text); background: var(--accent-bg); border-radius: var(--r-full); padding: 1px 8px; }

/* ── 결과(시상대) ─────────────────────────────────────────── */
.ttoPodium { display: flex; justify-content: center; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; padding: var(--sp-4) 0 0; }
.ttoStep { display: grid; justify-items: center; gap: 6px; width: 132px; text-align: center; animation: ttoRise .7s var(--tto-spring) both; }
.ttoStep b { overflow-wrap: anywhere; }
.ttoStep .tpPongi { width: 72px; }
.ttoStep.first .tpPongi { width: 104px; }
.ttoStepFace { position: relative; display: inline-block; }
.ttoCrown { position: absolute; left: 50%; top: -18px; font-size: 28px; line-height: 1; transform: translateX(-50%) rotate(-8deg); animation: ttoCrown 2.4s ease-in-out infinite; z-index: 1; }
.ttoStepBlock { display: grid; place-items: center; width: 100%; border-radius: var(--r) var(--r) 0 0; font-weight: var(--fw-black); color: #2a2326; }
.ttoStep.first { order: 2; animation-delay: .25s; }
.ttoStep.second { order: 1; animation-delay: .1s; }
.ttoStep.third { order: 3; animation-delay: .4s; }
.ttoStep.first .ttoStepBlock { height: 96px; background: var(--tto-gold); }
.ttoStep.second .ttoStepBlock { height: 68px; background: var(--tto-silver); }
.ttoStep.third .ttoStepBlock { height: 48px; background: var(--tto-bronze); }

/* ── 안내 ─────────────────────────────────────────────────── */
.ttoDesc { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-4); }
.ttoFacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.ttoFacts div { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-2) var(--sp-3); background: var(--surface); }
.ttoFacts dt { font-size: var(--fs-xs); color: var(--dim); }
.ttoFacts dd { margin: 2px 0 0; font-weight: var(--fw-semibold); }
.ttoLogLink { display: inline-flex; align-items: center; min-height: 44px; }
.ttoHistory ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: var(--fs-sm); }
.ttoHistory li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.ttoBack { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ttoBack .btn { min-height: 44px; }

/* ── 폼 ──────────────────────────────────────────────────── */
.ttoForm { display: grid; gap: var(--sp-4); max-width: 720px; }
.ttoForm fieldset { border: 1px solid var(--border); border-radius: var(--r-xl); padding: var(--sp-4) var(--sp-5); margin: 0; display: grid; gap: var(--sp-3); background: var(--surface); min-width: 0; }
.ttoForm legend { font-weight: var(--fw-bold); padding: 0 6px; font-size: var(--fs-lg); }
.ttoForm label { display: grid; gap: 4px; font-weight: var(--fw-semibold); font-size: var(--fs-md); min-width: 0; }
.ttoForm small { font-weight: var(--fw-regular); color: var(--dim); font-size: var(--fs-xs); }
.ttoForm input:not([type="radio"]):not([type="checkbox"]), .ttoForm select, .ttoForm textarea { min-height: 44px; width: 100%; min-width: 0; box-sizing: border-box; font: inherit; }
.ttoRow2 { display: grid; gap: var(--sp-3); grid-template-columns: 1fr 1fr; }
.ttoPicks { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.ttoPick { position: relative; display: block !important; }
.ttoPick input, .ttoSeg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ttoPick span { display: grid; gap: 4px; height: 100%; box-sizing: border-box; padding: var(--sp-3); border: 2px solid var(--border-2); border-radius: var(--r-lg); cursor: pointer; transition: transform var(--t-fast) var(--tto-spring), border-color var(--t-fast); }
.ttoPick input:checked + span { border-color: var(--accent); background: var(--accent-bg); transform: translateY(-2px); }
.ttoSegs { display: flex; flex-wrap: wrap; gap: 6px; }
.ttoSeg { display: inline-flex !important; }
.ttoSeg span { display: grid; place-items: center; text-align: center; min-height: 44px; padding: 4px var(--sp-4); border: 2px solid var(--border-2); border-radius: var(--r-full); cursor: pointer; font-weight: var(--fw-semibold); }
.ttoSeg span small { display: block; }
.ttoSeg input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
.ttoSeg input:checked + span small { color: inherit; opacity: .9; }
.ttoCheck { display: flex !important; flex-wrap: wrap; align-items: flex-start; gap: 8px !important; font-weight: var(--fw-medium) !important; }
.ttoCheck input { width: 22px; height: 22px; accent-color: var(--accent); margin: 1px 0 0; flex: none; }
.ttoCheck small { flex-basis: 100%; padding-left: 30px; }
.ttoFormMsg { margin: 0; color: var(--err); font-weight: var(--fw-semibold); min-height: 1.4em; }
.ttoFormMsg.ok { color: var(--ok); }
@media (max-width: 520px) {
  .ttoRow2 { grid-template-columns: 1fr; }
  .ttoForm fieldset { padding: var(--sp-3) var(--sp-4); }
}

/* ── 점수 넣기 대화상자 ──────────────────────────────────── */
.ttoScore { display: grid; gap: var(--sp-3); }
.ttoScoreHead { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-2); align-items: center; font-weight: var(--fw-bold); }
.ttoScoreHead span:last-child { text-align: right; }
.ttoGameRow { display: grid; grid-template-columns: 4.5em 1fr auto 1fr; gap: var(--sp-2); align-items: center; }
.ttoGameRow input { min-height: 48px; text-align: center; font-size: var(--fs-xl); font-variant-numeric: tabular-nums; width: 100%; box-sizing: border-box; }
.ttoGameRow label { font-size: var(--fs-sm); color: var(--dim); }
.ttoTally { text-align: center; font-size: var(--fs-2xl); font-weight: var(--fw-black); font-variant-numeric: tabular-nums; }
.ttoQuick { display: grid; gap: 4px; }
.ttoQuick input { min-height: 44px; }
.ttoGameRow input::-webkit-outer-spin-button, .ttoGameRow input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ttoGameRow input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.ttoScore details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.ttoWoRow { display: flex; flex-wrap: wrap; gap: 6px; }
.ttoWoRow .btn, .ttoScore .btn { min-height: 44px; }

/* ── 운영 화면 ───────────────────────────────────────────── */
.ttoManage { display: grid; gap: var(--sp-5); }
.ttoPanel { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); padding: var(--sp-4) var(--sp-5); box-shadow: var(--shadow-xs); min-width: 0; }
.ttoPanel h2 { font-size: var(--fs-xl); margin: 0 0 var(--sp-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ttoPanel .btn { min-height: 44px; }
.ttoPeople { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ttoPeople li { display: flex; flex-wrap: wrap; gap: 6px var(--sp-2); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ttoPeople li > b { flex: 1 1 140px; overflow-wrap: anywhere; }
.ttoInline { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.ttoInline label { display: grid; gap: 4px; font-weight: var(--fw-semibold); font-size: var(--fs-md); flex: 1 1 160px; }
.ttoInline input { min-height: 44px; }
.ttoCopy { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.ttoCopy input { flex: 1 1 240px; min-height: 44px; font-family: var(--font-mono); font-size: var(--fs-sm); }
.ttoDanger { border-color: var(--err); }

/* ── 포커스 ───────────────────────────────────────────────── */
.ttoCard a:focus-visible, .ttoTab:focus-visible, .ttoJump a:focus-visible, .ttoRoundTab:focus-visible,
.ttoPick input:focus-visible + span, .ttoSeg input:focus-visible + span, .ttoMine a:focus-visible,
.ttoGroupMatches summary:focus-visible, .ttoLogLink:focus-visible, .ttoLive:focus-visible {
  outline: 3px solid var(--focus, var(--accent)); outline-offset: 2px;
}
.ttoLiveTag:focus-visible rect { stroke: var(--focus, var(--accent)); stroke-width: 3; }

/* ── 움직임 ───────────────────────────────────────────────── */
@keyframes ttoPop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes ttoSlide { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; } }
@keyframes ttoDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes ttoGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ttoPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes ttoWiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
@keyframes ttoBounceIn { 0% { opacity: 0; transform: scale(.4); } 70% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes ttoRise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes ttoFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes ttoShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes ttoCrown { 0%, 100% { transform: translateX(-50%) rotate(-8deg) translateY(0); } 50% { transform: translateX(-50%) rotate(6deg) translateY(-6px); } }
@keyframes ttoFlash { 0% { background: var(--accent-bg); } 100% { background: var(--surface); } }

@media (prefers-reduced-motion: reduce) {
  .ttoCard, .ttoGroup, .ttoPlayers li, .ttoStep, .ttoM, .ttoChamp.on, html.ttoJs .ttoPane.on, .ttoRow.just { animation: none !important; }
  .ttoLink.won { animation: none !important; stroke-dashoffset: 0; }
  .ttoCapBar i, .ttoTrophy, .ttoCrown, .ttoLive, .ttoLiveTag, .ttoStatus.s-drawn::before { animation: none !important; }
  .ttoSkel i { animation: none; }
  .ttoCard a, .ttoPick span { transition: none; }
  .ttoCard a:hover, .ttoPick input:checked + span { transform: none; }
}
