@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg:        #0e0e12;
  --bg2:       #16161d;
  --bg3:       #1e1e28;
  --border:    #3a3050;
  --gold:      #c9a84c;
  --gold-dim:  #7a6330;
  --text:      #ddd4bb;
  --text-dim:  #8a7f6a;
  --red:       #c0392b;
  --teal:      #2a8a7e;
  --teal-dim:  #1a5a55;
  --glow:      0 0 18px rgba(201,168,76,0.25);
  --radius:    10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 18px;
  min-height: 100vh;
}

/* ── HEADER ───────────────────────────── */
.site-header {
  background: linear-gradient(180deg, #0a0a0e 0%, var(--bg2) 100%);
  border-bottom: 2px solid var(--gold-dim);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.site-header h1 {
  font-family: 'Cinzel', serif;
  font-size: 1.55rem;
  color: var(--gold);
  letter-spacing: .08em;
  text-shadow: var(--glow);
}
.site-header h1 span { color: var(--text-dim); font-size:.9rem; font-family:'Crimson Text',serif; }
.nav-links { display:flex; gap:10px; flex-wrap:wrap; }
.nav-links a {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201,168,76,.08);
}

/* ── PAGE WRAP ───────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 40px 24px 80px; }

/* ── HERO ────────────────────────────── */
.hero-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--gold);
  text-align: center;
  text-shadow: var(--glow);
  margin-bottom: 8px;
}
.hero-sub {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 48px;
}

/* ── CARDS ───────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,168,76,.04) 0%, transparent 60%);
  pointer-events: none;
}
.card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-4px);
  box-shadow: var(--glow);
}
.card-icon { font-size: 2.8rem; margin-bottom: 16px; display:block; }
.card h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 10px;
}
.card p { color: var(--text-dim); line-height: 1.6; }

/* ── DM AREA ─────────────────────────── */
.dm-bar {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.btn {
  font-family: 'Cinzel', serif;
  font-size: .82rem;
  letter-spacing: .07em;
  padding: 10px 24px;
  border-radius: var(--radius);
  border: 1px solid;
  cursor: pointer;
  transition: all .2s;
  background: transparent;
}
.btn-gold {
  color: var(--gold);
  border-color: var(--gold-dim);
}
.btn-gold:hover { background: rgba(201,168,76,.12); box-shadow: var(--glow); }
.btn-danger {
  color: #e74c3c;
  border-color: #7b2d26;
}
.btn-danger:hover { background: rgba(231,76,60,.12); }
.btn-teal {
  color: #4ecdc4;
  border-color: var(--teal-dim);
}
.btn-teal:hover { background: rgba(78,205,196,.1); }

/* ── SEARCH ──────────────────────────── */
.search-wrap { position: relative; margin-bottom: 28px; }
.search-wrap input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px 12px 44px;
  color: var(--text);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.search-wrap input:focus { border-color: var(--gold-dim); }
.search-wrap .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }

/* ── ITEM / CITY LIST ────────────────── */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.list-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  text-decoration: none;
  display: block;
  transition: all .2s;
}
.list-card:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.list-card .lc-title {
  font-family: 'Cinzel', serif;
  font-size: .9rem;
  color: var(--gold);
  margin-bottom: 4px;
}
.list-card .lc-sub { font-size: .85rem; color: var(--text-dim); }

/* ── DETAIL PAGE ─────────────────────── */
.detail-header {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 28px;
}
.detail-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 4px;
}
.detail-header .region {
  color: var(--text-dim);
  font-style: italic;
  font-size: .95rem;
}
.item-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.item-table th {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .1em;
  color: var(--gold);
  background: var(--bg3);
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.item-table td {
  padding: 13px 18px;
  border-bottom: 1px solid rgba(58,48,80,.5);
  color: var(--text);
  font-size: .95rem;
}
.item-table tr:last-child td { border-bottom: none; }
.item-table tr:hover td { background: rgba(201,168,76,.04); }
.badge {
  display: inline-block;
  background: rgba(201,168,76,.12);
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  font-size: .72rem;
  font-family: 'Cinzel', serif;
  padding: 2px 10px;
  letter-spacing: .06em;
}
.badge-teal {
  background: rgba(46,134,171,.12);
  color: #4ecdc4;
  border-color: var(--teal-dim);
}

/* ── LOG PAGE ────────────────────────── */
.log-entry {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.log-header {
  padding: 16px 22px;
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  flex-wrap: wrap;
  border-bottom: 1px solid transparent;
  transition: background .2s;
}
.log-header:hover { background: rgba(201,168,76,.04); }
.log-header.open { border-bottom-color: var(--border); }
.log-date {
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  color: var(--text-dim);
}
.log-desc { flex:1; color: var(--text); font-style: italic; }
.log-body { padding: 18px 22px; display: none; }
.log-body.open { display: block; }
.log-moves { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.log-moves li { font-size: .9rem; color: var(--text-dim); }
.log-moves li strong { color: var(--text); }
.arrow { color: var(--gold); margin: 0 6px; }

/* ── MODAL ───────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg2);
  border: 1px solid var(--gold-dim);
  border-radius: 14px;
  padding: 36px 40px;
  width: min(500px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), var(--glow);
  position: relative;
}
.modal h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 22px;
}
.modal-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: var(--text-dim);
  font-size: 1.4rem; cursor: pointer;
  transition: color .2s;
}
.modal-close:hover { color: var(--gold); }
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold-dim); }
.field textarea { resize: vertical; min-height: 80px; }
.field input[type=range] {
  padding: 0;
  accent-color: var(--gold);
  cursor: pointer;
}
.range-val {
  display: inline-block;
  margin-left: 10px;
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: .9rem;
}
.mode-toggle { display: flex; gap: 10px; margin-bottom: 6px; }
.mode-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  color: var(--text-dim);
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .05em;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.mode-btn.active {
  background: rgba(201,168,76,.12);
  border-color: var(--gold-dim);
  color: var(--gold);
}
.msg {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 14px;
  font-size: .9rem;
  display: none;
}
.msg.success { background: rgba(46,125,50,.2); border: 1px solid #2e7d32; color: #81c784; display:block; }
.msg.error   { background: rgba(183,28,28,.2); border: 1px solid #b71c1c; color: #ef9a9a; display:block; }

/* ── DM PAGE ─────────────────────────── */
.dm-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 32px;
}
.dm-section h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.copies-table input[type=number] {
  width: 70px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-family: 'Crimson Text', serif;
  font-size: .95rem;
  text-align: center;
  outline: none;
}
.copies-table input[type=number]:focus { border-color: var(--gold-dim); }
.save-copies-btn {
  font-size: .72rem;
  padding: 6px 14px;
  margin-left: 8px;
}

/* ── EMPTY STATE ─────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-style: italic;
}
.empty span { display: block; font-size: 2.5rem; margin-bottom: 12px; }

/* ── BACK LINK ───────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-family: 'Cinzel', serif;
  font-size: .78rem;
  letter-spacing: .06em;
  margin-bottom: 28px;
  transition: color .2s;
}
.back-link:hover { color: var(--gold); }

/* ── LOADING SPINNER ─────────────────── */
.spinner {
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  width: 28px; height: 28px;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────── */
@media (max-width: 600px) {
  .site-header { padding: 14px 18px; }
  .page { padding: 24px 16px 60px; }
  .modal { padding: 28px 22px; }
  .dm-section { padding: 20px 18px; }
}
