/* Tether: deep-green felt, a paper board, and one red thread. */
:root {
  --tt-bg: #17322b; --tt-bg-2: #1f3d35; --tt-text: #f4efe2; --tt-muted: #b9c8bd; --tt-line: #2f5247;
  --tt-paper: #f6efdd; --tt-grid: #ddd0b2; --tt-ink: #1d2622;
  --tt-x: #1c6e8c; --tt-o: #e2621b; --tt-thread: #c0392b; --tt-gold: #f2c14e;
  --suite-ink: #f4efe2; --suite-muted: #b9c8bd; --suite-line: #2f5247; --suite-paper: #1f3d35; --suite-active: #f4efe2; --suite-active-ink: #17322b; --suite-purple: #f2c14e;
}
* { box-sizing: border-box; }
body { margin: 0; background: radial-gradient(120% 70% at 50% -10%, #24493f, var(--tt-bg)); color: var(--tt-text); font-family: Arial, Helvetica, sans-serif; min-height: 100vh; }
button { font: inherit; color: inherit; }
.tt-top { display: flex; align-items: center; gap: 12px; width: min(100% - 32px, 560px); margin: 0 auto; padding: 18px 0 10px; }
.tt-logo img { display: block; width: 132px; height: auto; filter: brightness(0) invert(1); }
.tt-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tt-icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; font-size: 20px; font-weight: 800; cursor: pointer; }
.tt-icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tt-icon-btn[aria-pressed="false"] .wave { opacity: .2; }
.suite-switcher-row.game { width: min(100% - 32px, 560px); margin: 0 auto 6px; }
.tt { width: min(100% - 32px, 560px); margin: 0 auto; padding-bottom: 40px; }
.tt-hero { padding: 10px 0 16px; }
.tt-hero h1 { margin: 0; font-size: clamp(54px, 15vw, 84px); line-height: .9; letter-spacing: -.05em; font-weight: 950; }
.tt-hero h1 span { color: var(--tt-thread); }
.tt-hero p { margin: 10px 0 0; color: var(--tt-muted); font-size: 16px; line-height: 1.4; }
.tt-hero p span { display: block; color: var(--tt-text); font-weight: 700; }

.tt-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--tt-line); border-radius: 16px; background: rgba(0, 0, 0, .15); }
.tt-tab { min-height: 46px; border: 0; border-radius: 12px; background: transparent; color: var(--tt-muted); font-weight: 800; font-size: 15px; cursor: pointer; }
.tt-tab small { color: inherit; opacity: .7; }
.tt-tab[aria-selected="true"] { background: var(--tt-text); color: var(--tt-bg); }
.tt-opponents { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0 0; }
.tt-opponents[hidden] { display: none; }
.tt-bot { display: grid; justify-items: center; gap: 3px; min-height: 44px; padding: 8px 4px; border: 1px solid var(--tt-line); border-radius: 14px; background: var(--tt-bg-2); cursor: pointer; }
.tt-bot img { width: 40px; height: 40px; border-radius: 50%; background: #2b4f45; object-fit: cover; }
.tt-bot b { font-size: 13px; }
.tt-bot small { color: var(--tt-muted); font-size: 11px; }
.tt-bot[aria-checked="true"] { border-color: var(--tt-gold); box-shadow: 0 0 0 1px var(--tt-gold); }
.tt-bot:disabled { opacity: .45; cursor: default; }

.tt-play { margin-top: 14px; }
.tt-players { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 10px; }
.tt-player { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 50px; padding: 6px 10px; border: 1px solid var(--tt-line); border-radius: 14px; background: var(--tt-bg-2); transition: box-shadow .2s, border-color .2s; }
.tt-player.o { justify-content: flex-end; }
.tt-player b { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.tt-player.active.x { border-color: #5fb3d1; box-shadow: 0 0 0 2px rgba(95, 179, 209, .35); }
.tt-player.active.o { border-color: var(--tt-o); box-shadow: 0 0 0 2px rgba(226, 98, 27, .35); }
.tt-player-mark { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; background: var(--tt-paper); }
.tt-player-mark::before { content: ''; display: block; width: 100%; height: 100%; background: no-repeat center/60% url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6l12 12M18 6L6 18' stroke='%231c6e8c' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.tt-player-portrait { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: #2b4f45; object-fit: cover; }
.tt-player-portrait[hidden] { display: none; }
.tt-turn { min-width: 70px; color: var(--tt-muted); font: 800 11px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .06em; text-align: center; text-transform: uppercase; }

/* Board: paper, grid, one thread. */
.tt-board { position: relative; width: 100%; aspect-ratio: 1; padding: 10px; border-radius: 22px; background: var(--tt-paper); box-shadow: 0 10px 0 #0f241e, 0 24px 50px rgba(0, 0, 0, .35); }
.tt-cells { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr); width: 100%; height: 100%; }
.tt-cell { position: relative; display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-right: 1.5px solid var(--tt-grid); border-bottom: 1.5px solid var(--tt-grid); background: transparent; cursor: default; }
.tt-cell:nth-child(6n) { border-right: 0; }
.tt-cell:nth-child(n + 31) { border-bottom: 0; }
.tt-cell svg { width: 62%; height: 62%; fill: none; stroke-linecap: round; stroke-width: 3.2; }
.tt-cell.x svg { stroke: var(--tt-x); }
.tt-cell.o svg { stroke: var(--tt-o); }
.tt-cell.new svg { animation: tt-pop .28s cubic-bezier(.2, .9, .3, 1.4); }
.tt-cell.knot::after { content: ''; width: 34%; height: 34%; border-radius: 50%; background: var(--tt-thread); box-shadow: 0 0 0 5px rgba(192, 57, 43, .18); }
.tt-cell.legal { cursor: pointer; }
.tt-cell.legal::before { content: ''; position: absolute; inset: 22%; border-radius: 50%; background: rgba(242, 193, 78, .28); box-shadow: inset 0 0 0 2px rgba(214, 160, 30, .75); animation: tt-breathe 1.6s ease-in-out infinite; }
.tt-cell.legal:hover::before, .tt-cell.legal:focus-visible::before { background: rgba(242, 193, 78, .55); }
.tt-cell.pen { box-shadow: inset 0 0 0 3px rgba(192, 57, 43, .55); border-radius: 10px; }
.tt-cell.win { background: rgba(242, 193, 78, .35); }
.tt-cell.hint::before { background: rgba(28, 110, 140, .35) !important; box-shadow: inset 0 0 0 3px var(--tt-x) !important; }
.tt-thread, .tt-winline { position: absolute; inset: 10px; z-index: 1; width: calc(100% - 20px); height: calc(100% - 20px); pointer-events: none; }
.tt-winline { z-index: 3; }
#threadLine { fill: none; stroke: var(--tt-thread); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
#threadGlow { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .35; stroke-dasharray: 2 10; }
#winStroke { stroke: var(--tt-gold); stroke-width: 12; stroke-linecap: round; opacity: 0; }
.tt-winline.on #winStroke { opacity: .9; transition: opacity .3s; }
.tt-board.stuck { animation: tt-shake .4s; }
@keyframes tt-pop { from { transform: scale(.2); } }
@keyframes tt-breathe { 50% { transform: scale(.82); } }
@keyframes tt-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.tt-exits { display: flex; justify-content: center; gap: 6px; min-height: 30px; margin-top: 16px; }
.tt-exits span { padding: 6px 12px; border-radius: 999px; background: var(--tt-bg-2); color: var(--tt-muted); font: 800 12.5px/1 Arial, sans-serif; }
.tt-exits span b { color: var(--tt-gold); }
.tt-exits span.danger b { color: #ff7a6b; }
.tt-status { min-height: 44px; margin: 8px 0 0; text-align: center; font-size: 16px; line-height: 1.4; }
.tt-status b { color: var(--tt-gold); }
.tt-swap { display: grid; justify-items: center; gap: 8px; margin: 8px 0 0; padding: 12px; border: 1px dashed var(--tt-gold); border-radius: 14px; text-align: center; color: var(--tt-muted); font-size: 14px; }
.tt-swap[hidden], .tt-end[hidden] { display: none; }
.tt-end { display: flex; justify-content: center; gap: 10px; margin: 8px 0 0; }

.tt-cta { min-height: 52px; padding: 12px 22px; border: 0; border-radius: 16px; background: var(--tt-gold); color: var(--tt-ink); font-size: 17px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 #b88a1d; }
.tt-cta:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a1d; }
.tt-cta.small { min-height: 44px; padding: 8px 18px; font-size: 15px; }
.tt-cta.secondary { background: transparent; color: var(--tt-text); box-shadow: inset 0 0 0 2px var(--tt-line); }
.tt-ghost { min-height: 44px; padding: 8px 16px; border: 1px solid var(--tt-line); border-radius: 14px; background: transparent; font-weight: 800; cursor: pointer; }

.suite-today { margin: 34px 0 0; }
.tt-support { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 0; padding: 14px 16px; border: 1px solid var(--tt-line); border-radius: 16px; color: var(--tt-text); text-decoration: none; }
.tt-support span { display: grid; gap: 3px; }
.tt-support small { color: var(--tt-muted); }
.tt-support b { color: var(--tt-gold); }
.tt-footer { display: flex; justify-content: center; gap: 18px; margin-top: 26px; }
.tt-footer a { color: var(--tt-muted); font-size: 13px; }

.tt-dialog { width: min(100% - 32px, 400px); max-height: calc(100% - 32px); overflow: auto; padding: 0; border: 1px solid var(--tt-line); border-radius: 22px; background: var(--tt-bg-2); color: var(--tt-text); }
.tt-dialog::backdrop { background: rgba(5, 15, 12, .7); backdrop-filter: blur(3px); }
.tt-dialog-body { position: relative; display: grid; justify-items: center; gap: 8px; padding: 28px 22px 22px; text-align: center; }
.tt-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 26px; cursor: pointer; }
.tt-kicker { margin: 0; color: var(--tt-gold); font: 800 12px/1 ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.tt-dialog h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; }
.tt-result-portrait { width: 88px; height: 88px; border-radius: 50%; background: #2b4f45; object-fit: cover; }
.tt-result-portrait[hidden] { display: none; }
.tt-result-line { margin: 0; color: var(--tt-muted); }
.tt-dialog-actions { display: grid; gap: 10px; width: 100%; margin-top: 8px; }
.tt-dialog-actions [hidden] { display: none; }
.tt-toast { min-height: 18px; margin: 0; color: var(--tt-gold); font-size: 13px; font-weight: 700; }
#helpDialog .tt-dialog-actions { position: sticky; bottom: -22px; margin-bottom: -22px; padding: 14px 0 22px; background: linear-gradient(to bottom, transparent, var(--tt-bg-2) 14px); }
.tt-dialog .rc-card { --rc-text: var(--tt-text); --rc-muted: var(--tt-muted); --rc-accent: var(--tt-gold); --rc-on-accent: var(--tt-ink); --rc-line: var(--tt-line); --rc-sq: var(--tt-paper); --rc-hl: #f6dc9a; --rc-x: var(--tt-x); --rc-o: var(--tt-o); }
@media (prefers-reduced-motion: reduce) { .tt-cell.legal::before, .tt-cell.new svg, .tt-board.stuck { animation: none; } }
/* Friends: challenge by link or one device. */
.tt-friends { display: grid; gap: 8px; margin: 12px 0 0; }
.tt-friends[hidden], .tt-share-bar[hidden] { display: none; }
.tt-friend-option { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--tt-line); border-radius: 16px; background: var(--tt-bg-2); text-align: left; cursor: pointer; }
.tt-friend-option.primary { border-color: var(--tt-gold); }
.tt-friend-option small { color: var(--tt-muted); font-size: 13px; }
.tt-challenges { display: grid; gap: 6px; }
.tt-challenges-head { margin: 8px 0 0; color: var(--tt-muted); font: 800 12px/1 Arial, sans-serif; letter-spacing: .06em; text-transform: uppercase; }
.tt-challenge-item { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--tt-line); border-radius: 12px; color: var(--tt-text); text-decoration: none; }
.tt-challenge-item.yours { border-color: var(--tt-gold); }
.tt-challenge-item small { color: var(--tt-muted); }
.tt-share-bar { display: grid; justify-items: center; gap: 10px; margin: 8px 0 0; padding: 12px; border: 1px solid var(--tt-line); border-radius: 16px; text-align: center; font-size: 15px; }
.tt-share-bar b { color: var(--tt-gold); }
.tt-share-actions { display: flex; gap: 8px; }
.tt-share-actions [hidden] { display: none; }
.tt-link { word-break: break-all; color: var(--tt-gold); }

.tt-share-actions button:disabled { opacity: .45; cursor: default; box-shadow: none; transform: none; }
