:root {
  --bg: #fff7ec; --ink: #2b1d3a; --muted: #7a6b86; --card: #ffffff; --line: #f0dcc4;
  --saffron: #ff6b35; --pink: #f72585; --teal: #06a77d; --blue: #3a86ff; --yellow: #ffbe0b; --wa: #25d366;
  --radius: 18px; --shadow: 0 6px 0 rgba(43, 29, 58, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg) radial-gradient(circle at 10% 0%, #ffe3c6 0, transparent 40%) fixed; color: var(--ink); font-family: 'Baloo 2', system-ui, sans-serif; font-size: 17px; }
button { font: inherit; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }
.screen { max-width: 1180px; margin: 0 auto; padding: 16px; }

/* home */
.brand { text-align: center; margin: 18px 0 10px; }
.logo { font-size: clamp(44px, 9vw, 76px); font-weight: 800; line-height: 1; letter-spacing: -1px; }
.logo span { color: var(--saffron); } .logo b { color: var(--pink); } .logo i { font-style: normal; font-size: .7em; }
.tag { color: var(--muted); margin: 8px 0 0; }
.by { color: var(--muted); font-size: 15px; } .by a { color: var(--pink); font-weight: 700; text-decoration: none; }
.card { background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.setup { max-width: 520px; margin: 18px auto; }
.lbl { display: block; font-weight: 700; margin: 10px 0 6px; }
#name, .chatForm input { width: 100%; padding: 12px 14px; border: 3px solid var(--ink); border-radius: 12px; outline: none; background: #fffdf9; }
#name:focus, .chatForm input:focus { border-color: var(--saffron); }
.avatars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.avatars button { font-size: 26px; background: #fff3e2; border: 2px solid transparent; border-radius: 12px; padding: 4px 0; }
.avatars button.on { border-color: var(--saffron); background: #ffe1c7; }
.packs { display: flex; flex-wrap: wrap; gap: 8px; }
.packs button { border: 2px solid var(--ink); background: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 700; }
.packs button.on { background: var(--yellow); }
.row { display: flex; gap: 10px; margin-top: 16px; }
.btn { border: 3px solid var(--ink); border-radius: 12px; background: #fff; padding: 8px 14px; font-weight: 800; box-shadow: 0 3px 0 var(--ink); transition: transform .05s; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.big { flex: 1; font-size: 22px; padding: 10px; }
.btn.go { background: var(--saffron); color: #fff; }
.btn.alt { background: var(--blue); color: #fff; }
.btn.wa { background: var(--wa); color: #fff; }
.btn.ghost { box-shadow: none; border-width: 2px; }
.join { margin-top: 14px; text-align: center; }
.join p { margin: 0 0 8px; }
.err { color: #c1121f; min-height: 1.2em; margin: 8px 0 0; text-align: center; }
.how { max-width: 820px; margin: 22px auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.how div { background: #fff; border: 2px dashed var(--line); border-radius: 14px; padding: 12px; }
.how b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--pink); color: #fff; margin-right: 6px; }
.ad { max-width: 728px; margin: 18px auto; min-height: 90px; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: #c9b7a3; font-size: 13px; }

/* game */
.bar { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; background: var(--ink); color: #fff; border-radius: 14px; padding: 8px 14px; }
.round { font-weight: 700; }
.hint { text-align: center; font-size: 28px; font-weight: 800; letter-spacing: 6px; white-space: pre; }
.timer { justify-self: end; font-weight: 800; font-size: 22px; background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 0 14px; min-width: 64px; text-align: center; }
.timer.low { background: #ff4d6d; color: #fff; }
.layout { display: grid; grid-template-columns: 200px 1fr 300px; gap: 12px; margin-top: 12px; }
.players { display: flex; flex-direction: column; gap: 6px; }
.pl { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.pl .av { font-size: 26px; }
.pl .nm { font-weight: 700; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .sc { color: var(--muted); font-size: 14px; }
.pl.drawer { border-color: var(--blue); background: #eaf2ff; }
.pl.guessed { border-color: var(--teal); background: #e3fbf2; }
.pl.me .nm::after { content: ' (you)'; color: var(--muted); font-weight: 500; }
.pl .tag2 { margin-left: auto; font-size: 18px; }
.stage { min-width: 0; }
.canvasWrap { position: relative; background: #fff; border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; box-shadow: var(--shadow); }
canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.overlay { position: absolute; inset: 0; background: rgba(43, 29, 58, .78); color: #fff; display: grid; place-items: center; text-align: center; padding: 20px; }
.overlay h2 { margin: 0 0 8px; font-size: 32px; }
.overlay .choices { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.overlay .choices button { background: var(--yellow); border: 3px solid #fff; border-radius: 12px; padding: 8px 16px; font-size: 22px; font-weight: 800; }
.overlay ol { text-align: left; font-size: 22px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.colors { display: flex; flex-wrap: wrap; gap: 4px; }
.colors button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--ink); }
.colors button.on { outline: 3px solid var(--saffron); outline-offset: 1px; }
.sizes { display: flex; gap: 4px; }
.size { width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; line-height: 1; }
.size:nth-child(3) { font-size: 14px; } .size:nth-child(4) { font-size: 22px; }
.size.on, .tool.on { background: var(--yellow); }
.tool { height: 36px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; padding: 0 8px; font-size: 18px; }
.chat { display: flex; flex-direction: column; background: #fff; border: 3px solid var(--ink); border-radius: 16px; min-height: 360px; max-height: calc(100vh - 170px); }
.msgs { flex: 1; overflow-y: auto; padding: 8px 10px; font-size: 16px; }
.msgs div { padding: 2px 0; word-break: break-word; }
.msgs b { margin-right: 4px; }
.msgs .sys { color: var(--muted); font-style: italic; }
.msgs .good { color: var(--teal); font-weight: 800; }
.msgs .draw { color: var(--blue); font-weight: 700; }
.msgs .close { color: #e85d04; font-weight: 700; }
.msgs .secret { color: var(--teal); }
.chatForm { display: flex; gap: 6px; padding: 8px; border-top: 2px solid var(--line); }
.roomBar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.roomBar span { margin-right: auto; }
.lobbyBox { text-align: center; }
.lobbyBox select { font: inherit; border: 2px solid #fff; border-radius: 10px; padding: 2px 6px; }
.lobbyBox .btn { margin-top: 12px; font-size: 22px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .players { flex-direction: row; overflow-x: auto; order: 2; }
  .pl { min-width: 140px; }
  .stage { order: 1; }
  .chat { order: 3; min-height: 260px; max-height: 40vh; }
  .hint { font-size: 22px; letter-spacing: 3px; }
  .how { grid-template-columns: 1fr; }
}
.install { width: 100%; margin-top: 12px; }
.tip { color: var(--muted); font-size: 15px; text-align: center; margin: 10px 0 0; }
:fullscreen body, body.standalone { overscroll-behavior: none; }
