/* Betcha Sketch. Layout is drawn at Figma's frame sizes (1440×1024 landscape, 402×874 portrait)
   on a fixed-size "stage" that js/main.js scales to fit the window. */

@font-face {
  font-family: 'Yoster Island';
  src: url('../fonts/yoster.ttf?v=5') format('truetype');
  font-display: block;
}

:root {
  --red: #DE000F;
  --ink: #333333;
  --light: #F2F2F7;
  --mid: #AEAEAE;
  --screen: #D9D9D9;
  --font: 'Yoster Island', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--red);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font);
  color: var(--ink);
  /* The font turns "..." into a tiny ellipsis glyph; keep plain periods everywhere. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0, "dlig" 0;
}
body { position: fixed; inset: 0; }

button, input { font: inherit; color: inherit; font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0, "dlig" 0; }
button { -webkit-tap-highlight-color: transparent; }
.tm { font-size: 0.45em; vertical-align: 0.9em; margin-left: 2px; }

/* ---- Stage ------------------------------------------------------------- */

/* Wear on the red frame (js/frame.js): lighting, grain, dust, scratches. */
.frame-fx { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 0; }
.stage { z-index: 1; }

.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 1024px;
  transform-origin: 0 0;
}
.stage[data-layout="portrait"] { width: 402px; height: 874px; }

.logo {
  position: absolute;
  left: 0;
  right: 0;
  top: 12px;
  height: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  letter-spacing: -0.645px;
  color: var(--light);
  text-shadow: 1px 2px 0 #000;
  pointer-events: none;
}
.logo .tm { font-size: 14px; align-self: flex-start; margin-top: 28px; margin-left: 2px; vertical-align: 0; }
[data-layout="portrait"] .logo { top: 34px; height: 44px; font-size: 22px; }
[data-layout="portrait"] .logo .tm { font-size: 10px; margin-top: 12px; }

/* ---- Screen ------------------------------------------------------------ */

.screen {
  position: absolute;
  left: 100px;
  top: 97px;
  width: 1240px;
  height: 822px;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate; /* its inset shadow stays under the knobs */
  z-index: 0;
  /* Set into the frame: a shadowed lip above, a lit lip below. */
  box-shadow: 0 -2px 0 3px rgba(80, 0, 0, 0.35), 0 3px 0 3px rgba(255, 210, 210, 0.22), 0 0 0 7px rgba(0, 0, 0, 0.06);
  background:
    radial-gradient(farthest-side at 50% 50%,
      rgba(217, 217, 217, 0.3) 0%,
      rgba(163, 163, 163, 0.255) 25%,
      rgba(109, 109, 109, 0.21) 50%,
      rgba(54, 54, 54, 0.165) 75%,
      rgba(0, 0, 0, 0.12) 100%),
    var(--screen);
}
.screen::after { /* inset shadow above everything on the screen */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 4px 4px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 9;
}
.screen::before { /* natural falloff toward the edges of the glass, darker at the bottom */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 60% 55% at 50% 45%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%),
    radial-gradient(ellipse 72% 68% at 50% 46%, transparent 38%, rgba(25, 25, 25, 0.14) 68%, rgba(15, 15, 15, 0.36) 100%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.10));
  box-shadow: inset 0 0 60px 18px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  z-index: 8;
}
[data-layout="portrait"] .screen { left: 12px; top: 84px; width: 378px; height: 658px; border-radius: 20px; }

.ink { position: absolute; left: 0; top: 0; transition: opacity 300ms ease; filter: drop-shadow(2px 3px 0 rgba(40, 40, 40, 0.11)); }
/* The glass over the screen: every element prints a faint offset ghost of itself. */
.ui { filter: drop-shadow(2px 3px 0 rgba(40, 40, 40, 0.09)); }
.ink.faded { opacity: 0.25; }
.ink.hidden { opacity: 0; }

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  background: #000;
  border: 3px solid var(--light);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 2px 3px 0 1px rgba(40, 40, 40, 0.12);
  pointer-events: none;
  z-index: 3;
}
.cursor.off { display: none; }
/* The other team's doodle and cursor on the online waiting screens. */
.ink-remote { opacity: 0.4; }
.ink-remote[hidden] { display: none; }
.cursor.remote {
  background: transparent;
  border-color: var(--ink);
  box-shadow: none;
  opacity: 0.75;
  transition: transform 90ms linear;
}
.cursor.remote span {
  position: absolute;
  left: 14px;
  top: -6px;
  font-size: 15px;
  white-space: nowrap;
  color: var(--ink);
}
.cursor.remote[hidden] { display: none; }
.cursor.faded { opacity: 0.25; }
[data-layout="portrait"] .cursor { width: 11px; height: 11px; }

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(farthest-side at 50% 50%, transparent 45%, rgba(0, 0, 0, 0.6) 100%);
  opacity: 0;
  transition: opacity 400ms ease;
  pointer-events: none;
  z-index: 4;
}
.vignette.on { opacity: 0.6; }
.grain { position: absolute; left: 0; top: 0; z-index: 4; pointer-events: none; }
.vignette.dark { opacity: 1; background: radial-gradient(farthest-side at 50% 50%, rgba(0, 0, 0, 0.12) 20%, rgba(0, 0, 0, 0.6) 100%); }

/* ---- Pages ------------------------------------------------------------- */

.ui { position: absolute; inset: 0; z-index: 2; }

.page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 110px 70px;
  pointer-events: none;
}
.page > * { pointer-events: auto; }
.page .head, .page .body:empty { pointer-events: none; }

.head { text-align: center; flex: none; max-width: 100%; }
.head h1 {
  margin: 0;
  font-size: 60px;
  font-weight: normal;
  line-height: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head .sub { margin: 10px 0 0; font-size: 21px; letter-spacing: -0.5px; min-height: 26px; }

.body {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  pointer-events: none;
}
.body > * { pointer-events: auto; }
.body.top { justify-content: flex-start; }
.foot { flex: none; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.foot.row { flex-direction: row; }

.corner-score {
  position: absolute;
  right: 24px;
  top: 30px;
  font-size: 60px;
  line-height: 70px;
  font-style: italic;
  pointer-events: none;
}

.credit, .hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  font-size: 17px;
  letter-spacing: -0.43px;
  pointer-events: none;
}
.credit { text-transform: uppercase; }
a.credit { left: 50%; right: auto; transform: translateX(-50%); padding: 8px 12px; color: inherit; text-decoration: none; pointer-events: auto; cursor: pointer; }
a.credit:hover, a.credit:focus-visible { text-decoration: underline; }

.big { font-size: 150px; line-height: 1; text-align: center; pointer-events: none; }
.big.word { font-size: 120px; overflow-wrap: anywhere; }

.round-btn {
  position: absolute;
  top: 12px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 0;
  background: var(--mid);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  z-index: 6;
}
.round-btn svg { width: 40px; height: 40px; }
.round-btn.left { left: 12px; }
.round-btn.right { right: 12px; }
.round-btn.dark { background: var(--ink); }
.round-btn:disabled { opacity: 0.4; cursor: default; }

.timerbar {
  position: absolute;
  left: 104px;
  right: 104px;
  top: 20px;
  height: 8px;
  background: var(--mid);
  pointer-events: none;
}
.timerbar > i { display: block; height: 100%; background: var(--ink); transform-origin: 0 0; }

.btn {
  height: 52px;
  width: 334px;
  padding: 0 16px;
  border: 3px solid var(--ink);
  background: transparent;
  font-size: 21px;
  letter-spacing: -0.516px;
  text-transform: uppercase;
  cursor: pointer;
}
.btn.primary { background: var(--ink); color: var(--light); }
.btn.tall { height: 80px; width: 316px; }
.btn:disabled { opacity: 0.35; cursor: default; }

/* ---- Fields, sliders --------------------------------------------------- */

.fields { display: flex; flex-direction: column; gap: 8px; width: 336px; }
.field {
  height: 52px;
  width: 100%;
  padding: 0 16px;
  border: 3px solid transparent;
  background: var(--light);
  font-size: 17px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.field:focus { border-color: var(--ink); }
.field::placeholder { color: var(--mid); }
.field.invalid { border-color: var(--red); }

.setting { width: 410px; display: flex; flex-direction: column; gap: 14px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.setting label { font-size: 17px; text-transform: uppercase; line-height: 1.2; }
.num {
  width: 120px;
  height: 52px;
  padding: 0 12px;
  text-align: right;
  border: 3px solid var(--ink);
  background: var(--light);
  font-size: 21px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
.num:disabled { opacity: 0.6; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  touch-action: none;
  --p: 0%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: linear-gradient(to right, #000 var(--p), var(--mid) var(--p));
}
input[type="range"]::-moz-range-track { height: 4px; background: var(--mid); }
input[type="range"]::-moz-range-progress { height: 4px; background: #000; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -11px;
  background: var(--light);
  border: 3px solid var(--ink);
}
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 0; background: var(--light); border: 3px solid var(--ink); }
input[type="range"]:disabled { opacity: 0.4; }
input[type="range"]:focus { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--mid); }
.btn:focus:not(:focus-visible), .round-btn:focus:not(:focus-visible), .thumb:focus:not(:focus-visible), .wordbox:focus:not(:focus-visible) { outline: none; }

.wordbox {
  min-width: 160px;
  padding: 6px 28px;
  border: 0;
  background: var(--ink);
  color: var(--light);
  font-size: 60px;
  line-height: 73px;
  cursor: pointer;
}
.wordbox.shown { cursor: default; }

.howto { max-width: 880px; font-size: 21px; line-height: 36px; letter-spacing: -0.3px; text-align: left; }
.howto p { margin: 0 0 28px; }
.howto p:last-child { margin-bottom: 0; }

/* A page section that scrolls by itself while the header, tabs and buttons stay put. */
.body.scroll {
  justify-content: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
  margin: 20px 0;
  padding: 8px 12px;
  -webkit-mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 18px), transparent);
  mask-image: linear-gradient(transparent, #000 18px, #000 calc(100% - 18px), transparent);
}

/* ---- Guess --------------------------------------------------------------- */

.scrub { width: 780px; display: flex; align-items: center; gap: 19px; }
.scrub .round-btn { position: static; flex: none; }

/* ---- Scoreboard ---------------------------------------------------------- */

.scores { width: 482px; border-collapse: collapse; font-size: 17px; }
.scores th {
  font-weight: normal;
  font-size: 21px;
  text-transform: uppercase;
  padding: 0 12px 12px;
  border-bottom: 3px solid var(--ink);
}
.scores td { padding: 14px 12px 0; height: 46px; }
.scores .c-team { text-align: left; }
.scores .c-bet { text-align: center; }
.scores .c-total { text-align: right; }
.scores tr.out td { opacity: 0.4; }
.scores tr.win td { font-size: 21px; }
.delta { transition: opacity 400ms ease; }
.delta.gone { opacity: 0; }

.strip {
  display: flex;
  gap: 12px;
  max-width: 100%;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip.marquee { overflow: hidden; width: 100%; max-width: none; }
.strip.center { width: 100%; justify-content: center; overflow: visible; }
.strip .track { display: flex; gap: 12px; flex: none; }
.strip.marquee .track { animation: marquee var(--dur, 30s) linear infinite; }
@keyframes marquee { to { transform: translateX(calc(-50% - 6px)); } }

.thumb {
  flex: none;
  width: 190px;
  height: 190px;
  padding: 0;
  border: 3px solid transparent;
  background: transparent;
  cursor: pointer;
}
.thumb img { display: block; width: 100%; height: 100%; }
.thumb.lost img { opacity: 0.25; }
.thumb.focus { border-color: var(--ink); }
.thumb.selected { border-color: var(--ink); background: rgba(51, 51, 51, 0.12); }
.thumb.selected::after { content: ''; }

/* ---- Gallery ------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(5, 190px);
  gap: 12px;
  overflow-y: auto;
  max-height: 100%;
  padding: 6px;
  align-content: start;
  justify-content: start;
  scrollbar-width: thin;
  touch-action: pan-y;
}
.grid .thumb { width: 190px; height: 190px; }
.empty { font-size: 21px; opacity: 0.6; margin-top: 160px; }

.photo { position: relative; height: 100%; max-height: 560px; aspect-ratio: 1; }
.photo img { width: 100%; height: 100%; display: block; }
.side { top: 50%; margin-top: -40px; }
.round-btn.only-portrait { display: none; position: static; }
.photo-foot { align-items: center; gap: 14px; }
.side.left { left: 112px; }
.side.right { right: 112px; left: auto; }

/* ---- Menu flyout and dialog -------------------------------------------- */

.flyout {
  position: absolute;
  left: 12px;
  top: 104px;
  width: 240px;
  background: var(--light);
  border: 2px solid var(--mid);
  z-index: 7;
}
.flyout button {
  display: block;
  width: 100%;
  height: 55px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid var(--mid);
  background: transparent;
  text-align: left;
  font-size: 21px;
  text-transform: uppercase;
  cursor: pointer;
}
.flyout button:last-child { border-bottom: 0; }
.flyout button:disabled { color: var(--mid); cursor: default; }

.dialog-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: rgba(80, 80, 80, 0.88);
}
.dialog-layer[hidden] { display: none; }
.confirm { width: 334px; display: flex; flex-direction: column; gap: 8px; }
.confirm p { margin: 0 0 10px; font-size: 21px; color: var(--light); line-height: 1.35; text-align: center; }
.confirm .btn:not(.primary) { background: var(--screen); }


/* ---- How to play tabs ---------------------------------------------------- */

.tabs { display: flex; margin-top: 18px; flex: none; }
.tab {
  width: 220px;
  height: 46px;
  border: 3px solid var(--ink);
  background: transparent;
  font-size: 19px;
  text-transform: uppercase;
  cursor: pointer;
}
.tab + .tab { border-left: 0; }
.tab.on { background: var(--ink); color: var(--light); }
[data-layout="portrait"] .tabs { margin-top: 10px; }
[data-layout="portrait"] .tab { width: 118px; height: 38px; font-size: 13px; padding: 0 4px; }
.practice-tip { max-width: 760px; margin: 22px 0 0; font-size: 21px; line-height: 32px; text-align: center; flex: none; }
[data-layout="portrait"] .practice-tip { margin-top: 14px; font-size: 15px; line-height: 24px; padding: 0 8px; }

/* ---- Online ------------------------------------------------------------- */

.choices { display: flex; flex-direction: column; gap: 48px; align-items: center; }
.choice { display: flex; flex-direction: column; align-items: center; }
.choice p { margin: 8px 0 0; font-size: 17px; }
.note { margin: 0; font-size: 17px; text-align: center; opacity: 0.85; }
.err { margin: 0; min-height: 22px; font-size: 17px; color: var(--red); text-align: center; }
.err.soft { color: var(--ink); }
.codefield { width: 336px; height: 72px; font-size: 44px; text-align: center; letter-spacing: 10px; text-transform: uppercase; }
.share .code { font-size: 110px; line-height: 1; letter-spacing: 8px; white-space: nowrap; }
.wait { width: 334px; margin: 0 0 40px; font-size: 19px; text-align: left; white-space: nowrap; }
.dots { display: inline-block; width: 1.5em; text-align: left; }
.dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.cards { display: flex; gap: 16px; }
.card {
  width: 300px;
  min-height: 150px;
  padding: 16px;
  border: 3px solid var(--ink);
  background: rgba(242, 242, 247, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: center;
}
.card h2 { margin: 0; font-size: 21px; font-weight: normal; text-transform: uppercase; }
.card p { margin: 0; font-size: 17px; line-height: 1.35; }
.card .btn { width: 100%; }
.sent-img { width: 300px; height: 300px; }
.page.guess .body { gap: 12px; }
.mini { width: 270px; height: 270px; display: grid; place-items: center; }
.mini canvas { width: 100%; height: 100%; }
.scrub.small { width: 420px; }
.scrub.small .round-btn { width: 52px; height: 52px; }
.scrub.small .round-btn svg { width: 28px; height: 28px; }
.blanks { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.blank-word { display: flex; gap: 6px; }
.blank {
  width: 40px;
  height: 46px;
  padding: 0;
  border: 0;
  border-bottom: 4px solid var(--ink);
  background: transparent;
  font-size: 30px;
  cursor: pointer;
}
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 520px; }
.tile {
  width: 52px;
  height: 52px;
  padding: 0;
  border: 3px solid var(--ink);
  background: var(--light);
  font-size: 28px;
  cursor: pointer;
}
.tile:disabled { opacity: 0.2; cursor: default; }
.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 8;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--light);
  font-size: 17px;
  white-space: nowrap;
  pointer-events: none;
}
[data-layout="portrait"] .codefield { width: 280px; font-size: 34px; }
[data-layout="portrait"] .share .code { font-size: 56px; letter-spacing: 4px; }
[data-layout="portrait"] .cards { flex-direction: column; gap: 10px; width: 100%; }
[data-layout="portrait"] .card { width: 100%; min-height: 0; padding: 10px 12px; gap: 6px; }
[data-layout="portrait"] .card .btn { height: 42px; }
[data-layout="portrait"] .sent-img { width: 220px; height: 220px; }
[data-layout="portrait"] .page.guess .body { gap: 8px; }
[data-layout="portrait"] .mini { width: 190px; height: 190px; }
[data-layout="portrait"] .scrub.small { width: 100%; }
[data-layout="portrait"] .blank { width: 28px; height: 34px; font-size: 22px; }
[data-layout="portrait"] .blanks { gap: 14px; }
[data-layout="portrait"] .blank-word { gap: 4px; }
[data-layout="portrait"] .tile { width: 40px; height: 40px; font-size: 22px; }
[data-layout="portrait"] .tiles { gap: 6px; max-width: 300px; }
[data-layout="portrait"] .choice p { font-size: 14px; }
[data-layout="portrait"] .choices { gap: 36px; }
[data-layout="portrait"] .wait { width: 240px; margin-bottom: 28px; font-size: 16px; }
[data-layout="portrait"] .foot.row .btn:not(.tall) { width: 150px; }
/* Online guess screen: Give up sits top right; the timer bar leaves room for it. */
.corner-btn { position: absolute; top: 22px; right: 22px; width: auto; height: 60px; padding: 0 18px; z-index: 6; }
.page.guess .timerbar { right: 200px; }
[data-layout="portrait"] .btn.corner-btn { top: 12px; right: 12px; width: auto; height: 40px; padding: 0 10px; font-size: 14px; }
[data-layout="portrait"] .page.guess .timerbar { right: 112px; }
/* A wrong guess: the blanks give a little shake. */
@keyframes nope { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.blanks.nope { animation: nope 360ms ease-out; }
/* Online board: the turn cards lead, the scorecard sits under them. */
.body.top.board { padding-top: 24px; gap: 36px; }
.body.top.board .scores { margin-top: 48px; } /* the scorecard sits well apart from the turn cards */
[data-layout="portrait"] .body.top.board { padding-top: 8px; gap: 20px; }
[data-layout="portrait"] .body.top.board .scores { margin-top: 28px; }
[data-layout="portrait"] .page.guess .head { margin-top: 14px; }
/* Phone word-and-bet screen: Start round and Shuffle sit at the bottom, out of the way. */
[data-layout="portrait"] .page.select .body { padding-top: 28px; }
[data-layout="portrait"] .page.select .body .foot { margin-top: auto; padding-bottom: 8px; }
/* The bet sits in the middle of the space between the word and the buttons. */
[data-layout="portrait"] .page.select .body .setting { margin-top: auto; }
.body.top .codefield { margin-top: 20px; }

/* ---- Portrait ---------------------------------------------------------- */

[data-layout="portrait"] .page { padding: 22px 14px 70px; }
[data-layout="portrait"] .head { padding: 0 54px; }
[data-layout="portrait"] .head h1 { font-size: 32px; line-height: 31px; white-space: normal; overflow: visible; }
[data-layout="portrait"] .head .sub { margin-top: 12px; font-size: 15px; line-height: 19px; min-height: 19px; }
[data-layout="portrait"] .body { gap: 18px; }
[data-layout="portrait"] .corner-score { font-size: 28px; top: 24px; right: 14px; line-height: 32px; }
[data-layout="portrait"] .credit,
[data-layout="portrait"] .hint { bottom: 34px; font-size: 14px; }
[data-layout="portrait"] .big { font-size: 90px; }
[data-layout="portrait"] .big.word { font-size: 56px; }
[data-layout="portrait"] .round-btn { width: 56px; height: 56px; }
[data-layout="portrait"] .round-btn svg { width: 30px; height: 30px; }
[data-layout="portrait"] .timerbar { left: 79px; right: 79px; top: 20px; }
[data-layout="portrait"] .page.draw { padding-top: 40px; } /* the title sits below the timer bar */
[data-layout="portrait"] .btn { width: 280px; height: 46px; font-size: 18px; }
[data-layout="portrait"] .btn.tall { width: 140px; height: 56px; }
[data-layout="portrait"] .fields { width: 280px; }
[data-layout="portrait"] .setting { width: 300px; }
[data-layout="portrait"] .wordbox { font-size: 40px; line-height: 50px; padding: 4px 18px; }
[data-layout="portrait"] .howto { font-size: 16px; line-height: 27px; }
[data-layout="portrait"] .howto p { margin-bottom: 20px; }
[data-layout="portrait"] .body.scroll { margin: 14px 0; padding: 6px 4px; }
[data-layout="portrait"] .scrub { width: 100%; gap: 10px; }
[data-layout="portrait"] .scores { width: 100%; font-size: 15px; }
[data-layout="portrait"] .scores th { font-size: 16px; padding: 0 6px 8px; }
[data-layout="portrait"] .scores td { padding: 10px 6px 0; height: 36px; }
[data-layout="portrait"] .thumb { width: 116px; height: 116px; }
[data-layout="portrait"] .grid { grid-template-columns: repeat(3, 1fr); width: 100%; }
[data-layout="portrait"] .grid .thumb { width: 100%; height: auto; aspect-ratio: 1; }
[data-layout="portrait"] .photo { width: 100%; height: auto; max-height: none; }
/* Phones: the chevrons sit beside Close, in the same row, instead of at mid-height. */
[data-layout="portrait"] .side { display: none; }
[data-layout="portrait"] .round-btn.only-portrait { display: grid; }
[data-layout="portrait"] .photo-foot .btn { width: 170px; }
[data-layout="portrait"] .flyout { top: 76px; }
[data-layout="portrait"] .confirm { width: 280px; }

/* ---- Knobs ------------------------------------------------------------- */

.knob {
  position: absolute;
  top: 786px;
  width: 226px;
  height: 226px;
  touch-action: none;
  cursor: grab;
  filter: drop-shadow(6px 8px 3px rgba(0, 0, 0, 0.35));
  z-index: 5;
}
.knob:active { cursor: grabbing; }
.knob-left { left: 14px; }
.knob-right { left: 1199px; }
.knob-spin { width: 100%; height: 100%; will-change: transform; }
.knob-spin svg { display: block; width: 100%; height: 100%; }
[data-layout="portrait"] .knob { top: 712px; width: 145px; height: 145px; filter: drop-shadow(4px 5px 2px rgba(0, 0, 0, 0.35)); }
[data-layout="portrait"] .knob-left { left: 12px; }
[data-layout="portrait"] .knob-right { left: 245px; }


/* ---- Shake ------------------------------------------------------------- */

@keyframes shake {
  0%, 100% { translate: 0 0; }
  12% { translate: -14px 6px; }
  25% { translate: 12px -8px; }
  37% { translate: -10px -6px; }
  50% { translate: 9px 7px; }
  62% { translate: -7px 4px; }
  75% { translate: 5px -4px; }
  87% { translate: -3px 2px; }
}
.stage.shaking { animation: shake 450ms ease-out; }
/* The home screen fades in after the opening drawing is shaken away. */
@keyframes reveal { from { opacity: 0; } }
.ui.reveal { animation: reveal 450ms ease-out; }
/* Rendering the logo film (intro.js): every change is driven frame by frame. */
.filming .ink, .filming .vignette { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .stage.shaking { animation-duration: 1ms; }
  .ink, .vignette, .delta { transition-duration: 1ms; }
  .strip.marquee .track { animation: none; }
}
