/* The offline table's screens around the 3D canvas (offline play, phase 0). The game's own colours. */
.t3d { position: fixed; inset: 0; overflow: hidden; background: #0a0705; color: #f4e9c8; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.t3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.t3d button { font: inherit; color: inherit; cursor: pointer; }

/* The lobby, age check, new game, settings and rules: plain pages */
.t3d-page { position: absolute; inset: 0; overflow-y: auto; box-sizing: border-box; max-width: 460px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 24px); display: flex; flex-direction: column; gap: 12px; }
.t3d-brand { color: #c9a227; font-weight: 800; letter-spacing: .5px; }
.t3d-page h1 { margin: 0; font-size: 28px; }
.t3d-page h2 { margin: 10px 0 0; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: #9a9a9a; font-weight: 600; }
.t3d-note { margin: 0; font-size: 14px; line-height: 1.4; color: #cfc6ad; }
.t3d-levels { display: flex; flex-direction: column; gap: 8px; }
.t3d-levels button { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 14px; min-height: 56px; border-radius: 14px; background: #1a1a1a; border: 1px solid #2f2f2f; }
.t3d-levels button span { font-size: 13px; color: #b8b09a; }
.t3d-seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.t3d-seats button { min-height: 48px; border-radius: 10px; background: #151515; border: 1px solid #3a3a3a; font-size: 16px; }
.t3d-levels button.on, .t3d-seats button.on { background: #1f1a0a; border: 2px solid #c9a227; color: #f0d060; }
.t3d-levels button.on strong { color: #f0d060; }
.t3d-rules { margin: 4px 0 0; font-size: 13px; color: #9a9a9a; }
.t3d-go { min-height: 56px; padding: 0 28px; border-radius: 14px; border: 0; background: linear-gradient(180deg, #f0d060, #c9a227 60%, #9a7a18); color: #1a1205 !important; font-size: 18px !important; font-weight: 800; box-shadow: 0 4px 0 #6b4f12, 0 10px 20px rgba(0,0,0,.6); }
.t3d-last { margin-top: auto; }
.t3d-head { display: flex; align-items: center; gap: 10px; }
.t3d-head h1 { flex-grow: 1; font-size: 24px; }
.t3d-head .t3d-brand { flex-grow: 1; font-size: 20px; font-weight: 900; }
.t3d-pill { font-size: 12px; padding: 6px 10px; border-radius: 999px; background: #2a1f08; border: 1px solid #6b4f12; color: #ffb347; white-space: nowrap; }
.t3d-back { width: 44px; height: 44px; border-radius: 10px; border: 1px solid #2f2f2f; background: transparent; font-size: 26px; line-height: 1; }
.t3d-notice { padding: 10px 12px; border-radius: 12px; background: #2a1f08; border: 1px solid #6b4f12; font-size: 13px; line-height: 1.4; }
.t3d-small { margin: 0; font-size: 12px; line-height: 1.4; color: #9a9a9a; }
.t3d-counts { text-align: center; }
.t3d-saved { border-radius: 16px; overflow: hidden; border: 2px solid #c9a227; background: #17130a; }
.t3d-felt { height: 64px; background: radial-gradient(ellipse 70% 120% at 50% 0%, #1d8a63, #0d4a36 70%, #083424); border-bottom: 6px solid #5a3518; }
.t3d-saved-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: #e6dcc0; }
.t3d-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.t3d-row strong { font-size: 16px; color: #f0d060; }
.t3d-row span { font-size: 12px; color: #9a9a9a; }
.t3d-second { min-height: 52px; border-radius: 12px; border: 1px solid #c9a227; background: #1f1a0a; color: #f0d060 !important; font-size: 16px; font-weight: 700; }
.t3d-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.t3d-pair button { display: flex; align-items: center; gap: 8px; padding: 10px; min-height: 52px; border-radius: 12px; border: 1px solid #2f2f2f; background: #1a1a1a; font-size: 14px; text-align: left; }
.t3d-pair img { width: 32px; height: 32px; }
.t3d-locked { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.t3d-locked div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 10px; background: #121212; color: #8a8a8a; font-size: 11px; text-align: center; }
.t3d-locked img { width: 34px; height: 34px; filter: grayscale(1); opacity: .6; }
.t3d-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.t3d-foot p { margin: 0; font-size: 12px; line-height: 1.4; color: #9a9a9a; text-align: center; }
.t3d-centre { justify-content: center; }
.t3d-card { background: #1a1a1a; border: 1px solid #3a2f0e; border-radius: 18px; padding: 26px 20px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.t3d-18 { align-self: center; width: 64px; height: 64px; border-radius: 50%; border: 2px solid #c9a227; color: #f0d060; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; }
.t3d-seats.two { grid-template-columns: repeat(2, 1fr); }
.t3d-rules-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.45; color: #e6dcc0; }
.t3d-link { min-height: 44px; background: none; border: 0; color: #f0d060 !important; font-size: 15px; }

/* Table: thin readouts over the scene */
.t3d-top { position: absolute; left: 14px; right: 14px; top: calc(env(safe-area-inset-top) + 12px); display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.t3d-where { display: flex; flex-direction: column; }
.t3d-where strong { font-size: 14px; color: #e6dcc0; }
.t3d-where span { font-size: 11px; color: #a39880; }
.t3d-me { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.5); border: 1px solid rgba(201,162,39,.45); color: #f0d060; }
.t3d-me b { margin-left: 4px; font-size: 15px; }
.t3d-perf[data-speed="good"] { color: #6ee787; border-left: 4px solid #6ee787; }
.t3d-perf[data-speed="ok"] { color: #ffb347; border-left: 4px solid #ffb347; }
.t3d-perf[data-speed="slow"] { color: #ff6b6b; border-left: 4px solid #ff6b6b; }
.t3d-perf { position: absolute; left: 14px; top: calc(env(safe-area-inset-top) + 52px); font: 600 12px/1.3 ui-monospace, Consolas, monospace; color: #cfc6ad; background: rgba(0,0,0,.55); padding: 3px 6px; border-radius: 6px; pointer-events: none; }
.t3d-opp { position: absolute; display: flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.1); color: #d8cfb6; pointer-events: none; transition: border-color .25s, color .25s; }
.t3d-opp b { color: #f0d060; }
.t3d-opp.on { border-color: #f0d060; color: #fff6cc; }
.t3d-opp.top { top: calc(env(safe-area-inset-top) + 58px); left: 50%; transform: translateX(-50%); }
.t3d-opp.left { left: 8px; top: 30%; }
.t3d-opp.right { right: 8px; top: 30%; }
.t3d-opp q { position: absolute; top: calc(100% + 6px); min-width: 150px; max-width: 220px; padding: 7px 10px; border-radius: 12px; background: #f4e9c8; color: #1a1a1a; font-size: 13px; line-height: 1.3; quotes: none; }
.t3d-opp.left q { left: 0; } .t3d-opp.right q { right: 0; } .t3d-opp.top q { left: 50%; transform: translateX(-50%); }

.t3d-bottom { position: absolute; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.t3d-status { min-height: 20px; font-size: 14px; color: #a39880; text-align: center; text-shadow: 0 1px 3px #000; }
.t3d-status.mine { color: #f0d060; font-weight: 700; }
.t3d-actions { display: flex; align-items: center; gap: 16px; pointer-events: auto; }
.t3d-round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); background: rgba(0,0,0,.45); font-size: 12px; color: #d8cfb6; }
.t3d-round[aria-pressed="true"] { border-color: #9fe6b0; color: #9fe6b0; }
.t3d-knock { min-width: 120px; min-height: 44px; border-radius: 999px; border: 1px solid #c9a227; background: #1f1a0a; color: #f0d060 !important; font-weight: 700; }
.t3d-knock:disabled { border-color: rgba(255,255,255,.1); background: rgba(0,0,0,.35); color: #6a6a6a !important; cursor: default; }

/* Notices over the table: back online, welcome back, could not save */
.t3d-online, .t3d-welcome { position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 96px); z-index: 3; padding: 10px 12px; border-radius: 12px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }
.t3d-online { display: flex; align-items: center; gap: 8px; background: #0f6b4f; color: #f4f9f4; }
.t3d-online span { flex-grow: 1; }
.t3d-online-go { min-height: 36px; background: none; border: 0; color: #fff !important; font-weight: 700; text-decoration: underline; }
.t3d-online-x { width: 36px; height: 36px; background: none; border: 0; color: #fff !important; }
.t3d-welcome { background: rgba(10,7,5,.92); border: 1px solid #c9a227; color: #f0d060; font-weight: 600; pointer-events: none; }
.t3d-welcome.warn { border-color: #ffb347; color: #ffb347; font-weight: 400; }

/* The flat table: for a phone that cannot draw the 3D one */
.t3d-flat-wrap { position: absolute; inset: 0; box-sizing: border-box; padding: calc(env(safe-area-inset-top) + 64px) 12px calc(env(safe-area-inset-bottom) + 120px); display: flex; flex-direction: column; gap: 8px; }
.t3d-flat { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.t3d-flat-seats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.t3d-flat-seats > div { display: flex; flex-direction: column; gap: 4px; padding: 7px 8px; border-radius: 10px; background: #151515; border: 1px solid #262626; font-size: 12px; min-width: 0; }
.t3d-flat-seats > div.on { border-color: #f0d060; }
.t3d-flat-seats b { color: #f0d060; }
.t3d-flat-backs { display: flex; gap: 2px; }
.t3d-flat-backs i { width: 8px; height: 15px; border-radius: 2px; background: #efe7d2; border: 1px solid #b9b09a; }
.t3d-flat-felt { position: relative; flex: 1; min-height: 0; max-width: 100%; align-self: center; border-radius: 16px; border: 6px solid #5a3518; background: radial-gradient(ellipse at 50% 40%, #13694c, #0d4a36 70%, #083424); overflow: hidden; }
.t3d-bone { position: absolute; display: flex; box-sizing: border-box; padding: 0; background: #f6f1e4; border: 1px solid #b9b09a; border-radius: 12%/24%; }
.t3d-bone.v { flex-direction: column; border-radius: 24%/12%; }
.t3d-bone.last { border-color: #f0d060; box-shadow: 0 0 0 2px rgba(240,208,96,.6); }
.t3d-half { flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 2px; box-sizing: border-box; }
.t3d-bone.h .t3d-half + .t3d-half { border-left: 1px solid #c9bfa3; }
.t3d-bone.v .t3d-half + .t3d-half { border-top: 1px solid #c9bfa3; }
.t3d-half i { place-self: center; width: 56%; aspect-ratio: 1; border-radius: 50%; }
.t3d-half i.p1 { background: #d62828; } .t3d-half i.p2 { background: #2a9d3f; } .t3d-half i.p3 { background: #1f6fd1; }
.t3d-half i.p4 { background: #f77f00; } .t3d-half i.p5 { background: #7b2cbf; } .t3d-half i.p6 { background: #0f8b8d; }
.t3d-flat-end { position: absolute; border-radius: 50%; border: 3px solid #f0d060; background: rgba(240,208,96,.3); box-shadow: 0 0 14px rgba(240,208,96,.7); padding: 0; }
.t3d-flat-hand { display: flex; justify-content: center; gap: 6px; min-height: 96px; align-items: flex-end; }
.t3d-bone.big { position: static; width: 44px; height: 88px; border-width: 2px; border-radius: 7px; }
.t3d-bone.big.can { border-color: #f0d060; transform: translateY(-6px); }
.t3d-bone.big.dim { opacity: .5; }
.t3d-bone.big.picked { border-color: #19a37a; box-shadow: 0 0 0 3px rgba(25,163,122,.5); transform: translateY(-14px); }
.t3d-flat-said { padding: 7px 10px; border-radius: 12px; background: #f4e9c8; color: #1a1a1a; font-size: 13px; }

/* A hand or the table is won */
.t3d-moment { position: absolute; left: 0; right: 0; top: 24%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 20px; text-align: center; animation: t3d-in .45s ease-out; }
.t3d-big { font-size: clamp(44px, 14vw, 84px); line-height: 1; font-weight: 900; letter-spacing: 2px; color: #ffe08a; text-shadow: 0 1px 0 #d9a92a, 0 2px 0 #c8961e, 0 3px 0 #b38216, 0 4px 0 #9a6e10, 0 5px 0 #7d5808, 0 10px 18px rgba(0,0,0,.8), 0 0 40px rgba(255,214,110,.55); }
.t3d-moment p { margin: 0; font-size: 15px; color: #f4e9c8; text-shadow: 0 1px 4px #000; }
.t3d-tally { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; padding: 8px 14px; border-radius: 14px; background: rgba(0,0,0,.62); font-size: 13px; color: #cfc6ad; }
.t3d-tally b { color: #f0d060; margin-left: 3px; }
.t3d-tally .me { color: #fff6cc; font-weight: 700; }
.t3d-stats { font-size: 12px !important; color: #9fe6b0 !important; }
@keyframes t3d-in { from { opacity: 0; transform: scale(.86); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .t3d-moment { animation: none; } }

/* White pages (owner 2026-11-26): the lobby, age check, new game, settings and rules use the live game's white look.
   The table (3D or flat) keeps the dark room, as it does online. */
html:has(.t3d.light), html:has(.t3d.light) body { background: #fff; }
.t3d.light { background: #fff; color: #142d25; }
.t3d.light .t3d-brand { color: #0e4a32; }
.t3d.light .t3d-page h2, .t3d.light .t3d-rules, .t3d.light .t3d-small, .t3d.light .t3d-row span, .t3d.light .t3d-foot p { color: #5b6a62; }
.t3d.light .t3d-note, .t3d.light .t3d-levels button span { color: #44554c; }
.t3d.light .t3d-levels button, .t3d.light .t3d-seats button, .t3d.light .t3d-pair button { background: #fff; border-color: #d2d8cd; color: #142d25; }
.t3d.light .t3d-levels button.on, .t3d.light .t3d-seats button.on { background: #e7eee1; border: 2px solid #1f6b4e; color: #0e4a32; }
.t3d.light .t3d-levels button.on strong { color: #0e4a32; }
.t3d.light .t3d-pill { background: #fbf0dc; border-color: #d9a25a; color: #8a4b00; }
.t3d.light .t3d-back { border-color: #d2d8cd; color: #142d25; }
.t3d.light .t3d-notice { background: #fbf6e6; border-color: #d9a25a; color: #142d25; }
.t3d.light .t3d-saved { background: #fff; border-color: #1f6b4e; }
.t3d.light .t3d-saved-body { color: #142d25; }
.t3d.light .t3d-row strong { color: #142d25; }
.t3d.light .t3d-second { background: #fff; border-color: #1f6b4e; color: #0e4a32 !important; }
.t3d.light .t3d-locked div { background: #f1f4ec; color: #5b6a62; }
.t3d.light .t3d-card { background: #fff; border-color: #d2d8cd; box-shadow: 0 6px 24px rgba(20,45,37,.08); }
.t3d.light .t3d-18 { border-color: #c23a3a; color: #c23a3a; }
.t3d.light .t3d-rules-list { color: #142d25; }
.t3d.light .t3d-link { color: #0e4a32 !important; text-decoration: underline; }
.t3d.light .t3d-go { box-shadow: 0 4px 0 #6b4f12, 0 8px 16px rgba(20,45,37,.18); }

/* The 3D table is slow on this phone: offer the flat one (over the table, so it keeps the table's dark look) */
.t3d-slow { position: absolute; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 96px); z-index: 4; padding: 14px; border-radius: 14px; background: rgba(10,7,5,.95); border: 1px solid #ffb347; box-shadow: 0 8px 24px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.4; }
.t3d-slow p { margin: 0; }
.t3d-slow strong { color: #ffb347; }
.t3d-slow > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.t3d-slow .t3d-go { min-height: 48px; padding: 0 10px; font-size: 15px !important; }
.t3d-slow .t3d-second { min-height: 48px; font-size: 15px; }
/* On the flat table the notices sit over the top of the felt, below the opponents' row, not on it. */
.t3d.flat .t3d-online, .t3d.flat .t3d-welcome { top: calc(env(safe-area-inset-top) + 156px); }
