:root {
  --bg: #f7f1e8;
  --chrome: #ffffff;
  --ink: #2b2521;
  --ink-soft: #6f655d;
  --hover: #f3ece3;
  --line: rgba(43, 37, 33, 0.1);
  --tile: #faf6f0;
  --muted: #c9c0b7;
  --ring-dim: #ddd5cc;
  --solid: #2b2521;
  --on-solid: #ffffff;
  --glass: rgba(255, 255, 255, 0.86);
  --veil: rgba(247, 241, 232, 0.82);
  --backdrop: rgba(43, 37, 33, 0.35);
  --ok-bg: #dff7e6;
  --ok-ink: #1f8a43;
  --danger-bg: #ffe1e1;
  --paper: #ffffff;
  --swatch-edge: rgba(0, 0, 0, 0.12);
  --sophie: #ff5c8a;
  --amp: #ffb020;
  --kat: #4f7cff;
  --danger: #ff4d4f;
  --ok: #30c85e;
  --shadow-sm: 0 1px 2px rgba(70, 45, 20, 0.08), 0 2px 6px rgba(70, 45, 20, 0.06);
  --shadow: 0 1px 3px rgba(70, 45, 20, 0.06), 0 10px 30px rgba(70, 45, 20, 0.1);
  --shadow-lg: 0 20px 60px rgba(40, 25, 10, 0.25);
  --rainbow: conic-gradient(#ff3b30, #ff8a00, #ffd60a, #30c85e, #00bfb3, #2f7bff, #8f5cff, #ff4fa3, #ff3b30);
  --gutter: 16px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

/* Themes: chosen per device in Customize. "Auto" follows the device's dark mode.
   The paper itself stays white (or the chosen paper) so drawings look the same everywhere. */
:root[data-theme="dark"] {
  --swatch-edge: rgba(255, 255, 255, 0.32);
  --bg: #17141a;
  --chrome: #25212a;
  --ink: #f3eee8;
  --ink-soft: #b3aaa1;
  --hover: #332d38;
  --line: rgba(255, 255, 255, 0.12);
  --tile: #2e2833;
  --muted: #6e6676;
  --ring-dim: #4a4351;
  --solid: #f3eee8;
  --on-solid: #1c1820;
  --glass: rgba(37, 33, 42, 0.86);
  --veil: rgba(23, 20, 26, 0.82);
  --backdrop: rgba(0, 0, 0, 0.55);
  --ok-bg: #1d3b27;
  --ok-ink: #7ee2a0;
  --danger-bg: #4a2023;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
  --swatch-edge: rgba(255, 255, 255, 0.32);
    --bg: #17141a;
    --chrome: #25212a;
    --ink: #f3eee8;
    --ink-soft: #b3aaa1;
    --hover: #332d38;
    --line: rgba(255, 255, 255, 0.12);
    --tile: #2e2833;
    --muted: #6e6676;
    --ring-dim: #4a4351;
    --solid: #f3eee8;
    --on-solid: #1c1820;
    --glass: rgba(37, 33, 42, 0.86);
    --veil: rgba(23, 20, 26, 0.82);
    --backdrop: rgba(0, 0, 0, 0.55);
    --ok-bg: #1d3b27;
    --ok-ink: #7ee2a0;
    --danger-bg: #4a2023;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

:root[data-theme="midnight"] {
  --swatch-edge: rgba(255, 255, 255, 0.32);
  --bg: #121530;
  --chrome: #1d2147;
  --ink: #eef0ff;
  --ink-soft: #a9aed8;
  --hover: #2a2f5e;
  --line: rgba(255, 255, 255, 0.12);
  --tile: #252a55;
  --muted: #5d6299;
  --ring-dim: #3a3f72;
  --solid: #9aa5ff;
  --on-solid: #121530;
  --glass: rgba(29, 33, 71, 0.86);
  --veil: rgba(18, 21, 48, 0.82);
  --backdrop: rgba(0, 0, 0, 0.55);
  --ok-bg: #1f3a3a;
  --ok-ink: #8de8c4;
  --danger-bg: #4a2036;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

:root[data-theme="bubblegum"] {
  --bg: #ffe6f0;
  --ink: #4a2340;
  --ink-soft: #8a5a7c;
  --hover: #ffd6e8;
  --line: rgba(74, 35, 64, 0.12);
  --tile: #fff0f6;
  --muted: #e2b3c9;
  --ring-dim: #f3cfe0;
  --solid: #e0457b;
  --veil: rgba(255, 230, 240, 0.82);
  --backdrop: rgba(74, 35, 64, 0.35);
}

:root[data-theme="ocean"] {
  --bg: #e1f1fb;
  --ink: #133049;
  --ink-soft: #4d6b84;
  --hover: #d0e7f6;
  --line: rgba(19, 48, 73, 0.12);
  --tile: #eef7fc;
  --muted: #a9c6da;
  --ring-dim: #c7dceb;
  --solid: #1f6fb2;
  --veil: rgba(225, 241, 251, 0.82);
  --backdrop: rgba(19, 48, 73, 0.35);
}

:root[data-theme="forest"] {
  --bg: #e6f0e1;
  --ink: #1f3320;
  --ink-soft: #5a6e57;
  --hover: #d6e6ce;
  --line: rgba(31, 51, 32, 0.12);
  --tile: #f0f6ec;
  --muted: #b2c7aa;
  --ring-dim: #cfdec8;
  --solid: #2f7d45;
  --veil: rgba(230, 240, 225, 0.82);
  --backdrop: rgba(31, 51, 32, 0.35);
}

/* Paper styles, also per device. Only how the page looks here: saved pictures stay white. */
:root[data-paper="cream"] { --paper: #fff8ea; }
:root[data-paper="dots"] {
  --paper: radial-gradient(circle, rgba(60, 50, 40, 0.18) 1.4px, transparent 1.6px) center / 26px 26px, #ffffff;
}
:root[data-paper="grid"] {
  --paper: linear-gradient(rgba(70, 110, 160, 0.14) 1px, transparent 1px) center / 28px 28px,
    linear-gradient(90deg, rgba(70, 110, 160, 0.14) 1px, transparent 1px) center / 28px 28px, #ffffff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

[hidden] { display: none !important; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px var(--gutter);
}

.wordmark {
  margin: 0;
  font-size: clamp(20px, 1.8vw + 12px, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.wordmark-btn {
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.site-logo {
  display: block;
  height: 56px;
  max-width: 320px;
  margin: -6px 0;
  object-fit: contain;
  object-position: left center;
}

.wordmark.has-logo .wordmark-text { display: none; }

.wordmark .sophie { color: var(--sophie); }
.wordmark .amp { color: var(--amp); }
.wordmark .kat { color: var(--kat); }

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider {
  width: 1px;
  height: 26px;
  margin: 0 2px;
  background: var(--line);
}

.btn {
  appearance: none;
  border: 0;
  height: 44px;
  min-width: 44px;
  padding: 0 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--chrome);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.btn svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.btn:active:not(:disabled) { transform: scale(0.93); }
.btn:disabled { opacity: 0.35; cursor: default; }

.btn .label { padding-right: 4px; }

.btn[aria-pressed="true"] {
  background: var(--solid);
  color: var(--on-solid);
}

.btn-primary {
  padding: 0 18px;
  background: var(--solid);
  color: var(--on-solid);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn.link {
  height: auto;
  min-width: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--kat);
  font-size: inherit;
  text-decoration: underline;
}

/* The "more" menu */

.menu-anchor { position: relative; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 210px;
  padding: 6px;
  border-radius: 18px;
  background: var(--chrome);
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s ease-out;
}

.menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.menu button svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.menu button:disabled { opacity: 0.35; cursor: default; }
.app[data-mode="day"] #clear,
.app:not([data-mode="day"]) #new-page { display: none; }
.menu .danger { color: var(--danger); }
.menu .is-off .wave { opacity: 0; }

/* ---------- Game bar ---------- */

.game-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 var(--gutter) 10px;
  padding: 8px 8px 8px 16px;
  border-radius: 20px;
  background: var(--chrome);
  box-shadow: var(--shadow-sm);
}

.game-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.game-heading small {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.game-heading strong {
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-players {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.player {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.player.is-me { box-shadow: inset 0 0 0 2px var(--line); }

.player.is-done {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.player.is-done::after { content: " ✓"; }

.game-timer {
  min-width: 74px;
  padding: 6px 12px;
  border-radius: 14px;
  background: var(--hover);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.game-timer.is-urgent {
  background: var(--danger-bg);
  color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

/* ---------- Paper ---------- */

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  padding: 0 var(--gutter);
}

.paper-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}

/* Who's here and the chat: a column tucked into the empty margin beside the
   page (app.js picks the spot), so the page itself never moves or shrinks. */
.side {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  pointer-events: none; /* the column's empty space doesn't block anything */
}

.side > * { pointer-events: auto; }

/* Above the page instead (portrait iPad, phones): one row, centered. */
.side[data-dock="top"] {
  left: 0;
  right: 0;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  flex-direction: row;
  align-items: center;
}

.people {
  flex: none;
  min-height: 0;
  max-height: 55%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 12px;
  overflow-y: auto;
  border-radius: 22px;
  background: var(--chrome);
  box-shadow: var(--shadow);
}

/* The panel is narrow, so "Reconnecting…" gets its own line under the day. */
.people[data-dock="side"] .people-where { flex-wrap: wrap; row-gap: 2px; }
.people[data-dock="side"] .people-where small { flex-basis: 100%; margin-left: 16px; white-space: normal; }
.people-where small:empty { display: none; }

.app:not([data-mode="day"]) .people { display: none; }

/* ---------- Chat ---------- */

.chat {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 8px;
  border-radius: 22px;
  background: var(--chrome);
  box-shadow: var(--shadow);
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.chat-head h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: -4px -6px -4px 0;
  border: 0;
  border-radius: 50%;
  background: var(--hover);
  color: var(--ink);
}

.chat-close svg { width: 15px; height: 15px; }

.chat-form {
  display: flex;
  gap: 6px;
}

/* 16px keeps iOS from zooming the page when the box is tapped. */
#chat-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 0;
  border-radius: 12px;
  background: var(--tile);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

#chat-input:focus { outline: 2px solid var(--kat); outline-offset: 0; }

.chat-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--solid);
  color: var(--on-solid);
}

.chat-send svg { width: 18px; height: 18px; }

/* Oldest at the top, newest at the bottom just above the box you type in. */
.chat-log {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.32;
  overflow-wrap: anywhere;
}

.chat-msg b {
  margin-right: 5px;
  font-weight: 800;
}

.chat-msg.is-mine b { color: var(--ink-soft) !important; }
.chat-msg.is-pending { opacity: 0.5; }

.chat-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  justify-items: start;
  gap: 4px 6px;
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--tile);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.chat-note b { color: var(--ink); font-weight: 800; }
.chat-note .chat-emoji { font-size: 14px; line-height: 1.1; }
.chat-note img,
.chat-note button { grid-column: 2; }

.chat-note img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.chat-note button {
  padding: 2px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--chrome);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.chat-time {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.chat-empty {
  padding: 10px 4px;
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
}

/* Not enough margin for the whole chat: a button that opens it over the page. */
.chat-toggle {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 16px;
  background: var(--chrome);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.chat-toggle[hidden] { display: none; }
.chat-toggle svg { width: 20px; height: 20px; }
.chat-toggle[aria-expanded="true"] { background: var(--solid); color: var(--on-solid); }

.chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.chat-badge[hidden] { display: none; }

.side[data-size="faces"] .chat-toggle { padding: 0; width: 44px; }
.side[data-size="faces"] .chat-toggle-label,
.side[data-dock="top"][data-size="slim"] .chat-toggle-label { display: none; }
.side[data-dock="top"] .chat-toggle { height: 40px; }
.side[data-dock="top"][data-size="slim"] .chat-toggle { width: 36px; height: 34px; padding: 0; border-radius: 12px; }

.side[data-chat="docked"] .chat-close { display: none; }
.side[data-chat="pop"] .people { max-height: calc(100% - 54px); }

/* A narrower margin: the same chat, smaller (the keyboard's Send key sends). */
.side[data-size="slim"][data-chat="docked"] .chat { gap: 6px; padding: 8px 6px 6px; border-radius: 18px; }
.side[data-size="slim"][data-chat="docked"] .chat-send { display: none; }
.side[data-size="slim"][data-chat="docked"] #chat-input { height: 34px; padding: 0 8px; border-radius: 10px; }
.side[data-size="slim"][data-chat="docked"] .chat-msg { font-size: 12px; }
.side[data-size="slim"][data-chat="docked"] .chat-note { padding: 5px 6px; font-size: 11px; }

/* Opened from the button: floats over the page's top-right corner. */
.side[data-chat="pop"] .chat {
  position: fixed;
  z-index: 30;
  top: var(--pop-top);
  right: var(--pop-right);
  width: var(--pop-w);
  height: var(--pop-h);
  box-shadow: var(--shadow-lg);
}

.side[data-chat="pop"]:not(.is-chat-open) .chat { display: none; }

.people-where {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.people-where i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amp);
  animation: pulse 1.2s ease-in-out infinite;
}

.people-where[data-state="online"] i {
  background: var(--ok);
  animation: none;
}

.people-where[data-state="sleeping"] i {
  background: var(--muted);
  animation: none;
}

.people-where small {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.people-group h3 {
  margin: 0 0 6px;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.person {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.person:disabled { cursor: default; }
.person:not(:disabled):active { background: var(--hover); }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.person-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.person-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.person-where {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}

.people-empty {
  padding: 2px 6px;
  color: var(--ink-soft);
  font-size: 13px;
}

.people-me {
  margin: auto 0 0;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

/* Sized by app.js to the largest 4:3 sheet that fits. */
.paper {
  position: relative;
  background: var(--paper);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

#canvas,
#wet {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#canvas {
  touch-action: none;
  cursor: crosshair;
}

/* Name tags that follow other people's pens while they draw. */
.pen-tags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.pen-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 90ms linear, opacity 0.35s ease;
  will-change: transform;
}

/* The pointy corner faces the pen tip. */
.pen-tag[data-side="right"][data-above="true"] { border-bottom-left-radius: 4px; }
.pen-tag[data-side="left"][data-above="true"] { border-bottom-right-radius: 4px; }
.pen-tag[data-side="right"][data-above="false"] { border-top-left-radius: 4px; }
.pen-tag[data-side="left"][data-above="false"] { border-top-right-radius: 4px; }

.pen-tag i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  font-size: 11px;
  font-style: normal;
}

.pen-tag.is-done { opacity: 0; }

/* In the people list: a little pencil on the face of whoever is drawing right now. */
.avatar.is-drawing { position: relative; }

.avatar.is-drawing::after {
  content: "✏️";
  position: absolute;
  right: -6px;
  bottom: -5px;
  font-size: 13px;
  line-height: 1;
  animation: scribble 0.6s ease-in-out infinite alternate;
}

@keyframes scribble {
  from { transform: rotate(-12deg) translateX(-1px); }
  to { transform: rotate(10deg) translateX(1px); }
}

/* While two fingers pinch, the drawn page is just stretched (see app.js). */
#canvas,
#wet { transform-origin: 0 0; }

.zoom-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px 7px 9px;
  border: 0;
  border-radius: 999px;
  background: var(--chrome);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.zoom-btn svg { width: 18px; height: 18px; }
.zoom-btn[hidden] { display: none; }

#wet { pointer-events: none; }

.paper.is-locked #canvas { cursor: default; }

.presence {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}

.presence i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amp);
  animation: pulse 1.2s ease-in-out infinite;
}

.presence[data-state="online"] i {
  background: var(--ok);
  animation: none;
}

.presence[data-state="sleeping"] i {
  background: var(--muted);
  animation: none;
}

.today-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--amp);
  color: #3b2600;
  font-size: 14px;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.app[data-mode="game"] #days-btn,
.app[data-mode="game"] .presence,
.app[data-mode="game"] .today-btn,
.app[data-mode="logo"] #days-btn,
.app[data-mode="logo"] #game-btn,
.app[data-mode="logo"] .presence,
.app[data-mode="logo"] .today-btn { display: none; }

.game-conn {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff1d6;
  color: #8a5a00;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  animation: pulse 1.2s ease-in-out infinite;
}

.logo-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  margin: 0;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

/* The game's cards sit over the page. */
.game-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--veil);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  overflow: auto;
}

.game-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 24px;
  background: var(--chrome);
  box-shadow: var(--shadow);
  text-align: center;
  animation: pop 0.2s ease-out;
}

.game-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
}

.game-card p {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.game-card .game-kicker {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 800;
  color: var(--sophie);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.game-card .game-prompt-big {
  font-size: clamp(24px, 3vw + 12px, 36px);
  line-height: 1.15;
  color: var(--ink);
}

.game-card .game-note { font-size: 14px; }
.game-card .game-note:empty { display: none; }

.game-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 14px;
}

.game-actions .btn { height: 50px; }

.vote-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.btn.vote {
  height: auto;
  min-height: 78px;
  flex-direction: column;
  gap: 4px;
  padding: 10px 6px;
  background: var(--hover);
  box-shadow: none;
}

.vote strong { font-size: 18px; }

.vote .voters {
  min-height: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.vote-reroll strong::before {
  content: "🎲";
  display: block;
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}

.btn.vote.is-picked {
  background: var(--solid);
  color: var(--on-solid);
}

.vote.is-picked .voters { color: var(--on-solid); opacity: 0.75; }

/* ---------- Toolbar ---------- */

.toolbar {
  position: relative;
  align-self: center;
  margin: 12px var(--gutter) 16px;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 20px;
  background: var(--chrome);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.colors {
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.tool,
.size,
.swatch,
.brush-tile,
.gem-tile {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.tool:active,
.size:active,
.swatch:active,
.brush-tile:active,
.gem-tile:active { transform: scale(0.9); }

.tool {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: var(--ink);
}

.tool svg {
  width: 26px;
  height: 26px;
}

.tool[aria-pressed="true"] {
  background: var(--solid);
  color: var(--on-solid);
}

.tool.brush-btn {
  width: 62px;
  display: flex;
  gap: 1px;
  justify-content: center;
}

.brush-icon { display: grid; }

.brush-icon svg {
  width: 26px;
  height: 26px;
}

.brush-btn .caret {
  width: 12px;
  height: 12px;
  opacity: 0.6;
}

.gem-icon {
  width: 26px;
  height: 26px;
}

.size {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.size i {
  display: block;
  width: var(--d);
  height: var(--d);
  border-radius: 50%;
  background: var(--current, var(--ink));
  box-shadow: inset 0 0 0 1px var(--swatch-edge);
}

.toolbar[data-tool="rainbow"] .size i { background: var(--rainbow); }

.toolbar[data-tool="eraser"] .size i {
  background: var(--chrome);
  box-shadow: inset 0 0 0 2px var(--muted);
}

.toolbar[data-sticker] .size i {
  background: radial-gradient(circle at 35% 30%, #fff, #a8d8ff 35%, #3d6fd8 80%);
}

.size[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ink); }

.swatch {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.swatch i {
  position: relative;
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px var(--swatch-edge);
  transition: box-shadow 0.15s ease;
}

.swatch[aria-pressed="true"] i,
.swatch.is-selected i {
  box-shadow: inset 0 0 0 1px var(--swatch-edge), 0 0 0 3px var(--chrome), 0 0 0 5px var(--ink);
}

/* Color is remembered while the rainbow, eraser or a gem is in hand, so its ring fades. */
.toolbar[data-colorless] .swatch[aria-pressed="true"] i,
.toolbar[data-colorless] .swatch.is-selected i {
  box-shadow: inset 0 0 0 1px var(--swatch-edge), 0 0 0 3px var(--chrome), 0 0 0 5px var(--ring-dim);
}

.swatch.custom i { background: var(--rainbow); }

/* The sticker maker's border switch. */
.maker-option { white-space: nowrap; }
.maker-option[aria-pressed="false"] { background: var(--tile); color: var(--ink-soft); }

.swatch.custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* Trays that pop up above the toolbar */

.tray {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 20;
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 12px;
  border-radius: 22px;
  background: var(--chrome);
  box-shadow: var(--shadow-lg);
  animation: rise 0.18s ease-out;
}

.brush-tray {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: 6px;
}

.brush-tile {
  width: 116px;
  padding: 6px 4px 8px;
  border-radius: 16px;
  gap: 2px;
  background: var(--tile);
}

.brush-tile span {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

.brush-tile[aria-pressed="true"],
.gem-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--ink); }

.brush-tile[aria-pressed="true"] span { color: var(--ink); }

/* Big enough to show every sticker; if the family draws loads, the list
   scrolls without a scroll bar. app.js caps the height to the space above. */
.gem-tray {
  width: min(640px, calc(100vw - 2 * var(--gutter)));
  display: flex;
  flex-direction: column;
}

.gem-tray .sticker-pane {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.gem-tray .sticker-pane::-webkit-scrollbar { display: none; }
.gem-tray .sticker-pane[hidden] { display: none; }

.tray-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tray-bar .tray-label { margin-bottom: 6px; }

.tray-link {
  margin: -4px 0 2px;
  padding: 5px 10px;
  border: 0;
  border-radius: 10px;
  background: var(--tile);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.tray-link[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); }

/* Deleting: each family sticker wiggles and gets a red ✕. */
.sticker-grid.is-editing .sticker-tile.make { display: none; }
.sticker-grid.is-editing .sticker-tile[data-sticker] {
  position: relative;
  animation: jiggle 0.3s ease-in-out infinite alternate;
}

.sticker-grid.is-editing .sticker-tile[data-sticker]::after {
  content: "✕";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font: 800 11px/20px var(--font);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

@keyframes jiggle {
  from { transform: rotate(-2.5deg); }
  to { transform: rotate(2.5deg); }
}

.confirm-sticker-img {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 8px;
  object-fit: contain;
}

.tray-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.tray-tab {
  flex: 1;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--tile);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 800;
}

.tray-tab[aria-selected="true"] {
  background: var(--solid);
  color: var(--on-solid);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 5px;
  margin-bottom: 8px;
}

.sticker-tile {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--tile);
  font-size: 30px;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.12s ease;
}

.sticker-tile:active { transform: scale(0.88); }
.sticker-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--solid); }

.sticker-tile img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.25));
}

.sticker-tile.make {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  border: 2px dashed var(--muted);
  background: transparent;
}

.sticker-tile.make b {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.tray-label {
  margin: 2px 4px 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tray-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.gem-tile {
  padding: 4px;
  border-radius: 14px;
  background: var(--tile);
}

.tray-hint {
  margin: 0 4px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Margin above the page (portrait iPad, phones): the list becomes a strip. */
.people[data-dock="top"] {
  flex: 0 1 auto;
  min-width: 0;
  max-height: none;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  border-radius: 18px;
  white-space: nowrap;
}

.people[data-dock="top"]::-webkit-scrollbar { display: none; }

.people[data-dock="top"] .people-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.people[data-dock="top"] .people-group h3 { margin: 0; }
.people[data-dock="top"] .people-list { flex-direction: row; gap: 4px; }

.people[data-dock="top"] .person {
  width: auto;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: var(--tile);
}

.people[data-dock="top"] .avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.people[data-dock="top"] .person-where,
.people[data-dock="top"] .people-me { display: none; }
.people[data-dock="top"] .people-where small { margin-left: 4px; }
.people[data-dock="top"] .person-text { flex-direction: row; align-items: baseline; gap: 4px; }
.people[data-dock="top"] .person-you { display: inline; }

/* A thin margin above: smaller strip, faces only. */
.people[data-dock="top"][data-size="slim"] { gap: 10px; padding: 5px 10px; border-radius: 14px; }
.people[data-dock="top"][data-size="slim"] .person { padding: 0; background: none; }
.people[data-dock="top"][data-size="slim"] .person-text,
.people[data-dock="top"][data-size="slim"] .people-where span { display: none; }
.people[data-dock="top"][data-size="slim"] .people-where { font-size: 13px; }

/* A narrower margin beside the page: same list, smaller. */
.people[data-size="slim"][data-dock="side"] { gap: 10px; padding: 10px 6px; border-radius: 18px; }
.people[data-size="slim"][data-dock="side"] .people-where { gap: 6px; font-size: 13px; }
.people[data-size="slim"][data-dock="side"] .people-where small { margin-left: 14px; font-size: 11px; }
.people[data-size="slim"] .people-group h3 { margin-bottom: 3px; font-size: 9px; letter-spacing: 0.04em; white-space: normal; }
.people[data-size="slim"][data-dock="side"] .person { gap: 6px; padding: 4px; border-radius: 10px; }
.people[data-size="slim"][data-dock="side"] .avatar { width: 24px; height: 24px; font-size: 12px; }
.people[data-size="slim"][data-dock="side"] .person-name { font-size: 12px; }
.people[data-size="slim"][data-dock="side"] .person-where { font-size: 10px; }
.people[data-size="slim"] .people-empty { padding: 0 4px; font-size: 11px; }
.people[data-size="slim"] .people-me { font-size: 11px; }

/* Barely any margin: a slim column of faces (tap one to go to their page). */
.people[data-size="faces"] { align-items: center; gap: 10px; padding: 10px 4px; border-radius: 16px; }
.people[data-size="faces"] .people-where { justify-content: center; padding: 0; }
.people[data-size="faces"] .people-where span,
.people[data-size="faces"] .people-where small,
.people[data-size="faces"] .person-where,
.people[data-size="faces"] .people-empty,
.people[data-size="faces"] .people-me { display: none; }
.people[data-size="faces"] .people-group { display: flex; flex-direction: column; align-items: center; }
.people[data-size="faces"] .people-group h3 { margin: 0 0 4px; padding: 0; font-size: 0; letter-spacing: 0; }
.people[data-size="faces"] .people-group h3::after { content: attr(data-short); font-size: 8px; letter-spacing: 0.04em; }
.people[data-size="faces"] .people-list { align-items: center; gap: 4px; }
.people[data-size="faces"] .person { flex-direction: column; gap: 2px; width: 100%; padding: 2px 0; text-align: center; }
.people[data-size="faces"] .people-group,
.people[data-size="faces"] .people-list,
.people[data-size="faces"] .people-list li { width: 100%; }
.people[data-size="faces"] .person-text { width: 100%; align-items: center; }
.people[data-size="faces"] .person-name { max-width: 100%; font-size: 10px; font-weight: 700; }
.people[data-size="faces"] .avatar { width: 30px; height: 30px; font-size: 13px; }
/* Nobody else online: a little dash keeps the section from looking broken. */
.people[data-size="faces"] .people-list:has(> .people-empty:only-child)::after { content: "–"; color: var(--ink-soft); font-size: 12px; }


@media (hover: hover) {
  .person:not(:disabled):hover { background: var(--hover); }
  .btn:hover:not(:disabled):not(.btn-primary):not(.btn-danger):not([aria-pressed="true"]):not(.link):not(.is-picked) { background: var(--hover); }
  .menu button:hover:not(:disabled) { background: var(--hover); }
  .tool:hover:not([aria-pressed="true"]),
  .size:hover { background: var(--hover); }
  .brush-tile:hover,
  .gem-tile:hover { background: var(--hover); }
}

:focus-visible {
  outline: 3px solid var(--kat);
  outline-offset: 2px;
}

/* ---------- Dialogs ---------- */

dialog {
  width: min(380px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--chrome);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font-family: var(--font);
  text-align: center;
}

dialog[open] { animation: pop 0.18s ease-out; }

dialog::backdrop { background: var(--backdrop); }


.dialog-body { padding: 24px; }

.dialog-body h2 {
  margin: 4px 0 8px;
  font-size: 22px;
  font-weight: 800;
}

.dialog-body p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.dialog-actions {
  display: flex;
  gap: 10px;
}

.dialog-actions .btn {
  flex: 1;
  height: 50px;
  font-size: 16px;
  box-shadow: none;
}

.dialog-actions .btn:not(.btn-danger):not(.btn-primary) { background: var(--hover); }

.name-quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.btn.name-chip {
  height: 46px;
  padding: 0 18px;
  background: var(--hover);
  box-shadow: none;
  font-size: 17px;
}

#name-input {
  width: 100%;
  height: 50px;
  margin-bottom: 14px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  font: inherit;
  font-size: 17px;
  text-align: center;
  -webkit-user-select: text;
  user-select: text;
}

/* Sheets: Days, the reveal, past rounds */

.sheet {
  width: min(900px, calc(100vw - 24px));
  max-height: min(88vh, 960px);
  text-align: left;
}

.sheet[open] {
  display: flex;
  flex-direction: column;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px 22px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.sheet-sub {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.sheet-head .btn {
  background: var(--hover);
  box-shadow: none;
}

.sheet-note {
  margin: 0;
  padding: 0 22px 18px;
  font-size: 15px;
  color: var(--ink-soft);
  text-align: center;
}

.sheet-note:empty { display: none; }

.sheet .more {
  align-self: center;
  flex: none;
  margin: 0 0 20px;
  background: var(--hover);
  box-shadow: none;
}

.sheet .btn-primary.more {
  height: 50px;
  padding: 0 28px;
  background: var(--solid);
  color: var(--on-solid);
}

.sheet-head-actions {
  display: flex;
  gap: 8px;
}

.sheet-head-actions .btn-primary {
  background: var(--solid);
  color: var(--on-solid);
}

.sheet-intro { padding: 0 22px 12px; }

.logos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 4px 22px 18px;
  overflow-y: auto;
}

.logo-card {
  position: relative;
  display: grid;
  place-items: center;
  height: 110px;
  padding: 14px;
  border: 0;
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}

.logo-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-card .wordmark-text {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-card .sophie { color: var(--sophie); }
.logo-card .amp { color: var(--amp); }
.logo-card .kat { color: var(--kat); }

.logo-card.is-current { box-shadow: 0 0 0 3px var(--ink); }

.logo-card.is-current::after {
  content: "In use";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--solid);
  color: var(--on-solid);
  font-size: 12px;
  font-weight: 800;
}

/* Customize */

.sheet-scroll { overflow-y: auto; }

.custom-section { padding: 0 22px 18px; }

.custom-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 800;
}

.custom-section > p {
  margin: -4px 0 10px;
  color: var(--ink-soft);
  font-size: 14px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 0;
  border-radius: 16px;
  background: var(--tile);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 2.5px var(--solid); }

.theme-swatch {
  position: relative;
  width: 72px;
  height: 52px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.theme-swatch i {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 7px;
  height: 14px;
  border-radius: 6px;
}

.theme-swatch b {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 6px;
}

.paper-swatch {
  width: 72px;
  height: 52px;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--swatch-edge);
}

.choice.segment {
  min-width: 74px;
  padding: 12px 14px;
  font-size: 15px;
}

.icon-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 10px;
  border-radius: 16px;
  background: var(--tile);
}

.icon-preview {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--chrome);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.icon-preview svg {
  width: 26px;
  height: 26px;
}

.icon-preview img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.icon-card strong { font-size: 14px; }

.icon-actions {
  display: flex;
  gap: 6px;
}

.icon-actions .btn {
  height: 34px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: none;
}

.icon-actions .btn:not(.btn-primary) { background: var(--chrome); }

/* A family-drawn button picture in place of the usual icon. */
.btn .custom-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.days-grid {
  padding: 4px 22px 18px;
  overflow-y: auto;
}

.day-group + .day-group { margin-top: 20px; }

.day-group h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 800;
}

.day-group h3 small {
  margin-left: 4px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.day-pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.day-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}

.day-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}

.day-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.day-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.day-card.is-current .day-thumb { box-shadow: 0 0 0 3px var(--ink), var(--shadow-sm); }

.day-name {
  padding: 0 4px;
  font-size: 15px;
  font-weight: 800;
}

.reveal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 4px 22px 22px;
  overflow-y: auto;
}

.reveal-entry {
  margin: 0;
  cursor: zoom-in;
}

.reveal-entry.is-big {
  grid-column: 1 / -1;
  cursor: zoom-out;
}

.reveal-art {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}

.reveal-entry figcaption {
  padding: 8px 4px 0;
  font-size: 17px;
  font-weight: 800;
}

.rounds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 18px 18px;
  overflow-y: auto;
}

.round-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--tile);
  text-align: left;
}

.round-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.round-text strong {
  font-size: 17px;
  font-weight: 800;
}

.round-text small {
  font-size: 13px;
  color: var(--ink-soft);
}

.round-thumbs {
  display: flex;
  gap: 6px;
}

.round-thumbs img {
  width: 72px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}

/* ---------- Toast & tip ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 130px);
  z-index: 30;
  transform: translate(-50%, 8px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--solid);
  color: var(--on-solid);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.home-tip {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 72px);
  z-index: 30;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 18px;
  background: var(--solid);
  color: var(--on-solid);
  box-shadow: var(--shadow-lg);
  animation: tip-in 0.3s ease-out;
}

.home-tip p {
  margin: 0;
  flex: 1;
  font-size: 15px;
  line-height: 1.35;
}

.home-tip svg {
  width: 18px;
  height: 18px;
  vertical-align: -3px;
}

.home-tip em {
  font-style: normal;
  font-weight: 700;
  color: var(--amp);
}

.home-tip .btn {
  flex: none;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  box-shadow: none;
}

@keyframes tip-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .btn .label { display: none; }
}

@media (max-width: 560px) {
  :root { --gutter: 12px; }

  .topbar { padding: 10px var(--gutter); }
  .wordmark { font-size: 19px; }

  .site-logo {
    height: 42px;
    max-width: 128px;
    margin: -2px 0;
  }

  .sheet-head { flex-wrap: wrap; }
  .logos-grid { grid-template-columns: repeat(2, 1fr); padding: 4px 14px 14px; }
  .logo-card { height: 84px; }
  .actions { gap: 5px; }
  .divider { display: none; }

  .btn {
    height: 40px;
    min-width: 40px;
    padding: 0 8px;
    border-radius: 12px;
  }

  .paper { border-radius: 18px; }

  .game-bar {
    flex-wrap: wrap;
    padding: 8px 8px 8px 12px;
  }

  .game-heading strong { font-size: 16px; }

  .game-players {
    order: 5;
    width: 100%;
    justify-content: flex-start;
  }

  .game-timer {
    min-width: 60px;
    font-size: 18px;
  }

  .game-card { padding: 18px; }
  .vote-grid { grid-template-columns: repeat(2, 1fr); }

  .toolbar {
    margin: 10px var(--gutter) 12px;
    padding: 6px 8px;
    gap: 4px 12px;
    border-radius: 22px;
  }

  .tool {
    width: 42px;
    height: 42px;
    border-radius: 14px;
  }

  .tool.brush-btn { width: 54px; }

  .size,
  .swatch {
    width: 38px;
    height: 38px;
  }

  .swatch i {
    width: 28px;
    height: 28px;
  }

  .swatch[aria-pressed="true"] i,
  .swatch.is-selected i {
    box-shadow: inset 0 0 0 1px var(--swatch-edge), 0 0 0 2.5px var(--chrome), 0 0 0 4.5px var(--ink);
  }

  .toolbar[data-colorless] .swatch[aria-pressed="true"] i,
  .toolbar[data-colorless] .swatch.is-selected i {
    box-shadow: inset 0 0 0 1px var(--swatch-edge), 0 0 0 2.5px var(--chrome), 0 0 0 4.5px var(--ring-dim);
  }

  .brush-tray { grid-template-columns: repeat(3, auto); max-height: 60vh; overflow-y: auto; }
  .sticker-grid { grid-template-columns: repeat(6, 1fr); }
  .brush-tile { width: 104px; }
  .gem-tray { width: calc(100vw - 2 * var(--gutter)); }
  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }


  .days-grid { padding: 4px 14px 14px; }

  .day-pages {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .reveal-grid {
    grid-template-columns: 1fr;
    padding: 4px 14px 14px;
  }

  .round-thumbs img {
    width: 52px;
    height: 39px;
  }

  .custom-section { padding: 0 14px 14px; }

  .theme-swatch,
  .paper-swatch {
    width: 58px;
    height: 44px;
  }

  .icon-row { grid-template-columns: repeat(2, 1fr); }
  .btn .custom-icon { width: 26px; height: 26px; }
}
