/* ABOUTME: Styles for Roux Wars: a light enamel stovetop, index-card ticket, result sheet, and title card. */
/* ABOUTME: Mobile-first single column; every color, size, and easing comes from the tokens in :root. */
/* Hallmark · scope: app (single-screen game) · theme: custom · vibe: "Louisiana home kitchen: enamel, index cards, roux"
 * display: Ultra · body: Barlow Semi Condensed · card text: Courier Prime · anchor: enamel blue + bell-pepper green
 * light-only on purpose: brown only reads as brown against lighter surroundings
 * pre-emit critique: P5 H4 E4 S5 R5 V5 */

:root {
  /* Surfaces. Keep these near-neutral: they are what the roux color is judged against. */
  --range: #e5e6e1;
  --card: #fbfbf8;
  --enamel: #efeeea;
  --enamel-lip: #f6f5f2;
  --rule: #d4dfeb;
  --rule-red: #e3a39c;

  /* Ink */
  --ink: #1d2126;
  --ink-hover: #30363e;
  --ink-2: #585e66;
  --ink-shadow: #07090b;
  --on-dark: #ffffff;

  /* Kitchen */
  --pot: #27496d;
  --pot-edge: #1a3350;
  --grate: #a3a6a4;
  --wood: #c4914f;
  --wood-edge: #8e6230;
  --speck: #140e0a;
  --speck-rgb: 20, 14, 10;
  --onion: #efe9d6;
  --celery: #a9c77a;
  --pepper: #3d7a3a;
  --pepper-deep: #2b5a29;
  --pepper-wash: #dde8d9;
  --char: #9b3219;
  --char-wash: #f7dcd6;
  --flame-outer: rgba(58, 104, 222, 0.85);
  --flame-inner: rgba(176, 202, 255, 0.95);
  --steam-rgb: 255, 255, 255;
  --smoke-rgb: 88, 82, 76;

  /* Shadows */
  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.05), 0 10px 20px -14px rgba(0, 0, 0, 0.45);
  --shadow-chip: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 2px 5px -2px rgba(0, 0, 0, 0.3);
  --shadow-swatch: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-sheet: 0 -12px 32px -14px rgba(0, 0, 0, 0.4);
  --shadow-strip: 0 2px 6px -3px rgba(0, 0, 0, 0.4);
  --lift-ink: 0 4px 0 var(--ink-shadow), 0 10px 16px -10px rgba(0, 0, 0, 0.5);
  --lift-pepper: 0 4px 0 var(--pepper-deep), 0 10px 16px -10px rgba(0, 0, 0, 0.5);

  /* Type */
  --display: 'Ultra', 'Rockwell', Georgia, serif;
  --ui: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  --type: 'Courier Prime', ui-monospace, 'Courier New', monospace;
  --text-label: 13px;
  --text-body: 17px;
  --text-lead: 22px;
  --text-score: 60px;
  --text-logo: clamp(64px, 23vw, 108px);

  /* Space and shape */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 22px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-press: 70ms;
  --dur-fade: 200ms;
  --dur-sheet: 360ms;

  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--range);
  color: var(--ink);
  overscroll-behavior: none;
  overflow-x: clip;
}

body {
  font-family: var(--ui);
  font-size: var(--text-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

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

button:focus-visible {
  outline: 3px solid var(--pot);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Kitchen layout */

.kitchen {
  position: relative;
  height: 100vh;
  height: 100svh;
  max-width: 480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-sm)) var(--space-lg)
    calc(env(safe-area-inset-bottom, 0px) + 14px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  height: 44px;
}

.wordmark {
  font-family: var(--display);
  font-size: var(--text-lead);
  white-space: nowrap;
}

.progress {
  margin-left: auto;
  font-weight: 600;
  font-size: var(--text-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-2);
}

.mute {
  width: 44px;
  height: 44px;
  margin-right: -10px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--ink-2);
}

.mute svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.mute .icon-off,
.mute[aria-pressed='true'] .icon-on {
  display: none;
}

.mute[aria-pressed='true'] .icon-off {
  display: block;
}

/* Target ticket: a recipe index card with a paint chip clipped to it */

.ticket {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 10px;
  border-radius: var(--radius-sm);
  background-color: var(--card);
  background-image: linear-gradient(var(--rule-red), var(--rule-red)),
    repeating-linear-gradient(to bottom, transparent 0 25px, var(--rule) 25px 26px);
  background-size: 100% 1.5px, 100% 100%;
  background-position: 0 22px, 0 22px;
  background-repeat: no-repeat;
  box-shadow: var(--shadow-card);
}

/* The chip sits on the same enamel that rings the roux in the pot, so both are judged alike. */
.chip-card {
  flex: none;
  padding: 5px 5px 3px;
  background: var(--enamel);
  border-radius: 3px;
  box-shadow: var(--shadow-chip);
  transform: rotate(-2deg);
  text-align: center;
}

.chip {
  width: 80px;
  height: 64px;
  border-radius: 2px;
}

.chip-label {
  display: block;
  margin-top: 2px;
  font-family: var(--type);
  font-size: var(--text-label);
  color: var(--ink-2);
}

.ticket-text {
  min-width: 0;
  padding-top: var(--space-sm);
}

.dish {
  margin: 0;
  font-family: var(--display);
  font-size: var(--text-lead);
  line-height: 1.1;
  overflow-wrap: anywhere;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.target {
  margin: 6px 0 0;
  font-family: var(--type);
  font-size: var(--text-label);
  color: var(--ink-2);
}

/* Pot */

.stove {
  position: relative;
  min-height: 0;
  touch-action: none;
}

.stove canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* 3…2…1…Fire! over the pot. The burner lights itself on "Fire!". */
.countdown {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(72px, 28vw, 132px);
  line-height: 1;
  color: var(--ink);
  -webkit-text-stroke: 3px var(--card);
  paint-order: stroke fill;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
}

.countdown.show {
  animation: count-pop calc(0.8s - 20ms) var(--ease-out) both;
}

.countdown.fire {
  color: var(--char);
  font-size: clamp(56px, 20vw, 100px);
}

@keyframes count-pop {
  0% {
    opacity: 0;
    transform: scale(1.6);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* FASTER! / SLOWER! when the stir speed is way off the green zone. */
.nudge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2%;
  margin: 0;
  text-align: center;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(34px, 11vw, 52px);
  line-height: 1;
  text-transform: uppercase;
  color: var(--char);
  -webkit-text-stroke: 3px var(--card);
  paint-order: stroke fill;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  opacity: 0;
}

.nudge.show {
  opacity: 1;
  animation: nudge-shake 0.45s var(--ease-in-out) infinite alternate;
}

.nudge.faster::after {
  content: ' »';
}

.nudge.slower::before {
  content: '« ';
}

@keyframes nudge-shake {
  from {
    transform: scale(1) translateX(-4px);
  }
  to {
    transform: scale(1.08) translateX(4px);
  }
}

.meter[data-way-off] .meter-track {
  background: var(--char-wash);
  animation: pulse 0.3s var(--ease-in-out) infinite alternate;
}

/* Stir-speed meter: keep the needle (your speed) inside the green band. The band moves during the cook. */
.meter {
  --lo: 30%;
  --hi: 60%;
  --needle: 0%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--ui);
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: opacity var(--dur-fade) var(--ease-out);
}

.meter-track {
  position: relative;
  height: 26px;
  border-radius: 13px;
  background: var(--card);
  box-shadow: inset 0 0 0 2px var(--rule), inset 0 2px 4px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.meter-band {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: var(--lo);
  width: calc(var(--hi) - var(--lo));
  border-radius: 10px;
  background: var(--pepper-wash);
  box-shadow: inset 0 0 0 2px var(--pepper);
  transition: background-color var(--dur-fade) var(--ease-out), box-shadow var(--dur-fade) var(--ease-out);
}

.meter-needle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(3px, var(--needle), calc(100% - 3px));
  width: 6px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--card);
}

.meter[data-state='on'] .meter-band {
  background: var(--pepper);
}

.meter[data-state='slow'] .meter-needle,
.meter[data-state='fast'] .meter-needle {
  background: var(--char);
}

.meter[data-state='slow'] .meter-band,
.meter[data-state='fast'] .meter-band {
  box-shadow: inset 0 0 0 2px var(--char);
}

.meter[data-moving] .meter-band {
  animation: pulse 0.25s var(--ease-in-out) infinite alternate;
}

.meter[data-state='off'] {
  opacity: 0.35;
}

/* One fixed line so the pot never resizes when the caption changes. Copy is kept to 27 characters. */
.caption {
  margin: 0;
  height: 1.4em;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
  font-family: var(--type);
  font-size: var(--text-body);
  color: var(--ink-2);
}

.caption.warn {
  color: var(--char);
}

.caption.alarm {
  color: var(--char);
  font-weight: 700;
  animation: pulse 0.5s var(--ease-in-out) infinite alternate;
}

/* Buttons */

.controls {
  display: grid;
  gap: var(--space-md);
}

.action {
  width: 100%;
  height: 60px;
  border: 0;
  border-radius: 14px;
  color: var(--on-dark);
  font-weight: 700;
  font-size: var(--text-lead);
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: var(--ink);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform: translateY(-3px);
  box-shadow: var(--lift-ink);
  transition: transform var(--dur-press) var(--ease-out), box-shadow var(--dur-press) var(--ease-out),
    background-color var(--dur-fade) var(--ease-out);
}

.action:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 var(--ink-shadow);
}

/* Once unlocked, "Drop the trinity" is a calm outlined key, not a bright "go" signal. */
.action[data-kind='trinity'] {
  background: var(--card);
  color: var(--pepper-deep);
  box-shadow: inset 0 0 0 2px var(--pepper), var(--lift-pepper);
}

.action[data-kind='trinity']:active {
  box-shadow: inset 0 0 0 2px var(--pepper), 0 0 0 var(--pepper-deep);
}

/* Locked until you've stirred; the fill shows how close you are. */
.action[data-kind='locked'] {
  background: var(--card);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 2px var(--rule);
  transform: none;
  cursor: default;
}

.action[data-kind='locked']:active {
  transform: none;
  box-shadow: inset 0 0 0 2px var(--rule);
}

.action[data-kind='locked']::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--pepper-wash);
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
  transition: transform var(--dur-fade) var(--ease-out);
}

.action[data-kind='wait'] {
  background: var(--ink-2);
  transform: none;
  box-shadow: none;
  cursor: default;
}

.secondary {
  width: 100%;
  height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  font-weight: 700;
  font-size: var(--text-body);
  white-space: nowrap;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1.5px;
}

@media (hover: hover) {
  .action:hover {
    background: var(--ink-hover);
  }
  .action[data-kind='trinity']:hover {
    background: var(--pepper-wash);
  }
  .action[data-kind='wait']:hover {
    background: var(--ink-2);
  }
  .action[data-kind='locked']:hover {
    background: var(--card);
  }
  .secondary:hover {
    text-decoration-thickness: 3px;
  }
  .mute:hover {
    color: var(--ink);
  }
}

/* Result and menu sheets */

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + var(--space-lg));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--card);
  box-shadow: var(--shadow-sheet);
  animation: rise var(--dur-sheet) var(--ease-out);
}

.sheet[hidden] {
  display: none;
}

.swatches {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.swatches figure {
  margin: 0;
}

.swatch {
  height: 80px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-swatch);
}

.swatch.specked {
  background-image: radial-gradient(circle, var(--speck) 0 1.6px, transparent 2.2px),
    radial-gradient(circle, var(--speck) 0 1.1px, transparent 1.7px);
  background-size: 29px 23px, 37px 31px;
  background-position: 4px 6px, 17px 13px;
}

.swatches figcaption {
  margin-top: 6px;
  font-family: var(--type);
  font-size: var(--text-label);
  color: var(--ink-2);
}

.score {
  margin: 14px 0 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.score .num {
  display: inline-block;
  font-family: var(--display);
  font-size: var(--text-score);
  line-height: 0.9;
}

.score .of {
  font-size: var(--text-lead);
  font-weight: 600;
  color: var(--ink-2);
}

.verdict {
  margin: 10px 0 0;
  font-size: var(--text-lead);
  font-weight: 700;
  line-height: 1.15;
}

.tip {
  margin: 6px 0 0;
  font-size: var(--text-body);
  line-height: 1.3;
  color: var(--ink-2);
}

.stir-line {
  margin: 10px 0 0;
  font-size: var(--text-body);
  color: var(--ink-2);
}

.stir-line strong {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-lead);
  color: var(--ink);
}

.penalty {
  margin: var(--space-sm) 0 0;
  font-size: var(--text-body);
  color: var(--char);
}

.sheet > .action,
.sheet-actions {
  margin-top: 18px;
}

.source {
  margin: 10px 0 0;
  font-size: var(--text-body);
  color: var(--ink-2);
}

.source a,
.row-name a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

@media (hover: hover) {
  .source a:hover,
  .row-name a:hover {
    text-decoration-thickness: 2px;
  }
}

.source a:focus-visible,
.row-name a:focus-visible {
  outline: 3px solid var(--pot);
  outline-offset: 2px;
}

.menu-title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-lead);
}

.menu-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-rows li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-md);
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.pair {
  display: flex;
}

.pair i {
  width: 30px;
  height: 36px;
  box-shadow: var(--shadow-swatch);
}

.pair i:first-child {
  border-radius: 3px 0 0 3px;
}

.pair i:last-child {
  border-radius: 0 3px 3px 0;
}

.row-name {
  font-weight: 700;
  font-size: var(--text-body);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.row-name small {
  display: block;
  font-family: var(--type);
  font-weight: 400;
  font-size: var(--text-label);
  color: var(--ink-2);
}

.row-pts {
  font-family: var(--display);
  font-size: var(--text-lead);
}

.share-text {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--space-sm);
  font-family: var(--ui);
  font-size: var(--text-body);
  resize: none;
  -webkit-user-select: text;
  user-select: text;
}

/* Title card */

.title {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + var(--space-xl)) var(--space-xl)
    calc(env(safe-area-inset-bottom, 0px) + var(--space-xl));
  background: var(--range);
  transition: opacity var(--dur-sheet) var(--ease-out), visibility var(--dur-sheet) var(--ease-out);
}

.title.gone {
  opacity: 0;
  visibility: hidden;
}

.title-inner {
  width: 100%;
  max-width: 420px;
  margin: auto;
}

.logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--text-logo);
  line-height: 0.86;
}

.stages {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  height: 30px;
  margin: 20px 0 22px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-strip);
}

.rounds-head {
  margin: 0 0 var(--space-md);
  font-family: var(--display);
  font-size: var(--text-lead);
  line-height: 1.15;
}

/* Three recipe cards, one per round, each a little darker and a little more crooked. */
.rounds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.rounds li {
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 8px 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-card);
  transform: rotate(-1.5deg);
}

.rounds li:nth-child(2) {
  transform: rotate(1deg) translateY(3px);
}

.rounds li:nth-child(3) {
  transform: rotate(-0.5deg);
}

.round-chip {
  width: 100%;
  height: 34px;
  margin-bottom: 4px;
  border-radius: 2px;
  box-shadow: var(--shadow-chip);
}

.rounds b {
  font-family: var(--type);
  font-size: var(--text-label);
  font-weight: 400;
  color: var(--ink-2);
}

.round-shade {
  font-family: var(--display);
  font-size: var(--text-body);
  line-height: 1.1;
}

.round-heat {
  font-size: var(--text-label);
  font-weight: 700;
  color: var(--char);
}

.title .tagline {
  margin: var(--space-lg) 0 18px;
  color: var(--ink-2);
}

.intro {
  margin-bottom: 22px;
}

.lead {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-lead);
  font-weight: 700;
  line-height: 1.2;
}

.tagline {
  margin: 4px 0 10px;
  font-size: var(--text-body);
  line-height: 1.3;
}

.howto {
  display: grid;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-body);
  line-height: 1.3;
  color: var(--ink-2);
}

.howto b {
  color: var(--ink);
}

.menu-label {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 700;
}

.title .action {
  margin-top: var(--space-lg);
}

.keyhint {
  margin: 6px 0 0;
  text-align: center;
  font-size: var(--text-label);
  color: var(--ink-2);
}

@media (hover: none) {
  .keyhint {
    display: none;
  }
}

.made-by {
  margin: 14px 0 0;
  text-align: center;
  font-size: var(--text-label);
  color: var(--ink-2);
}

.made-by a {
  color: inherit;
}

@keyframes rise {
  from {
    transform: translateY(100%);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes pulse {
  to {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet {
    animation: fade 150ms var(--ease-out);
  }
  .caption.alarm,
  .nudge.show,
  .meter[data-way-off] .meter-track,
  .countdown.show {
    animation: none;
  }
  .countdown.show {
    opacity: 1;
  }
  .title,
  .action,
  .action::before {
    transition: none;
  }
}
