/* Ten to Win v2 ("the ladder"). Everything is scoped to .tw / body.tw-page so it can't leak into other pages. */
body.tw-page {
  background:
    radial-gradient(70% 38% at 12% 0%, rgba(110, 160, 255, 0.14), transparent 70%),
    radial-gradient(70% 38% at 88% 0%, rgba(255, 150, 80, 0.12), transparent 70%),
    #060a13;
  background-attachment: fixed;
}
@media (max-width: 640px) { body.tw-page .site-header, body.tw-page .circuit-bar { position: static; } }
.tw-h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.tw {
  --panel: #0e1526; --panel2: #131c33; --line: rgba(255, 255, 255, 0.1);
  --acc: #ff7a2e; --txt: #f3f5fa; --dim: #9aa6bd; --ok: #38c977; --bad: #e5484d;
  max-width: 460px; margin: 0 auto; padding: 6px 0 28px; color: var(--txt);
}
.tw button { font-family: inherit; }
.tw [hidden] { display: none !important; }

.tw-preview { background: rgba(255, 122, 46, .12); border: 1px dashed rgba(255, 122, 46, .6); color: #ffd2b5; border-radius: 8px; padding: 8px 12px; font-size: 12px; line-height: 1.4; margin: 4px 0 10px; }

/* HUD */
.tw-hud { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px 2px 12px; }
.tw-brand { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 30px; line-height: 1; white-space: nowrap; text-align: center; }
.tw-brand small { display: block; font-family: var(--font-body, Inter, sans-serif); font-size: 9.5px; letter-spacing: .22em; font-weight: 700; color: var(--acc); margin-top: 5px; }
.tw-datenav { display: flex; align-items: center; justify-content: center; gap: 12px; }
.tw-datenav button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--txt); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tw-datenav button:disabled { opacity: .3; cursor: not-allowed; }
.tw-datenav button:not(:disabled):hover { border-color: var(--acc); }
.tw-datenav span { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 15px; color: var(--acc); min-width: 110px; text-align: center; }

.tw-h2h { background: rgba(56, 201, 119, .12); border: 1px solid var(--ok); border-radius: 10px; padding: 10px 12px; text-align: center; font-size: 13px; font-weight: 600; margin-bottom: 10px; }

/* Start card */
.tw-start { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 18px 20px; text-align: center; }
.tw-kick { font-size: 10.5px; letter-spacing: .22em; font-weight: 800; color: var(--acc); text-transform: uppercase; }
.tw-bigtitle { font-family: var(--font-display, 'Jersey 15', sans-serif); font-weight: 400; font-size: 32px; line-height: 1.08; margin: 10px 0 12px; text-wrap: balance; }
.tw-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tw-chips span { font-size: 11.5px; font-weight: 700; color: var(--dim); border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 4px 11px; }
.tw-chips span.par { color: var(--acc); border-color: rgba(255, 122, 46, .55); background: rgba(255, 122, 46, .08); }
.tw-rules { list-style: none; margin: 18px 0 18px; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.tw-rules li { font-size: 13px; color: var(--dim); line-height: 1.4; padding-left: 22px; position: relative; }
.tw-rules li::before { content: "⚽"; position: absolute; left: 0; top: 0; font-size: 12px; }
.tw-startbtn { width: 100%; font-size: 16px; padding: 15px; }

/* Buttons */
.tw-btn { font-weight: 800; font-size: 14px; padding: 13px 18px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; }
.tw-btn.primary { background: var(--acc); color: #0a0a0a; }
.tw-btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .3); color: var(--txt); }
.tw-btn.ghost.armed { border-color: var(--bad); color: #f0868a; }
.tw-btn:active { transform: scale(.98); }

/* Game: clock */
.tw-top { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px 6px; }
.tw-time { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 40px; line-height: 1; color: var(--txt); font-variant-numeric: tabular-nums; transition: color .2s; }
.tw-count { font-size: 13px; font-weight: 800; color: var(--acc); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.tw-barwrap { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .09); overflow: hidden; margin-bottom: 14px; }
.tw-barwrap i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--ok); transition: width .35s ease-out; }
.tw-title { font-family: var(--font-display, 'Jersey 15', sans-serif); font-weight: 400; font-size: 24px; line-height: 1.12; margin: 0 0 10px; text-wrap: balance; }
.tw-game > .tw-chips { justify-content: flex-start; margin-bottom: 14px; }

/* Input */
.tw-form { margin: 0; }
.tw-inrow { display: flex; gap: 8px; }
.tw-inrow input { flex: 1; min-width: 0; background: var(--panel); border: 1.5px solid rgba(255, 255, 255, .25); border-radius: 10px; padding: 13px 14px; color: var(--txt); font-size: 16px; outline: none; }
.tw-inrow input:focus { border-color: var(--acc); }
.tw-inrow.shake { animation: twShake .4s; }
.tw-inrow .bk-ac-wrap { flex: 1; min-width: 0; display: block; position: relative; }
.tw-inrow .bk-ac-wrap input { width: 100%; box-sizing: border-box; }
.tw-inrow .bk-ac-list { left: 0; right: 0; z-index: 30; max-height: 252px; }
.tw-inrow .bk-ac-item { font-size: 15px; padding: 10px 10px; }
.tw-add { padding: 13px 20px; }
.tw-flash { min-height: 20px; font-size: 13px; font-weight: 700; text-align: center; opacity: 0; transition: opacity .2s; margin: 7px 0 2px; }
.tw-flash.on { opacity: 1; }
.tw-flash.ok { color: var(--ok); }
.tw-flash.bad { color: #f0868a; }
.tw-flash.warn { color: #ffc27a; }
.tw-wrongs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 12px; font-size: 12px; color: var(--dim); }
.tw-wrongs em { font-style: normal; background: rgba(229, 72, 77, .14); color: #f0868a; border-radius: 999px; padding: 3px 10px; text-decoration: line-through; }

/* Board */
.tw-board { list-style: none; margin: 8px 0 14px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.tw-board .slot { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 13.5px; font-weight: 700; line-height: 1.2; overflow: hidden; }
.tw-board .slot i { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 10.5px; font-weight: 800; color: #6b7690; background: rgba(255, 255, 255, .06); font-variant-numeric: tabular-nums; }
.tw-board .slot span { min-width: 0; overflow-wrap: anywhere; }
.tw-board .slot.empty .bar { display: block; height: 9px; border-radius: 3px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .1) 0 8px, rgba(255, 255, 255, .03) 8px 12px); }
.tw-board .slot.empty { border-style: dashed; border-color: rgba(255, 255, 255, .13); background: transparent; }
.tw-board .slot.got { border-color: rgba(56, 201, 119, .55); background: #0f2219; }
.tw-board .slot.got i { background: var(--ok); color: #06140c; }
.tw-board .slot.got.fresh { animation: twFlip .5s cubic-bezier(.3, 1.3, .5, 1); border-color: var(--ok); box-shadow: 0 0 14px rgba(56, 201, 119, .35); }
.tw-board .slot.miss { border-color: rgba(229, 72, 77, .4); background: #1d0f12; color: #f0a0a3; animation: twIn .4s ease-out both; }
.tw-board .slot.miss i { background: rgba(229, 72, 77, .25); color: #f0868a; }
.tw-board .slot.more { grid-column: 1 / -1; justify-content: center; border: 1px dashed rgba(255, 255, 255, .13); background: transparent; color: var(--dim); font-size: 12px; font-weight: 600; min-height: 34px; }

.tw-finishrow { text-align: center; margin-bottom: 4px; }
.tw-finishrow .tw-btn { font-size: 13px; padding: 11px 20px; }
.tw-game:has(.tw-result:not([hidden])) .tw-finishrow { display: none; }

/* Result */
.tw-result { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 16px; text-align: center; margin-top: 8px; animation: twIn .5s ease-out; }
.tw-result.won { border-color: rgba(56, 201, 119, .6); }
.tw-result.low { border-color: rgba(229, 72, 77, .5); }
.tw-kicker { font-size: 10.5px; letter-spacing: .22em; font-weight: 800; color: var(--dim); }
.tw-result.won .tw-kicker { color: var(--ok); }
.tw-grade { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 34px; margin: 6px 0 2px; line-height: 1.05; text-transform: uppercase; }
.tw-grade .ic { margin-right: 8px; }
.tw-sub { font-size: 13px; color: var(--dim); margin: 0 0 12px; }
.tw-score { font-family: var(--font-display, 'Jersey 15', sans-serif); font-size: 64px; line-height: 1; color: var(--acc); }
.tw-score small { font-size: 18px; color: var(--dim); margin-left: 6px; }
.tw-timeline { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 800; letter-spacing: .02em; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 5px 14px; font-variant-numeric: tabular-nums; }
.tw-emoji { font-size: 20px; letter-spacing: 2px; margin: 12px 0 14px; line-height: 1.35; }
.tw-h2hres { font-weight: 700; font-size: 14px; margin: -2px 0 12px; }
.tw-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-acts .tw-btn { flex: 1 1 120px; padding: 12px 10px; font-size: 13px; }
.tw-chal { margin-top: 8px; width: 100%; }
.tw-nextbox { margin-top: 14px; text-align: center; }
.tw-nextbox .go { display: flex; flex-direction: column; gap: 2px; width: 100%; background: linear-gradient(180deg, #1d2a4a, #15203a); border: 1px solid rgba(255, 122, 46, .55); color: var(--txt); padding: 12px; }
.tw-nextbox .go span { font-size: 10.5px; letter-spacing: .14em; font-weight: 800; color: var(--acc); text-transform: uppercase; }
.tw-nextbox .go b { font-family: var(--font-display, 'Jersey 15', sans-serif); font-weight: 400; font-size: 22px; }
.tw-nextbox small { display: block; margin-top: 6px; color: var(--dim); font-size: 11.5px; }
.tw-done { background: rgba(56, 201, 119, .12); border: 1px solid var(--ok); border-radius: 10px; padding: 12px; font-weight: 700; font-size: 14px; }

.tw .bk-lb { margin-top: 14px; }
.tw-lbnote { margin: -2px 0 8px; font-size: 11.5px; color: var(--dim); }

/* Preview tools */
.tw-tools { margin-top: 18px; padding: 12px; border: 1px dashed rgba(255, 255, 255, .2); border-radius: 10px; font-size: 12px; color: var(--dim); }
.tw-tools p { margin: 0 0 10px; line-height: 1.45; }
.tw-tools label { display: block; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 10.5px; margin-bottom: 4px; }
.tw-tools select { width: 100%; background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; font-size: 13px; margin-bottom: 10px; }
.tw-tools div { display: flex; gap: 8px; flex-wrap: wrap; }
.tw-tools button { background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 12px; cursor: pointer; }

@keyframes twShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes twIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes twFlip { 0% { transform: rotateX(90deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes twPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .tw *, .tw-time { animation: none !important; transition: none !important; } }
@media (max-width: 380px) { .tw-board .slot { font-size: 12.5px; padding: 7px 8px; gap: 7px; } .tw-bigtitle { font-size: 28px; } }

/* Ten to Win additions */
.tw-board .slot { min-height: 46px; }
.tw-board .slot span { display: flex; flex-direction: column; gap: 1px; }
.tw-board .slot .nm { font-weight: 700; }
.tw-board .slot .cl { font-style: normal; font-size: 11px; font-weight: 600; color: var(--dim); }
.tw-board .slot.miss .cl { color: #b9777a; }
.tw-board .slot.empty.clued { border-color: rgba(255, 255, 255, .2); }
.tw-board .slot.empty.clued .nm { color: var(--dim); font-weight: 600; font-size: 13px; }
.tw-board .slot.empty.clued i { color: var(--acc); background: rgba(255, 122, 46, .12); }
.tw-board .slot.empty .bar { align-self: center; }
.tw-hudrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 8px; }
.tw-time { font-size: 34px; }
.tw-lives { display: flex; gap: 5px; align-items: center; }
.tw-lives i { font-style: normal; font-size: 23px; line-height: 1; transition: color .2s, transform .2s; }
.tw-lives i.on { color: #ff4d5e; text-shadow: 0 0 10px rgba(255, 77, 94, .45); }
.tw-lives i.off { color: #2c3550; text-shadow: none; transform: scale(.82); }
.tw-lives.last i.on { animation: twBeat .9s ease-in-out infinite; }
.tw-lives.hit { animation: twShake .4s; }
.tw-emoji .lv { margin-top: 4px; font-size: 16px; letter-spacing: 3px; }
.tw-count { font-size: 14px; }
.tw-title { margin-top: 2px; }
@keyframes twBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (max-width: 380px) { .tw-lives i { font-size: 20px; } }
