:root {
  --bg-deep: #1a2a24;
  --bg-mid: #243830;
  --foam: #f4efe4;
  --mist: #c5d5c8;
  --muted: #8fa898;
  --ink: #1c1814;
  --spray: #5ecf8a;
  --water: #5eb8d8;
  --amber: #e8a838;
  --tire: #e07060;
  --paper: #f7f1e6;
  --paper-dark: #e8dcc8;
  --radius: 10px;
  --card-w: 118px;
  --card-h: 168px;
  --card-w-lg: 168px;
  --card-h-lg: 240px;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, sans-serif;
  --shadow-card: 0 10px 24px rgba(20, 30, 24, 0.45);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--foam);
  background: var(--bg-deep);
}

body {
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 20% 15%, rgba(232, 168, 56, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 50% at 85% 25%, rgba(94, 184, 216, 0.16), transparent 50%),
    radial-gradient(ellipse 80% 55% at 50% 100%, rgba(94, 207, 138, 0.12), transparent 55%),
    linear-gradient(170deg, #243a32 0%, #1a2a24 45%, #15221d 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='10' cy='10' r='1.2' fill='%23c5d5c8'/%3E%3Ccircle cx='50' cy='40' r='0.8' fill='%23c5d5c8'/%3E%3C/svg%3E");
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

#start-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.start-inner {
  max-width: 42rem;
  width: 100%;
  animation: rise 0.8s ease-out both;
}

.brand,
.brand-mini {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--spray);
}

.brand {
  font-size: clamp(2.5rem, 8vw, 4rem);
  margin: 0 0 0.35rem;
  line-height: 0.95;
}

.brand-mini {
  font-size: 1.1rem;
}

#start-screen h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.85rem, 5.5vw, 2.65rem);
  margin: 0 0 1rem;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--foam);
}

.tagline {
  margin: 0 0 0.85rem;
  color: var(--mist);
  font-size: 1.05rem;
  line-height: 1.55;
}

.tagline em {
  font-style: italic;
  color: var(--amber);
}

.tagline-block {
  margin: 0 0 1.5rem;
  padding: 1rem 1.05rem 0.9rem;
  background: rgba(18, 30, 26, 0.45);
  border-radius: var(--radius);
  border: 1px solid rgba(197, 213, 200, 0.12);
  touch-action: pan-y;
}

.tagline-block .fact-slides {
  position: relative;
  min-height: 13.5rem;
  overflow: visible;
}

.tagline-block .fact-slide {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 0.85rem 1.1rem;
  align-items: stretch;
  text-align: left;
  padding: 0.15rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  transform: translateX(0.6rem);
  transition: opacity 0.35s ease, transform 0.35s ease, visibility 0.35s;
}

.tagline-block .fact-slide.is-active {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 1;
  transform: translateX(0);
}

.tagline-block .fact-media {
  display: flex;
  align-items: stretch;
  min-width: 0;
  padding: 0.55rem;
  background: rgba(10, 18, 14, 0.55);
  border: 1px solid rgba(197, 213, 200, 0.14);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: inset 0 1px 0 rgba(94, 207, 138, 0.06);
}

.tagline-block .fact-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 0.45rem;
  margin: 0;
  width: 100%;
  min-height: 11.5rem;
}

.tagline-block .fact-thumbs img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 5.25rem;
  object-fit: contain;
  object-position: center;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid rgba(197, 213, 200, 0.22);
  background: rgba(26, 42, 36, 0.9);
  box-shadow: 0 4px 12px rgba(10, 18, 14, 0.4);
}

.tagline-block .fact-thumbs--trio {
  grid-template-columns: 1.35fr 1fr;
  grid-template-rows: 1fr 1fr;
}

.tagline-block .fact-thumbs--trio img:first-child {
  grid-row: 1 / -1;
  min-height: 100%;
}

.tagline-block .fact-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.85rem 1rem;
  background: rgba(36, 56, 48, 0.35);
  border: 1px solid rgba(197, 213, 200, 0.12);
  border-radius: calc(var(--radius) + 2px);
  border-left: 3px solid rgba(94, 207, 138, 0.55);
}

.tagline-block .fact-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--spray);
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.tagline-block .fact-text {
  margin: 0;
  max-width: none;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--mist);
}

.tagline-block .fact-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.7rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(197, 213, 200, 0.1);
}

.tagline-block .fact-nav {
  width: 1.85rem;
  height: 1.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(197, 213, 200, 0.22);
  border-radius: 999px;
  background: rgba(36, 56, 48, 0.75);
  color: var(--foam);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.tagline-block .fact-nav:hover,
.tagline-block .fact-nav:focus-visible {
  background: rgba(94, 207, 138, 0.2);
  border-color: rgba(94, 207, 138, 0.55);
  outline: none;
  transform: translateY(-1px);
}

.tagline-block .fact-dots {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.tagline-block .fact-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(244, 239, 228, 0.28);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tagline-block .fact-dot.active {
  background: var(--spray);
  transform: scale(1.2);
}

.tagline-block .fact-dot:focus-visible {
  outline: 2px solid var(--spray);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .tagline-block .fact-slides {
    min-height: 0;
  }

  .tagline-block .fact-slide {
    grid-template-columns: 1fr;
    gap: 0.65rem;
    padding: 0.1rem;
  }

  .tagline-block .fact-media {
    padding: 0.45rem;
  }

  .tagline-block .fact-thumbs {
    min-height: 10rem;
    gap: 0.4rem;
  }

  .tagline-block .fact-thumbs img {
    min-height: 4.5rem;
  }

  .tagline-block .fact-copy {
    padding: 0.75rem 0.85rem;
    gap: 0.35rem;
  }

  .tagline-block .fact-title {
    font-size: 1.08rem;
  }

  .tagline-block .fact-text {
    font-size: 0.96rem;
  }
}

@media (max-width: 420px) {
  .tagline-block {
    padding: 0.8rem 0.7rem 0.7rem;
  }

  .tagline-block .fact-thumbs {
    min-height: 8.75rem;
    gap: 0.35rem;
  }

  .tagline-block .fact-thumbs img {
    min-height: 3.85rem;
  }

  .tagline-block .fact-copy {
    padding: 0.65rem 0.75rem;
  }

  .tagline-block .fact-title {
    font-size: 1rem;
  }

  .tagline-block .fact-text {
    font-size: 0.9rem;
  }
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.deck-legend {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.deck-legend strong {
  color: var(--foam);
}

.preview-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--foam);
}

.type-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.25rem;
}

.preview-card {
  --frame: #5ecf8a;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: rgba(26, 42, 36, 0.55);
  border: 1px solid color-mix(in srgb, var(--frame) 45%, transparent);
  border-left: 3px solid var(--frame);
}

.preview-card.frame-green { --frame: #5ecf8a; }
.preview-card.frame-blue { --frame: #5eb8d8; }
.preview-card.frame-amber { --frame: #e8a838; }
.preview-card.frame-red { --frame: #e07060; }
.preview-card.frame-wild { --frame: #c9a0d8; }
.preview-card.frame-season { --frame: #e8a838; }

.preview-card h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--frame) 85%, white);
}

.preview-card p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--spray);
  color: #123024;
  box-shadow: 0 8px 24px rgba(94, 207, 138, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--foam);
  border: 1.5px solid rgba(244, 239, 228, 0.3);
}

.btn.sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.panel-dialog {
  border: 1px solid rgba(197, 213, 200, 0.25);
  border-radius: 14px;
  background: var(--bg-mid);
  color: var(--foam);
  padding: 1.75rem;
  max-width: 28rem;
  box-shadow: var(--shadow-card);
}

.panel-dialog::backdrop {
  background: rgba(12, 20, 16, 0.72);
  backdrop-filter: blur(4px);
}

.panel-dialog h2 {
  font-family: var(--font-display);
  margin: 0 0 1rem;
}

/* ——— Introduction slides ——— */
#intro-screen {
  align-items: stretch;
  justify-content: center;
  padding: 1rem 1rem 1.25rem;
}

.intro-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 2rem);
  animation: rise 0.55s ease-out both;
}

.intro-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.slide-dots {
  display: flex;
  gap: 0.45rem;
  margin-left: auto;
}

.slide-dots .dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  background: rgba(244, 239, 228, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.slide-dots .dot.active {
  background: var(--spray);
  transform: scale(1.2);
}

.slides {
  flex: 1;
  position: relative;
  background: rgba(26, 42, 36, 0.72);
  border: 1px solid rgba(197, 213, 200, 0.18);
  border-radius: 18px;
  padding: 1.35rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-card);
  overflow: auto;
}

.slide {
  display: none;
  animation: rise 0.4s ease-out both;
}

.slide.active {
  display: block;
}

.slide-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spray);
}

.slide h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  margin: 0 0 0.55rem;
  line-height: 1.2;
}

.slide-lead {
  margin: 0 0 1.15rem;
  color: var(--mist);
  line-height: 1.5;
  max-width: 40rem;
}

.slide-lead em {
  color: var(--amber);
  font-style: italic;
}

.slide-grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.slide-panel {
  background: rgba(18, 30, 26, 0.55);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(197, 213, 200, 0.12);
}

.slide-panel h3 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--foam);
}

.slide-panel ul,
.slide-panel ol {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--mist);
  font-size: 0.88rem;
  line-height: 1.5;
}

.slide-panel li + li {
  margin-top: 0.35rem;
}

.color-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.key-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  color: #1c1814;
}

.key-chip.frame-green { background: var(--spray); }
.key-chip.frame-blue { background: var(--water); }
.key-chip.frame-amber { background: var(--amber); }
.key-chip.frame-red { background: var(--tire); color: #fff; }

.framework {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.framework-step {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: rgba(18, 30, 26, 0.55);
  border: 1px solid rgba(197, 213, 200, 0.12);
}

.framework-step > span {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--spray);
  color: #123024;
}

.framework-step strong {
  display: block;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}

.framework-step p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.season-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.season-pill {
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--foam);
  border: 1px solid transparent;
}

.season-pill strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.82rem;
}

.season-pill.hot {
  background: rgba(232, 168, 56, 0.15);
  border-color: rgba(232, 168, 56, 0.35);
}

.season-pill.wet {
  background: rgba(94, 184, 216, 0.15);
  border-color: rgba(94, 184, 216, 0.35);
}

.season-pill.urban {
  background: rgba(196, 168, 130, 0.15);
  border-color: rgba(196, 168, 130, 0.35);
}

.intro-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.intro-progress {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .slide-grid.two,
  .season-row {
    grid-template-columns: 1fr;
  }

  .slides {
    padding: 1.1rem;
  }

  .intro-top #btn-skip-intro {
    order: 3;
    width: 100%;
  }

  .slide-dots {
    margin-left: 0;
  }
}

.rules-list {
  margin: 0 0 1.5rem;
  padding-left: 1.2rem;
  color: var(--mist);
  line-height: 1.55;
  font-size: 0.95rem;
}

.swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 0.15rem;
}

.swatch.green { background: var(--spray); }
.swatch.blue { background: var(--water); }
.swatch.amber { background: var(--amber); }
.swatch.red { background: var(--tire); }

.picker-hint {
  color: var(--muted);
  margin: -0.5rem 0 1rem;
  font-size: 0.9rem;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.color-pick {
  border: none;
  border-radius: 12px;
  padding: 1rem 0.75rem;
  font-weight: 700;
  cursor: pointer;
  color: #1c1814;
  font-family: var(--font-body);
}

.color-pick.frame-green { background: var(--spray); }
.color-pick.frame-blue { background: var(--water); }
.color-pick.frame-amber { background: var(--amber); }
.color-pick.frame-red { background: var(--tire); color: #fff; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.1rem;
  border-bottom: 1px solid rgba(197, 213, 200, 0.15);
  background: rgba(26, 42, 36, 0.72);
  backdrop-filter: blur(10px);
}

.season-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(232, 168, 56, 0.15);
  border: 1px solid rgba(232, 168, 56, 0.35);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--amber);
}

.season-badge.rainy {
  background: rgba(94, 184, 216, 0.15);
  border-color: rgba(94, 184, 216, 0.4);
  color: #9fd4ea;
}

.season-badge.urban,
.season-badge.dry {
  background: rgba(196, 168, 130, 0.15);
  border-color: rgba(196, 168, 130, 0.4);
  color: #d4b896;
}

.deck-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.deck-meta strong {
  color: var(--foam);
}

.meters {
  margin-left: auto;
}

.meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.meter-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

.meter-track {
  width: 7rem;
  height: 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--spray), var(--amber), var(--tire));
  transition: width 0.45s ease;
}

.playfield {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.65rem 0.85rem 1rem;
  gap: 0.4rem;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.player-meta {
  display: flex;
  justify-content: space-between;
  padding: 0 0.2rem 0.4rem;
  font-size: 0.88rem;
}

.hand-count {
  color: var(--muted);
  font-size: 0.8rem;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-end;
  min-height: calc(var(--card-h) + 6px);
}

.ai-hand,
.human-hand {
  justify-content: center;
}

.table {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.pile-stack {
  display: flex;
  align-items: flex-end;
  gap: 1.4rem;
}

.deck-pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
}

.deck-pile:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.deck-back {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 2px solid rgba(94, 207, 138, 0.4);
  background:
    linear-gradient(145deg, rgba(94, 207, 138, 0.2), transparent 45%),
    repeating-linear-gradient(-28deg, #254036, #254036 7px, #1c322a 7px, #1c322a 14px);
  box-shadow: var(--shadow-card);
}

.deck-label {
  position: absolute;
  bottom: 0.5rem;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spray);
}

.discard-wrap {
  position: relative;
}

.discard-pile {
  width: var(--card-w-lg);
  height: var(--card-h-lg);
  position: relative;
}

.discard-pile .mtg-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  animation: discard-land 0.3s ease both;
}

.match-chip {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1c1814;
  text-align: center;
  width: 100%;
}

.match-chip.frame-green { background: var(--spray); }
.match-chip.frame-blue { background: var(--water); }
.match-chip.frame-amber { background: var(--amber); }
.match-chip.frame-red { background: var(--tire); color: #fff; }

.turn-banner {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
}

.log-line {
  margin: 0;
  max-width: 38rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
  min-height: 2.5em;
}

/* ——— MTG card frame ——— */
.mtg-card {
  --frame: #5ecf8a;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 9px;
  border: 2.5px solid color-mix(in srgb, var(--frame) 75%, #2a2018);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--frame) 35%, #2a382f) 0%, #1e2a24 100%);
  box-shadow: var(--shadow-card);
  padding: 4px;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  cursor: default;
  user-select: none;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: deal-in 0.35s ease both;
  overflow: hidden;
}

.mtg-card.large {
  width: var(--card-w-lg);
  height: var(--card-h-lg);
  padding: 6px;
  border-radius: 12px;
}

.mtg-card.frame-green { --frame: #5ecf8a; }
.mtg-card.frame-blue { --frame: #5eb8d8; }
.mtg-card.frame-amber { --frame: #e8a838; }
.mtg-card.frame-red { --frame: #e07060; }
.mtg-card.frame-wild {
  --frame: #c9a0d8;
  background: linear-gradient(135deg, #4a3558, #2a2430 60%, #3a5048);
}

.mtg-top {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border-radius: 4px 4px 0 0;
  padding: 3px 5px;
  min-height: 1.35rem;
}

.mtg-name {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.58rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtg-card.large .mtg-name {
  font-size: 0.78rem;
}

.mtg-cost {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8e8, var(--frame));
  border: 1.5px solid color-mix(in srgb, var(--frame) 60%, #333);
  display: grid;
  place-items: center;
  font-size: 0.58rem;
  font-weight: 800;
  font-family: var(--font-display);
}

.mtg-cost.wide {
  width: auto;
  min-width: 1.15rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  font-size: 0.5rem;
}

.mtg-card.large .mtg-cost.wide {
  font-size: 0.65rem;
  padding: 0 0.35rem;
}

.signature-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.sig-preview {
  --frame: #5ecf8a;
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.55rem;
  border-radius: 12px;
  padding: 0.55rem;
  background: rgba(26, 42, 36, 0.55);
  border: 1px solid color-mix(in srgb, var(--frame) 45%, transparent);
}

.sig-preview.frame-green { --frame: #5ecf8a; }
.sig-preview.frame-blue { --frame: #5eb8d8; }
.sig-preview.frame-red { --frame: #e07060; }

.sig-art {
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: #f5f0e6;
  min-height: 4.5rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.sig-cost {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  color: #123024;
  background: var(--frame);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  margin-bottom: 0.2rem;
}

.sig-meta h3 {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-size: 0.82rem;
  line-height: 1.15;
}

.sig-type {
  margin: 0 0 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--frame) 80%, white);
}

.sig-rules {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
}

.mtg-card.large .mtg-cost {
  width: 1.45rem;
  height: 1.45rem;
  font-size: 0.75rem;
}

.mtg-art {
  flex: 1;
  min-height: 0;
  margin: 3px 0;
  border-radius: 3px;
  background-color: #f5f0e6;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(40, 30, 20, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.mtg-type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  background: var(--paper-dark);
  padding: 2px 5px;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mtg-card.large .mtg-type {
  font-size: 0.62rem;
  padding: 3px 6px;
}

.mtg-num-badge {
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: color-mix(in srgb, var(--frame) 70%, #222);
}

.mtg-text {
  background: var(--paper);
  padding: 3px 5px 2px;
  flex: 0 0 auto;
  max-height: 38%;
  overflow: hidden;
}

.mtg-card:not(.large) .mtg-text {
  display: none;
}

.mtg-card:not(.large) .mtg-type span:first-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mtg-card.large .mtg-text {
  display: block;
  max-height: 28%;
}

.mtg-rules {
  margin: 0 0 0.25rem;
  font-size: 0.58rem;
  line-height: 1.25;
  color: #2a241c;
}

.mtg-flavor {
  margin: 0;
  font-size: 0.52rem;
  line-height: 1.25;
  color: #5a5044;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 0.2rem;
}

.mtg-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--paper);
  border-radius: 0 0 4px 4px;
  padding: 2px 5px 3px;
  font-size: 0.5rem;
  font-weight: 700;
}

.mtg-card.large .mtg-bottom {
  font-size: 0.65rem;
  padding: 3px 6px 4px;
}

.mtg-impact {
  color: #3a342c;
}

.mtg-rarity {
  width: 0.7rem;
  height: 0.7rem;
  display: grid;
  place-items: center;
  border-radius: 2px;
  font-size: 0.55rem;
  transform: rotate(45deg);
}

.mtg-rarity.rarity-C { color: #6a655c; background: #d8d2c6; }
.mtg-rarity.rarity-U { color: #1e4a7a; background: #b8d4f0; }
.mtg-rarity.rarity-R { color: #7a5a10; background: #f0d070; }
.mtg-rarity.rarity-M { color: #6a2010; background: linear-gradient(135deg, #f0a040, #e05080); }

.mtg-card.face-down {
  background:
    linear-gradient(145deg, rgba(94, 207, 138, 0.22), transparent 50%),
    repeating-linear-gradient(-28deg, #254036, #254036 7px, #1c322a 7px, #1c322a 14px);
  border-color: rgba(94, 207, 138, 0.4);
  color: var(--foam);
}

.card-back-mark {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  opacity: 0.55;
}

.human-hand .mtg-card.playable {
  cursor: pointer;
  outline: 2px solid var(--spray);
  outline-offset: 2px;
}

.human-hand .mtg-card.playable:hover {
  transform: translateY(-12px) scale(1.05);
  z-index: 6;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
}

.human-hand .mtg-card:not(.playable) {
  opacity: 0.55;
  filter: saturate(0.75);
}

#end-screen {
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.end-card {
  max-width: 26rem;
  text-align: center;
  animation: rise 0.6s ease-out both;
}

.end-card .brand {
  font-size: 2rem;
}

.end-card h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0.4rem 0 0.75rem;
}

#end-message {
  color: var(--mist);
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding: 0;
}

.end-stats dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.end-stats dd {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--spray);
}

/* ——— Assessment Quiz ——— */
#quiz-screen {
  align-items: stretch;
  justify-content: center;
  padding: 1rem 1rem 1.5rem;
}

.quiz-shell {
  width: min(40rem, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: rise 0.55s ease-out both;
}

.quiz-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.quiz-top .brand-mini {
  margin: 0;
  flex: 0 0 auto;
}

.quiz-progress-wrap {
  flex: 1 1 12rem;
  min-width: 0;
}

.quiz-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

#quiz-score-live {
  color: var(--spray);
}

.quiz-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(197, 213, 200, 0.15);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--spray), var(--water));
  transition: width 0.35s ease;
}

.quiz-play,
.quiz-summary {
  background: rgba(26, 42, 36, 0.72);
  border: 1px solid rgba(197, 213, 200, 0.2);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1.4rem;
}

.quiz-qhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: 0.65rem;
}

.quiz-type {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.quiz-type.type-id {
  color: #123024;
  background: var(--spray);
}

.quiz-type.type-enum {
  color: #0d2a36;
  background: var(--water);
}

.quiz-type.type-sit {
  color: #2a1f0c;
  background: var(--amber);
}

.quiz-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.quiz-prompt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 2.8vw, 1.35rem);
  line-height: 1.35;
  margin: 0 0 1rem;
}

.quiz-art {
  width: 100%;
  max-width: 16rem;
  aspect-ratio: 16 / 11;
  margin: 0 auto 1.1rem;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(197, 213, 200, 0.28);
  box-shadow: var(--shadow-card);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  text-align: left;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1.5px solid rgba(197, 213, 200, 0.22);
  background: rgba(20, 32, 28, 0.55);
  color: var(--foam);
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
  border-color: rgba(94, 207, 138, 0.45);
  transform: translateY(-1px);
}

.quiz-option.selected {
  border-color: var(--spray);
  background: rgba(94, 207, 138, 0.12);
}

.quiz-option.is-correct {
  border-color: var(--spray);
  background: rgba(94, 207, 138, 0.18);
}

.quiz-option.is-wrong {
  border-color: var(--tire);
  background: rgba(224, 112, 96, 0.16);
}

.quiz-option:disabled {
  cursor: default;
}

.quiz-option-mark {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
  border-radius: 4px;
  border: 1.5px solid rgba(197, 213, 200, 0.4);
  background: transparent;
}

.quiz-option.selected .quiz-option-mark {
  background: var(--spray);
  border-color: var(--spray);
  box-shadow: inset 0 0 0 2px rgba(18, 48, 36, 0.85);
}

.quiz-option-text {
  flex: 1;
}

.quiz-feedback {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
}

.quiz-feedback.ok {
  background: rgba(94, 207, 138, 0.12);
  border-color: rgba(94, 207, 138, 0.35);
}

.quiz-feedback.bad {
  background: rgba(224, 112, 96, 0.12);
  border-color: rgba(224, 112, 96, 0.35);
}

.quiz-verdict {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

.quiz-feedback.ok .quiz-verdict {
  color: var(--spray);
}

.quiz-feedback.bad .quiz-verdict {
  color: var(--tire);
}

.quiz-explain {
  margin: 0;
  color: var(--mist);
  font-size: 0.92rem;
  line-height: 1.5;
}

.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
}

.quiz-summary {
  text-align: center;
}

.quiz-summary .brand-mini {
  margin: 0 0 0.35rem;
}

.quiz-summary h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 0 0 0.5rem;
}

.quiz-final-score {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0 0 0.75rem;
  color: var(--foam);
}

.quiz-final-score strong {
  color: var(--spray);
  font-weight: 800;
}

.quiz-final-score span {
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 600;
}

.quiz-final-note {
  color: var(--mist);
  line-height: 1.5;
  margin: 0 auto 1.35rem;
  max-width: 28rem;
}

.quiz-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 0 0 1.5rem;
  padding: 0;
  text-align: center;
}

.quiz-breakdown dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.quiz-breakdown dd {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--water);
}

.quiz-end-cta {
  justify-content: center;
  margin-bottom: 0;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes deal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes discard-land {
  from { transform: scale(1.08) rotate(-3deg); opacity: 0.7; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

@media (max-width: 720px) {
  :root {
    --card-w: 92px;
    --card-h: 132px;
    --card-w-lg: 132px;
    --card-h-lg: 188px;
  }

  .meters {
    margin-left: 0;
    width: 100%;
    order: 6;
  }

  .meter-track {
    flex: 1;
    width: auto;
  }

  .human-hand {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .end-stats {
    grid-template-columns: 1fr;
  }

  .quiz-breakdown {
    grid-template-columns: 1fr;
  }

  .quiz-top #btn-quiz-back {
    width: 100%;
  }
}

/* ——— Board-game request form ——— */
#request-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.req-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--mist);
}

.req-field span em {
  color: var(--muted);
  font-style: normal;
}

.req-field input,
.req-field textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--foam);
  background: var(--bg-deep);
  border: 1px solid rgba(197, 213, 200, 0.25);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  resize: vertical;
}

.req-field input:focus,
.req-field textarea:focus {
  outline: none;
  border-color: var(--spray);
  box-shadow: 0 0 0 2px rgba(94, 207, 138, 0.25);
}

.req-status {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.req-status.ok {
  background: rgba(94, 207, 138, 0.15);
  color: var(--spray);
}

.req-status.err {
  background: rgba(224, 112, 96, 0.15);
  color: var(--tire);
}

.req-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

/* ——— Mode selection cards ——— */
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: min(680px, 100%);
  margin: 0 auto 1.25rem;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(197, 213, 200, 0.22);
  background: var(--bg-mid);
  color: var(--foam);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(94, 207, 138, 0.5);
}

.mode-card.sel {
  border-color: var(--spray);
  box-shadow: 0 0 0 2px rgba(94, 207, 138, 0.25);
}

.mode-ico {
  font-size: 1.5rem;
}

.mode-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.98rem;
}

.mode-desc {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* ——— Online lobby ——— */
.lobby-choice {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.5rem 0;
}

.lobby-code-label {
  color: var(--mist);
  font-size: 0.85rem;
  margin: 0.75rem 0 0.35rem;
}

.lobby-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  color: var(--spray);
  background: var(--bg-deep);
  border: 1px dashed rgba(94, 207, 138, 0.5);
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  text-align: center;
  margin-bottom: 0.6rem;
  user-select: all;
  word-break: break-all;
}

.lobby-spinner {
  width: 34px;
  height: 34px;
  margin: 0.75rem auto;
  border: 3px solid rgba(197, 213, 200, 0.25);
  border-top-color: var(--spray);
  border-radius: 50%;
  animation: lobby-spin 0.8s linear infinite;
}

@keyframes lobby-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 560px) {
  .mode-cards { grid-template-columns: 1fr; }
}
