:root {
  --ink: #151515;
  --paper: #f4f0e8;
  --paper-2: #ebe5da;
  --white: #fffdf8;
  --orange: #ff5b35;
  --orange-soft: #ffb49f;
  --blue: #2747d7;
  --blue-soft: #b8c5ff;
  --yellow: #f3c942;
  --pink: #ef7da5;
  --magenta: #c84c9b;
  --cyan: #38bcd0;
  --plum: #5b2b73;
  --green: #59775a;
  --muted: #6f6b64;
  --line: rgba(21, 21, 21, .15);
  --shadow: 0 18px 50px rgba(41, 33, 25, .14);
  --radius: 22px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Iowan Old Style, Baskerville, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--paper); scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 91, 53, .10), transparent 28rem),
    linear-gradient(rgba(21, 21, 21, .026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 21, 21, .026) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 28px 28px, 28px 28px, auto;
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(39, 71, 215, .32);
  outline-offset: 2px;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; padding-bottom: 96px; }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 232, .88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: rotate(-1.5deg);
}

.brand-mark {
  display: grid;
  min-width: 88px;
  font-size: 13px;
  font-weight: 800;
  line-height: .9;
  letter-spacing: -.055em;
  text-align: left;
}
.brand-mark strong { font-size: 24px; font-weight: 800; }
.brand-la {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  color: var(--white);
  background: var(--orange);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  border-radius: 3px 12px 3px 12px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.install-mini { min-height: 40px; padding: 8px 14px; border-color: var(--blue); background: var(--blue); }
.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: var(--white);
  background: var(--green);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.network-pill[hidden] { display: none; }
.network-pill svg { width: 15px; height: 15px; }
body.app-installed .install-action { display: none !important; }
.privacy-pill, .eyebrow, .category-pill, .status-chip, .mini-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .72);
  border-radius: 99px;
}
.privacy-pill i { width: 7px; height: 7px; background: #41a35c; border-radius: 50%; box-shadow: 0 0 0 3px rgba(65,163,92,.14); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  transition: .18s ease;
}
.icon-button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(21,21,21,.10); }
.mobile-upload { display: none; background: var(--ink); color: var(--white); }

main { width: min(1240px, 100%); margin: 0 auto; padding: clamp(24px, 4vw, 56px); }
.view { display: none; animation: view-in .3s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 28px; }
.heading-copy { max-width: 760px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px; color: var(--orange); }
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-family: var(--font-display); font-size: clamp(42px, 7vw, 76px); line-height: .92; letter-spacing: -.055em; }
h2 { margin-bottom: 10px; font-family: var(--font-display); font-size: clamp(28px, 4vw, 42px); line-height: 1; letter-spacing: -.035em; }
h3 { margin-bottom: 8px; font-size: 18px; letter-spacing: -.025em; }
.lead { max-width: 640px; margin-bottom: 0; color: var(--muted); font-size: clamp(15px, 2vw, 18px); line-height: 1.6; }
.subtle { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  border-radius: 99px;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 9px 22px rgba(21,21,21,.18); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }
.btn.secondary { background: var(--white); color: var(--ink); }
.btn.orange { border-color: var(--orange); background: var(--orange); }
.btn.blue { border-color: var(--blue); background: var(--blue); }
.btn.ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 13px; }
.btn.block { width: 100%; }

.play-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: clamp(26px, 6vw, 76px);
  align-items: center;
  min-height: 560px;
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid var(--ink);
  background: var(--yellow);
  border-radius: 12px 54px 12px 54px;
  box-shadow: var(--shadow);
}
.play-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 420px;
  height: 420px;
  right: -140px;
  top: -160px;
  border: 80px solid rgba(255,253,248,.33);
  border-radius: 50%;
}
.play-hero h1 { max-width: 560px; font-size: clamp(50px, 8vw, 88px); }
.play-hero h1 em { color: var(--orange); font-style: normal; text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .08em; }
.hero-copy { position: relative; z-index: 2; }
.hero-copy .lead { color: rgba(21,21,21,.72); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.app-capabilities { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.app-capabilities span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid rgba(21,21,21,.22); background: rgba(255,253,248,.30); border-radius: 99px; font-family: var(--font-mono); font-size: 9px; font-weight: 500; letter-spacing: .055em; text-transform: uppercase; }
.app-capabilities svg { width: 13px; height: 13px; }
.quick-stats { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 34px; }
.quick-stat { display: grid; gap: 2px; }
.quick-stat strong { font-family: var(--font-display); font-size: 25px; line-height: 1; }
.quick-stat span { color: rgba(21,21,21,.58); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }

.hero-deck { position: relative; min-height: 390px; perspective: 1000px; }
.hero-card {
  position: absolute;
  width: min(270px, 67vw);
  aspect-ratio: 5/7;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 9px 11px 0 var(--ink);
  transform-origin: bottom center;
}
.hero-card:nth-child(1) { z-index: 3; left: 50%; top: 20px; background: var(--blue); color: var(--white); transform: translateX(-56%) rotate(-5deg); }
.hero-card:nth-child(2) { z-index: 2; left: 50%; top: 4px; background: var(--orange); transform: translateX(-40%) rotate(8deg); }
.hero-card:nth-child(3) { z-index: 1; left: 50%; top: 28px; background: var(--white); transform: translateX(-72%) rotate(-14deg); }
.hero-card .card-no { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; }
.hero-card .giant-letter { position: absolute; inset: 18% 0 auto; font-family: var(--font-display); font-size: 170px; font-weight: 800; line-height: 1; text-align: center; }
.hero-card:nth-child(2) .giant-letter { font-family: var(--font-sans); font-weight: 800; }
.hero-card:nth-child(3) .giant-letter { font-family: var(--font-mono); font-size: 142px; }
.hero-card .card-label { position: absolute; left: 20px; right: 20px; bottom: 20px; display: flex; align-items: flex-end; justify-content: space-between; font-weight: 800; text-transform: uppercase; }
.hero-card .card-label span:last-child { font-family: var(--font-mono); font-size: 10px; font-weight: 500; }

.section-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.panel { border: 1px solid var(--line); background: rgba(255,253,248,.78); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(36,31,25,.06); }

.setup-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 24px; }
.setup-panel { padding: clamp(22px, 4vw, 38px); }
.setup-side { padding: 24px; background: var(--ink); color: var(--white); }
.setup-side .subtle { color: rgba(255,255,255,.58); }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0 28px; }
.mode-option { position: relative; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; }
.mode-inner { display: grid; min-height: 150px; padding: 16px; border: 1px solid var(--line); background: var(--white); border-radius: 16px; transition: .18s ease; }
.mode-option input:checked + .mode-inner { border: 2px solid var(--blue); background: rgba(184,197,255,.28); box-shadow: inset 0 0 0 2px var(--paper); }
.mode-inner svg { color: var(--blue); }
.mode-inner strong { align-self: end; font-size: 15px; }
.mode-inner small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.field-label { display: block; margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.player-editor { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 99px; }
.player-chip input { width: 82px; border: 0; outline: 0; background: transparent; font-size: 13px; font-weight: 600; }
.player-chip button { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.player-chip button svg { width: 14px; }
.add-player { min-height: 38px; padding: 7px 12px; }
.setup-note { display: grid; gap: 18px; margin-top: 24px; }
.setup-rule { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start; }
.setup-rule b { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; font-family: var(--font-mono); font-size: 12px; }
.setup-rule p { margin: 3px 0 0; color: rgba(255,255,255,.67); font-size: 13px; line-height: 1.5; }

.game-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.round-info { display: flex; align-items: center; gap: 10px; }
.round-counter { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; }
.live-dot { width: 8px; height: 8px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,91,53,.13); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(255,91,53,0); } }

.game-board { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; }
.drawn-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 2vw, 20px); align-items: start; }
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 470px;
  padding: clamp(18px, 2.4vw, 28px);
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 7px 8px 0 var(--ink);
}
.game-card.type { background: var(--blue); color: var(--white); }
.game-card.place { background: var(--orange); }
.game-card.challenge { background: var(--yellow); }
.game-card::after { content: attr(data-letter); position: absolute; right: -8px; top: 48px; opacity: .10; font-family: var(--font-display); font-size: 190px; font-weight: 800; line-height: 1; pointer-events: none; }
.game-card-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 2; }
.game-card .category-pill { padding: 6px 9px; border: 1px solid currentColor; border-radius: 99px; }
.game-card-number { font-family: var(--font-mono); font-size: 10px; }
.game-card-main { position: relative; z-index: 2; display: flex; flex: 1; flex-direction: column; justify-content: flex-end; }
.game-card-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; border: 1px solid currentColor; border-radius: 50%; }
.game-card-icon svg { width: 23px; height: 23px; }
.game-card h3 { font-family: var(--font-display); font-size: clamp(27px, 3vw, 39px); line-height: .98; }
.game-card p { margin-bottom: 0; font-size: 13px; line-height: 1.55; opacity: .78; }
.game-card-footer { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 14px; border-top: 1px solid currentColor; font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; opacity: .72; }
.linked-preview { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; }
.linked-preview::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,21,21,.12), rgba(21,21,21,.92)); }
.game-card.has-photo { color: var(--white); }
.game-card.has-photo > *:not(.linked-preview) { position: relative; z-index: 2; }

.score-panel { padding: 20px; background: var(--ink); color: var(--white); }
.turn-label { color: rgba(255,255,255,.48); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.turn-name { margin: 6px 0 18px; font-family: var(--font-display); font-size: 28px; }
.score-list { display: grid; gap: 8px; margin-bottom: 20px; }
.score-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; }
.score-row.current { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.score-row span { font-size: 13px; font-weight: 600; }
.score-row strong { font-family: var(--font-mono); }
.game-actions { display: grid; gap: 8px; }
.game-actions .btn { width: 100%; }
.score-panel .btn.secondary { border-color: rgba(255,255,255,.4); background: transparent; color: var(--white); }
.score-panel .btn.ghost { color: rgba(255,255,255,.72); border-color: transparent; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 22px; }
.segmented { display: inline-flex; gap: 3px; padding: 4px; border: 1px solid var(--line); background: rgba(255,253,248,.8); border-radius: 99px; }
.segmented button { padding: 8px 13px; border: 0; background: transparent; border-radius: 99px; font-size: 12px; font-weight: 700; cursor: pointer; }
.segmented button.active { background: var(--ink); color: var(--white); }
.search-box { position: relative; min-width: min(320px, 40vw); }
.search-box svg { position: absolute; top: 50%; left: 13px; transform: translateY(-50%); color: var(--muted); }
.search-box input { width: 100%; min-height: 42px; padding: 10px 14px 10px 40px; border: 1px solid var(--line); background: rgba(255,253,248,.82); border-radius: 99px; }

.deck-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); }
.deck-card { position: relative; aspect-ratio: 5/7; padding: 18px; overflow: hidden; border: 2px solid var(--ink); border-radius: 17px; background: var(--white); box-shadow: 5px 6px 0 var(--ink); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.deck-card:hover { transform: translateY(-6px) rotate(-.5deg); box-shadow: 8px 11px 0 var(--ink); }
.deck-card[data-category="type"] { background: var(--blue); color: var(--white); }
.deck-card[data-category="place"] { background: var(--orange); }
.deck-card[data-category="challenge"] { background: var(--yellow); }
.deck-card-art { position: absolute; inset: 0; z-index: 0; display: grid; place-items: center; overflow: hidden; }
.deck-card-art::before { content: attr(data-letter); font-family: var(--font-display); font-size: 148px; font-weight: 800; line-height: 1; opacity: .11; transform: rotate(-8deg); }
.deck-card-art.has-image { background-size: cover; background-position: center; }
.deck-card-art.has-image::before { display: none; }
.deck-card-art.has-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21,21,21,.08), rgba(21,21,21,.84)); }
.deck-card.has-image { color: var(--white); }
.deck-card-head, .deck-card-body, .deck-card-foot { position: relative; z-index: 1; }
.deck-card-head { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.deck-card-body { position: absolute; left: 18px; right: 18px; bottom: 48px; }
.deck-card h3 { font-family: var(--font-display); font-size: clamp(22px, 2.6vw, 31px); line-height: 1; }
.deck-card p { margin: 0; font-size: 11px; line-height: 1.4; opacity: .74; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deck-card-foot { position: absolute; left: 18px; right: 18px; bottom: 16px; display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; }
.paired-count { display: inline-flex; align-items: center; gap: 4px; }

.example-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: -6px 0 26px; border: 1px solid var(--ink); background: var(--ink); border-radius: 18px; overflow: hidden; }
.example-summary div { display: grid; gap: 4px; padding: 18px 22px; color: var(--white); border-right: 1px solid rgba(255,255,255,.18); }
.example-summary div:last-child { border-right: 0; }
.example-summary strong { color: var(--yellow); font-family: var(--font-display); font-size: 28px; line-height: 1; }
.example-summary span { color: rgba(255,255,255,.68); font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.examples-toolbar { justify-content: flex-start; }
.example-section { margin-top: 42px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.section-title h2 { margin-bottom: 0; }
.section-title p { max-width: 430px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.special-example-grid, .example-grid { display: grid; gap: clamp(13px, 2vw, 22px); }
.special-example-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.example-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.example-card { display: grid; gap: 10px; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.example-card img { width: 100%; aspect-ratio: 5/7; object-fit: cover; border: 2px solid var(--ink); border-radius: 15px; box-shadow: 5px 6px 0 var(--ink); transition: transform .2s ease, box-shadow .2s ease; }
.example-card:hover img { transform: translateY(-5px) rotate(-.35deg); box-shadow: 8px 10px 0 var(--ink); }
.example-card > span { display: grid; gap: 2px; padding: 0 5px; }
.example-card strong { font-size: 13px; }
.example-card small { color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .045em; text-transform: uppercase; }
.example-card.featured:nth-child(1) small { color: var(--cyan); }
.example-card.featured:nth-child(2) small { color: var(--magenta); }
.example-card.featured:nth-child(3) small { color: var(--orange); }
.example-detail { display: block; width: min(390px, 100%); margin: 0 auto; border: 2px solid var(--ink); border-radius: 18px; box-shadow: 8px 10px 0 var(--ink); }

.collection-progress { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 10px; margin: 0 0 26px; }
.progress-overview, .collection-category { min-height: 145px; padding: 18px; border: 1px solid var(--ink); border-radius: 17px; }
.progress-overview { display: grid; align-content: start; color: var(--white); background: var(--ink); }
.progress-overview .eyebrow { margin-bottom: 12px; color: var(--yellow); }
.progress-overview strong { font-family: var(--font-display); font-size: 40px; line-height: 1; }
.progress-overview strong small { color: rgba(255,255,255,.48); font-size: 20px; }
.progress-overview > span:last-of-type { margin-top: 5px; color: rgba(255,255,255,.65); font-size: 12px; }
.progress-track { height: 7px; margin-top: 14px; overflow: hidden; background: rgba(255,255,255,.15); border-radius: 99px; }
.progress-track i { display: block; height: 100%; background: var(--yellow); border-radius: inherit; transition: width .25s ease; }
.collection-category { display: grid; grid-template-columns: 1fr auto; align-content: start; gap: 6px 10px; text-align: left; cursor: pointer; }
.collection-category span { align-self: center; font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.collection-category strong { font-family: var(--font-display); font-size: 34px; line-height: 1; }
.collection-category small { grid-column: 1/-1; line-height: 1.35; }
.collection-category.modern { background: var(--magenta); }
.collection-category.civic { background: var(--cyan); }
.collection-category.vernacular { background: var(--orange); }

.photo-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.photo-sidebar { position: sticky; top: 100px; padding: 22px; }
.upload-zone { display: grid; place-items: center; min-height: 185px; padding: 24px; border: 2px dashed rgba(21,21,21,.3); background: rgba(255,255,255,.45); border-radius: 18px; text-align: center; cursor: pointer; transition: .2s ease; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--orange); background: rgba(255,91,53,.08); }
.upload-zone svg { width: 32px; height: 32px; margin-bottom: 12px; color: var(--orange); }
.upload-zone strong { display: block; margin-bottom: 5px; }
.upload-zone small { color: var(--muted); line-height: 1.4; }
.photo-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.summary-box { padding: 12px; background: var(--paper); border-radius: 12px; }
.summary-box strong { display: block; font-family: var(--font-display); font-size: 23px; }
.summary-box span { color: var(--muted); font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; }
.filter-list { display: grid; gap: 3px; margin-top: 22px; }
.filter-list button { display: flex; justify-content: space-between; width: 100%; padding: 10px 12px; border: 0; background: transparent; border-radius: 9px; text-align: left; cursor: pointer; }
.filter-list button.active { background: var(--ink); color: var(--white); }
.filter-list b { font-family: var(--font-mono); font-size: 10px; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.photo-card { position: relative; aspect-ratio: 4/5; overflow: hidden; border: 1px solid var(--ink); background: var(--paper-2); border-radius: 14px; cursor: pointer; }
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.photo-card:hover img { transform: scale(1.035); }
.photo-card-overlay { position: absolute; inset: auto 0 0; padding: 44px 13px 13px; color: var(--white); background: linear-gradient(transparent, rgba(21,21,21,.86)); }
.photo-card-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-card-meta { display: flex; gap: 7px; margin-top: 5px; font-family: var(--font-mono); font-size: 8px; text-transform: uppercase; opacity: .8; }
.photo-card .linked-badge { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; gap: 4px; padding: 6px 8px; color: var(--ink); background: var(--yellow); border-radius: 99px; font-family: var(--font-mono); font-size: 8px; text-transform: uppercase; }
.empty-state { grid-column: 1/-1; display: grid; place-items: center; min-height: 390px; padding: 40px; border: 1px dashed rgba(21,21,21,.26); background: rgba(255,253,248,.45); border-radius: var(--radius); text-align: center; }
.empty-state-art { position: relative; width: 150px; height: 120px; margin-bottom: 20px; }
.empty-state-art span { position: absolute; display: grid; place-items: center; width: 84px; height: 105px; border: 2px solid var(--ink); border-radius: 10px; font-family: var(--font-display); font-size: 52px; font-weight: 800; box-shadow: 4px 4px 0 var(--ink); }
.empty-state-art span:nth-child(1) { left: 9px; top: 11px; background: var(--blue); color: white; transform: rotate(-10deg); }
.empty-state-art span:nth-child(2) { right: 9px; background: var(--orange); transform: rotate(9deg); }
.empty-state p { max-width: 420px; color: var(--muted); line-height: 1.55; }

.guide-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 22px; }
.guide-main, .guide-aside { padding: clamp(22px, 4vw, 38px); }
.guide-main { background: var(--ink); color: var(--white); }
.guide-main .subtle { color: rgba(255,255,255,.65); }
.rule-steps { display: grid; gap: 0; margin-top: 26px; counter-reset: rules; }
.rule-step { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.16); }
.rule-step::before { counter-increment: rules; content: "0" counter(rules); font-family: var(--font-mono); color: var(--yellow); }
.rule-step p { margin: 3px 0 0; color: rgba(255,255,255,.65); font-size: 13px; line-height: 1.55; }
.mode-list { display: grid; gap: 12px; margin-top: 20px; }
.guide-mode { padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.guide-mode b { display: flex; align-items: center; gap: 8px; }
.guide-mode b svg { color: var(--blue); }
.guide-mode p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.legend { display: grid; gap: 8px; margin-top: 24px; }
.legend-row { display: grid; grid-template-columns: 13px 75px 1fr; gap: 9px; align-items: center; font-size: 11px; }
.legend-row i { width: 11px; height: 11px; border-radius: 50%; }
.legend-row span:last-child { color: var(--muted); }

.bottom-nav {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(21,21,21,.94);
  box-shadow: 0 14px 38px rgba(21,21,21,.28);
  backdrop-filter: blur(18px);
  border-radius: 99px;
  transform: translateX(-50%);
}
.nav-item { position: relative; display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 10px 15px; border: 0; color: rgba(255,255,255,.62); background: transparent; border-radius: 99px; font-size: 12px; font-weight: 700; cursor: pointer; }
.nav-item.active { color: var(--ink); background: var(--yellow); }
.nav-item svg { width: 17px; height: 17px; }
.nav-item b { position: absolute; top: 1px; right: 5px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; color: var(--white); background: var(--orange); border: 2px solid var(--ink); border-radius: 99px; font-size: 8px; }
.nav-item b[hidden] { display: none; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(21,21,21,.66); backdrop-filter: blur(8px); animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { position: relative; width: min(720px, 100%); max-height: min(820px, 92vh); overflow: auto; border: 1px solid var(--ink); background: var(--paper); border-radius: 24px; box-shadow: 0 26px 80px rgba(0,0,0,.32); animation: modal-in .22s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.modal-close { position: sticky; z-index: 4; top: 14px; float: right; margin: 14px 14px 0 0; }
.modal-body { padding: clamp(22px, 4vw, 38px); }
.modal-header { margin-bottom: 22px; padding-right: 48px; }
.modal-header h2 { font-size: 36px; }
.modal-card-layout { display: grid; grid-template-columns: 210px 1fr; gap: 26px; }
.modal-card-preview { aspect-ratio: 5/7; padding: 18px; border: 2px solid var(--ink); border-radius: 17px; background: var(--yellow); box-shadow: 6px 7px 0 var(--ink); }
.modal-card-preview.type { background: var(--blue); color: white; }
.modal-card-preview.place { background: var(--orange); }
.modal-card-preview h3 { margin-top: 145px; font-family: var(--font-display); font-size: 28px; }
.photo-select-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 290px; padding: 2px; overflow: auto; }
.photo-select { position: relative; aspect-ratio: 1; overflow: hidden; border: 2px solid transparent; border-radius: 10px; cursor: pointer; }
.photo-select.selected { border-color: var(--blue); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--blue); }
.photo-select img { width: 100%; height: 100%; object-fit: cover; }
.photo-select span { position: absolute; right: 6px; bottom: 6px; display: none; place-items: center; width: 22px; height: 22px; color: white; background: var(--blue); border-radius: 50%; }
.photo-select.selected span { display: grid; }
.form-row { display: grid; gap: 7px; margin-bottom: 14px; }
.form-row label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.form-row input, .form-row select, .form-row textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); background: var(--white); border-radius: 11px; }
.form-row textarea { min-height: 88px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.detail-photo { width: 100%; max-height: 430px; object-fit: cover; border-radius: 16px; }
.install-preview { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); background: var(--white); border-radius: 18px; }
.install-preview img { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 8px 18px rgba(21,21,21,.14); }
.install-preview strong, .install-preview span { display: block; }
.install-preview strong { margin-bottom: 6px; font-family: var(--font-display); font-size: 22px; }
.install-preview span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.install-steps { display: grid; gap: 10px; margin: 20px 0 0; padding: 0; list-style: none; counter-reset: install; }
.install-steps li { counter-increment: install; display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.install-steps li::before { content: counter(install); display: grid; place-items: center; width: 31px; height: 31px; color: var(--white); background: var(--blue); border-radius: 50%; font-family: var(--font-mono); font-size: 11px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 20px; }
.mini-tag { padding: 6px 8px; border: 1px solid var(--line); border-radius: 99px; }

.toast-root { position: fixed; z-index: 200; right: 18px; bottom: 96px; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 250px; max-width: 360px; padding: 13px 15px; color: var(--white); background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); animation: toast-in .25s ease; font-size: 13px; }
.toast svg { color: var(--yellow); }
@keyframes toast-in { from { opacity: 0; transform: translateX(12px); } }

@media (max-width: 980px) {
  .play-hero { grid-template-columns: 1fr; }
  .hero-deck { min-height: 360px; margin-top: 10px; }
  .setup-layout, .guide-grid { grid-template-columns: 1fr; }
  .game-board { grid-template-columns: 1fr; }
  .score-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .score-panel > .game-actions { align-self: end; }
  .deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-layout { grid-template-columns: 240px 1fr; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .example-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .collection-progress { grid-template-columns: repeat(3, 1fr); }
  .progress-overview { grid-column: 1/-1; min-height: 125px; }
}

@media (max-width: 720px) {
  .app-shell { padding-bottom: 84px; }
  .topbar { min-height: 66px; padding: 10px 16px; }
  .privacy-pill { display: none; }
  .mobile-upload { display: inline-grid; }
  .install-mini { width: 42px; padding: 0; font-size: 0; }
  .install-mini svg { width: 18px; height: 18px; }
  main { padding: 22px 15px 38px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading .btn { width: 100%; }
  .play-hero { min-height: 0; padding: 28px 22px 38px; border-radius: 10px 34px 10px 34px; }
  .play-hero h1 { font-size: 52px; }
  .hero-deck { min-height: 330px; transform: scale(.88); margin: -6px -20px -30px; }
  .hero-actions .btn { flex: 1 1 150px; }
  .mode-cards { grid-template-columns: 1fr; }
  .mode-inner { min-height: 92px; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; }
  .mode-inner svg { grid-row: 1/3; }
  .mode-inner strong { align-self: end; }
  .mode-inner small { margin-top: 0; }
  .game-bar { align-items: flex-start; }
  .drawn-cards { grid-template-columns: 1fr; gap: 18px; }
  .game-card { min-height: 390px; }
  .score-panel { display: block; }
  .score-panel .game-actions { margin-top: 18px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; white-space: nowrap; }
  .search-box { min-width: 0; width: 100%; }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .deck-card { padding: 13px; border-radius: 13px; box-shadow: 3px 4px 0 var(--ink); }
  .deck-card-body { left: 13px; right: 13px; bottom: 39px; }
  .deck-card h3 { font-size: 21px; }
  .deck-card p { display: none; }
  .deck-card-foot { left: 13px; right: 13px; bottom: 12px; }
  .photo-layout { grid-template-columns: 1fr; }
  .photo-sidebar { position: static; }
  .filter-list { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .filter-list button { width: auto; min-width: max-content; gap: 12px; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .photo-card-overlay { padding: 34px 10px 10px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: 91vh; border-radius: 24px 24px 0 0; }
  .modal-card-layout { grid-template-columns: 1fr; }
  .modal-card-preview { width: 190px; margin: 0 auto; }
  .bottom-nav { width: calc(100% - 24px); justify-content: space-around; bottom: max(8px, env(safe-area-inset-bottom)); }
  .nav-item { flex: 1; justify-content: center; padding: 9px 8px; }
  .nav-item span { font-size: 10px; }
  .example-summary { grid-template-columns: 1fr; }
  .example-summary div { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.18); }
  .example-summary div:last-child { border-bottom: 0; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .special-example-grid { grid-template-columns: 1fr; }
  .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-progress { grid-template-columns: 1fr; }
  .progress-overview { grid-column: auto; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: max(12px, env(safe-area-inset-top)); }
  .app-shell { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body { overscroll-behavior-y: none; }
}

@media (max-width: 390px) {
  .nav-item { flex-direction: column; gap: 2px; }
  .nav-item svg { width: 16px; height: 16px; }
  .deck-card h3 { font-size: 18px; }
  .quick-stats { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
