/* Lexisketch drawing-sync test. The comic look from the mockups: black frames with notched corners on white paper. */
@font-face { font-family: 'Gochi Hand'; src: url('/client/fonts/gochi-hand.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Shantell Sans'; src: url('/client/fonts/shantell-sans-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --bg: #7b4fd6;
  --ink: #111;
  --paper: #fff;
  --notch: 12px;
  --hand: 'Gochi Hand', 'Comic Sans MS', cursive;
  --num: 'Shantell Sans', 'Gochi Hand', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 20px/1.2 var(--hand);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
[hidden] { display: none !important; }

.screen {
  min-height: 100dvh;
  padding: max(12px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
  max-width: 1400px; margin: 0 auto;
}

/* Frames: black outside, paper inside, both notched. */
.frame {
  background: #000; padding: 5px;
  clip-path: polygon(var(--notch) 0, calc(100% - var(--notch)) 0, 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, 0 calc(100% - var(--notch)), 0 var(--notch));
}
.frame > .inner, .frame.title > span {
  display: block; background: var(--paper);
  --n: calc(var(--notch) - 2px);
  clip-path: polygon(var(--n) 0, calc(100% - var(--n)) 0, 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, 0 calc(100% - var(--n)), 0 var(--n));
}

/* Pick screen */
.title { margin: 6vh auto 0; font-weight: normal; font-size: 48px; letter-spacing: 2px; width: min(100%, 420px); text-align: center; }
.title > span { padding: 6px 10px 2px; }
.lede { margin: 0 auto; max-width: 420px; text-align: center; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.panel { width: 100%; }
#pick .panel { max-width: 420px; margin: 0 auto; }
.frame > .inner.stack { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.field input {
  font: 800 34px/1 var(--num); letter-spacing: 8px; text-transform: uppercase; text-align: center;
  border: 3px solid #000; border-radius: 6px 10px 5px 9px; padding: 8px; width: 100%; background: #fff; color: #111;
}
.hint { margin: 4px 0 0; font-size: 16px; color: #333; text-align: center; overflow-wrap: anywhere; }

.btn {
  font: 20px/1 var(--hand); color: #111; background: #fff; text-decoration: none;
  border: 3px solid #000; border-radius: 6px 10px 5px 9px;
  min-height: 44px; padding: 8px 12px 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation;
}
.btn.big { min-height: 54px; font-size: 24px; }
.btn.on, .btn[aria-pressed='true'] { background: #111; color: #fff; }
.btn:active { transform: translateY(1px); }

/* Game screen */
.bar { display: flex; gap: 8px; align-items: stretch; }
.chip { --notch: 9px; }
.chip > .inner { padding: 6px 10px 4px; font-size: 18px; white-space: nowrap; height: 100%; display: flex; align-items: center; }
.chip.grow { flex: 1; min-width: 0; }
.chip.grow > .inner { overflow: hidden; text-overflow: ellipsis; }
.num { font-family: var(--num); font-weight: 800; font-size: 14px !important; }

/* The canvas is always 4:3, as big as fits. */
.canvas-frame { --notch: 14px; width: 100%; margin: 0 auto; max-width: calc((100dvh - var(--reserve, 330px)) * 4 / 3); }
body.watching .canvas-frame { --reserve: 140px; }
body.tv .canvas-frame { --reserve: 90px; }
.paper { position: relative; aspect-ratio: 4 / 3; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.pencil { position: absolute; left: 0; top: 0; width: 13%; aspect-ratio: 1; pointer-events: none; transform: translate(-50%, -50%); }
/* The tip sits 31% left and 31% down from the pencil's middle; shift it so the tip lands on the point. */
.pencil svg { width: 100%; height: 100%; transform: translate(31%, -31%); }
.offline { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; background: rgba(255,255,255,.7); }

.frame > .inner.tools { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
#colors { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.swatch { height: 44px; border: 3px solid #000; border-radius: 7px 11px 6px 10px; padding: 0; cursor: pointer; }
.swatch.on { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #000; position: relative; z-index: 1; }
.size { width: 52px; padding: 0; }
.size i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: currentColor; }
#erase { flex: 1; }
.icon { width: 52px; padding: 0; }
.icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hold { position: relative; overflow: hidden; width: 100%; }
.hold .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #f3b4b4; }
.hold .label { position: relative; }

.watchbar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
body.tv .bar .chip:first-child, body.tv .watchbar { opacity: .85; }

@media (min-width: 900px) {
  body.drawing #game { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto 1fr; align-items: start; }
  body.drawing .bar { grid-column: 1 / -1; }
  body.drawing .canvas-frame { --reserve: 120px; }
}
