/* Pass the doodle on the phones and the TV (web/games/doodle.js). Drawings are on cream paper, in the pens'
   colours; their widths are in the drawing's own 0–1000 units, so a drawing looks the same at any size. */

/* Drawings, everywhere. */
.dd-svg { display: block; width: 100%; height: 100%; }
.dd-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.dd-svg .pen-0 { stroke: var(--background); stroke-width: 7; }
.dd-svg .pen-1 { stroke: var(--background); stroke-width: 20; }
.dd-svg .pen-2 { stroke: var(--accent); stroke-width: 13; }
.dd-svg .pen-3 { stroke: var(--crown); stroke-width: 13; }
.dd-paper { display: block; aspect-ratio: 1; background: var(--paper); overflow: hidden; }

/* Phones. */
.page .timer { font-size: 13px; }
.dd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.dd-given {
  margin: 0; padding: 14px 16px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.dd-given strong { font-size: 24px; line-height: 1.15; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.dd-given strong.soft { font-size: 17px; font-weight: 600; color: var(--text-soft); }

.dd-pad { position: relative; }
.dd-canvas {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: 20px; background: var(--paper);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.dd-hint {
  position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; padding: 24px;
  text-align: center; color: var(--background); opacity: 0.4; font-size: 15px; pointer-events: none;
}
.dd-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dd-pens { display: flex; gap: 10px; }
.dd-pen {
  width: 44px; height: 44px; padding: 0; border-radius: 9999px; border: 0; background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.45s cubic-bezier(0.3, 1.8, 0.4, 1), box-shadow 0.2s ease;
}
.dd-pen i { display: block; border-radius: 9999px; }
.dd-pen.pen-0 i { width: 8px; height: 8px; background: var(--background); }
.dd-pen.pen-1 i { width: 20px; height: 20px; background: var(--background); }
.dd-pen.pen-2 i { width: 15px; height: 15px; background: var(--accent); }
.dd-pen.pen-3 i { width: 15px; height: 15px; background: var(--crown); }
.dd-pen[aria-checked="true"] { transform: scale(1.12); box-shadow: 0 0 0 3px var(--background), 0 0 0 5px var(--accent); }
.dd-pen:active { transform: scale(0.92); transition-duration: 0.08s; }
.dd-edit { display: flex; gap: 8px; }
.dd-edit .btn { width: auto; min-height: 40px; padding: 0 14px; font-size: 14px; }

.dd-suggest {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-card); border: 1px dashed var(--line-strong); background: transparent;
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  transition: transform 0.45s cubic-bezier(0.3, 1.8, 0.4, 1), border-color 0.2s ease;
}
.dd-suggest strong { font-size: 18px; }
.dd-suggest:active { transform: scale(0.97); transition-duration: 0.08s; border-color: var(--accent); }

.page .dd-paper { border-radius: 20px; }
.page .dd-paper.empty { display: flex; align-items: center; justify-content: center; padding: 28px; text-align: center; color: var(--background); }
.page .dd-paper.empty p { margin: 0; font-size: 17px; font-weight: 600; opacity: 0.6; }

.dd-wait { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 24px; }
.dd-wait .me-critter { width: 112px; margin-bottom: 8px; }

.dd-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.dd-choice {
  position: relative; padding: 8px 8px 10px; border-radius: var(--radius-card); border: 2px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 8px; text-align: left; min-width: 0;
  transition: transform 0.45s cubic-bezier(0.3, 1.8, 0.4, 1), border-color 0.2s ease, background-color 0.2s ease;
}
.dd-choice:active:not(:disabled) { transform: scale(0.96); transition-duration: 0.08s; }
.dd-choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft-bg); }
.dd-choice:disabled { opacity: 0.5; cursor: default; }
.dd-choice .dd-paper { border-radius: 12px; }
.dd-words {
  display: flex; align-items: center; justify-content: center; aspect-ratio: 1; padding: 10px; border-radius: 12px;
  background: var(--background); font-size: 17px; font-weight: 700; line-height: 1.2; text-align: center; overflow-wrap: anywhere;
}
.dd-words.none { color: var(--text-muted); font-weight: 400; }
.dd-by { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; font-weight: 600; }
.dd-by > span:not(.critter) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-by-critter { width: 22px; }
.dd-tag, .dd-count {
  position: absolute; top: 14px; right: 14px; padding: 3px 9px; border-radius: 9999px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
}
.dd-tag { background: var(--surface); color: var(--text-muted); }
.dd-count { background: var(--accent); color: var(--accent-text); }

/* The playback on a phone, as on the TV, so a night needs no TV: the chain so far in a strip, the newest big. */
.dd-show-head { display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; }
.page .dd-dots { gap: 6px; }
.page .dd-dots i { width: 8px; height: 8px; }
.dd-reel {
  list-style: none; margin: 0 -16px; padding: 2px 16px 4px; display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 16px; scrollbar-width: none;
}
.dd-reel::-webkit-scrollbar { display: none; }
.dd-reel::after { content: ''; flex: 0 0 6px; } /* Safari drops a scroller's end padding: the gap and this make 16px */
.dd-reel-item { flex: 0 0 92px; display: flex; flex-direction: column; gap: 6px; scroll-snap-align: end; opacity: 0.78; }
.dd-reel-item .dd-paper { border-radius: 12px; }
.dd-reel-item .dd-words { border-radius: 12px; padding: 8px; font-size: 12px; background: var(--surface); border: 1px solid var(--line); }
.dd-reel-item .dd-by { font-size: 11px; }
.dd-reel-item .dd-by-critter { width: 16px; }
.dd-now { display: flex; flex-direction: column; gap: 10px; }
.dd-now.k-drawing { align-items: center; }
/* Small enough that the host's button stays in view under it. */
.dd-now .dd-paper { width: min(100%, 38svh); box-shadow: 0 0 0 3px var(--accent); }
.dd-words.big {
  aspect-ratio: auto; min-height: 148px; padding: 22px 22px 26px; justify-content: flex-start; text-align: left;
  border-radius: 20px; background: var(--surface); border: 2px solid var(--accent);
  font-size: 28px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15;
}
.dd-words.big p { margin: 0; }
.dd-words.big.none { border-color: var(--line-strong); color: var(--text-muted); font-size: 20px; font-weight: 600; }
.dd-now .dd-by { font-size: 15px; }
.dd-now .dd-by-critter { width: 28px; }
.page .dd-kind { font-size: 10px !important; }

@media (min-width: 820px) {
  .dd-now { max-width: 560px; }
  .dd-pad, .page .dd-paper:not(.dd-choice .dd-paper) { max-width: 560px; }
  .dd-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The TV. */
.tv .timer.tv-timer { font-size: calc(22 * var(--u)); }
.dd-top { display: flex; align-items: center; gap: calc(18 * var(--u)); }

/* The playback: the step before, and the newest, big. */
.dd-play { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: calc(28 * var(--u)); }
.dd-arrow { font-size: calc(48 * var(--u)); color: var(--text-muted); }
.dd-entry {
  position: relative; display: flex; flex-direction: column; gap: calc(10 * var(--u)); align-items: flex-start;
  transition: opacity 0.5s ease;
}
.tv .dd-paper { border-radius: calc(22 * var(--u)); transition: width 0.5s cubic-bezier(0.3, 1.2, 0.5, 1); }
.dd-entry.now .dd-paper { width: calc(290 * var(--u)); box-shadow: 0 0 0 calc(4 * var(--u)) var(--accent); }
.dd-entry.prev { opacity: 0.72; }
.dd-entry.prev .dd-paper { width: calc(210 * var(--u)); }
.tv .dd-words {
  aspect-ratio: auto; justify-content: flex-start; border-radius: calc(22 * var(--u)); background: var(--surface);
  border: calc(2 * var(--u)) solid var(--line-strong); font-weight: 800; letter-spacing: -0.01em; text-align: left;
  transition: width 0.5s cubic-bezier(0.3, 1.2, 0.5, 1), font-size 0.5s ease;
}
.tv .dd-words p { margin: 0; }
.dd-entry.now .dd-words { width: calc(520 * var(--u)); min-height: calc(220 * var(--u)); padding: calc(28 * var(--u)) calc(32 * var(--u)); font-size: calc(46 * var(--u)); border-color: var(--accent); }
.dd-entry.prev .dd-words { width: calc(330 * var(--u)); min-height: calc(160 * var(--u)); padding: calc(22 * var(--u)); font-size: calc(30 * var(--u)); }
.tv .dd-words.none { color: var(--text-muted); font-weight: 400; }
.tv .dd-by { gap: calc(10 * var(--u)); font-size: calc(22 * var(--u)); }
.tv .dd-by-critter { width: calc(36 * var(--u)); }
.dd-kind {
  font-family: var(--mono); font-size: calc(13 * var(--u)) !important; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.dd-dots { display: flex; justify-content: center; gap: calc(10 * var(--u)); }
.dd-dots i { width: calc(12 * var(--u)); height: calc(12 * var(--u)); border-radius: 9999px; background: var(--line-strong); transition: background-color 0.3s ease, transform 0.4s cubic-bezier(0.3, 1.8, 0.4, 1); }
.dd-dots i.on { background: var(--text-muted); }
.dd-dots i.now { background: var(--accent); transform: scale(1.3); }

/* Voting: the whole chain in a row. */
.dd-vote-head { display: flex; align-items: baseline; gap: calc(24 * var(--u)); }
.dd-vote-head .t-lede { font-size: calc(22 * var(--u)); }
/* Each entry as big as fits: up to 200 units, fewer when the chain is long. */
.dd-strip {
  --cell: min(calc(200 * var(--u)), calc((1152 * var(--u) - 16 * var(--u) * (var(--n, 6) - 1)) / var(--n, 6)));
  display: grid; grid-template-columns: repeat(var(--n, 6), var(--cell)); gap: calc(16 * var(--u)); align-items: start;
}
.dd-strip.n-3 { --n: 3; } .dd-strip.n-4 { --n: 4; } .dd-strip.n-5 { --n: 5; } .dd-strip.n-6 { --n: 6; } .dd-strip.n-7 { --n: 7; } .dd-strip.n-8 { --n: 8; }
.dd-entry.small { min-width: 0; align-items: stretch; }
.dd-entry.small .dd-paper { width: 100%; }
.dd-entry.small .dd-words { width: 100%; aspect-ratio: 1; padding: calc(14 * var(--u)); font-size: calc(22 * var(--u)); justify-content: center; text-align: center; }
.dd-entry.small .dd-by { font-size: calc(16 * var(--u)); }
.dd-entry.small .dd-by-critter { width: calc(26 * var(--u)); }
.dd-entry.small .dd-kind { display: none; }
.tv .dd-count { top: calc(-10 * var(--u)); right: calc(-6 * var(--u)); padding: calc(4 * var(--u)) calc(12 * var(--u)); font-size: calc(14 * var(--u)); }

/* The votes in: everything readable, the favourite ringed. */
.dd-choice.closed:disabled { opacity: 1; }
.dd-entry.small.top .dd-paper, .dd-entry.small.top .dd-words { box-shadow: 0 0 0 calc(4 * var(--u)) var(--accent); }
