:root {
  --bg: #edf3fb;
  --paper: rgba(255, 255, 255, 0.96);
  --paper-strong: rgba(255, 255, 255, 0.99);
  --ink: #15233a;
  --ink-soft: #55657c;
  --muted: #78879b;
  --line: #d9e1eb;
  --navy: #16253d;
  --navy-soft: #2f4567;
  --coral: #ff6f61;
  --coral-strong: #f04f73;
  --mint: #11a39a;
  --mint-soft: #ebfbf8;
  --peach: #fff1ea;
  --danger: #b82353;
  --shadow: 0 24px 48px rgba(20, 35, 58, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(255, 111, 97, 0.14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(17, 163, 154, 0.1), transparent 18%),
    linear-gradient(180deg, #fbfdff 0%, #edf3fb 100%);
}

a {
  color: inherit;
}

.topbar,
.hero,
.hero-card,
.gate-panel,
.info-card,
.summary-panel,
.app-topbar,
.session-bar,
.stats-bar,
.game-stage {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.page,
.gate-shell {
  width: min(1120px, calc(100% - 24px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.gate-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.gate-panel {
  width: min(560px, 100%);
  padding: 36px;
  border-radius: 32px;
}

.pin-form {
  display: grid;
  gap: 14px;
}

.pin-form .button {
  margin-top: 10px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  color: var(--navy-soft);
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  max-width: 11ch;
}

.app-title {
  max-width: none;
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.intro,
.lead,
.info-card p,
.summary-panel p,
.gate-note p {
  color: var(--ink-soft);
  line-height: 1.6;
}

.compact-lead {
  max-width: 34rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

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

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--coral), var(--coral-strong));
}

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

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

.field span {
  color: var(--navy-soft);
  font-size: 0.94rem;
  font-weight: 700;
}

.field input {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.field input:focus {
  outline: 3px solid rgba(255, 111, 97, 0.14);
  border-color: var(--coral);
}

.notice {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.notice.error {
  color: var(--danger);
  border-color: rgba(184, 35, 83, 0.24);
  background: #fff3f7;
}

.check-list {
  margin: 14px 0 0;
  padding-left: 20px;
  line-height: 1.75;
  color: var(--ink);
}

.topbar {
  width: min(1120px, calc(100% - 24px));
  margin: 18px auto 0;
  padding: 14px 18px;
  border-radius: 999px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  text-decoration: none;
  font-weight: 800;
}

.topnav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.topnav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
}

.hero {
  border-radius: 30px;
  padding: 34px;
  display: grid;
  grid-template-columns: 1.35fr 0.92fr;
  gap: 18px;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.hero-card {
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(165deg, rgba(255, 241, 234, 0.96), rgba(235, 251, 248, 0.96));
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.info-tabs {
  margin-top: 20px;
}

.tab-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tab-button.active {
  background: linear-gradient(135deg, var(--navy), var(--coral));
  border-color: transparent;
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.info-card,
.summary-panel {
  border-radius: 28px;
  padding: 20px;
}

.info-card.accent {
  background: linear-gradient(160deg, rgba(255, 111, 97, 0.08), rgba(17, 163, 154, 0.08));
}

.app-page {
  width: min(920px, calc(100% - 12px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 8px 0 16px;
}

.app-shell {
  display: grid;
  gap: 12px;
}

.app-topbar,
.session-bar,
.stats-bar,
.game-stage {
  border-radius: 28px;
}

.app-topbar {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.toolbar-link {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}

.topbar-title {
  text-align: center;
}

.topbar-title .eyebrow {
  margin-bottom: 4px;
}

.session-bar {
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.session-copy {
  display: grid;
  gap: 6px;
}

.session-line {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
}

.session-subline {
  margin: 0;
  color: var(--ink-soft);
}

.start-button {
  min-width: 156px;
}

.stats-bar {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat-chip,
.summary-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.stat-chip span,
.summary-card span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 5px;
}

.stat-chip strong,
.summary-card strong {
  font-size: 1.15rem;
  color: var(--navy);
}

.game-stage {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.direction-banner {
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
  color: var(--navy);
  font-weight: 700;
}

.deck-shell {
  position: relative;
  min-height: 500px;
}

.deck-stack,
.deck {
  position: absolute;
  inset: 0;
  border-radius: 30px;
}

.deck-stack {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 225, 235, 0.78);
}

.deck-back-one {
  transform: translateY(10px) scale(0.97);
}

.deck-back-two {
  transform: translateY(18px) scale(0.94);
}

.deck {
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.96), rgba(243, 248, 253, 0.98)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 245, 252, 0.96));
  border: 1px solid var(--line);
  box-shadow: 0 26px 50px rgba(20, 35, 58, 0.14);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.deck,
.deck * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.deck::before {
  content: "";
  position: absolute;
  inset: 20px;
  border-radius: 24px;
  border: 1px dashed rgba(22, 37, 61, 0.12);
}

.deck-glow {
  position: absolute;
  top: 50%;
  width: 120px;
  height: 120px;
  margin-top: -60px;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.28;
}

.deck-glow-left {
  left: 18px;
  background: rgba(17, 163, 154, 0.22);
}

.deck-glow-right {
  right: 18px;
  background: rgba(255, 111, 97, 0.22);
}

.deck-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 90px;
  height: 90px;
  margin-left: -45px;
  margin-top: -45px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(22, 37, 61, 0.08);
  box-shadow: 0 14px 28px rgba(20, 35, 58, 0.1);
}

.deck-center.focus {
  transform: scale(1.06);
}

.deck-center.active-left {
  background: linear-gradient(135deg, rgba(235, 251, 248, 0.98), rgba(17, 163, 154, 0.14));
}

.deck-center.active-right {
  background: linear-gradient(135deg, rgba(255, 241, 234, 0.98), rgba(255, 111, 97, 0.14));
}

.deck-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(82vw, 330px);
  max-width: 330px;
  min-height: 190px;
  transform: translate(-50%, -50%);
  border-radius: 30px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%);
  border: 2px solid rgba(22, 37, 61, 0.08);
  box-shadow: 0 28px 52px rgba(20, 35, 58, 0.18);
  display: grid;
  touch-action: none;
}

.card-face {
  padding: 24px 22px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 10px;
}

.deck-card.dragging {
  box-shadow: 0 34px 60px rgba(20, 35, 58, 0.24);
}

.deck-card.direction-left {
  border-color: rgba(17, 163, 154, 0.36);
  background: linear-gradient(160deg, #ffffff 0%, #effbf8 100%);
}

.deck-card.direction-right {
  border-color: rgba(255, 111, 97, 0.34);
  background: linear-gradient(160deg, #ffffff 0%, #fff3ee 100%);
}

.card-kicker {
  color: var(--navy-soft);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-subline {
  color: var(--ink-soft);
  font-size: 0.94rem;
}

.result-row {
  display: grid;
  gap: 12px;
}

.result-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--mint-soft);
  border: 1px solid rgba(17, 163, 154, 0.16);
  color: var(--mint);
  font-weight: 800;
}

.result-badge.warn {
  background: var(--peach);
  border-color: rgba(255, 111, 97, 0.16);
  color: var(--navy);
}

.result-badge.error {
  background: #fff3f7;
  border-color: rgba(184, 35, 83, 0.18);
  color: var(--danger);
}

.score-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 700;
}

.summary-panel.hidden {
  display: none;
}

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

.info-under-app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 920px) {
  .hero,
  .info-under-app {
    grid-template-columns: 1fr;
  }

  .session-bar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    border-radius: 24px;
    padding: 14px;
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .page,
  .gate-shell {
    width: min(100% - 16px, 1120px);
  }

  .hero,
  .hero-card,
  .gate-panel,
  .info-card,
  .summary-panel,
  .app-topbar,
  .session-bar,
  .stats-bar,
  .game-stage {
    border-radius: 24px;
    padding: 16px;
  }

  .app-topbar {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .topbar-title {
    grid-column: 1 / -1;
    order: -1;
    text-align: left;
  }

  .stats-bar,
  .score-row,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .deck-shell {
    min-height: 460px;
  }

  .deck-card {
    width: min(84vw, 292px);
    min-height: 176px;
  }
}

@media (max-width: 520px) {
  .app-title {
    font-size: 2.05rem;
  }

  .compact-lead,
  .session-subline {
    font-size: 0.98rem;
  }

  .stats-bar,
  .score-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .deck-shell {
    min-height: 420px;
  }

  .deck-center {
    width: 82px;
    height: 82px;
    margin-left: -41px;
    margin-top: -41px;
  }

  .deck-card {
    width: min(86vw, 272px);
    min-height: 166px;
  }

  .card-face {
    padding: 20px 18px;
  }
}
