:root { --ink: #2a1b4d; --gold: #ffd23a; --sun: #ff8a2a; --card: rgba(30, 18, 60, .88); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #c9b8ff radial-gradient(circle at 20% 30%, rgba(255,255,255,.35) 0 6px, transparent 7px) 0 0/60px 60px, radial-gradient(circle at 70% 70%, rgba(255,111,207,.3) 0 5px, transparent 6px) 0 0/80px 80px, linear-gradient(160deg, #a8d8ff, #c9b8ff 50%, #ffc6ea); font-family: 'Lilita One', 'Arial Rounded MT Bold', Arial, sans-serif; color: #fff; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* panels */
.panel { position: fixed; inset: 0; display: flex; overflow-y: auto; padding: 16px; z-index: 20; }
.panel > div { margin: auto; }
#title { background: linear-gradient(180deg, rgba(42, 27, 77, .15), rgba(42, 27, 77, .55)); }
.tbox { text-align: center; max-width: 760px; width: 100%; }
.logo { font-size: clamp(54px, 11vw, 112px); margin: 0; letter-spacing: 2px; line-height: 1; text-shadow: 0 6px 0 var(--ink), 0 10px 24px rgba(0,0,0,.35); -webkit-text-stroke: 3px var(--ink); }
.logo.small { font-size: clamp(42px, 8vw, 72px); }
.logo span { display: inline-block; animation: wob 2.4s ease-in-out infinite; }
.logo span:nth-child(2n) { animation-delay: -.6s; } .logo span:nth-child(3n) { animation-delay: -1.2s; }
@keyframes wob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
.c0 { color: #ff4d5e; } .c1 { color: #ff9a2e; } .c2 { color: #ffd93b; } .c3 { color: #6fdc3c; } .c4 { color: #22d3c5; } .c5 { color: #3d8bff; } .c6 { color: #9b5cff; } .c7 { color: #ff6fcf; }
.sub { font-size: clamp(16px, 2.6vw, 22px); margin: 10px 0 14px; text-shadow: 0 2px 0 var(--ink); }
.lbl { font-size: 15px; letter-spacing: 1px; opacity: .95; margin: 6px 0; text-shadow: 0 2px 0 var(--ink); }
.chars { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.chr { width: 74px; padding: 6px 0 5px; border-radius: 16px; background: rgba(30, 18, 60, .55); border: 3px solid transparent; cursor: pointer; color: #fff; font-size: 13px; }
.chr .dot { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 4px; position: relative; box-shadow: inset -5px -6px 0 rgba(0,0,0,.18); }
.chr .dot::before, .chr .dot::after { content: ''; position: absolute; top: 12px; width: 9px; height: 11px; background: #fff; border-radius: 50%; box-shadow: inset 2px 3px 0 0 #1b1030; }
.chr .dot::before { left: 10px; } .chr .dot::after { right: 10px; }
.chr.sel { border-color: #fff; background: rgba(30, 18, 60, .85); transform: scale(1.06); }
.chr.taken { opacity: .3; cursor: not-allowed; }
.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: rgba(30, 18, 60, .6); border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; }
.seg span { margin-right: 4px; opacity: .85; }
.seg button { border: 0; border-radius: 999px; padding: 6px 12px; background: transparent; color: #fff; font-size: 14px; cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); }
.seg.locked button { cursor: default; }
.brow { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 8px; }
.btn { font-size: clamp(19px, 2.6vw, 26px); color: var(--ink); background: linear-gradient(180deg, #fff6b0, var(--gold) 45%, var(--sun)); border: 0; border-radius: 999px; padding: 12px 34px; box-shadow: 0 5px 0 #a24a10, 0 10px 24px rgba(0,0,0,.3); cursor: pointer; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a24a10; }
.btn.alt { background: linear-gradient(180deg, #c7f7ff, #4fd2ff 45%, #2a8cff); box-shadow: 0 5px 0 #17468f, 0 10px 24px rgba(0,0,0,.3); }
.btn.alt:active { box-shadow: 0 1px 0 #17468f; }
.btn.small { font-size: 18px; padding: 9px 24px; }
.btn:disabled { filter: grayscale(.8); opacity: .6; cursor: default; }
.keys { margin-top: 14px; font-size: 13px; opacity: .9; text-shadow: 0 1px 0 var(--ink); }
.game-info { margin: 16px auto 0; max-width: 560px; font: 13px/1.5 Arial, Helvetica, sans-serif; color: #f2ecff; background: rgba(30, 18, 60, .45); border-radius: 14px; padding: 10px 14px; }
.game-info h2 { font-size: 14px; margin: 0 0 4px; }
.game-info p { margin: 0; }

.pbox, .rbox { background: var(--card); border-radius: 26px; padding: 22px 26px; text-align: center; box-shadow: 0 16px 40px rgba(0,0,0,.4); max-width: 560px; width: 100%; }
#pause, #results, #msg { background: rgba(20, 10, 40, .35); }
#msg { z-index: 40; }
#msgt { margin: 0 0 8px; font-size: 28px; }
#msgb { font: 16px/1.45 Arial, sans-serif; margin: 0 0 12px; }

/* results */
#rwin { font-size: clamp(22px, 4vw, 32px); margin: 6px 0 12px; }
.rrow { display: flex; align-items: center; gap: 10px; margin: 6px 0; font-size: 18px; }
.rrow .rk { width: 28px; text-align: right; opacity: .85; }
.rrow .nm { width: 110px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow .bar { flex: 1; height: 22px; background: rgba(255,255,255,.12); border-radius: 999px; overflow: hidden; }
.rrow .bar i { display: block; height: 100%; border-radius: 999px; width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.rrow .pc { width: 58px; text-align: right; }
.rrow.me .nm { text-decoration: underline; }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#timer { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 38px; text-shadow: 0 3px 0 var(--ink), 0 0 12px rgba(0,0,0,.3); -webkit-text-stroke: 2px var(--ink); }
#timer.hurry { color: #ffd23a; animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.15); } }
#scores { position: absolute; top: max(62px, calc(env(safe-area-inset-top) + 52px)); left: 50%; transform: translateX(-50%); display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; width: min(96vw, 760px); }
.sc { display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 999px; background: rgba(30, 18, 60, .7); font-size: 15px; transition: transform .2s; }
.sc b { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.sc.me { outline: 2px solid #fff; }
.sc.lead { transform: scale(1.1); }
#big { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font-size: clamp(60px, 14vw, 140px); -webkit-text-stroke: 4px var(--ink); text-shadow: 0 8px 0 var(--ink); opacity: 0; }
#big.show { animation: pop .9s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: 1; transform: scale(1.15); } 35% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }
#power { position: absolute; bottom: 20%; left: 0; right: 0; text-align: center; font-size: clamp(26px, 5vw, 40px); -webkit-text-stroke: 2px var(--ink); text-shadow: 0 4px 0 var(--ink); opacity: 0; }
#power.show { animation: pop 1.3s ease-out forwards; }
#feed { position: absolute; left: 12px; bottom: 12px; font: 14px Arial, sans-serif; text-shadow: 0 1px 2px #000; }
#feed div { animation: fade 4s forwards; }
@keyframes fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

.corner { position: fixed; top: max(10px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(30, 18, 60, .6); color: #fff; font-size: 20px; cursor: pointer; z-index: 30; }
#mutebtn { right: 10px; }
#menubtn { left: 10px; }

/* name tags */
#tags { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.tag { position: absolute; transform: translate(-50%, -100%); font-size: 14px; padding: 1px 8px; border-radius: 999px; background: rgba(30, 18, 60, .65); white-space: nowrap; }
.tag.me { background: #fff; color: var(--ink); }

/* touch controls */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#stickzone { position: absolute; left: 0; bottom: 0; width: 60%; height: 70%; pointer-events: auto; }
#stickbase { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%; background: rgba(255,255,255,.18); border: 3px solid rgba(255,255,255,.45); left: 110px; top: calc(100% - 120px); }
#stickknob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255,255,255,.8); }
#dashbtn { position: absolute; right: max(26px, env(safe-area-inset-right)); bottom: max(34px, env(safe-area-inset-bottom)); width: 100px; height: 100px; border-radius: 50%; border: 0; pointer-events: auto; font-size: 22px; color: var(--ink); background: radial-gradient(circle at 40% 35%, #fff6b0, var(--gold) 55%, var(--sun)); box-shadow: 0 5px 0 #a24a10; }
#dashbtn.cool { filter: grayscale(.9) brightness(.8); }

/* online UI */
#netui { background: linear-gradient(180deg, rgba(42, 27, 77, .3), rgba(42, 27, 77, .7)); }
.nbox { background: var(--card); border-radius: 26px; padding: 18px 22px; text-align: center; max-width: 720px; width: 100%; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.nbox h2 { margin: 0 0 8px; font-size: 30px; }
.nbox p { font: 15px/1.45 Arial, sans-serif; margin: 6px 0; }
.codein { font-family: inherit; font-size: 34px; width: 170px; text-align: center; letter-spacing: 6px; text-transform: uppercase; border-radius: 16px; border: 3px solid #fff; background: rgba(255,255,255,.1); color: #fff; padding: 6px; }
.nstatus { min-height: 22px; font: 15px Arial, sans-serif; margin-top: 10px; color: #c9f1ff; }
.nstatus.err { color: #ffb0b0; }
.codebig { font-size: 52px; letter-spacing: 8px; color: var(--gold); text-shadow: 0 4px 0 #000; }
.plist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.pl { display: flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 16px; }
.pl b { width: 22px; height: 22px; border-radius: 50%; }
.pl small { font: 12px Arial, sans-serif; opacity: .8; }
.pl.rdy { background: rgba(111, 220, 60, .3); }
.linkrow { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; font: 13px Arial, sans-serif; }
.linkrow input { width: min(320px, 70vw); font: 13px Arial, sans-serif; padding: 6px 8px; border-radius: 8px; border: 0; }

@media (max-height: 520px) {
  .logo { font-size: 50px; } .sub { margin: 4px 0 6px; } .chr { width: 62px; } .chr .dot { width: 32px; height: 32px; } .chr .dot::before, .chr .dot::after { top: 9px; width: 7px; height: 9px; } .chr .dot::before { left: 7px; } .chr .dot::after { right: 7px; }
  #timer { font-size: 30px; } #scores { top: 48px; } .game-info { display: none; }
}
.seg.wrap { flex-wrap: wrap; justify-content: center; border-radius: 22px; max-width: 100%; }
.seg button { white-space: nowrap; }

/* ---------------- Draw & Guess game screen */
#title { background: none; }
#play { position: fixed; inset: 0; display: flex; flex-direction: column; padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom)); gap: 8px; }
#top { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; padding: 0 56px; }
#topinfo { background: rgba(30, 18, 60, .78); border-radius: 999px; padding: 8px 18px; font-size: clamp(16px, 2.4vw, 22px); text-align: center; }
#topinfo .rnd { opacity: .75; font-size: .8em; margin-right: 6px; }
#topinfo .word { color: #ffd23a; letter-spacing: 1px; }
#clock { --p: 1; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; flex: none;
  background: conic-gradient(#ffd23a calc(var(--p) * 360deg), rgba(30,18,60,.5) 0); box-shadow: inset 0 0 0 6px rgba(30,18,60,.85); color: #fff; -webkit-text-stroke: 1px #2a1b4d; }
#clock.hurry { background: conic-gradient(#ff4d5e calc(var(--p) * 360deg), rgba(30,18,60,.5) 0); animation: shake .4s infinite; }
@keyframes shake { 50% { transform: rotate(6deg) scale(1.08); } }
#main { flex: 1; display: flex; gap: 10px; min-height: 0; }
#plist { width: 190px; flex: none; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.pp { display: flex; align-items: center; gap: 8px; background: rgba(30, 18, 60, .7); border-radius: 16px; padding: 6px 10px 6px 6px; font-size: 16px; transition: background .3s; }
.pp.me { outline: 2px solid #fff; }
.pp.drawing { background: rgba(255, 210, 58, .45); }
.pp.got { background: rgba(63, 191, 74, .55); }
.pp .nm { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp .pts { color: #ffd23a; }
.pp .st { width: 20px; text-align: center; }
.av { width: 30px; height: 30px; border-radius: 50%; flex: none; position: relative; display: inline-block; box-shadow: inset -4px -5px 0 rgba(0,0,0,.18); }
.av::before, .av::after { content: ''; position: absolute; top: 8px; width: 7px; height: 9px; background: #fff; border-radius: 50%; box-shadow: inset 2px 2px 0 0 #1b1030; }
.av::before { left: 7px; } .av::after { right: 7px; }
.av.big { width: 70px; height: 70px; } .av.big::before, .av.big::after { top: 20px; width: 15px; height: 19px; } .av.big::before { left: 16px; } .av.big::after { right: 16px; }
#boardwrap { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
#board { position: relative; aspect-ratio: 4 / 3; max-width: 100%; max-height: 100%; height: 100%; border-radius: 18px; overflow: hidden; box-shadow: 0 10px 30px rgba(42, 27, 77, .35), 0 0 0 6px #fff; background: #fff; }
@supports not (aspect-ratio: 4 / 3) { #board { width: 100%; } }
#cv { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
#ovl { position: absolute; inset: 0; background: rgba(42, 27, 77, .55); display: flex; align-items: center; justify-content: center; }
.ob { text-align: center; padding: 14px; }
.ob h2 { margin: 8px 0 12px; font-size: clamp(22px, 3.4vw, 34px); text-shadow: 0 3px 0 #2a1b4d; }
.opts { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.opt { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 130px; padding: 12px 16px; border: 0; border-radius: 20px; background: #fff; color: #2a1b4d; font-size: 22px; cursor: pointer; box-shadow: 0 5px 0 #b9a8e8; }
.opt:hover { transform: translateY(-3px); }
.opt .em { font-size: 54px; line-height: 1.1; }
.hintline { margin-top: 12px; font: 15px Arial, sans-serif; opacity: .9; }
.rev .huge { font-size: clamp(70px, 12vw, 120px); line-height: 1; }
.gl { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 20px; margin: 4px 0; }
.gl b { color: #ffd23a; }
.gl .av { width: 26px; height: 26px; } .gl .av::before, .gl .av::after { top: 7px; width: 6px; height: 8px; } .gl .av::before { left: 6px; } .gl .av::after { right: 6px; }
#pop { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: clamp(34px, 6vw, 56px); -webkit-text-stroke: 2px #2a1b4d; text-shadow: 0 4px 0 #2a1b4d; opacity: 0; pointer-events: none; }
#pop.show { animation: pop 1.3s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: 1; transform: scale(1.15); } 35% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }
#bottom { flex: none; min-height: 70px; display: flex; align-items: center; justify-content: center; }
#tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; background: rgba(30, 18, 60, .75); border-radius: 22px; padding: 8px 12px; }
#tools .cols { display: grid; grid-template-columns: repeat(6, 34px); gap: 6px; }
#tools .col { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); cursor: pointer; }
#tools .col.on { border-color: #fff; transform: scale(1.15); box-shadow: 0 0 0 3px #ffd23a; }
#tools .tb { display: flex; gap: 6px; }
#tools .sz, #tools .tool { width: 48px; height: 48px; border-radius: 14px; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; }
#tools .sz i { display: block; border-radius: 50%; background: #fff; }
#tools .sz.on, #tools .tool.on { background: #ffd23a; } #tools .sz.on i { background: #2a1b4d; }
#guess { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; width: min(100%, 900px); }
.gb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; border: 0; border-radius: 18px; background: #fff; color: #2a1b4d; font-family: inherit; font-size: 17px; cursor: pointer; box-shadow: 0 5px 0 #b9a8e8; transition: opacity .4s, transform .1s; }
.gb:active { transform: translateY(4px); box-shadow: 0 1px 0 #b9a8e8; }
.gb .em { font-size: 34px; line-height: 1.15; }
.gb.gone { opacity: .18; cursor: default; }
.gb.nope { animation: nope .45s; background: #ffd0d6; }
@keyframes nope { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.gdone { grid-column: 1 / -1; text-align: center; font-size: 22px; background: rgba(30, 18, 60, .7); border-radius: 18px; padding: 14px; }
#freebar { display: flex; gap: 12px; }
#play #feed { position: fixed; left: 12px; bottom: 90px; font: 15px Arial, sans-serif; text-shadow: 0 1px 2px #000; pointer-events: none; }
#play #feed div { animation: fade 3.5s forwards; }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #main { flex-direction: column; }
  #plist { width: auto; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px; }
  .pp { padding: 3px 8px 3px 3px; font-size: 14px; } .pp .av { width: 24px; height: 24px; } .pp .av::before, .pp .av::after { top: 6px; width: 6px; height: 7px; } .pp .av::before { left: 5px; } .pp .av::after { right: 5px; }
  #board { height: auto; width: 100%; }
  #guess { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gb .em { font-size: 30px; }
  #tools .cols { grid-template-columns: repeat(6, 30px); } #tools .col { width: 30px; height: 30px; }
  #top { padding: 0 50px; } #topinfo { font-size: 15px; padding: 6px 12px; }
}
#title .logo { font-size: clamp(30px, 8.5vw, 96px); white-space: nowrap; margin-top: 30px; }
.pp.got .pts { color: #fff; }
.pp.drawing { background: #ffd23a; color: #2a1b4d; }
.pp.drawing .pts { color: #2a1b4d; }

/* cartoon kid faces */
.av.kid, .chr .dot.kid { background: none; box-shadow: none; overflow: visible; }
.av.kid::before, .av.kid::after, .chr .dot.kid::before, .chr .dot.kid::after { display: none; }
.av.kid svg, .chr .dot.kid svg { width: 100%; height: 100%; display: block; }
.chr .dot.kid { width: 48px; height: 48px; }
.pl .av.kid { width: 26px; height: 26px; }
.av.kid.big { width: 90px; height: 90px; }
.pp .av.kid { width: 34px; height: 34px; }

/* random page background (drawguess-bgs.js) */
#bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
#bg svg { width: 100%; height: 100%; display: block; }
#title .sub, #title .lbl { text-shadow: 0 2px 0 #2a1b4d, 0 0 10px rgba(42, 27, 77, .6); }
