/* ── Reset & Base ─────────────────────────────────── */
/* v2024-05-expanded */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --parchment:    #f5e9c9;
  --parchment-dk: #e8d5a3;
  --ink:          #2c1a0e;
  --ink-light:    #5c3d1e;
  --gold:         #b8860b;
  --gold-light:   #d4a843;
  --red:          #7a1c1c;
  --border:       #8b6914;
  --shadow:       rgba(44, 26, 14, 0.4);
}

body {
  min-height: 100vh;
  background: #1a0f06 url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23362010' fill-opacity='0.5'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 4rem;
  font-family: 'IM Fell English', Georgia, serif;
  color: var(--ink);
}

/* ── Parchment Card ───────────────────────────────── */
.parchment-wrapper {
  width: 100%;
  max-width: 720px;
  background: var(--parchment);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 2.5rem 3rem;
  box-shadow:
    0 0 0 6px #0005,
    0 0 60px #0008,
    inset 0 0 40px rgba(139, 105, 20, 0.15);
  position: relative;
}

.parchment-wrapper::before,
.parchment-wrapper::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}
.parchment-wrapper::before { top: 10px; }
.parchment-wrapper::after  { bottom: 10px; }

/* ── Header ───────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.crest {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 2px 4px var(--shadow));
}

h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.4rem;
  color: var(--red);
  text-shadow: 1px 1px 0 var(--gold), 2px 2px 4px var(--shadow);
  letter-spacing: 0.06em;
}

.subtitle {
  font-style: italic;
  color: var(--ink-light);
  margin-top: 0.4rem;
  font-size: 1rem;
}

/* ── Sections ─────────────────────────────────────── */
section {
  margin-bottom: 1.8rem;
}

label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

/* ── Inputs ───────────────────────────────────────── */
input[type="text"],
input[type="password"] {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 2px;
  background: #fffbf0;
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 1rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  border-color: var(--gold-light);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}

.input-row, .api-row {
  display: flex;
  gap: 0.6rem;
}

/* ── Buttons ──────────────────────────────────────── */
button {
  padding: 0.6rem 1.2rem;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  border: 2px solid var(--border);
  border-radius: 2px;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── API section ──────────────────────────────────── */
.api-section {
  background: rgba(139, 105, 20, 0.08);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
}

.api-hint {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink-light);
  font-style: italic;
}

/* ── Quest list ───────────────────────────────────── */
.quest-list-section h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold);
  border-bottom: 1px solid var(--parchment-dk);
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.empty-state {
  text-align: center;
  font-style: italic;
  color: var(--ink-light);
  padding: 2rem;
  line-height: 1.8;
}

/* ── Quest Item ───────────────────────────────────── */
.quest-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: start;
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--parchment-dk);
  border-left: 4px solid var(--gold);
  border-radius: 2px;
  padding: 0.8rem 1rem;
  animation: fadeIn 0.3s ease;
  cursor: pointer;
}

.quest-item.done {
  border-left-color: #666;
  opacity: 0.6;
}

.quest-item.done .quest-title {
  text-decoration: line-through;
  color: var(--ink-light);
}

.quest-item.expanded { }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.quest-checkbox {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 3px;
  cursor: pointer;
  accent-color: var(--gold);
}

.quest-content {
  min-width: 0;
}

.quest-title {
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 600;
}

.quest-fantasy {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  margin-top: 0.4rem;
  display: none;
  white-space: pre-line;
}

.quest-original {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--ink-light);
  margin-top: 0.3rem;
  display: none;
}

.quest-completion {
  margin-top: 0.45rem;
  padding: 0.45rem 0.7rem;
  background: rgba(184, 134, 11, 0.08);
  border-left: 2px solid var(--gold);
  border-radius: 2px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-line;
  animation: fadeIn 0.3s ease;
  display: none;
}
.quest-completion.pending {
  color: var(--ink-light);
  font-style: italic;
  background: rgba(139, 105, 20, 0.05);
}
.quest-completion .dots {
  display: inline-block;
  animation: dotPulse 1.2s steps(3, end) infinite;
}
@keyframes dotPulse {
  0%   { opacity: 0.3; }
  50%  { opacity: 1; }
  100% { opacity: 0.3; }
}

.quest-item.expanded .quest-fantasy,
.quest-item.expanded .quest-original,
.quest-item.expanded .quest-completion {
  display: block;
}

.quest-delete {
  background: none;
  border: none;
  color: var(--ink-light);
  font-size: 1rem;
  padding: 0.1rem 0.3rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  line-height: 1;
}

.quest-delete:hover {
  opacity: 1;
  color: var(--red);
}

/* ── Spinner ──────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.hidden { display: none !important; }

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

/* ── Toast ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--parchment);
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  padding: 0.6rem 1.4rem;
  border-radius: 2px;
  border: 1px solid var(--gold);
  box-shadow: 0 4px 16px #0006;
  animation: toastIn 0.25s ease;
  z-index: 999;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Footer ───────────────────────────────────────── */
footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--parchment-dk);
  font-size: 0.78rem;
  color: var(--ink-light);
  font-style: italic;
}

footer a { color: var(--gold); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.reset-btn {
  display: inline-block;
  background: none;
  border: 1px solid var(--ink-light);
  color: var(--ink-light);
  font-family: inherit;
  font-size: 0.7rem;
  font-style: normal;
  padding: 0.15rem 0.5rem;
  margin-top: 0.5rem;
  opacity: 0.45;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.reset-btn:hover:not(:disabled) {
  opacity: 1;
  color: var(--red);
  border-color: var(--red);
}

/* ── Job Intro (운명 도입) ───────────────────────── */
.intro-card {
  background: rgba(139, 105, 20, 0.08);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 1.8rem 1.6rem 1.4rem;
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.intro-prelude {
  font-style: italic;
  color: var(--ink-light);
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}
.intro-job-name {
  font-family: 'Cinzel', serif;
  color: var(--red);
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 0 var(--gold-light);
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--parchment-dk);
}
.intro-text {
  text-align: left;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-line;
  margin-bottom: 1.4rem;
}
#introStartBtn {
  margin: 0 auto;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
}

/* ── Onboarding ───────────────────────────────────── */
.onboarding-card {
  background: rgba(139, 105, 20, 0.08);
  border: 2px dashed var(--border);
  border-radius: 4px;
  padding: 1.5rem 1.6rem;
  text-align: center;
}

.onboarding-card h2 {
  font-family: 'Cinzel', serif;
  color: var(--red);
  font-size: 1.2rem;
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}

.onboarding-hint {
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 1rem;
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ── Character Panel ──────────────────────────────── */
.character-panel {
  background: linear-gradient(180deg, rgba(184, 134, 11, 0.12), rgba(139, 105, 20, 0.06));
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}

.char-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 0.6rem;
}

.char-job-line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.char-level {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold);
  background: var(--ink);
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.char-job {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: var(--red);
  letter-spacing: 0.03em;
}

.pending-points {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 134, 11, 0.6); }
  50%      { box-shadow: 0 0 0 8px rgba(184, 134, 11, 0); }
}

.xp-bar {
  position: relative;
  height: 16px;
  background: rgba(44, 26, 14, 0.18);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.3s ease;
}

.xp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--ink);
  text-shadow: 0 0 2px var(--parchment);
  letter-spacing: 0.05em;
}

.char-stats {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.stat-pill {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--parchment-dk);
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  color: var(--ink-light);
  letter-spacing: 0.03em;
  position: relative;
  cursor: help;
}
.stat-pill b { color: var(--ink); font-weight: 700; }
.stat-pill em {
  font-style: normal;
  color: var(--gold);
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

.stat-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--ink);
  color: var(--parchment);
  border: 1px solid var(--gold);
  border-radius: 2px;
  padding: 0.55rem 0.75rem;
  font-family: 'IM Fell English', serif;
  font-style: normal;
  font-size: 0.78rem;
  line-height: 1.55;
  letter-spacing: normal;
  width: max-content;
  max-width: 240px;
  text-align: left;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 50;
}
.stat-tooltip b {
  color: var(--gold-light);
  font-weight: 700;
}
.stat-pill:hover .stat-tooltip,
.stat-pill:focus-within .stat-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.quest-slots-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--ink-light);
  font-style: italic;
  border-top: 1px dashed var(--parchment-dk);
  padding-top: 0.5rem;
}
.slot-count {
  font-family: 'Cinzel', serif;
  font-style: normal;
  color: var(--gold);
  font-size: 0.95rem;
}
.slot-next { font-size: 0.78rem; }

/* ── Section headings ─────────────────────────────── */
.equipment-section h2,
.inventory-section h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  color: var(--gold);
  border-bottom: 1px solid var(--parchment-dk);
  padding-bottom: 0.4rem;
  margin-bottom: 0.8rem;
  letter-spacing: 0.04em;
}

/* ── Equipment Grid ───────────────────────────────── */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.equip-slot {
  background: rgba(255, 251, 240, 0.5);
  border: 1px solid var(--parchment-dk);
  border-radius: 2px;
  padding: 0.5rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.equip-slot.filled { border-left: 3px solid var(--gold); }

.equip-slot-label {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.equip-slot-empty {
  font-style: italic;
  color: var(--ink-light);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.5rem 0;
  opacity: 0.6;
}

.equip-slot-item.unique .equip-slot-name { color: var(--red); }
.equip-slot-name {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.3;
}

.equip-slot-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin: 0.25rem 0;
  background: var(--parchment);
  border: 1px solid var(--parchment-dk);
  border-radius: 2px;
  object-fit: contain;
}
.equip-slot-item.unique .equip-slot-image {
  border-color: var(--red);
  box-shadow: 0 0 6px rgba(122, 28, 28, 0.25);
}

.equip-slot-stats {
  font-size: 0.72rem;
  color: var(--ink-light);
  font-style: italic;
}

.equip-slot-effect {
  font-size: 0.72rem;
  color: var(--red);
  font-style: italic;
  border-left: 2px solid var(--red);
  padding-left: 0.4rem;
  margin-top: 0.2rem;
}

.equip-unequip {
  margin-top: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  align-self: flex-end;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-light);
}
.equip-unequip:hover:not(:disabled) {
  background: rgba(122, 28, 28, 0.1);
  color: var(--red);
}

/* ── Inventory ────────────────────────────────────── */
.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
}

.inv-item {
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--parchment-dk);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.inv-item.unique {
  border-left-color: var(--red);
  background: linear-gradient(180deg, rgba(122, 28, 28, 0.06), rgba(255, 251, 240, 0.7));
}

.inv-item-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: var(--parchment);
  border: 1px solid var(--parchment-dk);
  border-radius: 2px;
  object-fit: contain;
  margin: 0.25rem 0;
}
.inv-item-image.placeholder {
  opacity: 0.4;
}
.inv-item.unique .inv-item-image {
  border-color: var(--red);
  box-shadow: 0 0 6px rgba(122, 28, 28, 0.25);
}

.inv-item-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.inv-item-slot {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  color: var(--gold);
}
.inv-item-name { color: var(--ink); font-weight: 600; }
.inv-item.unique .inv-item-name { color: var(--red); }

.inv-item-stats { font-size: 0.75rem; font-style: italic; color: var(--ink-light); }
.inv-item-effect {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--red);
  border-left: 2px solid var(--red);
  padding-left: 0.4rem;
}

.inv-item-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.2rem;
}
.inv-item-actions button {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  flex: 1;
}
.inv-discard {
  background: none;
  color: var(--ink-light);
  border: 1px solid var(--border);
}
.inv-discard:hover:not(:disabled) {
  background: rgba(122, 28, 28, 0.1);
  color: var(--red);
}

/* ── Quest difficulty chip ────────────────────────── */
.quest-diff {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  margin-right: 0.3rem;
  padding: 0.05rem 0.4rem;
  border-radius: 2px;
  background: var(--ink);
  color: var(--gold-light);
  vertical-align: middle;
}
.quest-item.diff-상 .quest-diff { background: var(--red); color: var(--gold-light); }
.quest-item.diff-중 .quest-diff { background: var(--gold); color: var(--ink); }
.quest-item.diff-하 .quest-diff { background: var(--ink-light); color: var(--parchment); }

/* ── Reputation ───────────────────────────────────── */
.reputation-block {
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--parchment-dk);
}
.reputation-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.4rem;
  background: none;
  border: 1px dashed transparent;
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.reputation-toggle:hover:not(:disabled) {
  background: rgba(184, 134, 11, 0.08);
  border-color: var(--parchment-dk);
}
.reputation-title { flex: 1; text-align: left; }
.reputation-status {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.72rem;
  color: var(--ink-light);
  letter-spacing: 0;
}
.reputation-chevron {
  font-size: 0.8rem;
  color: var(--ink-light);
  transition: transform 0.2s ease;
}
.reputation-block.collapsed .reputation-chevron {
  transform: rotate(-90deg);
}
.reputation-body {
  margin-top: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--parchment-dk);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-line;
  max-height: 320px;
  overflow-y: auto;
}
.reputation-block.collapsed .reputation-body {
  display: none;
}

/* ── Deck view button ─────────────────────────────── */
.deck-view-btn {
  margin-top: 0.6rem;
  padding: 0.4rem 0.7rem;
  width: 100%;
  background: rgba(184, 134, 11, 0.1);
  border: 1px dashed var(--border);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.deck-view-btn:hover:not(:disabled) {
  background: rgba(184, 134, 11, 0.18);
}
.deck-view-count {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--ink-light);
  font-size: 0.8rem;
  letter-spacing: 0;
}

/* ── Deck view modal ──────────────────────────────── */
.deck-view-modal-card { max-width: 560px; }
.deck-view-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.55rem;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding: 0.2rem;
}
.deck-view-list .card {
  cursor: default;
  min-height: 0;
}
.deck-view-list .card .card-count {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* ── Card (보상덱) ────────────────────────────────── */
.card-list, .deck-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  max-height: 70vh;
  overflow-y: auto;
  padding: 4px;
}
.card-section-heading {
  grid-column: 1 / -1;
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-top: 0.4rem;
  border-bottom: 1px solid var(--parchment-dk);
  padding-bottom: 0.2rem;
}
.card {
  background: var(--parchment);
  border: 2px solid var(--border);
  border-radius: 3px;
  padding: 4px 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
  font-family: 'IM Fell English', serif;
  color: var(--ink);
  cursor: default;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.card.candidate {
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}
.card.candidate.revealed:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 카드 일러스트 영역 */
.card-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--parchment);
  overflow: hidden;
}
.card-art > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.card-art > img.card-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px 0;
  flex: 1;
}

/* 카드 뒷면 (보상 뽑기 연출) */
.card-back-overlay {
  position: absolute;
  inset: -2px;
  background:
    radial-gradient(circle at 50% 30%, rgba(184, 134, 11, 0.35) 0%, transparent 55%),
    radial-gradient(circle at 50% 80%, rgba(184, 134, 11, 0.2) 0%, transparent 50%),
    linear-gradient(135deg, #2c1a0e 0%, #1a0f06 100%);
  border: 2px solid var(--gold);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  color: var(--gold-light);
  font-size: 1.7rem;
  text-shadow: 0 0 6px rgba(184, 134, 11, 0.7);
  box-shadow: inset 0 0 14px rgba(184, 134, 11, 0.25);
  z-index: 2;
  transform-origin: left center;
  transition: transform 0.4s cubic-bezier(.4,0,.2,1), opacity 0.2s ease 0.25s;
  backface-visibility: hidden;
}
.card.revealed .card-back-overlay {
  transform: perspective(600px) rotateY(-115deg);
  opacity: 0;
  pointer-events: none;
}

@keyframes card-deal-in {
  0%   { opacity: 0; transform: translate(-40%, -120%) rotate(-12deg) scale(0.7); }
  60%  { opacity: 1; transform: translate(0, 4%) rotate(2deg) scale(1.04); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}
.card.dealing {
  animation: card-deal-in 0.45s cubic-bezier(.2,.7,.3,1) backwards;
  animation-delay: calc(var(--deal-i, 0) * 110ms);
}
.card.cast {
  opacity: 0.7;
  background: rgba(184, 134, 11, 0.08);
}
.card-label {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--red);
  letter-spacing: 0.03em;
}
.card-name {
  font-size: 0.78rem;
  color: var(--ink-light);
  line-height: 1.3;
}
.card-desc {
  font-size: 0.66rem;
  font-style: italic;
  color: var(--gold);
  margin-top: auto;
}
.card-count {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  color: var(--gold);
  margin-top: auto;
}
.card-item_unique     { border-color: var(--red); }
.card-draw_extra,
.card-xp_bonus        { border-style: dashed; }

/* ── Levelup options ─────────────────────────────── */
.levelup-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}
.levelup-option {
  text-align: left;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 251, 240, 0.85);
  border: 1px solid var(--border);
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
}
.levelup-option:hover:not(:disabled) {
  background: rgba(184, 134, 11, 0.18);
}
.levelup-option-name {
  font-family: 'Cinzel', serif;
  font-size: 0.92rem;
  color: var(--red);
}
.levelup-option-desc {
  font-size: 0.76rem;
  color: var(--ink-light);
  font-style: italic;
}

/* ── Modal ────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(26, 15, 6, 0.7);
}
.modal-card {
  position: relative;
  background: var(--parchment);
  border: 3px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem 1.6rem;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 0 0 4px #0008, 0 0 40px #000a;
}

.modal-card h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  color: var(--red);
  text-align: center;
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}
.modal-hint {
  text-align: center;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 1rem;
}
.modal-hint b { color: var(--gold); font-style: normal; font-size: 1.1rem; }

.modal-close {
  display: block;
  margin: 0 auto;
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-light);
  font-size: 0.8rem;
}

.completion-text {
  text-align: left;
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-line;
  padding: 0.9rem 1.1rem;
  background: rgba(184, 134, 11, 0.08);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  margin-bottom: 1.2rem;
  max-height: 50vh;
  overflow-y: auto;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 520px) {
  .parchment-wrapper { padding: 1.5rem 1.4rem; }
  h1 { font-size: 1.8rem; }
  .input-row { flex-direction: column; }
  button { justify-content: center; }
  .equipment-grid { grid-template-columns: repeat(2, 1fr); }
  .inventory-list { grid-template-columns: 1fr; }
  .char-header { flex-direction: column; align-items: flex-start; }
}
