/* Carrom: a dark teal room, a walnut board, gold for what matters. */
:root {
    --bg: #10282b; --bg2: #17383c; --card: #1a3a3e; --text: #f4ecd8; --dim: #a9c3bf; --line: rgba(244,236,216,.18);
    --gold: #f2b84b; --ink: #12201f; --red: #d6483b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--text); min-height: 100vh;
    background-color: var(--bg);
    background-image:
        repeating-linear-gradient(95deg, rgba(255,255,255,.015) 0 2px, transparent 2px 9px),
        radial-gradient(1000px 520px at 50% -10%, #25535a 0%, transparent 70%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.site-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 18px; min-height: 46px; background: #003a7a; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.site-bar a { text-decoration: none; color: #dbe7fb; font-weight: 700; font-size: 14px; }
.site-bar a:hover { color: #fff; }
.site-bar .brand { font-size: 20px; font-weight: 800; color: #fff; letter-spacing: .2px; white-space: nowrap; }
.site-bar nav { display: flex; gap: 4px 18px; flex-wrap: wrap; justify-content: flex-end; }
.site-bar nav a.on { color: #fff; box-shadow: 0 3px 0 var(--gold); }

.shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 960px) minmax(0, 1fr); gap: 18px; max-width: 1700px; margin: 0 auto; padding: 14px 12px 0; align-items: start; }
.rail { max-width: 300px; width: 100%; justify-self: center; margin-top: 8px; }
.stage { grid-column: 2; min-width: 0; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 12px; background: var(--text); color: var(--ink); font-family: 'Playfair Display', Georgia, serif; font-weight: 800; font-size: 17px; padding: 10px 18px; box-shadow: 0 4px 0 rgba(0,0,0,.5); transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-block; text-align: center; line-height: 1.25; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.5); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.go { background: #7bc67e; width: 100%; font-size: 20px; padding: 12px 16px; }
.btn.sun { background: var(--gold); } .btn.coral { background: #ee8264; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { font-size: 14px; padding: 8px 12px; font-family: 'Nunito', sans-serif; font-weight: 800; }
.btn.small.go { width: auto; font-size: 15px; }
.btn.wa { background: #25d366; color: #05361a; }

/* ---------- the start screen ---------- */
.home { text-align: center; padding: 8px 0 20px; }
.logo { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-weight: 800; font-size: clamp(54px, 11vw, 96px); line-height: 1.05; color: var(--text); text-shadow: 0 5px 0 rgba(0,0,0,.4); }
.logo span { background: linear-gradient(180deg, #fff1cf 0%, var(--gold) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tag { margin: 8px auto 20px; max-width: 580px; color: var(--dim); font-size: 17px; line-height: 1.5; }
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; text-align: left; }
.mode { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 0 rgba(0,0,0,.3); }
.mode h2 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 22px; line-height: 1.15; }
.mode .mtext { margin: 0; color: var(--dim); font-size: 14.5px; line-height: 1.5; }
.mode .btn.go { margin-top: auto; }
.field { display: grid; gap: 6px; }
.lab { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); }
.hint { color: var(--dim); font-size: 13px; line-height: 1.4; min-height: 2.8em; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { border: 2px solid var(--line); background: transparent; border-radius: 10px; padding: 8px 4px; font-weight: 800; font-size: 14px; }
.seg button.on { background: var(--text); color: var(--ink); border-color: var(--text); }
.field input[type="text"] { height: 44px; border: 2px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.28); padding: 0 12px; font-size: 16px; font-weight: 700; }
.field input[type="text"]:focus { border-color: var(--gold); outline: none; }
.err { margin: 14px 0 0; background: #ffe3df; color: #8c2314; border-radius: 10px; padding: 10px 14px; font-weight: 700; }

/* ---------- the game ---------- */
.game { display: grid; justify-items: center; gap: 12px; padding: 4px 0 18px; }
.play { width: 100%; }
.table { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 14px; align-items: start; }
.boardcol { display: grid; gap: 8px; min-width: 0; }
.strip { display: flex; align-items: center; gap: 10px; min-height: 40px; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.strip .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; border: 2px solid #777; }
.strip .dot.w { background: #fff; } .strip .dot.b { background: #1a1a1a; border-color: #aaa; }
.strip .nm { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.strip .left { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; gap: 3px; flex-wrap: wrap; height: 24px; overflow: hidden; justify-content: flex-end; }
.strip .left i { width: 15px; height: 15px; border-radius: 50%; display: block; flex: 0 0 auto; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); }
.strip .left i.w { background: #fbf3df; } .strip .left i.b { background: #2b2622; box-shadow: inset 0 0 0 2px #6b6258; } .strip .left i.q { background: var(--red); box-shadow: inset 0 0 0 2px #7d1c14; margin-left: 4px; }
.strip .left i.off { opacity: .22; }
.strip .cnt { font-weight: 800; font-size: 13px; color: var(--dim); white-space: nowrap; margin-left: 6px; }
.strip.turn { border-color: var(--gold); }
.boardwrap { position: relative; width: 100%; }
.board { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; box-shadow: 0 8px 0 rgba(0,0,0,.4), 0 18px 40px rgba(0,0,0,.45); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; background: #4a2d1a; }
.board.idle { cursor: default; }
.slidebox { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--gold); border-radius: 12px; padding: 8px 14px; }
.slidebox label { font-weight: 800; font-size: 14px; white-space: nowrap; }
.slidebox input[type="range"] { width: 100%; height: 34px; margin: 0; accent-color: var(--gold); touch-action: pan-y; }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88%, 360px); background: rgba(16,40,43,.96); border: 3px solid var(--gold); border-radius: 18px; padding: 16px 18px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.6); z-index: 6; }
.banner h3 { margin: 0 0 4px; font-family: 'Playfair Display', Georgia, serif; font-size: 26px; color: var(--gold); }
.banner p { margin: 4px 0 0; font-weight: 700; color: var(--dim); }
.banner .btn { margin-top: 12px; }

.side { display: grid; gap: 10px; min-width: 0; }
.boardcol > .status { text-align: center; margin-bottom: 2px; }
.status { margin: 0; min-height: 28px; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 20px; line-height: 1.2; }
.tip { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.5; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tip b { color: var(--text); }
.rulebox { margin: 0; padding: 10px 12px 10px 28px; color: var(--dim); font-size: 13.5px; line-height: 1.5; background: var(--card); border: 2px solid var(--line); border-radius: 12px; }
.rulebox li { margin: 3px 0; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }

.wait { width: min(100%, 520px); background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 10px; box-shadow: 0 8px 0 rgba(0,0,0,.3); text-align: center; }
.wait h2 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 24px; }
.invrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.invrow input { height: 40px; border: 2px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.3); padding: 0 10px; font-size: 14px; min-width: 0; }
.invrow2 { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lobsub { margin: 4px 0; color: var(--dim); font-weight: 700; }

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 150; background: #05110f; color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 800; box-shadow: 0 6px 20px rgba(0,0,0,.6); max-width: 90vw; text-align: center; }
.netbar { position: fixed; left: 0; right: 0; top: 0; z-index: 160; background: #b91c1c; color: #fff; text-align: center; padding: 6px; font-weight: 800; font-size: 14px; }

/* ---------- ads and the footer ---------- */
.adbox { background: rgba(255,255,255,.06); border-radius: 12px; padding: 6px 8px 8px; overflow: hidden; min-width: 0; }
.adbox small { display: block; text-align: center; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.adbox ins { min-height: 90px; }
.rail .adbox ins { min-height: 250px; }
.adbottom { width: calc(100% - 24px); max-width: 980px; margin: 18px auto 0; }
.site-foot { background: #08181a; color: #a9c3bf; text-align: center; padding: 22px 16px 26px; font-size: 14px; line-height: 1.6; }
.site-foot p { margin: 4px 0; }
.site-foot a { color: #fff; text-decoration: none; font-weight: 700; }
.site-foot a:hover { text-decoration: underline; }
.site-foot .copy { font-size: 12px; opacity: .7; }

/* ---------- the text under the start screen ---------- */
.about { background: #f3efe4; color: #1f2e2c; margin-top: 30px; padding: 30px 16px 40px; }
body.in-game .about { display: none; }
.abwrap { max-width: 760px; margin: 0 auto; }
.about h2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 26px; margin: 26px 0 10px; }
.about h2:first-child { margin-top: 0; }
.about p, .rules { line-height: 1.65; }
.rules { padding-left: 22px; } .rules li { margin: 6px 0; }
.feat { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.feat li { background: #fff; border: 2px solid #dcd5c2; border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.feat li span { color: #4a5c59; font-size: 14.5px; line-height: 1.5; }
details { border: 2px solid #dcd5c2; background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; color: #4a5c59; }
.note { margin-top: 24px; color: #5f716e; font-size: 14px; }

/* ---------- a tablet and a phone ---------- */
@media (max-width: 1500px) {
    .shell { grid-template-columns: minmax(0, 960px); justify-content: center; }
    .rail { display: none; }
    .stage { grid-column: 1; }
}
@media (max-width: 860px) {
    .table { grid-template-columns: minmax(0, 1fr); }
    .modes { grid-template-columns: minmax(0, 1fr); }
    .hint { min-height: 0; }
}
@media (max-width: 480px) {
    .site-bar { padding: 0 12px; }
    .site-bar nav a:first-child { display: none; }
    .site-bar nav { gap: 4px 12px; flex-wrap: nowrap; } .site-bar nav a { font-size: 13px; } .site-bar .brand { font-size: 17px; }
    .strip { padding: 3px 8px; gap: 6px; }
    .strip .left i { width: 12px; height: 12px; }
    .slidebox { padding: 6px 10px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
}
