:root {
  --bg: #ffffff;
  --bg-strong: #f7f7f7;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-strong: #ffffff;
  --ink: #111111;
  --muted: #5f6368;
  --line: rgba(0, 0, 0, 0.1);
  --accent: #8a6337;
  --accent-deep: #6b4d2b;
  --success: #6aaa64;
  --present: #c9b458;
  --miss: #787c7e;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.page-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.hero,
.panel,
.board-panel,
.side-card,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  border-radius: 32px;
  padding: 56px;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, #ffffff 0%, #fcfbf8 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -8% -28% auto;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(138, 99, 55, 0.12) 0%, rgba(138, 99, 55, 0) 72%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Abril Fatface", serif;
  font-weight: 400;
  line-height: 0.95;
}

h1 {
  font-size: clamp(3.8rem, 11vw, 7rem);
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero-copy,
.panel p,
.side-card p,
.help-copy,
.result-summary {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-copy {
  max-width: 640px;
  margin: 18px 0 0;
}

.hero-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.icon-button {
  gap: 10px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
  transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.icon-button:hover svg {
  transform: translateX(1px) scale(1.04);
}

.button.primary {
  background: var(--ink);
  color: #ffffff;
}

.button.is-copied {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
  animation: copiedPulse 420ms ease;
}

.button.secondary {
  background: #ffffff;
  border-color: var(--line);
}

.button.tertiary {
  background: #ffffff;
  border-color: var(--line);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.panel {
  border-radius: 28px;
  padding: 28px;
}

.panel-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-deep);
  background: rgba(184, 105, 45, 0.12);
}

.tile-strip,
.route-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 26px;
}

.tile-strip span,
.route-demo span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  min-height: 62px;
  padding: 0 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel-serious {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
}

.aftergame-intro {
  margin-top: 28px;
}

.site-jump-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.site-jump-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 140ms ease, border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.site-jump-link:hover {
  transform: translateY(-1px);
  color: var(--ink);
  border-color: rgba(0, 0, 0, 0.16);
}

.site-jump-link.is-active {
  background: var(--ink);
  color: #ffffff;
  border-color: var(--ink);
}

.aftergame-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.content-grid-varied {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.content-grid-varied .feature-panel {
  grid-column: auto;
}

.faq-panel {
  grid-column: 1 / -1;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.faq-grid details {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafafa;
  padding: 18px 20px;
}

.faq-grid summary {
  cursor: pointer;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.faq-grid p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.content-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
  align-items: center;
}

.content-visual {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafafa;
}

.content-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.content-list {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.content-list li + li {
  margin-top: 8px;
}

.content-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 0.98rem;
  line-height: 1.5;
}

.content-table th,
.content-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.content-table th {
  color: var(--ink);
  background: #f7f7f7;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.content-table td {
  color: var(--muted);
}

.content-table tr:last-child td {
  border-bottom: 0;
}

.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
  padding: 18px 8px 0;
  border-top: 1px solid var(--line);
}

.site-footer-brand {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.site-footer-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px 18px;
}

.site-footer-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.site-footer-nav a:hover {
  color: var(--ink);
}

.play-shell {
  padding-top: 10px;
}

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 0 8px;
}

.play-header-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 40px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  white-space: nowrap;
}

.site-brand-image {
  display: block;
  width: auto;
  height: 42px;
}

.play-header-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.play-header-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  transition: background-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.play-header-link:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.play-header-link.is-active {
  color: var(--ink);
  background: rgba(138, 99, 55, 0.12);
}

.back-link {
  font-weight: 700;
}

.play-header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.play-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ghost-button {
  min-width: 0;
  min-height: 40px;
  padding: 0 14px;
}

.play-header .ghost-button svg {
  width: 16px;
  height: 16px;
}

.play-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.info-shell {
  width: min(880px, calc(100vw - 32px));
}

.info-hero {
  margin-top: 8px;
}

.info-hero h1 {
  font-size: clamp(2.8rem, 7vw, 4.4rem);
}

.info-copy {
  margin-top: 18px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.info-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.horsle-layout {
  display: flex;
  justify-content: center;
}

.board-panel,
.side-card {
  border-radius: 24px;
  padding: 18px 20px;
}

.board-panel {
  width: min(100%, 540px);
  box-shadow: none;
}

.horsle-panel {
  margin-top: 6px;
}

.horsle-intro {
  text-align: center;
  margin-bottom: 10px;
}

.horsle-intro h1 {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 0.95;
}

.horsle-intro p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.board-topline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.status-label,
.stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.status-value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(100%, 350px);
  margin: 0 auto;
}

.horsle-board {
  max-height: 286px;
  overflow-y: auto;
  align-content: start;
  padding-right: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.horsle-board::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.cell {
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid #d3d6da;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 200ms ease, background-color 180ms ease, border-color 180ms ease;
}

.cell.filled {
  border-color: #878a8c;
}

.cell.locked {
  background: #f6f7f8;
}

.cell.flip {
  animation: flip 420ms ease;
}

.cell.correct {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.cell.present {
  background: var(--present);
  border-color: var(--present);
  color: #fff;
}

.cell.miss {
  background: var(--miss);
  border-color: var(--miss);
  color: #fff;
}

.message {
  min-height: 28px;
  margin: 10px 0 8px;
  color: var(--accent-deep);
  font-weight: 600;
  text-align: center;
}

.keyboard {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 484px;
  margin: 0 auto;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.key {
  min-width: 40px;
  min-height: 50px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: #d3d6da;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  font-weight: 700;
}

.key.wide {
  min-width: 62px;
}

.key.correct {
  background: var(--success);
  color: #fff;
}

.key.present {
  background: var(--present);
  color: #fff;
}

.key.miss {
  background: var(--miss);
  color: #fff;
}

.side-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100%, 700px);
}

.stats-card {
  grid-column: 1 / -1;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.stats-summary-modal {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stats-summary-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafafa;
}

.stats-summary-item strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
  line-height: 1;
}

.distribution-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.compact-distribution {
  margin-bottom: 18px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
}

.distribution-label,
.distribution-value {
  font-size: 0.9rem;
  font-weight: 700;
}

.distribution-bar-track {
  height: 14px;
  border-radius: 999px;
  background: #efefef;
  overflow: hidden;
}

.distribution-bar {
  width: 0;
  min-width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, #b88a59 100%);
  transition: width 220ms ease;
}

.distribution-bar.loss-bar {
  background: linear-gradient(90deg, var(--miss) 0%, #9ea2a4 100%);
}

.distribution-bar.is-empty {
  width: 0 !important;
}

.loss-row .distribution-label,
.loss-row .distribution-value {
  color: var(--miss);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(520px, 100%);
  border-radius: 28px;
  padding: 30px;
}

.help-modal-card {
  width: min(720px, 100%);
  max-height: min(92vh, 860px);
  overflow-y: auto;
}

.help-visual {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fafafa;
}

.help-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.help-steps {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.help-steps div,
.help-color-guide div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafafa;
}

.help-steps span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.help-steps p,
.help-color-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.help-color-guide {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.guide-tile {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
}

.guide-tile.correct {
  background: var(--success);
}

.guide-tile.present {
  background: var(--present);
}

.guide-tile.absent {
  background: var(--miss);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.result-stats > div {
  padding: 16px;
  border-radius: 18px;
  background: #fafafa;
  border: 1px solid var(--line);
}

.countdown-card {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #fcfbf8 0%, #f7f3ed 100%);
}

.countdown-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.06em;
}

.stats-countdown-card {
  margin-top: 16px;
}

.result-line {
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.share-preview {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fafafa;
  color: var(--ink);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.pony {
  position: absolute;
  top: -40px;
  font-size: 1.8rem;
  animation: fall linear forwards;
}

@keyframes flip {
  0% { transform: rotateX(0deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes fall {
  from {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  to {
    transform: translateY(110vh) rotate(220deg);
    opacity: 0;
  }
}

@keyframes copiedPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(106, 170, 100, 0);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 10px 24px rgba(106, 170, 100, 0.28);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 rgba(106, 170, 100, 0);
  }
}

@media (max-width: 900px) {
  .feature-grid,
  .aftergame-grid,
  .panel-serious {
    grid-template-columns: 1fr;
    display: grid;
  }

  .content-grid-varied .feature-panel {
    grid-column: auto;
  }

  .faq-panel {
    grid-column: auto;
  }

  .faq-grid {
    grid-template-columns: 1fr;
  }

  .content-split {
    grid-template-columns: 1fr;
  }

  .panel-serious {
    justify-content: start;
  }

  .play-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .play-header-main {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .play-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .side-panel {
    grid-template-columns: 1fr;
    width: min(100%, 540px);
  }

  .info-grid,
  .site-footer {
    grid-template-columns: 1fr;
    display: grid;
  }

  .site-footer-nav {
    justify-content: flex-start;
  }

  .stats-summary-grid,
  .stats-summary-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-bottom: 28px;
  }

  .hero,
  .panel,
  .board-panel,
  .side-card,
  .modal-card {
    border-radius: 22px;
  }

  .hero {
    padding: 36px 22px;
  }

  .panel,
  .board-panel,
  .side-card,
  .modal-card {
    padding: 20px;
  }

  .tile-strip span,
  .route-demo span,
  .cell {
    border-radius: 14px;
  }

  .board-panel {
    padding: 12px 12px 14px;
    border-radius: 18px;
  }

  .play-header {
    margin-bottom: 10px;
    gap: 10px;
    padding: 0 2px;
  }

  .play-header-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .play-header-nav {
    flex-wrap: wrap;
    gap: 6px;
  }

  .play-header-actions {
    gap: 10px;
  }

  .play-kicker {
    font-size: 0.74rem;
    letter-spacing: 0.14em;
  }

  .board-topline {
    margin-bottom: 10px;
  }

  .board {
    width: min(100%, 312px);
    gap: 5px;
  }

  .horsle-board {
    max-height: 252px;
  }

  .horsle-intro h1 {
    font-size: clamp(1.9rem, 11vw, 2.8rem);
  }

  .cell {
    border-radius: 8px;
    font-size: clamp(1.2rem, 5vw, 1.55rem);
  }

  .keyboard {
    max-width: 100%;
    gap: 5px;
  }

  .key {
    min-width: 28px;
    min-height: 40px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 0.82rem;
  }

  .key.wide {
    min-width: 50px;
  }

  .content-table {
    font-size: 0.9rem;
  }

  .content-table th,
  .content-table td {
    padding: 12px;
  }

  .stats-summary-grid,
  .stats-summary-modal {
    grid-template-columns: 1fr 1fr;
  }

  .distribution-row {
    grid-template-columns: 16px minmax(0, 1fr) 28px;
    gap: 8px;
  }
}
