:root {
  --paper: #F6F1E7;
  --ink: #1F2A2E;
  --ink-soft: #4A5559;
  --terracotta: #8E3B22;
  --terracotta-pressed: #6F2C18;
  --green: #1E5A4C;
  --green-pressed: #144338;
  --blue: #24466F;
  --blue-pressed: #183354;
  --plum: #5A3A63;
  --plum-pressed: #432B4A;
  --on-colour: #FFFFFF;
  --radius: 28px;
  --gap: clamp(16px, 2.6vmin, 28px);
  --edge: clamp(16px, 3.5vmin, 40px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding:
    max(var(--edge), env(safe-area-inset-top))
    max(var(--edge), env(safe-area-inset-right))
    max(var(--edge), env(safe-area-inset-bottom))
    max(var(--edge), env(safe-area-inset-left));
  font-family: -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overflow: hidden;
}

/* ---- Header ---- */

.top {
  flex: none;
  padding: 0 4px clamp(12px, 2.5vmin, 28px);
}

.top h1 {
  margin: 0;
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 5.5vmin, 3.25rem);
  line-height: 1.15;
}

.today {
  margin: 0.2em 0 0;
  font-size: clamp(1.25rem, 3.2vmin, 1.9rem);
  color: var(--ink-soft);
}

/* ---- Buttons ---- */

.buttons {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(var(--count, 3), 1fr);
  gap: var(--gap);
}

.big-button {
  display: flex;
  align-items: center;
  gap: clamp(16px, 4vmin, 40px);
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: clamp(16px, 3vmin, 36px) clamp(20px, 5vmin, 56px);
  border: 0;
  border-radius: var(--radius);
  color: var(--on-colour);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 80ms ease-out;
}

.big-button:active,
.big-button.is-pressed {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.big-button:focus-visible {
  outline: 5px solid var(--ink);
  outline-offset: 4px;
}

.theme-terracotta { background: var(--terracotta); }
.theme-terracotta:active, .theme-terracotta.is-pressed { background: var(--terracotta-pressed); }
.theme-green { background: var(--green); }
.theme-green:active, .theme-green.is-pressed { background: var(--green-pressed); }
.theme-blue { background: var(--blue); }
.theme-blue:active, .theme-blue.is-pressed { background: var(--blue-pressed); }
.theme-plum { background: var(--plum); }
.theme-plum:active, .theme-plum.is-pressed { background: var(--plum-pressed); }

.big-button .icon {
  flex: none;
  width: clamp(64px, 13vmin, 128px);
  height: clamp(64px, 13vmin, 128px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.big-button .icon svg {
  width: 62%;
  height: 62%;
}

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

.big-button .label {
  font-size: clamp(2rem, 6.2vmin, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
}

.big-button .hint {
  margin-top: 0.25em;
  font-size: clamp(1.2rem, 3.4vmin, 2rem);
  font-weight: 500;
  opacity: 0.92;
}

/* Playing state: same size and colour, just a clear ring so it reads as "on" */
.big-button.is-playing {
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.18), inset 0 0 0 6px rgba(255, 255, 255, 0.85);
}

/* ---- Message line (fixed height so nothing moves) ---- */

.message {
  flex: none;
  min-height: 2.8em;
  margin: clamp(12px, 2.5vmin, 24px) 4px 0;
  font-size: clamp(1.15rem, 3vmin, 1.7rem);
  line-height: 1.35;
  color: var(--ink);
}

/* ---- Landscape: three buttons side by side (icon above words),
        or four as a 2 × 2 grid (icon beside words) ---- */

@media (orientation: landscape) and (min-width: 900px) {
  .buttons {
    grid-template-rows: none;
    grid-template-columns: repeat(3, 1fr);
  }

  .buttons.count-4 {
    grid-template-rows: repeat(2, 1fr);
    grid-template-columns: repeat(2, 1fr);
  }

  .count-3 .big-button {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .count-3 .big-button .text { align-items: center; }

  .count-3 .big-button .icon {
    width: clamp(96px, 18vmin, 160px);
    height: clamp(96px, 18vmin, 160px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .big-button { transition: none; }
}
