/* Ludo: a plum-dark room with a bright board. The four colours of the pieces are the only loud thing. */
:root {
    --bg: #2a1236; --bg2: #3a1a4a; --card: #381a47; --text: #fff4e6; --dim: #c9b4d6; --line: rgba(255,244,230,.2);
    --red: #e63946; --green: #2fb344; --yellow: #ffc400; --blue: #2f7de1; --saffron: #ffb020; --ink: #2a1236;
}
* { 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:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='%23ffffff' stroke-opacity='.06' stroke-width='2'%3E%3Ccircle cx='60' cy='60' r='34'/%3E%3Ccircle cx='60' cy='60' r='20'/%3E%3Cpath d='M60 6 v108 M6 60 h108 M22 22 l76 76 M98 22 l-76 76'/%3E%3C/svg%3E"),
        radial-gradient(1000px 560px at 50% -10%, #5a2670 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(--saffron); 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(--saffron); }

.shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 760px) minmax(0, 1fr); gap: 18px; max-width: 1420px; 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: 'Baloo 2', 'Nunito', sans-serif; font-weight: 700; font-size: 19px; padding: 8px 20px; box-shadow: 0 4px 0 rgba(0,0,0,.4); transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-block; text-align: center; line-height: 1.3; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.4); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.go { background: #43d17d; width: 100%; font-size: 22px; padding: 9px 16px; }
.btn.sun { background: var(--saffron); } .btn.coral { background: #ff6b6b; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.small { font-size: 16px; padding: 7px 14px; }
.btn.wa { background: #25d366; color: #05361a; }
.btn.icon { font-size: 16px; }

/* ---------- the start screen ---------- */
.home { text-align: center; padding: 8px 0 20px; }
.logo { display: flex; align-items: center; justify-content: center; gap: 12px; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(54px, 11vw, 92px); line-height: 1; text-shadow: 0 5px 0 rgba(0,0,0,.3); }
.logo i { width: .34em; height: .34em; border-radius: 50%; background: var(--c); box-shadow: inset 0 -.06em 0 rgba(0,0,0,.25), 0 0 0 .04em #fff; display: inline-block; }
.logo i:nth-of-type(odd) { transform: translateY(-.08em); } .logo i:nth-of-type(even) { transform: translateY(.1em); }
.tag { margin: 8px auto 20px; max-width: 540px; 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,.25); }
.mode h2 { margin: 0; font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 24px; line-height: 1.1; }
.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); }
.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: 15px; }
.seg button.on { background: var(--text); color: var(--ink); border-color: var(--text); }
.cols { display: flex; gap: 10px; }
.cols button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; background: var(--c); box-shadow: inset 0 -4px 0 rgba(0,0,0,.25); padding: 0; }
.cols button.on { border-color: #fff; box-shadow: 0 0 0 3px var(--c), inset 0 -4px 0 rgba(0,0,0,.25); }
.field input { height: 44px; border: 2px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.2); padding: 0 12px; font-size: 16px; font-weight: 700; }
.field input:focus { border-color: var(--saffron); 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; }
.chips { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; width: min(100%, 620px); }
.chip { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 6px 8px; display: grid; gap: 1px; text-align: center; border-top: 5px solid var(--c); transition: background .2s, border-color .2s; min-width: 0; }
.chip .nm { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .sub { font-size: 12px; color: var(--dim); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.turn { background: #5a2a70; border-color: var(--text); border-top-color: var(--c); }
.chip.away { opacity: .6; }
.chip .pips { display: flex; gap: 3px; justify-content: center; margin-top: 2px; }
.chip .pips i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.18); }
.chip .pips i.on { background: var(--c); box-shadow: 0 0 0 1px #fff; }

.play { display: grid; justify-items: center; gap: 12px; width: 100%; }
.boardwrap { position: relative; width: min(100%, 620px); }
.board { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 8px 0 rgba(0,0,0,.3), 0 18px 40px rgba(0,0,0,.4); background: #fffdf8; }
.tok { cursor: default; transition: transform .14s linear; }
.tok .body { stroke: #fff; stroke-width: .07; }
.tok .shine { fill: rgba(255,255,255,.5); }
.tok .ring { display: none; fill: none; stroke: #fff; stroke-width: .09; }
.tok.can { cursor: pointer; }
.tok.can .ring { display: block; animation: ring .8s ease-in-out infinite alternate; }
.tok.can .body { stroke: #1b1b1b; stroke-width: .09; }
@keyframes ring { from { r: .42; opacity: 1; } to { r: .56; opacity: .35; } }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(42,18,54,.94); border: 3px solid var(--saffron); border-radius: 18px; padding: 14px 26px; text-align: center; font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: clamp(26px, 6vw, 40px); line-height: 1.1; box-shadow: 0 10px 30px rgba(0,0,0,.5); white-space: nowrap; }
.banner small { display: block; font-size: 15px; font-weight: 700; color: var(--dim); font-family: 'Nunito', sans-serif; margin-top: 4px; }

.ctl { display: flex; align-items: center; justify-content: center; gap: 16px; width: min(100%, 620px); padding: 6px 10px; }
.die { position: relative; flex: 0 0 auto; width: 76px; height: 76px; border-radius: 16px; border: 4px solid var(--dc, #fff); background: #fff; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 9px; gap: 2px; box-shadow: 0 5px 0 rgba(0,0,0,.35); cursor: default; }
.die span { border-radius: 50%; background: transparent; }
.die span.on { background: #1b1426; }
.die.ready { cursor: pointer; animation: ready 1s ease-in-out infinite alternate; }
@keyframes ready { from { transform: scale(1); box-shadow: 0 5px 0 rgba(0,0,0,.35), 0 0 0 0 var(--dc, #fff); } to { transform: scale(1.07); box-shadow: 0 5px 0 rgba(0,0,0,.35), 0 0 0 8px rgba(255,255,255,.2); } }
.die.rolling { animation: shake .12s linear infinite; }
@keyframes shake { 0% { transform: rotate(-9deg) translateY(-2px); } 50% { transform: rotate(8deg) translateY(2px); } 100% { transform: rotate(-9deg) translateY(-2px); } }
.status { margin: 0; flex: 1 1 auto; min-height: 44px; display: flex; align-items: center; font-family: 'Baloo 2', sans-serif; font-weight: 600; font-size: 21px; line-height: 1.2; }
.acts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.acts .btn.go { width: auto; padding: 8px 26px; }

.lobby { 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,.25); }
.lobby h2 { margin: 0; text-align: center; font-family: 'Baloo 2', sans-serif; font-size: 26px; }
.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,.25); padding: 0 10px; font-size: 14px; min-width: 0; }
.invrow2 { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lobsub { margin: 4px 0 0; text-align: center; color: var(--dim); font-weight: 700; }
.lobplayers { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lobplayers li { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.2); border-radius: 10px; padding: 8px 12px; font-weight: 800; }
.lobplayers li i { width: 14px; height: 14px; border-radius: 50%; background: var(--saffron); }
.lobplayers li span { color: var(--dim); font-weight: 700; font-size: 13px; margin-left: auto; }
.lobwait { margin: 0; text-align: center; color: var(--dim); font-weight: 700; }

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 50; background: #12071a; color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 800; box-shadow: 0 6px 20px rgba(0,0,0,.5); max-width: 90vw; text-align: center; }
.netbar { position: fixed; left: 0; right: 0; top: 0; z-index: 60; 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: #170a20; color: #bda9ca; 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: #f7f2fa; color: #2a1236; margin-top: 30px; padding: 30px 16px 40px; }
body.in-game .about { display: none; }
.abwrap { max-width: 760px; margin: 0 auto; }
.about h2 { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 28px; 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 #e6d9ee; border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.feat li span { color: #5b4568; font-size: 14.5px; line-height: 1.5; }
details { border: 2px solid #e6d9ee; background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; color: #5b4568; }
.note { margin-top: 24px; color: #6d587a; font-size: 14px; }

/* ---------- a tablet and a phone ---------- */
@media (max-width: 1180px) {
    .shell { grid-template-columns: minmax(0, 760px); justify-content: center; }
    .rail { display: none; }
    .stage { grid-column: 1; }
}
@media (max-width: 760px) {
    .modes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .site-bar { padding: 0 12px; }
    .site-bar nav a:first-child { display: none; }
    .die { width: 66px; height: 66px; padding: 8px; }
    .status { font-size: 18px; }
    .chip .nm { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
    .tok { transition: none; }
    .tok.can .ring, .die.ready, .die.rolling { animation: none; }
    .btn { transition: none; }
}
