/* Chess: a walnut room, a board of two woods, gold for what matters. */
:root {
    --bg: #211812; --bg2: #33261b; --card: #2c2018; --text: #f6ead8; --dim: #bda98e; --line: rgba(246,234,216,.18);
    --gold: #e8b84a; --ink: #1d140e; --light: #f0d9b5; --dark: #b58863;
}
* { 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,.018) 0 2px, transparent 2px 9px),
        radial-gradient(1000px 520px at 50% -10%, #4a3524 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: #e8795a; }
.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, #fff3d4 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.wrap { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
.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 { 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: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 .nm small { color: var(--dim); font-weight: 700; }
.strip .cap { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; height: 24px; overflow: hidden; }
.strip .cap i { width: 18px; height: 22px; margin-right: -7px; display: block; }
.strip .cap i svg { width: 100%; height: 100%; }
.strip .cap b { font-size: 12px; margin-left: 12px; color: var(--gold); font-weight: 800; white-space: nowrap; }
.strip .clk { margin-left: auto; font-family: 'Nunito', sans-serif; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; background: rgba(0,0,0,.35); border-radius: 8px; padding: 2px 10px; min-width: 68px; text-align: center; }
.strip .clk.run { background: #f6ead8; color: var(--ink); }
.strip .clk.low { background: #b3261e; color: #fff; }
.strip.turn { border-color: var(--gold); }
.boardwrap { position: relative; width: 100%; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; 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; }
.sq { position: relative; display: block; min-width: 0; min-height: 0; }
.sq.l { background: var(--light); } .sq.d { background: var(--dark); }
.sq.last::before { content: ''; position: absolute; inset: 0; background: rgba(250, 232, 80, .5); }
.sq.sel::before { content: ''; position: absolute; inset: 0; background: rgba(120, 210, 110, .55); }
.sq.chk::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255,60,60,.95) 0%, rgba(255,60,60,.65) 35%, rgba(255,60,60,0) 72%); }
.sq.tg::after { content: ''; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 70, 20, .38); pointer-events: none; }
.sq.tg.cap::after { left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; background: none; box-shadow: inset 0 0 0 5px rgba(20, 70, 20, .42); }
.sq .pc { position: absolute; inset: 4%; z-index: 1; }
.sq .pc svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.sq .co { position: absolute; font-size: clamp(8px, 1.8vw, 12px); font-weight: 800; z-index: 0; pointer-events: none; opacity: .8; line-height: 1; }
.sq.l .co { color: var(--dark); } .sq.d .co { color: var(--light); }
.sq .co.f { right: 3px; bottom: 2px; } .sq .co.r { left: 3px; top: 2px; }
.drag { position: fixed; z-index: 100; pointer-events: none; width: 70px; height: 70px; margin: -35px 0 0 -35px; filter: drop-shadow(0 6px 6px rgba(0,0,0,.4)); }
.drag svg { width: 100%; height: 100%; }
.promo { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: center; gap: 8px; padding: 14px; background: rgba(33,24,18,.95); border-block: 3px solid var(--gold); z-index: 5; }
.promo button { width: 22%; max-width: 84px; aspect-ratio: 1; border: 2px solid var(--line); border-radius: 12px; background: var(--light); padding: 4px; }
.promo button:hover { background: #fff3d4; }
.promo button svg { width: 100%; height: 100%; display: block; }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(88%, 360px); background: rgba(33,24,18,.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; }
.status { margin: 0; min-height: 28px; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 20px; line-height: 1.2; }
.offer { background: rgba(232,184,74,.16); border: 2px solid var(--gold); border-radius: 12px; padding: 8px 10px; font-weight: 800; font-size: 14px; display: grid; gap: 6px; }
.offer .row { display: flex; gap: 8px; }
.moves { background: var(--card); border: 2px solid var(--line); border-radius: 12px; height: 260px; overflow-y: auto; padding: 6px; display: grid; grid-template-columns: 34px 1fr 1fr; align-content: start; gap: 2px 4px; font-weight: 700; font-size: 14px; }
.moves .n { color: var(--dim); padding: 3px 4px; text-align: right; }
.moves .m { padding: 3px 6px; border-radius: 6px; cursor: pointer; }
.moves .m:hover { background: rgba(255,255,255,.08); }
.moves .m.cur { background: var(--gold); color: var(--ink); }
.nav { display: flex; gap: 6px; }
.ib { flex: 1; height: 38px; border: 2px solid var(--line); background: transparent; border-radius: 10px; font-size: 22px; font-weight: 800; line-height: 1; }
.ib:hover { background: rgba(255,255,255,.07); }
.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: #0c0805; 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: #140e0a; color: #bda98e; 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: #f6f0e6; color: #2a1e14; 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 #e6dac6; border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.feat li span { color: #5e4b3a; font-size: 14.5px; line-height: 1.5; }
details { border: 2px solid #e6dac6; background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; color: #5e4b3a; }
.note { margin-top: 24px; color: #7a6652; 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); }
    .moves { height: 130px; }
    .modes { grid-template-columns: minmax(0, 1fr); }
    .hint { min-height: 0; }
    .drag { width: 56px; height: 56px; margin: -28px 0 0 -28px; }
}
@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 .clk { font-size: 17px; min-width: 58px; }
    .strip .cap i { width: 15px; height: 19px; }
}
@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
}
