/* Doodle Rush: the look of the game. Deep indigo ground with faint doodles, white cards, coral / sun / mint / sky as the paint colours. */
:root {
    --ink: #1b1f3b; --ground: #1d2250; --ground2: #262c66; --card: #ffffff; --soft: #eef0fb; --line: #dfe3f5;
    --coral: #ff5d73; --sun: #ffc93c; --mint: #2dd4a7; --sky: #4cc9f0; --grape: #a78bfa; --muted: #6a7099;
}
* { 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(--ground);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240' fill='none' stroke='%23ffffff' stroke-opacity='.07' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 40 l6 -14 l6 14 l-14 -9 h16z'/%3E%3Ccircle cx='150' cy='38' r='11'/%3E%3Cpath d='M190 120 q10 -16 20 0 t20 0'/%3E%3Cpath d='M40 150 h26 v22 h-26z M40 150 l13 -14 l13 14'/%3E%3Cpath d='M120 190 q14 -26 28 0'/%3E%3Cpath d='M100 100 l12 12 m0 -12 l-12 12'/%3E%3Cpath d='M205 205 c-10 -10 -22 4 -10 14 c12 -10 22 -24 10 -14z'/%3E%3C/svg%3E"),
        radial-gradient(1000px 500px at 50% -10%, var(--ground2), transparent 70%);
}
button, input, select, textarea { 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-family: 'Fredoka', sans-serif; font-size: 20px; font-weight: 700; 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 #2dd4a7; }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 12px; background: var(--coral); color: #fff; font-weight: 800; padding: 11px 18px; font-size: 16px; box-shadow: 0 4px 0 rgba(0,0,0,.18); transition: transform .08s, box-shadow .08s, filter .15s; font-family: 'Fredoka', 'Nunito', sans-serif; letter-spacing: .2px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.18); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.big { font-size: 22px; padding: 13px 22px; }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn.blue { background: #3b82f6; }
.btn.ghost { background: var(--soft); color: var(--ink); box-shadow: 0 4px 0 var(--line); }
.btn.play { background: var(--mint); color: #053b2d; }
.btn small { display: block; font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 12px; opacity: .85; margin-top: 1px; letter-spacing: 0; }
.btn.big small { font-size: 13px; }
.inv { background: #e8fbf4; border: 2px solid var(--mint); border-radius: 14px; padding: 12px; text-align: center; display: grid; gap: 8px; }
.inv p { margin: 0; font-weight: 700; }
.inv b { font-family: 'Fredoka', sans-serif; letter-spacing: 2px; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; font-weight: 700; font-size: 14px; padding: 2px; }
.home.invited #btnPlay, .home.invited #btnCreate, .home.invited .join { display: none; }

/* ---------- the start screen ---------- */
.home { max-width: 560px; margin: 0 auto; padding: 4px 16px 24px; text-align: center; }
.logo { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: clamp(46px, 11vw, 78px); line-height: 1; margin: 8px 0 6px; letter-spacing: 1px; text-shadow: 0 4px 0 rgba(0,0,0,.25); display: flex; justify-content: center; align-items: flex-end; flex-wrap: wrap; }
.logo span { color: var(--c); display: inline-block; transform: rotate(-4deg); }
.logo span:nth-child(even) { transform: rotate(3deg) translateY(3px); }
.logo .gap { width: .3em; }
.logo i { color: var(--sun); font-size: .6em; margin-left: .15em; transform: rotate(35deg); }
.tag { color: #c9cdf2; margin: 0 auto 18px; font-size: 16px; max-width: 420px; }
.panel { background: var(--card); border-radius: 20px; padding: 18px; box-shadow: 0 10px 0 rgba(0,0,0,.18), 0 20px 40px rgba(0,0,0,.25); display: grid; gap: 12px; text-align: left; }
.who { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.who input, .who select, .join input { height: 46px; border: 2px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 16px; font-weight: 700; }
.who input:focus, .join input:focus { border-color: var(--grape); outline: none; }
.avpick { display: grid; justify-items: center; gap: 8px; background: var(--soft); border-radius: 14px; padding: 12px 10px 10px; position: relative; }
.avrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; }
.avset { display: inline-flex; align-items: center; gap: 4px; }
.avset em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); min-width: 40px; text-align: center; text-transform: uppercase; letter-spacing: .4px; }
.avset button { width: 28px; height: 30px; border: 0; border-radius: 8px; background: #fff; font-size: 22px; line-height: 1; color: var(--muted); box-shadow: 0 2px 0 var(--line); padding: 0; }
.avset button:hover { color: var(--ink); }
.avbox { width: 104px; height: 104px; }
.avbox .av { width: 100%; height: 100%; display: block; }
.rand { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #fff; color: var(--muted); box-shadow: 0 2px 0 var(--line); }
.err { margin: 0; background: #ffe9ec; color: #a1203a; border-radius: 10px; padding: 9px 12px; font-weight: 700; font-size: 14px; }
.join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.join input { text-transform: uppercase; letter-spacing: 2px; }

/* ---------- the game ---------- */
.game { max-width: 1400px; margin: 0 auto; padding: 8px 10px 14px; }
.g-top { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 14px; background: var(--card); border-radius: 14px; padding: 8px 14px; box-shadow: 0 5px 0 rgba(0,0,0,.18); }
.clock { width: 48px; height: 48px; border-radius: 50%; background: var(--sun); display: grid; place-items: center; font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 22px; box-shadow: inset 0 0 0 4px rgba(0,0,0,.08); }
.clock:empty, .clock span:empty { }
.clock.low { background: var(--coral); color: #fff; animation: beat .5s infinite alternate; }
@keyframes beat { to { transform: scale(1.1); } }
.g-round { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; white-space: nowrap; }
.g-word { text-align: center; min-width: 0; }
.wl { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.wlet { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px 4px; min-height: 32px; align-items: flex-end; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 28px; line-height: 1.1; }
.wlet .l { text-transform: uppercase; }
.wlet .b { width: 20px; height: 28px; border-bottom: 4px solid var(--ink); display: inline-block; border-radius: 2px; }
.wlet .sp { width: 16px; }
.g-btns { display: flex; gap: 6px; }
.ibtn { width: 38px; height: 38px; border: 0; border-radius: 10px; background: var(--soft); color: var(--ink); font-size: 17px; }
.ibtn:hover { background: var(--line); }

.g-main { display: grid; grid-template-columns: 220px minmax(0, 1fr) 270px; gap: 10px; margin-top: 10px; align-items: start; }
.g-players, .g-chat { background: var(--card); border-radius: 14px; box-shadow: 0 5px 0 rgba(0,0,0,.18); overflow: hidden; }
.g-left { display: grid; gap: 10px; min-width: 0; }
.g-players { display: flex; flex-direction: column; max-height: calc(100vh - 150px); overflow-y: auto; }
.pl { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) 42px; align-items: center; gap: 6px; padding: 7px 8px 7px 6px; border-bottom: 1px solid var(--line); }
.pl:nth-child(even) { background: #f7f8fe; }
.pl.got { background: #dcfce9 !important; }
.pl.away { opacity: .5; }
.pl .rk { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 14px; color: var(--muted); text-align: center; }
.pl .pn { font-weight: 800; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl.me .pn { color: #2563eb; }
.pl .ps { font-size: 12px; color: var(--muted); font-weight: 700; }
.pa { display: block; width: 100%; }
.pa .av, .sr .pa .av { width: 100%; height: auto; display: block; }
.badge { position: absolute; right: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; border: 2px solid #fff; }
.badge.dr { background: var(--coral); }
.badge.ok { background: #16a34a; }
.badge.host { background: var(--sun); color: #5a3d00; right: auto; left: 22px; top: 2px; bottom: auto; width: 17px; height: 17px; font-size: 9px; }
.kick { position: absolute; right: 2px; top: 2px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: #b4b8d6; font-size: 16px; line-height: 1; padding: 0; opacity: 0; }
.pl:hover .kick, .kick:focus { opacity: 1; }
.kick:hover { color: #dc2626; background: #fee2e2; }
@media (hover: none) { .kick { opacity: .6; } }

.g-stage { min-width: 0; margin: 0 auto; width: 100%; max-width: calc((100vh - 285px) * 1.3333); min-width: 320px; }
.paper { position: relative; width: 100%; padding-bottom: 75%; background: #fff; border-radius: 14px; box-shadow: 0 5px 0 rgba(0,0,0,.18); overflow: hidden; }
.paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; display: block; cursor: default; }
.paper canvas.can { cursor: crosshair; }
.ov { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(29, 34, 80, .78); padding: 12px; overflow-y: auto; }
.ov.on { display: flex; }
.paper.tall { padding-bottom: 0; min-height: 440px; display: flex; }
.paper.tall canvas { display: none; }
.paper.tall .ov { position: relative; inset: auto; flex: 1 1 auto; background: transparent; padding: 16px 12px; }
.paper.tall { background: rgba(255,255,255,.12); }
.ovc { background: var(--card); border-radius: 18px; padding: 16px 20px; width: min(100%, 520px); max-height: 100%; overflow-y: auto; text-align: center; box-shadow: 0 8px 0 rgba(0,0,0,.2); }
.ovc h2 { margin: 0 0 10px; font-family: 'Fredoka', sans-serif; font-size: 24px; }
.ovc .sub { margin: 8px 0; color: var(--muted); font-weight: 700; }
.ovc .code { margin: 8px 0 0; font-family: 'Fredoka', sans-serif; font-size: 20px; letter-spacing: 3px; }
.ovc .sets { margin: 8px 0; font-size: 14px; color: var(--ink); font-weight: 700; }
.invite { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; }
.invite input { height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 14px; min-width: 0; background: var(--soft); }
.bigcd { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 54px; color: var(--coral); line-height: 1.1; }
.set { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; text-align: left; margin: 12px 0 8px; }
.set label, .cw { display: grid; gap: 3px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.set select, .cw textarea { border: 2px solid var(--line); border-radius: 10px; padding: 7px 8px; background: #fff; font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--ink); }
.cw { text-align: left; margin: 8px 0 12px; }
.cw textarea { resize: vertical; font-weight: 600; }
.cw .only { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.choices { display: grid; gap: 8px; margin: 6px 0; }
.btn.choice { font-size: 22px; background: var(--grape); }
.btn.choice:nth-child(2) { background: var(--sky); color: #06374a; }
.btn.choice:nth-child(3) { background: var(--sun); color: #4a3400; }
.bigav { width: 96px; height: 96px; margin: 4px auto; }
.bigav .av { width: 100%; height: 100%; }
.theword { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 40px; color: var(--coral); text-transform: uppercase; margin: -2px 0 8px; word-break: break-word; line-height: 1.1; }
.winner { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 20px; margin: 0; color: #15803d; }
.sl { display: grid; gap: 4px; margin-top: 8px; text-align: left; }
.sr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 3px 8px; border-radius: 10px; background: var(--soft); }
.sr.me { background: #dbeafe; }
.sr .sn { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr .sg { color: #15803d; font-weight: 800; }
.sr .sp2 { font-family: 'Fredoka', sans-serif; font-weight: 600; min-width: 44px; text-align: right; }

.tools { margin-top: 10px; background: var(--card); border-radius: 14px; padding: 8px 10px; box-shadow: 0 5px 0 rgba(0,0,0,.18); display: grid; gap: 8px; }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tb { width: 40px; height: 40px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-size: 17px; color: var(--ink); }
.tb:hover { background: var(--soft); }
.tb.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tb.red { color: #dc2626; }
.sizes { display: inline-flex; gap: 4px; margin: 0 6px; }
.sz { width: 40px; height: 40px; border: 2px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; padding: 0; }
.sz i { display: block; border-radius: 50%; background: var(--ink); }
.sz.on { border-color: var(--ink); background: var(--soft); }
.colors { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.sw { height: 30px; border: 2px solid rgba(0,0,0,.12); border-radius: 8px; padding: 0; }
.sw.on { outline: 3px solid var(--ink); outline-offset: 1px; border-color: #fff; }

.g-chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 360px; }
.chatlog { flex: 1 1 auto; overflow-y: auto; padding: 6px 0; font-size: 14px; }
.cm { padding: 4px 12px; word-break: break-word; }
.cm:nth-child(even) { background: #f7f8fe; }
.cm b { font-weight: 800; }
.cm.sys { color: var(--muted); font-weight: 700; font-size: 13px; }
.cm.join { color: #15803d; font-weight: 700; font-size: 13px; }
.cm.left { color: #b91c1c; font-weight: 700; font-size: 13px; }
.cm.good { color: #15803d; font-weight: 800; background: #dcfce9 !important; }
.cm.close { color: #b45309; font-weight: 800; background: #fef3c7 !important; }
.cm.secret { background: #dcfce9 !important; }
.chatform { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 8px; border-top: 2px solid var(--line); }
.chatform input { height: 40px; border: 2px solid var(--line); border-radius: 10px; padding: 0 10px; min-width: 0; font-size: 15px; }
.chatform input:focus { border-color: var(--grape); outline: none; }

.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(0,0,0,.35); 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, the mark of the site, the footer ---------- */
.adbox { background: rgba(255,255,255,.07); 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: #aab0e6; margin-bottom: 4px; }
.adbox ins { min-height: 90px; }
.g-ad ins { min-height: 250px; }
.adbottom { max-width: 980px; margin: 18px auto 0; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px) minmax(0, 1fr); gap: 18px; max-width: 1340px; margin: 0 auto; align-items: start; padding: 0 12px; }
.home-grid .rail { max-width: 300px; width: 100%; justify-self: center; margin-top: 18px; }
.home-grid .home { grid-column: 2; padding-left: 0; padding-right: 0; }
.wm { position: absolute; right: 10px; bottom: 6px; z-index: 1; font-size: 12px; font-weight: 800; letter-spacing: .4px; color: rgba(27, 31, 59, .28); pointer-events: none; user-select: none; }
.site-foot { margin-top: 0; background: #0f1337; color: #aeb4e6; 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; }
body.in-game .about { display: none; }

/* ---------- the text under the start screen ---------- */
.about { background: var(--card); margin-top: 30px; padding: 30px 16px 40px; }
.abwrap { max-width: 760px; margin: 0 auto; }
.about h2 { font-family: 'Fredoka', sans-serif; font-size: 26px; margin: 26px 0 10px; }
.about h2:first-child { margin-top: 0; }
.steps { padding-left: 22px; line-height: 1.6; }
.steps li { margin: 6px 0; }
.feat { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.feat li { background: var(--soft); border-radius: 12px; padding: 12px 14px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.feat i { color: var(--coral); font-size: 20px; width: 24px; text-align: center; }
details { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px; margin: 8px 0; }
summary { font-weight: 800; cursor: pointer; }
details p { margin: 8px 0 2px; line-height: 1.6; color: #3b4166; }
.note { margin-top: 24px; color: var(--muted); font-size: 14px; }

/* ---------- a tablet and a phone ---------- */
@media (max-width: 1100px) {
    .g-main { grid-template-columns: 180px minmax(0, 1fr) 230px; }
}
@media (max-width: 1180px) {
    .home-grid { grid-template-columns: minmax(0, 560px); justify-content: center; }
    .home-grid .rail { display: none; }
    .home-grid .home { grid-column: 1; }
}
@media (max-width: 900px) {
    .game { padding: 6px; }
    .g-top { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; padding: 8px 10px; }
    .g-round { display: none; }
    .wlet { font-size: 22px; }
    .wlet .b { width: 15px; height: 22px; border-bottom-width: 3px; }
    .g-main { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .g-stage { max-width: none; min-width: 0; order: 1; }
    .g-left { order: 2; }
    .g-ad { display: none; }
    .g-players { order: 2; flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
    .g-chat { order: 3; height: 300px; min-height: 0; }
    .pl { flex: 0 0 148px; border-bottom: 0; border-right: 1px solid var(--line); grid-template-columns: 26px minmax(0, 1fr) 36px; }
    .pl .rk { font-size: 12px; }
    .colors { grid-template-columns: repeat(10, minmax(0, 1fr)); }
    .sw { height: 26px; }
    .tb, .sz { width: 36px; height: 36px; }
    .ovc { padding: 12px 14px; }
    .ovc h2 { font-size: 20px; }
    .theword { font-size: 30px; }
    .set { grid-template-columns: 1fr 1fr; }
    .invite { grid-template-columns: minmax(0, 1fr) auto; }
    .invite .ghost { display: none; }
}
@media (max-width: 480px) {
    .home { padding-left: 10px; padding-right: 10px; }
    .site-bar { padding: 0 12px; }
    .site-bar nav a:first-child { display: none; }
    .panel { padding: 14px; }
    .who { grid-template-columns: 1fr; }
    .clock { width: 40px; height: 40px; font-size: 18px; }
    .bigcd { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
    .clock.low { animation: none; }
    .btn { transition: none; }
}
