/* Call It: styles. A retro print palette, one look whatever the phone's theme. */

:root {
  --ink: #1c1816;
  --ink-soft: #5a4e46;
  --cream: #f4e9d3;
  --paper: #fbf5e8;
  --tan: #e2cfa9;
  --orange: #e8702a;
  --orange-deep: #c4521b;
  --teal: #2a8c8c;
  --teal-deep: #1e6868;
  --red: #b8402e;
  --radius: 18px;
  --font-display: 'Abril Fatface', Georgia, 'Times New Roman', serif;
  --font-ui: 'Work Sans', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  background: var(--cream);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.35;
  color: var(--ink);
  background: var(--cream);
}

button {
  font: inherit;
  color: inherit;
  margin: 0;
}

button, a, [role="button"] {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--cream);
}

.screen[hidden] { display: none; }

/* Home: the cover, then the two mode buttons */

.screen-home {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.cover-wrap {
  background: #f29a4a;
  padding-top: var(--sat);
}

.cover {
  display: block;
  width: 100%;
  height: auto;
}

.cover-title {
  font-family: var(--font-display);
  font-size: 92px;
}

.cover-tag {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
}

.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px calc(18px + var(--sab));
}

.mode-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-radius: var(--radius);
  color: var(--paper);
  text-align: left;
  box-shadow: 0 3px 0 rgba(28, 24, 22, 0.28);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.mode-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(28, 24, 22, 0.28);
}

.mode-btn-batter { background: var(--orange); }
.mode-btn-play { background: var(--teal); }

.mode-title {
  grid-column: 1;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.1;
}

.mode-sub {
  grid-column: 1;
  font-size: 14px;
  opacity: 0.92;
}

.mode-best {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(251, 245, 232, 0.22);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mode-best:empty { display: none; }

.home-note {
  margin: auto 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

/* Play: one screen, no scrolling. The card takes whatever height is left. */

.screen-play {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: var(--sat) 16px calc(12px + var(--sab));
}

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 60px;
  align-items: center;
  height: 56px;
}

.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  text-align: center;
  white-space: nowrap;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: var(--ink-soft);
  transition: background 100ms;
}

.icon-btn:active { background: var(--tan); }

.progress {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.scoreline {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 2px 0 10px;
}

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tan);
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms, color 150ms;
}

.pill b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pill.is-hot {
  background: var(--orange);
  color: var(--paper);
}

.card {
  position: relative;
  flex: 1 1 0;
  min-height: 160px;
  margin: 0;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 50% 40%, #fdf8ee 0%, var(--paper) 55%, #e9d8b5 100%);
  box-shadow: inset 0 0 0 1px rgba(28, 24, 22, 0.1), 0 2px 0 rgba(28, 24, 22, 0.14);
}

.card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.14 0'/></filter><rect width='220' height='220' filter='url(%23n)'/></svg>");
}

.card img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: opacity 180ms var(--ease-out);
}

.card img.is-loading { opacity: 0; }

.verdict-line {
  height: 26px;
  margin: 10px 0 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verdict-line.is-right { color: var(--teal-deep); }
.verdict-line.is-wrong { color: var(--red); }

.answers {
  display: grid;
  gap: 8px;
}

.answers.is-batter { grid-template-columns: 1fr; }
.answers.is-play { grid-template-columns: 1fr 1fr; }

.answer {
  min-height: 50px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  transition: transform 100ms var(--ease-out), background 120ms, color 120ms, border-color 120ms, opacity 200ms;
}

.answers.is-play .answer {
  min-height: 64px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
}

.answer:active {
  transform: scale(0.97);
  background: var(--tan);
}

.answer:disabled { cursor: default; }
.answer:disabled:active { transform: none; background: var(--paper); }

.answer.is-correct,
.answer.is-correct:disabled:active {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--paper);
}

.answer.is-wrong,
.answer.is-wrong:disabled:active {
  background: var(--red);
  border-color: var(--red);
  color: var(--paper);
}

.answer.is-dim { opacity: 0.4; }

.next-wrap {
  height: 54px;
  margin-top: 10px;
}

.next-wrap .btn { visibility: hidden; }
.next-wrap.is-ready .btn { visibility: visible; }

.btn {
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--paper);
  font-size: 18px;
  font-weight: 700;
  transition: transform 100ms var(--ease-out), background 120ms;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary:active { background: #2e2622; }

.btn-ghost:active { background: var(--tan); }

/* Results */

.screen-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 100dvh;
  padding: calc(24px + var(--sat)) 24px calc(24px + var(--sab));
  text-align: center;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.big-score {
  margin: 6px 0;
  font-family: var(--font-display);
  font-size: 84px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.caption {
  margin: 0 0 10px;
  font-size: 18px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  margin-top: 22px;
}

/* Mouse users get a hover; fingers never do (a tap would leave it stuck on). */
@media (hover: hover) and (pointer: fine) {
  .answer:hover:not(:disabled) { background: var(--tan); }
  .btn-ghost:hover { background: var(--tan); }
  .mode-btn:hover { filter: brightness(1.06); }
  .icon-btn:hover { background: var(--tan); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Short phones: trim the chrome so the card keeps room */
@media (max-height: 680px) {
  .topbar { height: 48px; }
  .scoreline { margin-bottom: 6px; }
  .answer { min-height: 46px; font-size: 16px; }
  .answers.is-play .answer { min-height: 56px; font-size: 24px; }
}
