*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --water: #07121f;
  --harbor: #0c1c2e;
  --foam: #efe6d4;
  --ink: #1a140c;
  --sodium: #ffb020;
  --story: #ff4d8d;
  --reel: #3ee0d4;
  --photo: #c9b8ff;
  --muted: #8aa0b8;
}

html, body {
  min-height: 100%;
}

body {
  background:
    radial-gradient(ellipse 70% 50% at 12% 0%, rgba(255, 176, 32, 0.14), transparent 50%),
    radial-gradient(ellipse 50% 40% at 88% 100%, rgba(62, 224, 212, 0.1), transparent 45%),
    var(--water);
  color: var(--foam);
  font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
}

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 40px;
  align-items: center;
  padding: 36px 48px;
  max-width: 1180px;
  margin: 0 auto;
}

.board h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.55rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: 16ch;
}

.board h1 code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.72em;
  color: var(--sodium);
}

.board-kicker {
  color: var(--sodium);
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.board-lead {
  margin-top: 14px;
  max-width: 36ch;
  line-height: 1.5;
  color: #d7e2ee;
}

.formulas {
  list-style: none;
  margin: 28px 0 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.formulas li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.84rem;
  color: #c5d4e4;
}

.formulas strong {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  color: var(--foam);
  min-width: 3.6rem;
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
}

.swatch.photo { background: var(--photo); }
.swatch.story { background: var(--story); }
.swatch.reel { background: var(--reel); }

.ranks {
  list-style: none;
  background: var(--foam);
  color: var(--ink);
  border-radius: 4px 18px 18px 4px;
  border-left: 6px solid var(--sodium);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranks li {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 10px;
  align-items: baseline;
  font-size: 0.88rem;
}

.rank-n {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
  color: #7a6a4a;
}

.rank-cap {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 500;
}

.board-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.board-actions p {
  font-size: 0.82rem;
  color: var(--muted);
}

#reset {
  border: 1px solid rgba(255, 176, 32, 0.45);
  background: transparent;
  color: var(--sodium);
  font: inherit;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

#reset:hover,
#reset:focus-visible {
  background: rgba(255, 176, 32, 0.12);
  outline: none;
}

.phone-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.phone {
  width: min(390px, 92vw);
  height: min(720px, 86vh);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255, 77, 141, 0.08), transparent 28%),
    linear-gradient(180deg, #122033 0%, #08131f 100%);
  box-shadow:
    0 0 0 10px #050d16,
    0 28px 70px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-bar {
  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.app-name {
  font-size: 0.92rem;
  color: #9bb0c6;
}

.app-tab {
  margin-top: 2px;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.85rem;
  font-weight: 700;
}

.feed {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 12px 14px 10px;
  background: rgba(8, 16, 28, 0.55);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.card-rank {
  width: 1.85rem;
  height: 1.85rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
}

.card:first-child .card-rank {
  background: var(--sodium);
  color: #1a140c;
}

.card-kind {
  font-size: 0.78rem;
  color: var(--photo);
}

.card.story .card-kind { color: var(--story); }
.card.reel .card-kind { color: var(--reel); }

.card-caption {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
}

.card-meta {
  font-size: 0.78rem;
  color: #9bb0c6;
}

.card-score {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  color: #d4c4a0;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.card-actions button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--foam);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.card-actions button:hover,
.card-actions button:focus-visible {
  border-color: var(--reel);
  outline: none;
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  max-width: 22rem;
  line-height: 1.45;
}

.hint code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--reel);
}

@media (max-width: 860px) {
  .stage {
    grid-template-columns: 1fr;
    padding: 28px 18px 40px;
    gap: 28px;
  }

  .board h1 { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
