:root {
  --bg0: #0f1218;
  --bg1: #171c26;
  --ink: #f2ebe3;
  --muted: #a39a90;
  --accent: #c45c3e;
  --accent-2: #e8b86d;
  --line: rgba(242, 235, 227, 0.12);
  --card: rgba(23, 28, 38, 0.92);
  --radius: 16px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(196, 92, 62, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(232, 184, 109, 0.14), transparent 50%),
    linear-gradient(180deg, #12161f 0%, var(--bg0) 45%, #0c0e13 100%);
  z-index: 0;
}

.site-header,
.shell,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 20px 8px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.brand-sub {
  font-size: 0.75rem;
  color: var(--accent-2);
  letter-spacing: 0.2em;
}

.park-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.park-link:hover { color: var(--ink); border-bottom-color: var(--line); }

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 20px 48px;
}

.shell:has(.panel-hub.active) {
  max-width: 920px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 32px;
  backdrop-filter: blur(8px);
  animation: rise 0.45s ease both;
}

.panel-hub {
  background: transparent;
  border: 0;
  padding-left: 0;
  padding-right: 0;
  backdrop-filter: none;
}

.panel[hidden] { display: none !important; }

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

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.35rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }

.lede {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 1rem;
}

.nick-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.nick-form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  font-size: 1rem;
  margin-bottom: 14px;
}

.nick-form input[type="text"]:focus {
  outline: 2px solid rgba(196, 92, 62, 0.45);
  border-color: transparent;
}

.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}

.consent-row input {
  margin-top: 3px;
  flex-shrink: 0;
}

.hint {
  margin: 14px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #9a3d28);
  color: #fff;
  width: 100%;
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 16px;
}

.btn-share {
  background: var(--bg1);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-share:hover {
  border-color: rgba(232, 184, 109, 0.45);
}

.quiz-progress {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.quiz-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}

.quiz-meta {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  text-align: left;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.quiz-option:hover {
  border-color: rgba(196, 92, 62, 0.55);
  background: #1d2431;
}

.score-list {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.score-list li {
  display: grid;
  grid-template-columns: minmax(96px, 1.2fr) 1fr 40px;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
}

.score-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: inherit;
}

.share-box {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-bottom: 20px;
}

.share-label {
  margin: 0 0 12px;
  font-weight: 600;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 40px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer a { color: var(--accent-2); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #1f2633;
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 50;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.bookshelf {
  margin: 8px 0 28px;
}

.shelf-row {
  position: relative;
  padding: 8px 4px 0;
}

.shelf-books {
  list-style: none;
  margin: 0;
  padding: 0 8px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 16px;
  min-height: 220px;
}

.shelf-plank {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #3a2a22 0%, #2a1d17 45%, #1a120e 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(232, 184, 109, 0.18);
}

.book-slot { position: relative; z-index: 1; }

.book-slot--loading,
.book-slot--empty {
  width: 100%;
  color: var(--muted);
  font-size: 0.92rem;
  padding-bottom: 8px;
}

.book {
  --book-h: 200px;
  --book-w: 132px;
  width: var(--book-w);
  height: var(--book-h);
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  display: block;
  text-align: left;
  color: var(--ink);
  background: transparent;
  transform-origin: center bottom;
  transition: transform 0.22s ease, filter 0.22s ease;
  filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
}

.book:hover,
.book:focus-visible {
  transform: translateY(-10px) rotate(-1.5deg);
  outline: none;
  filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.45));
}

.book-cover {
  position: absolute;
  inset: 0;
  border-radius: 3px 8px 8px 3px;
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.book-cover::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, rgba(0,0,0,0.35), transparent);
}

.book-cover::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(242, 235, 227, 0.12);
  border-radius: 2px;
  pointer-events: none;
}

.book--tone-ember .book-cover {
  background: linear-gradient(160deg, #5c2a1f 0%, #2a1612 55%, #1a100e 100%);
}
.book--tone-ink .book-cover {
  background: linear-gradient(160deg, #243044 0%, #151b26 55%, #0e1218 100%);
}
.book--tone-moss .book-cover {
  background: linear-gradient(160deg, #2f3d2a 0%, #1a2218 55%, #10140f 100%);
}
.book--tone-wine .book-cover {
  background: linear-gradient(160deg, #4a1f32 0%, #241018 55%, #140c10 100%);
}

.book-badge {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  border: 1px solid rgba(232, 184, 109, 0.35);
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
}

.book-title {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 10px 0 6px;
}

.book-sub {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  color: rgba(242, 235, 227, 0.72);
  line-height: 1.35;
}

.book-meta {
  position: relative;
  z-index: 1;
  font-size: 0.7rem;
  color: rgba(163, 154, 144, 0.95);
  margin-top: auto;
}

@media (max-width: 480px) {
  .book { --book-h: 176px; --book-w: 112px; }
  .book-title { font-size: 0.95rem; }
}

.park-promo {
  margin-top: 8px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(232, 184, 109, 0.28);
  background: linear-gradient(135deg, rgba(196, 92, 62, 0.14), rgba(23, 28, 38, 0.6));
}

.park-promo-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.park-promo-body {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

body.is-embed .park-link,
body.is-embed .park-promo,
body.is-embed #site-footer,
body.is-embed #back-to-hub,
body.is-embed #result-to-hub {
  display: none !important;
}

body.is-embed .site-header {
  padding-top: max(12px, env(safe-area-inset-top));
}

body.is-embed .shell {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

@media (max-width: 480px) {
  .panel { padding: 22px 18px 26px; }
  .score-list li { grid-template-columns: 72px 1fr 36px; font-size: 0.82rem; }
}
