/* Snakes and Ladders: a sunny sky-blue page (the only light one of the games), white cards, a pastel board, colourful snakes. */
:root {
    --sky: #cfeaff; --sky2: #eef8ff; --card: #ffffff; --ink: #0f2742; --dim: #4f6a86; --line: #bfd9ef;
    --blue: #1d6fd6; --sun: #ffb000; --leaf: #2fb344; --red: #e63946;
}
* { 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(--ink); min-height: 100vh;
    background-color: var(--sky);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='160' viewBox='0 0 260 160'%3E%3Cg fill='%23ffffff' fill-opacity='.7'%3E%3Cellipse cx='60' cy='40' rx='34' ry='13'/%3E%3Cellipse cx='84' cy='32' rx='22' ry='12'/%3E%3Cellipse cx='190' cy='110' rx='38' ry='14'/%3E%3Cellipse cx='214' cy='100' rx='24' ry='12'/%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(180deg, #b6e0ff 0%, #e8f6ff 55%, #f6fbff 100%);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--sun); 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(--sun); }

.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(--ink); color: #fff; font-family: 'Lilita One', 'Nunito', sans-serif; font-size: 20px; padding: 8px 20px; box-shadow: 0 4px 0 rgba(15,39,66,.35); transition: transform .08s, box-shadow .08s, filter .15s; text-decoration: none; display: inline-block; text-align: center; line-height: 1.3; letter-spacing: .3px; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(15,39,66,.35); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.go { background: var(--leaf); width: 100%; font-size: 24px; padding: 9px 16px; }
.btn.sun { background: var(--sun); color: #3d2b00; } .btn.coral { background: #ff6b5e; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 rgba(15,39,66,.12); }
.btn.small { font-size: 17px; padding: 7px 14px; }
.btn.wa { background: #25d366; color: #05361a; }
.btn.icon { font-size: 17px; }

/* ---------- the start screen ---------- */
.home { text-align: center; padding: 8px 0 20px; }
.logo { margin: 0; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: clamp(38px, 8vw, 70px); line-height: 1.05; color: var(--ink); text-shadow: 0 4px 0 rgba(255,255,255,.9), 0 6px 0 rgba(15,39,66,.12); }
.logo span:first-child { color: #2e9e4f; } .logo span:last-child { color: #c9731a; }
.logo i { font-style: normal; color: var(--blue); }
.tag { margin: 10px auto 20px; max-width: 560px; color: var(--dim); font-size: 17px; line-height: 1.5; font-weight: 600; }
.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(15,39,66,.1); }
.mode h2 { margin: 0; font-family: 'Lilita One', sans-serif; font-weight: 400; font-size: 24px; line-height: 1.1; }
.mode .mtext { margin: 0; color: var(--dim); font-size: 14.5px; line-height: 1.5; font-weight: 600; }
.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: #fff; border-radius: 10px; padding: 8px 4px; font-weight: 800; font-size: 15px; }
.seg button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.cols { display: flex; gap: 10px; }
.cols button { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 2px var(--line), inset 0 -4px 0 rgba(0,0,0,.2); padding: 0; }
.cols button.on { box-shadow: 0 0 0 3px var(--ink), inset 0 -4px 0 rgba(0,0,0,.2); }
.field input { height: 44px; border: 2px solid var(--line); border-radius: 10px; background: #f6fbff; padding: 0 12px; font-size: 16px; font-weight: 700; }
.field input:focus { border-color: var(--blue); 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: #fff; 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: #fff7d6; border-color: var(--ink); border-top-color: var(--c); box-shadow: 0 4px 0 rgba(15,39,66,.15); }
.chip.away { opacity: .6; }

.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(15,39,66,.2), 0 18px 40px rgba(15,39,66,.25); background: #fff; }
.board text { font-family: 'Nunito', sans-serif; font-weight: 800; }
.tok { transition: transform .15s linear; }
.tok.shake { animation: bump .4s linear; }
@keyframes bump { 0%, 100% { translate: 0 0; } 25% { translate: -1px 0; } 75% { translate: 1px 0; } }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(255,255,255,.97); border: 4px solid var(--sun); border-radius: 18px; padding: 14px 26px; text-align: center; font-family: 'Lilita One', sans-serif; font-size: clamp(28px, 6vw, 42px); line-height: 1.1; color: var(--ink); box-shadow: 0 10px 30px rgba(15,39,66,.4); white-space: nowrap; }
.banner small { display: block; font-size: 15px; color: var(--dim); font-family: 'Nunito', sans-serif; font-weight: 700; 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, var(--ink)); 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(15,39,66,.3); cursor: default; }
.die span { border-radius: 50%; background: transparent; }
.die span.on { background: #12263d; }
.die.ready { cursor: pointer; animation: ready 1s ease-in-out infinite alternate; }
@keyframes ready { from { transform: scale(1); } to { transform: scale(1.08); box-shadow: 0 5px 0 rgba(15,39,66,.3), 0 0 0 8px rgba(255,176,0,.35); } }
.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: 'Lilita One', sans-serif; font-size: 21px; line-height: 1.2; letter-spacing: .2px; }
.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(15,39,66,.1); }
.lobby h2 { margin: 0; text-align: center; font-family: 'Lilita One', sans-serif; font-weight: 400; 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: #f6fbff; 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: #eef8ff; border-radius: 10px; padding: 8px 12px; font-weight: 800; }
.lobplayers li i { width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--sun)); }
.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: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 800; box-shadow: 0 6px 20px rgba(15,39,66,.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,.55); 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: #0b2038; color: #a9bfd6; text-align: center; padding: 22px 16px 26px; font-size: 14px; line-height: 1.6; margin-top: 0; }
.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: #fff; color: var(--ink); margin-top: 30px; padding: 30px 16px 40px; }
body.in-game .about { display: none; }
.abwrap { max-width: 760px; margin: 0 auto; }
.about h2 { font-family: 'Lilita One', sans-serif; font-weight: 400; 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: #eef8ff; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; }
.feat li span { color: var(--dim); font-size: 14.5px; line-height: 1.5; }
details { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; color: var(--dim); }
.note { margin-top: 24px; color: var(--dim); 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; }
    .die.ready, .die.rolling, .tok.shake { animation: none; }
    .btn { transition: none; }
}

@media (max-width: 480px) {
    .site-bar nav { gap: 4px 12px; flex-wrap: nowrap; }
    .site-bar nav a { font-size: 13px; }
    .site-bar .brand { font-size: 17px; }
}
