:root {
  --bg: #f4f1ea;
  --paper: rgba(255, 255, 255, 0.72);
  --line: rgba(17, 24, 39, 0.12);
  --text: #121212;
  --muted: rgba(18, 18, 18, 0.6);
  --shadow: 0 20px 40px rgba(25, 28, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(0.4rem, 1.8vw, 1rem);
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 210, 140, 0.24), transparent 28%),
    linear-gradient(180deg, #f7f3ec 0%, #efebe2 100%);
  overflow: hidden;
}

/*
  Desktop: width is limited by viewport height so the square grid never overflows.
  9rem = body padding (~1rem×2) + instruction + gap + generous breathing room.
  No min-height — page is compact and centered by body's place-items: center,
  which naturally creates top/bottom breathing room.
*/
.page {
  width: min(88vw, calc(100svh - 9rem));
  display: grid;
  grid-template-rows: auto auto;
  gap: clamp(1rem, 2.2vmin, 1.4rem);
}

.instruction {
  margin: 0;
  justify-self: start;
  font-size: clamp(0.88rem, 2.1vmin, 1.15rem);
  font-weight: 600;
  font-family: "Inter", sans-serif;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* Desktop: square grid → square cards */
.grid {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(0.65rem, 1.5vmin, 1rem);
}

.card {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(0.75rem, 1.9vmin, 1.2rem);
  border-radius: clamp(12px, 2.2vmin, 22px);
  color: inherit;
  text-align: left;
  cursor: pointer;
  background: var(--paper);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(17, 24, 39, 0.2);
}

.card:focus-visible {
  outline: 2px solid rgba(17, 24, 39, 0.45);
  outline-offset: 3px;
}

.card[disabled] {
  cursor: default;
}

.card[data-tone="accepted"] {
  background: #dcf7ea;
  color: #0d5a3f;
  border-color: rgba(13, 90, 63, 0.18);
}

.card[data-tone="rejected"] {
  background: #fde4df;
  color: #8f2e21;
  border-color: rgba(143, 46, 33, 0.18);
}

.card[data-tone="deferred"],
.card[data-tone="waitlist"] {
  background: #ece8e1;
  color: #4e4a44;
  border-color: rgba(78, 74, 68, 0.16);
}

/* Two rows: top (name + badge), center (value + hint) */
.card-inner {
  position: relative;
  display: grid;
  gap: clamp(0.4rem, 1.2vmin, 0.72rem);
  height: 100%;
  grid-template-rows: auto 1fr;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.badge {
  width: clamp(2.4rem, 7.8vmin, 4.4rem);
  height: clamp(1.9rem, 6.2vmin, 3.5rem);
  flex: 0 0 auto;
  object-fit: contain;
  object-position: right center;
}

.name {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(0.78rem, 2.2vmin, 1.25rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

/* Value and hint stacked, centered together in the remaining card space */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35em;
  min-height: 0;
}

.value {
  margin: 0;
  font-size: clamp(0.85rem, 2.6vmin, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hint {
  margin: 0;
  font-size: clamp(0.52rem, 1.45vmin, 0.78rem);
  line-height: 1.2;
  color: rgba(18, 18, 18, 0.52);
  text-align: center;
  visibility: hidden;
}

.card[data-tone="accepted"] .hint,
.card[data-tone="rejected"] .hint,
.card[data-tone="deferred"] .hint,
.card[data-tone="waitlist"] .hint {
  color: inherit;
  opacity: 0.72;
}

.accepted {
  color: inherit;
}

.rejected {
  color: inherit;
}

.deferred {
  color: inherit;
}

.waitlist {
  color: inherit;
}

/* Mobile: portrait cards (taller than wide), horizontal breathing room */
@media (max-width: 600px) {
  .page {
    width: min(90vw, calc((100svh - 1.5rem) * 0.79));
    gap: clamp(1.4rem, 6vw, 2rem);
  }

  .grid {
    aspect-ratio: 0.78;
    gap: clamp(0.32rem, 2vw, 0.55rem);
  }

  .card {
    padding: clamp(0.46rem, 2.6vw, 0.72rem);
  }

  .card-inner {
    gap: clamp(0.22rem, 1.4vw, 0.42rem);
  }

  .badge {
    width: clamp(1.9rem, 6.5vw, 3rem);
    height: clamp(1.5rem, 5.2vw, 2.4rem);
  }
}

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