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

:root {
  --bg-abyss: #080604;
  --bg-deep: #0e0b08;
  --bg-surface: #161210;
  --bg-card: #1c1812;
  --bg-card-hover: #221e16;
  --bg-input: #100d08;
  --bg-input-focus: #181410;
  --border: #2a2418;
  --border-light: #383022;
  --border-gold: #6b5a30;
  --border-gold-bright: #8b7340;
  --accent-gold: #c9a84c;
  --accent-gold-dim: #8a7030;
  --accent-gold-light: #e8d48b;
  --text-primary: #ddd0ba;
  --text-secondary: #a89878;
  --text-muted: #6a5e4a;
  --text-gold: #d4b868;
  --danger: #943030;
  --danger-light: #c84848;
  --radius: 4px;
  --radius-lg: 6px;
  --font-display: 'Cinzel', serif;
  --font-body: 'Cormorant Garamond', serif;
  --font-mono: 'Fira Mono', monospace;
}

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-abyss);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
}

/* === NOISE OVERLAY === */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-gold-dim); }

/* === ANIMATIONS === */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* === ORNAMENTAL DIVIDER === */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 1.2rem 0;
  color: var(--border-gold);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
}

.ornament::before,
.ornament::after {
  content: '';
  flex: 1;
  max-width: 80px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}

/* ================================================================== */
/*  UPLOAD SCREEN                                                      */
/* ================================================================== */
#upload-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 2rem 3rem;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 15%, rgba(201,168,76,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(201,168,76,0.02) 0%, transparent 40%),
    var(--bg-abyss);
}

.upload-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2.6rem;
  color: var(--accent-gold);
  text-align: center;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
  text-shadow: 0 0 40px rgba(201,168,76,0.15), 0 2px 4px rgba(0,0,0,0.5);
  animation: fadeUp 0.6s ease both;
}

.upload-subtitle {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  animation: fadeUp 0.6s ease 0.1s both;
}

/* --- Drop Zone --- */
.drop-zone {
  width: 100%;
  max-width: 540px;
  border: 2px dashed var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.35s ease;
  background: var(--bg-surface);
  position: relative;
  margin-top: 2rem;
  animation: fadeUp 0.6s ease 0.2s both;
}

.drop-zone::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(107,90,48,0.2);
  border-radius: 4px;
  pointer-events: none;
  transition: border-color 0.3s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent-gold);
  background: var(--bg-card);
  box-shadow:
    0 0 30px rgba(201,168,76,0.06),
    inset 0 0 50px rgba(201,168,76,0.02);
  transform: translateY(-2px);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
  border-color: rgba(201,168,76,0.3);
}

.drop-zone-icon {
  font-size: 2.8rem;
  margin-bottom: 0.8rem;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

.drop-zone:hover .drop-zone-icon { opacity: 0.8; }

.drop-zone-text {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.03em;
}

.drop-zone-hint {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* --- Warning --- */
.upload-warning {
  margin-top: 1.5rem;
  padding: 0.9rem 1.3rem;
  background: rgba(148,48,48,0.1);
  border: 1px solid rgba(148,48,48,0.2);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--danger-light);
  max-width: 540px;
  width: 100%;
  line-height: 1.6;
  animation: fadeUp 0.6s ease 0.3s both;
}

.upload-warning strong {
  color: #e06060;
}

/* --- Save Location --- */
.save-location {
  margin-top: 1.5rem;
  padding: 1.4rem 1.6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  animation: fadeUp 0.6s ease 0.4s both;
}

.save-location-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.save-location-path {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.save-location-path code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  color: var(--text-gold);
  word-break: break-all;
  user-select: all;
}

.save-location-path .btn { flex-shrink: 0; }

.save-location-steps {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.save-location-steps kbd {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  color: var(--text-primary);
}

.save-location-steps strong { color: var(--text-primary); }

.save-location-subtitle {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.save-location-structure { margin: 0.9rem 0; }

.save-location-structure pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  overflow-x: auto;
}

.save-location-structure pre .hl { color: var(--text-primary); }
.save-location-structure pre .hl2 { color: var(--accent-gold); font-weight: 500; }

/* ================================================================== */
/*  DISCLAIMER MODAL                                                   */
/* ================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease both;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 660px;
  width: 100%;
  padding: 2.5rem 2.8rem;
  box-shadow:
    0 0 80px rgba(0,0,0,0.6),
    0 0 30px rgba(201,168,76,0.08),
    inset 0 1px 0 rgba(201,168,76,0.08);
  position: relative;
  animation: fadeUp 0.4s ease 0.1s both;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  text-align: center;
  text-shadow: 0 0 20px rgba(201,168,76,0.15);
}

.modal-body {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 1.8rem;
}

.modal-body ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.modal-body ul li {
  padding: 0.4rem 0 0.4rem 1.6rem;
  position: relative;
}

.modal-body ul li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-gold-dim);
  position: absolute;
  left: 0;
  top: 0.85rem;
}

.modal-body strong { color: var(--text-primary); }

.modal-body .modal-warn {
  background: rgba(148,48,48,0.1);
  border: 1px solid rgba(148,48,48,0.2);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  color: var(--danger-light);
  font-size: 1rem;
  margin-top: 1.2rem;
  line-height: 1.7;
}

.modal-footer {
  display: flex;
  justify-content: center;
}

.modal-footer .btn {
  font-size: 0.85rem;
  padding: 0.75rem 2.2rem;
  letter-spacing: 0.1em;
}

/* ================================================================== */
/*  EDITOR SCREEN                                                      */
/* ================================================================== */
#editor-screen { display: none; }

/* --- Disclaimer Banner --- */
.disclaimer-banner {
  background: rgba(201,168,76,0.04);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

/* --- Header --- */
.editor-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--bg-deep), rgba(14,11,8,0.97));
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
}

.editor-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.editor-actions { display: flex; gap: 0.5rem; align-items: center; }

.editor-body {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.6rem 2rem 4rem;
}

/* ================================================================== */
/*  BUTTONS                                                            */
/* ================================================================== */
.btn {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-gold);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-gold {
  background: linear-gradient(135deg, #8a6a28, #a88030);
  color: #1a1408;
  border-color: var(--accent-gold);
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255,255,255,0.1);
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  box-shadow: 0 0 16px rgba(201,168,76,0.25);
}

.btn-danger {
  border-color: rgba(148,48,48,0.4);
  color: var(--danger-light);
}

.btn-danger:hover {
  background: rgba(148,48,48,0.15);
  border-color: var(--danger-light);
}

/* ================================================================== */
/*  GAME DATA BAR                                                      */
/* ================================================================== */
.game-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 1.2rem;
}

.game-bar-field { display: flex; align-items: center; gap: 0.5rem; }

.game-bar-field label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-bar-field input {
  width: 90px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.35rem 0.55rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-gold);
  text-align: right;
  transition: all 0.2s ease;
}

.game-bar-field input:focus {
  outline: none;
  border-color: var(--border-gold);
  background: var(--bg-input-focus);
  box-shadow: 0 0 8px rgba(201,168,76,0.08);
}

.game-bar-info {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* ================================================================== */
/*  PARTY TABS                                                         */
/* ================================================================== */
.party-section { margin-bottom: 1.2rem; }

.section-label {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.party-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.party-tab {
  display: flex;
  flex-direction: column;
  padding: 0.65rem 1.1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 145px;
}

.party-tab:hover {
  background: var(--bg-card);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.party-tab.active {
  background: var(--bg-card);
  border-color: var(--border-gold-bright);
  box-shadow: 0 0 14px rgba(201,168,76,0.07), inset 0 1px 0 rgba(201,168,76,0.06);
}

.party-tab-name {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.party-tab.active .party-tab-name { color: var(--accent-gold-light); }

.party-tab-info {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* ================================================================== */
/*  NPC BROWSER                                                        */
/* ================================================================== */
.npc-browser { margin-bottom: 1.2rem; }
.npc-browser-bar { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.5rem; }

.npc-search {
  flex: 1;
  max-width: 300px;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.4rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.npc-search::placeholder { color: var(--text-muted); }

.npc-search:focus {
  outline: none;
  border-color: var(--border-gold);
  background: var(--bg-input-focus);
  box-shadow: 0 0 8px rgba(201,168,76,0.08);
}

.npc-count { font-size: 0.82rem; color: var(--text-muted); }

.npc-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 130px;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.npc-chip {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}

.npc-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

.npc-chip.active {
  background: var(--accent-gold-dim);
  border-color: var(--accent-gold);
  color: #1a1408;
}

.npc-chip .npc-chip-level { color: var(--text-muted); font-weight: 400; margin-left: 0.2rem; }
.npc-chip.active .npc-chip-level { color: rgba(26,20,8,0.55); }

/* ================================================================== */
/*  CHARACTER EDITOR                                                   */
/* ================================================================== */
.char-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.char-name {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent-gold-light);
  text-shadow: 0 0 20px rgba(201,168,76,0.1);
}

.char-meta { font-size: 0.95rem; color: var(--text-muted); }
.char-meta span { margin-right: 0.8rem; }

/* === Editor Tab Bar === */
.editor-tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.editor-tab {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.65rem 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.editor-tab:hover {
  color: var(--text-secondary);
  background: rgba(201,168,76,0.03);
}

.editor-tab.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.stat-card:hover {
  border-color: var(--border-light);
}

.stat-card-title {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-gold);
  padding: 0.65rem 1.1rem;
  background: linear-gradient(180deg, rgba(201,168,76,0.07), rgba(201,168,76,0.02));
  border-bottom: 1px solid var(--border);
}

.stat-table { width: 100%; border-collapse: collapse; }
.stat-table tr { border-bottom: 1px solid rgba(42,36,24,0.5); }
.stat-table tr:last-child { border-bottom: none; }
.stat-table tr:hover { background: rgba(201,168,76,0.025); }
.stat-table td { padding: 0.45rem 1.1rem; vertical-align: middle; }

.stat-table .stat-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.stat-table .stat-value { text-align: right; }
.stat-table .stat-header-row { background: rgba(0,0,0,0.2); }

.stat-table .stat-header-row td {
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.4rem 1.1rem;
  text-align: right;
}

.stat-table .stat-header-row td:first-child { text-align: left; }

/* --- Hide number spinners globally --- */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

/* --- Stat Inputs --- */
.stat-input {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: 74px;
  padding: 0.3rem 0.5rem;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-primary);
  text-align: right;
  transition: all 0.2s ease;
}

.stat-input:hover { border-color: var(--border); }

.stat-input:focus {
  outline: none;
  border-color: var(--border-gold);
  background: var(--bg-input-focus);
  color: var(--accent-gold-light);
  box-shadow: 0 0 6px rgba(201,168,76,0.1);
}

.stat-input.changed {
  color: var(--accent-gold-light);
  background: rgba(201,168,76,0.06);
  border-color: var(--accent-gold-dim);
}

.stat-input-wide { width: 100px; }

/* --- Searchable dropdown --- */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
}

.search-input {
  width: 100% !important;
  text-align: left !important;
  font-family: var(--font-body) !important;
  font-size: 0.88rem !important;
}

.search-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.search-dropdown.visible {
  display: block;
}

.search-result {
  padding: 0.45rem 0.7rem;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s ease;
  border-bottom: 1px solid rgba(42,36,24,0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-result:last-child {
  border-bottom: none;
}

.search-result:hover {
  background: rgba(201,168,76,0.08);
  color: var(--accent-gold-light);
}

.search-result-id {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 0.5rem;
}

.search-no-results {
  padding: 0.6rem 0.7rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* --- Card count badge --- */
.card-count {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  letter-spacing: 0;
  text-transform: none;
}

/* --- Add bar at bottom of card --- */
.card-add-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}

.btn-sm {
  font-size: 0.65rem;
  padding: 0.3rem 0.7rem;
}

/* --- Remove button --- */
.btn-remove {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0 0.4rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  line-height: 1;
}
.btn-remove:hover {
  color: var(--danger-light);
  border-color: rgba(148,48,48,0.3);
  background: rgba(148,48,48,0.1);
}

.btn-remove-inline {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0.2rem;
  margin-left: 0.3rem;
  transition: color 0.15s ease;
  line-height: 1;
}
.btn-remove-inline:hover { color: var(--danger-light); }

/* --- Toggle checkbox --- */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.75rem;
}
.toggle-label input[type="checkbox"] {
  accent-color: var(--accent-gold);
  cursor: pointer;
}
.toggle-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Trait chips --- */
.trait-list-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  flex: 1;
  overflow-y: auto;
  align-content: flex-start;
}

.trait-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  min-height: 2.5rem;
  align-items: center;
}

.trait-chip {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  letter-spacing: 0.02em;
}

/* --- Item name in inventory --- */
.item-name {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.item-name-unknown {
  color: var(--text-muted);
  font-style: italic;
}
.item-id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* === Inventory Two-Panel Layout === */
.stat-card-wide {
  grid-column: 1 / -1;
}

.inv-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-surface);
}

.inv-panel {
  display: flex;
  flex-direction: column;
  min-height: 350px;
  max-height: 700px;
}

.inv-panel-owned {
  border-right: 1px solid var(--border);
}

.inv-panel-catalog {
  background: var(--bg-deep);
}

/* Drag-and-drop highlight */
.inv-drop-hover {
  background: rgba(201,168,76,0.06) !important;
  box-shadow: inset 0 0 20px rgba(201,168,76,0.08);
}

.icard-catalog[draggable="true"] {
  cursor: grab;
}

.icard-catalog[draggable="true"]:active {
  cursor: grabbing;
}

.inv-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.inv-item {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(42,36,24,0.5);
  transition: background 0.15s ease;
}

.inv-item:hover {
  background: rgba(201,168,76,0.025);
}

.inv-item:last-child {
  border-bottom: none;
}

.inv-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.inv-item-name {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.inv-item-fields {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.inv-field {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.inv-field-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inv-field-value {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.inv-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.item-attrs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.item-attr-chip {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 0.15rem 0.45rem;
  background: rgba(201,168,76,0.06);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-secondary);
}

/* --- Item Catalog (right panel) --- */
.inv-catalog-search {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}

.inv-catalog-search .search-input {
  width: 100% !important;
  text-align: left !important;
  font-family: var(--font-body) !important;
  font-size: 0.88rem !important;
  padding: 0.4rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
}

.inv-catalog-search .search-input:focus {
  outline: none;
  border-color: var(--border-gold);
  background: var(--bg-input-focus);
  box-shadow: 0 0 6px rgba(201,168,76,0.1);
}

.inv-catalog-list {
  flex: 1;
  overflow-y: auto;
}

.catalog-item {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid rgba(42,36,24,0.3);
  cursor: pointer;
  transition: background 0.1s ease;
  gap: 0.5rem;
}

.catalog-item:hover {
  background: rgba(201,168,76,0.06);
}

.catalog-item-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-item:hover .catalog-item-name {
  color: var(--accent-gold-light);
}

.catalog-item-id {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.catalog-add-btn {
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.catalog-item:hover .catalog-add-btn {
  opacity: 1;
}

.catalog-item-owned {
  opacity: 0.45;
  cursor: default;
}

.catalog-item-owned:hover {
  background: transparent;
}

.catalog-item-owned .catalog-item-name {
  color: var(--text-muted);
}

.catalog-owned-badge {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--accent-gold-dim);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* --- Data credit in banner --- */
.data-credit {
  margin-left: 0.6rem;
}
.data-credit a {
  color: var(--accent-gold-dim);
  text-decoration: none;
}
.data-credit a:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

/* ================================================================== */
/*  STATUS & MASTERY BARS                                              */
/* ================================================================== */
.status-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }

.status-bar {
  flex: 1;
  height: 5px;
  background: rgba(16,13,8,0.8);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.status-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.status-bar-fill.hp { background: linear-gradient(90deg, #6a2828, #c04040); }
.status-bar-fill.sp { background: linear-gradient(90deg, #286a28, #40a040); }
.status-bar-fill.mp { background: linear-gradient(90deg, #28346a, #4060c0); }
.status-bar-fill.health { background: linear-gradient(90deg, var(--accent-gold-dim), var(--accent-gold)); }
.status-bar-fill.morale { background: linear-gradient(90deg, #4a3a5a, #7a5a9a); }
.status-bar-fill.vigor { background: linear-gradient(90deg, #3a4a2a, #6a8a4a); }
.status-bar-fill.satiety { background: linear-gradient(90deg, #4a3a20, #9a7a40); }

.mastery-row { display: flex; align-items: center; gap: 0.4rem; }

.mastery-bar {
  flex: 1;
  height: 4px;
  background: rgba(16,13,8,0.8);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}

.mastery-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold-dim), var(--accent-gold));
  border-radius: 3px;
}

/* ================================================================== */
/*  CHANGE TRACKER                                                     */
/* ================================================================== */
.changes-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, var(--bg-deep), #0a0806);
  border-top: 1px solid var(--border-gold);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  box-shadow: 0 -6px 24px rgba(0,0,0,0.5);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.changes-bar.visible {
  transform: translateY(0);
}

/* ================================================================== */
/*  VISUAL ITEM CARDS -- Polished Inventory                            */
/* ================================================================== */

@keyframes icard-appear {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shimmerLegendary {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes tooltipReveal {
  from { opacity: 0; transform: translateY(4px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Item Card Grid --- */
.icard-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
}

.icard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  align-content: start;
}

.icard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 0.3rem 0.35rem;
  background:
    linear-gradient(180deg, rgba(28,24,18,0.95), rgba(22,18,16,0.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: default;
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
              box-shadow 0.22s ease,
              border-color 0.18s ease,
              background 0.18s ease;
  border-top-width: 2px;
  overflow: hidden;
  animation: icard-appear 0.3s ease both;
}

/* Subtle inner glow at top */
.icard::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(180deg, rgba(201,168,76,0.06), transparent);
  pointer-events: none;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: opacity 0.2s ease;
  opacity: 0.5;
}

.icard:hover {
  background:
    linear-gradient(180deg, rgba(34,30,22,0.98), rgba(28,24,18,1));
  border-color: var(--border-light);
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.4),
    0 0 12px rgba(201,168,76,0.06);
  z-index: 2;
}

.icard:hover::before {
  opacity: 1;
}

.icard-catalog {
  cursor: pointer;
}

.icard-catalog:hover {
  border-color: var(--accent-gold-dim);
  box-shadow:
    0 6px 20px rgba(0,0,0,0.4),
    0 0 14px rgba(201,168,76,0.1);
}

.icard-catalog:active {
  transform: translateY(-1px) scale(1.0);
  transition-duration: 0.08s;
}

/* Legendary shimmer overlay */
.icard-legendary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(201,168,76,0.08) 45%,
    rgba(232,212,139,0.12) 50%,
    rgba(201,168,76,0.08) 55%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: shimmerLegendary 4s ease-in-out infinite;
  pointer-events: none;
  border-radius: var(--radius);
}

/* --- Sprite image --- */
.icard-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  margin-bottom: 0.25rem;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
  transition: transform 0.2s ease, filter 0.2s ease;
  position: relative;
  z-index: 1;
}

.icard:hover .icard-img {
  transform: scale(1.08);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)) brightness(1.1);
}

.icard-no-img {
  background: rgba(42,36,24,0.3);
  border-radius: 3px;
  border: 1px dashed rgba(42,36,24,0.3);
}

.icard-name {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.25;
  max-height: 2.5em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
  letter-spacing: 0.01em;
  position: relative;
  z-index: 1;
  transition: color 0.15s ease;
}

.icard:hover .icard-name {
  color: var(--text-primary);
}

.icard-qty {
  position: absolute;
  top: 3px;
  right: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-gold-light);
  background: rgba(0,0,0,0.75);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  line-height: 1.4;
  z-index: 3;
  border: 1px solid rgba(201,168,76,0.15);
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}

/* --- Owned card meta row --- */
.icard-meta {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.2rem;
  position: relative;
  z-index: 1;
}

.icard-stat {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(0,0,0,0.35);
  padding: 0.08rem 0.3rem;
  border-radius: 2px;
  line-height: 1.4;
  border: 1px solid rgba(42,36,24,0.3);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.icard:hover .icard-stat {
  color: var(--text-secondary);
  border-color: rgba(42,36,24,0.5);
}

.icard-field {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(42,36,24,0.4);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  width: 2.5rem;
  padding: 0 0.15rem;
  outline: none;
  -moz-appearance: textfield;
}
.icard-field::-webkit-outer-spin-button,
.icard-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.icard-field:focus {
  border-bottom-color: var(--accent-gold);
  background: rgba(0,0,0,0.3);
}

/* --- Remove button (top-left corner) --- */
.icard-rm {
  position: absolute;
  top: 2px;
  left: 2px;
  opacity: 1;
  transition: color 0.15s ease, transform 0.15s ease;
  font-size: 0.85rem !important;
  padding: 0 0.2rem !important;
  line-height: 1;
  z-index: 4;
}

.icard:hover .icard-rm {
  opacity: 1;
  color: var(--danger-light);
}

.icard-rm:hover {
  transform: scale(1.2) !important;
}

/* --- Category Filter Pills --- */
.icat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(42,36,24,0.3);
}

.icat-pill {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.icat-pill:hover {
  color: var(--text-secondary);
  border-color: var(--border-gold);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.icat-pill.icat-active {
  color: #1a1408;
  background: linear-gradient(135deg, var(--accent-gold-dim), var(--accent-gold));
  border-color: var(--accent-gold);
  box-shadow:
    0 0 8px rgba(201,168,76,0.2),
    0 2px 6px rgba(0,0,0,0.3);
  text-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

.icat-pill.icat-active:hover {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-light));
  transform: translateY(-1px);
}

/* --- Hover Tooltip --- */
.item-tooltip {
  position: fixed;
  z-index: 9000;
  background:
    linear-gradient(135deg, rgba(28,24,18,0.98), rgba(22,18,16,0.99));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 0;
  min-width: 220px;
  max-width: 300px;
  pointer-events: none;
  box-shadow:
    0 12px 48px rgba(0,0,0,0.7),
    0 0 24px rgba(201,168,76,0.1),
    0 0 1px rgba(201,168,76,0.3),
    inset 0 1px 0 rgba(201,168,76,0.06);
  font-size: 0.82rem;
  line-height: 1.5;
  animation: tooltipReveal 0.15s ease both;
  overflow: hidden;
}

/* Ornamental top accent line */
.item-tooltip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  z-index: 1;
}

/* Subtle parchment vignette */
.item-tooltip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(201,168,76,0.04) 0%, transparent 60%);
  pointer-events: none;
  border-radius: var(--radius-lg);
}

.tt-inner {
  position: relative;
  z-index: 1;
  padding: 0.75rem 0.95rem 0.7rem;
}

.tt-sprite-wrap {
  text-align: center;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background:
    radial-gradient(ellipse at center, rgba(201,168,76,0.05), transparent 70%),
    rgba(0,0,0,0.35);
  border-radius: var(--radius);
  border: 1px solid rgba(42,36,24,0.5);
  position: relative;
}

/* Corner accent marks on sprite frame */
.tt-sprite-wrap::before,
.tt-sprite-wrap::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--accent-gold-dim);
  border-style: solid;
  opacity: 0.5;
}

.tt-sprite-wrap::before {
  top: 4px;
  left: 4px;
  border-width: 1px 0 0 1px;
}

.tt-sprite-wrap::after {
  bottom: 4px;
  right: 4px;
  border-width: 0 1px 1px 0;
}

.tt-sprite {
  width: 80px;
  height: 80px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}

.tt-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.tt-sub {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  letter-spacing: 0.02em;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(42,36,24,0.4);
}

.tt-section {
  font-family: var(--font-display);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 0.45rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tt-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.1rem 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.tt-row span:first-child {
  opacity: 0.75;
}

.tt-row span:last-child {
  color: var(--text-primary);
  font-weight: 500;
}

.tt-enchant span:last-child {
  color: var(--accent-gold-light);
  text-shadow: 0 0 6px rgba(201,168,76,0.3);
}

.tt-dim span {
  color: var(--text-muted) !important;
  font-weight: 400 !important;
  opacity: 0.7 !important;
}

.tt-divider {
  border: none;
  border-top: 1px solid rgba(42,36,24,0.4);
  margin: 0.35rem 0;
  position: relative;
}

.tt-divider::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,168,76,0.15), transparent);
}

/* ================================================================== */
/*  RESPONSIVE                                                         */
/* ================================================================== */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: 1fr; }
  .inv-layout { grid-template-columns: 1fr; }
  .inv-panel-owned { border-right: none; border-bottom: 1px solid var(--border); }
  .inv-panel { max-height: 400px; }
  .icard-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* === Build Presets === */
.builds-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem;
}

.build-card {
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.build-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.build-card-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-gold);
  letter-spacing: 0.06em;
}

.build-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.6rem;
}

.build-card-stats {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.build-stat {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: rgba(201,168,76,0.08);
  border: 1px solid rgba(201,168,76,0.15);
  color: var(--text-secondary);
}

@media (max-width: 700px) {
  .upload-title { font-size: 1.6rem; letter-spacing: 0.1em; }
  .upload-subtitle { font-size: 0.75rem; }
  #upload-screen { padding: 2.5rem 1.2rem 2rem; }
  .drop-zone { padding: 2rem 1.2rem; }
  .save-location { padding: 1rem 1.2rem; }

  .editor-body { padding: 0.8rem 1rem; }
  .game-bar { flex-direction: column; align-items: stretch; }
  .char-header { flex-direction: column; gap: 0.3rem; }
  .editor-header { flex-direction: column; gap: 0.4rem; padding: 0.5rem 0.8rem; }
  .changes-bar { flex-direction: column; gap: 0.5rem; padding: 0.8rem; }
  .editor-tab { flex: 1; text-align: center; padding: 0.5rem 0.5rem; font-size: 0.68rem; }
  .inv-item-fields { gap: 0.7rem; }
}

/* === VERSION TAG === */
.version-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  opacity: 0.6;
  float: right;
  margin-left: 1rem;
}
.version-tag:hover { opacity: 1; text-decoration: underline; }
.changelog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 9999; display: flex; align-items: center; justify-content: center;
}
.changelog-modal {
  background: var(--bg-dark, #1a1714); border: 1px solid var(--accent-gold, #c8a94e);
  border-radius: 8px; padding: 1.5rem; max-width: 500px; width: 90%;
  max-height: 70vh; overflow-y: auto; color: var(--text-primary, #e8dcc8);
  font-family: var(--font-body, sans-serif);
}
.changelog-header {
  font-size: 1.2rem; font-weight: bold; color: var(--accent-gold, #c8a94e);
  border-bottom: 1px solid rgba(200,169,78,0.3); padding-bottom: 0.5rem; margin-bottom: 1rem;
}
.changelog-version {
  font-weight: bold; font-size: 0.95rem; color: var(--accent-gold, #c8a94e);
  margin-top: 0.8rem;
}
.changelog-date { font-weight: normal; font-size: 0.75rem; color: var(--text-muted, #888); margin-left: 0.5rem; }
.changelog-list {
  margin: 0.3rem 0 0.5rem 1.2rem; padding: 0; font-size: 0.8rem;
  color: var(--text-secondary, #b8a88a); line-height: 1.5;
}
.changelog-list li { margin-bottom: 0.15rem; }
