/* D&D Companion — App Styles */
:root {
  --stone-950: #0c0a09;
  --stone-900: #1c1917;
  --stone-800: #292524;
  --stone-700: #44403c;
  --stone-600: #57534e;
  --stone-500: #78716c;
  --stone-400: #a8a29e;
  --stone-300: #d6d3d1;
  --stone-200: #e7e5e4;
  --stone-100: #f5f5f4;
  --amber-600: #d97706;
  --amber-500: #f59e0b;
  --amber-400: #fbbf24;
  --amber-300: #fcd34d;
  --red-400:   #f87171;
  --red-500:   #ef4444;
  --green-400: #4ade80;
  --blue-400:  #60a5fa;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 6px;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font-sans);
  background: var(--stone-950);
  color: var(--stone-200);
  min-height: 100svh;
  line-height: 1.5;
}

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 1.25rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .75rem; }
p  { margin-bottom: .75rem; }
a  { color: var(--amber-400); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .8rem; color: var(--stone-400); }

/* ---- Header / Nav ---- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--stone-900);
  border-bottom: 1px solid var(--stone-700);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.nav-brand {
  font-size: 1.1rem; font-weight: 700;
  color: var(--amber-400); text-decoration: none; white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; color: var(--amber-300); }
.nav-links {
  display: flex; align-items: center; gap: .5rem; margin-left: auto;
  flex-wrap: wrap;
}
.nav-link {
  font-size: .9rem; color: var(--stone-400);
  padding: .3rem .5rem; border-radius: var(--radius);
  text-decoration: none; transition: color .15s;
}
.nav-link:hover, .nav-active { color: var(--stone-100) !important; text-decoration: none; }
.nav-active { font-weight: 600; color: var(--amber-400) !important; }
.nav-username { font-size: .85rem; color: var(--stone-500); padding: 0 .25rem; }
.nav-btn { font-size: .85rem; padding: .35rem .85rem; border-radius: var(--radius); font-weight: 500; text-decoration: none; }
.nav-btn-outline { border: 1px solid var(--stone-600); color: var(--stone-300); }
.nav-btn-outline:hover { border-color: var(--stone-400); color: var(--stone-100); text-decoration: none; }
.nav-btn-primary { background: var(--amber-500); color: var(--stone-950); }
.nav-btn-primary:hover { background: var(--amber-400); text-decoration: none; }
.nav-hamburger { display: none; background: none; border: 1px solid var(--stone-600); color: var(--stone-300); padding: .3rem .6rem; border-radius: var(--radius); cursor: pointer; font-size: 1rem; }

@media (max-width: 640px) {
  .nav-hamburger { display: block; }
  .nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--stone-900); border-bottom: 1px solid var(--stone-700); flex-direction: column; padding: .75rem 1rem; gap: .4rem; }
  .nav-links.open { display: flex; }
  .site-header { position: relative; }
}

/* ---- Layout ---- */
.main-content { padding: 2rem 1rem; }
.container { max-width: 1100px; margin: 0 auto; }
.page-header { margin-bottom: 1.5rem; display: flex; align-items: center; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }

/* ---- Cards ---- */
.card {
  background: var(--stone-800); border: 1px solid var(--stone-700);
  border-radius: var(--radius); padding: 1.25rem;
}
.card-sm { padding: .875rem; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .85rem; color: var(--stone-400); margin-bottom: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], textarea, select {
  width: 100%; background: var(--stone-900); color: var(--stone-100);
  border: 1px solid var(--stone-700); border-radius: var(--radius);
  padding: .5rem .75rem; font-size: .95rem; font-family: inherit;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--amber-500); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red-500); }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ---- File input ---- */
.file-input { margin-top: .15rem; }
.file-input-native {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.file-input-trigger {
  display: flex; align-items: center; gap: .75rem; width: 100%;
  padding: .65rem .75rem; background: var(--stone-900);
  border: 1px dashed var(--stone-600); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.file-input-trigger:hover {
  border-color: var(--amber-500); background: var(--stone-800);
}
.file-input-btn {
  flex-shrink: 0; display: inline-flex; align-items: center;
  padding: .4rem .85rem; background: var(--stone-700); color: var(--stone-100);
  border-radius: var(--radius); font-size: .85rem; font-weight: 600;
}
.file-input-trigger:hover .file-input-btn { background: var(--amber-600); color: var(--stone-950); }
.file-input-name {
  flex: 1; min-width: 0; font-size: .875rem; color: var(--stone-400);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-input-native:focus-visible + .file-input-trigger {
  outline: 2px solid var(--amber-500); outline-offset: 2px;
}
.file-input-hint {
  margin: .45rem 0 0; font-size: .75rem; color: var(--stone-500);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; font-family: inherit;
  cursor: pointer; text-decoration: none; border: none;
  transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary   { background: var(--amber-500); color: var(--stone-950); }
.btn-primary:hover:not(:disabled) { background: var(--amber-400); }
.btn-secondary { background: var(--stone-700); color: var(--stone-100); }
.btn-secondary:hover:not(:disabled) { background: var(--stone-600); }
.btn-danger    { background: var(--red-500); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: .85; }
.btn-ghost     { background: transparent; border: 1px solid var(--stone-600); color: var(--stone-300); }
.btn-ghost:hover:not(:disabled) { border-color: var(--stone-400); color: var(--stone-100); }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Flash messages ---- */
.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.flash-success { background: #14532d; border: 1px solid #166534; color: var(--green-400); }
.flash-error   { background: #450a0a; border: 1px solid #7f1d1d; color: var(--red-400); }
.flash-info    { background: #1e3a5f; border: 1px solid #1e40af; color: var(--blue-400); }
.flash-list { margin: .45rem 0 0 1.1rem; }
.flash-list li { margin-bottom: .2rem; }

/* ---- Error / helper text ---- */
.field-error { color: var(--red-400); font-size: .8rem; margin-top: .25rem; }
.text-muted  { color: var(--stone-400); font-size: .85rem; }
.text-amber  { color: var(--amber-400); }
.text-green  { color: var(--green-400); }
.text-red    { color: var(--red-400); }

/* ---- Auth pages ---- */
.auth-wrap { max-width: 400px; margin: 2rem auto; }
.auth-wrap h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.auth-links  { margin-top: 1rem; font-size: .85rem; color: var(--stone-400); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { background: var(--stone-700); color: var(--stone-300); font-weight: 600; padding: .6rem .75rem; text-align: left; }
td { padding: .55rem .75rem; border-bottom: 1px solid var(--stone-700); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--stone-800); }

/* ---- Badges ---- */
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; }
.badge-amber { background: #451a03; color: var(--amber-400); border: 1px solid #78350f; }
.badge-green { background: #14532d; color: var(--green-400); border: 1px solid #166534; }
.badge-red   { background: #450a0a; color: var(--red-400);   border: 1px solid #7f1d1d; }
.badge-gray  { background: var(--stone-700); color: var(--stone-300); }

/* ---- Character sheet specifics ---- */
.character-card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.character-card-head > div:nth-child(2) { flex: 1; min-width: 0; }
.character-card-portrait {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--stone-600); background: var(--stone-900); flex-shrink: 0;
}
.character-card-portrait-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--amber-400); font-weight: 800; font-size: .8rem;
}
.character-profile { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.character-profile-media { display: flex; justify-content: center; }
.character-portrait-lg {
  width: 180px; height: 220px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--stone-600); background: var(--stone-900);
}
.character-portrait-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--amber-400); font-size: 2rem; font-weight: 900;
}
.character-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.recommendation-box {
  background: #1c1503; border: 1px solid #78350f; border-radius: var(--radius);
  padding: .85rem 1rem;
}
.recommendation-box h3 { color: var(--amber-400); margin-bottom: .5rem; }
.recommendation-box ul { padding-left: 1.1rem; color: var(--stone-300); font-size: .9rem; }
.recommendation-box li { margin-bottom: .35rem; }
.recommendation-box li:last-child { margin-bottom: 0; }
.ability-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (min-width: 600px) { .ability-grid { grid-template-columns: repeat(6, 1fr); } }
.ability-box { text-align: center; background: var(--stone-900); border: 1px solid var(--stone-700); border-radius: var(--radius); padding: .75rem .5rem; }
.ability-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--stone-400); }
.ability-score { font-size: 1.6rem; font-weight: 700; color: var(--amber-400); line-height: 1; margin: .2rem 0; }
.ability-mod { font-size: .85rem; color: var(--stone-300); }
.wizard-ability-grid input[type=number] {
  text-align: center; border: 0; background: transparent; color: var(--amber-400);
  font-size: 1.6rem; font-weight: 700; padding: .15rem 0; appearance: textfield;
}
.wizard-ability-grid input[type=number]::-webkit-outer-spin-button,
.wizard-ability-grid input[type=number]::-webkit-inner-spin-button { appearance: none; margin: 0; }

.wizard-progress { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.wizard-step-tab {
  border: 1px solid var(--stone-700); background: var(--stone-900); color: var(--stone-400);
  border-radius: 999px; padding: .35rem .7rem; cursor: pointer; font-size: .8rem;
}
.wizard-step-tab.active { border-color: var(--amber-500); color: var(--amber-400); background: #1c1503; }
.wizard-step-tab.completed { border-color: #166534; color: var(--green-400); }
.wizard-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1rem; align-items: start; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.wizard-preview { position: sticky; top: 1rem; }
.wizard-validation {
  background: #450a0a; border: 1px solid #7f1d1d; color: var(--red-400);
  border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .9rem;
}
.wizard-validation ul { margin: .45rem 0 0 1.1rem; }
.wizard-help {
  background: var(--stone-900); border: 1px solid var(--stone-700);
  border-radius: var(--radius); padding: .75rem .85rem; margin-bottom: 1rem;
}
.wizard-help strong { color: var(--amber-400); display: block; margin-bottom: .25rem; }
.wizard-help p { color: var(--stone-400); font-size: .85rem; margin: 0; }
.explanation-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1rem; }
.wizard-stat-list { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 1rem 0; }
.wizard-stat-list span {
  background: var(--stone-900); border: 1px solid var(--stone-700);
  border-radius: var(--radius); padding: .45rem .55rem; font-size: .85rem;
}
.wizard-stat-list strong { color: var(--amber-400); float: right; }
.wizard-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; }
.wizard-summary-grid strong { display: block; color: var(--amber-400); font-size: 1.5rem; margin-top: .2rem; }
.skill-picker-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .4rem; margin-top: .5rem; }
.skill-choice {
  display: flex; align-items: center; gap: .4rem; border: 1px solid var(--stone-700);
  border-radius: var(--radius); padding: .45rem .55rem; background: var(--stone-900);
}
.skill-choice.recommended { border-color: var(--amber-600); background: #1c1503; }
.skill-choice.automatic { border-color: #166534; background: #052e16; }
.skill-choice.automatic::after {
  content: 'Auto'; color: var(--green-400); border: 1px solid #166534;
  border-radius: 99px; padding: .05rem .35rem; font-size: .65rem; font-weight: 700;
}
.skill-choice input { width: auto; }
.skill-choice span { flex: 1; font-size: .9rem; }
.skill-choice small { color: var(--stone-500); font-size: .7rem; }
.calculation-breakdown {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem;
}
.calculation-breakdown > div {
  background: var(--stone-900); border: 1px solid var(--stone-700);
  border-radius: var(--radius); padding: .75rem;
}
.calculation-breakdown strong { color: var(--stone-100); display: block; margin-bottom: .3rem; }
.calculation-breakdown p { color: var(--stone-400); font-size: .85rem; margin: 0; }
.dice-assignment {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem;
  flex-wrap: wrap;
}
.dice-assignment p { margin-bottom: 0; }
.roll-log {
  width: 100%; background: var(--stone-900); border: 1px dashed var(--stone-700);
  border-radius: var(--radius); padding: .55rem .65rem; font-size: .8rem;
}
.ability-roll-btn { margin-top: .45rem; justify-content: center; width: 100%; }
.roll-detail { min-height: 1.1rem; color: var(--stone-400); font-size: .72rem; margin-top: .35rem; }
@media (max-width: 820px) {
  .wizard-layout, .character-profile, .explanation-grid { grid-template-columns: 1fr; }
  .wizard-preview { position: static; }
}

.hp-tracker { display: flex; align-items: center; gap: .5rem; }
.hp-current { font-size: 2rem; font-weight: 700; color: var(--amber-400); min-width: 3rem; text-align: center; }
.hp-max     { color: var(--stone-400); }

.skill-list { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem; font-size: .85rem; }
@media (max-width: 480px) { .skill-list { grid-template-columns: 1fr; } }
.skill-row { display: flex; align-items: center; gap: .4rem; padding: .25rem .4rem; border-radius: 4px; }
.skill-row:hover { background: var(--stone-700); }
.skill-mod  { font-weight: 600; min-width: 2.2rem; text-align: right; color: var(--stone-100); }
.skill-name { color: var(--stone-300); flex: 1; }
.prof-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--stone-500); cursor: pointer; flex-shrink: 0; }
.prof-dot.active   { background: var(--amber-500); border-color: var(--amber-500); }
.prof-dot.expert   { background: var(--amber-300); border-color: var(--amber-300); }

/* ---- Combat view ---- */
.combatant-list { display: flex; flex-direction: column; gap: .5rem; }
.combatant-row  { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: var(--radius); background: var(--stone-800); border: 1px solid var(--stone-700); }
.combatant-row.active-turn { border-color: var(--amber-500); background: #1c1503; }
.combatant-row.defeated { opacity: .45; }
.init-badge { min-width: 2.2rem; text-align: center; font-weight: 700; color: var(--amber-400); }
.combatant-name { flex: 1; font-weight: 500; }
.hp-badge { display: flex; align-items: center; gap: .3rem; }
.conditions { display: flex; gap: .3rem; flex-wrap: wrap; }
.condition-tag { background: #3b1818; color: var(--red-400); font-size: .7rem; padding: .1rem .45rem; border-radius: 99px; border: 1px solid #7f1d1d; }

.combat-log { background: var(--stone-900); border: 1px solid var(--stone-700); border-radius: var(--radius); padding: .75rem; max-height: 220px; overflow-y: auto; font-size: .8rem; color: var(--stone-400); }
.log-entry { padding: .2rem 0; border-bottom: 1px solid var(--stone-800); }
.log-entry:last-child { border-bottom: none; }

/* ---- Dice roller ---- */
.dice-roller { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 200; }
.dice-toggle { width: 52px; height: 52px; border-radius: 50%; background: var(--amber-500); color: var(--stone-950); border: none; font-size: 1.4rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; }
.dice-toggle:hover { background: var(--amber-400); }
.dice-panel { position: absolute; bottom: 64px; right: 0; width: 280px; background: var(--stone-800); border: 1px solid var(--stone-600); border-radius: var(--radius); padding: 1rem; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: none; }
.dice-panel.open { display: block; }
.dice-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.dice-btn { background: var(--stone-700); border: 1px solid var(--stone-600); color: var(--stone-200); border-radius: var(--radius); padding: .3rem .6rem; font-size: .8rem; cursor: pointer; }
.dice-btn:hover { background: var(--stone-600); }
.dice-result { font-size: 1.4rem; font-weight: 700; color: var(--amber-400); text-align: center; min-height: 2rem; }
.dice-history { max-height: 80px; overflow-y: auto; font-size: .75rem; color: var(--stone-400); margin-top: .5rem; }

/* ---- Tavern View (full-screen TV mode) ---- */
.tavern-body { background: #0a0804; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; }
.tavern-title { font-size: 3rem; font-weight: 900; color: var(--amber-400); letter-spacing: .05em; margin-bottom: .5rem; text-shadow: 0 0 30px rgba(251,191,36,.3); }
.tavern-map { max-width: min(900px, 90vw); max-height: 70vh; object-fit: contain; border: 2px solid var(--stone-700); border-radius: var(--radius); margin: 1rem 0; }
.tavern-combatants { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; width: 100%; max-width: 1100px; }
.tavern-side { min-width: 0; }
.tavern-side-title { color: var(--stone-400); font-size: .85rem; font-weight: 700; letter-spacing: .12em; margin-bottom: .5rem; text-transform: uppercase; }
.tavern-side-enemies .tavern-side-title { text-align: right; }
.tavern-combatant-list { display: flex; flex-direction: column; gap: .75rem; }
.tavern-combatant { background: var(--stone-800); border: 1px solid var(--stone-700); border-radius: var(--radius); padding: .75rem 1rem; }
.tavern-combatant.active-turn { border-color: var(--amber-500); background: #1c1503; }
.tavern-combatant-name { font-weight: 700; font-size: 1rem; margin-bottom: .4rem; }
.tavern-combatant-meta { color: var(--stone-400); font-size: .85rem; }
.tavern-hp-bar { background: var(--stone-700); border-radius: 4px; height: 8px; margin-bottom: .4rem; overflow: hidden; }
.tavern-hp-bar > div { border-radius: 4px; height: 100%; }
.tavern-side-enemies .tavern-combatant { text-align: right; }
.tavern-side-enemies .conditions { justify-content: flex-end; }
@media (max-width: 760px) { .tavern-combatants { grid-template-columns: 1fr; } .tavern-side-enemies .tavern-side-title, .tavern-side-enemies .tavern-combatant { text-align: left; } .tavern-side-enemies .conditions { justify-content: flex-start; } }

/* ---- Pricing ---- */
.pricing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 700px; margin: 0 auto; }
@media (max-width: 540px) { .pricing-grid { grid-template-columns: 1fr; } }
.pricing-card { border: 2px solid var(--stone-700); border-radius: var(--radius); padding: 1.5rem; background: var(--stone-800); }
.pricing-card.featured { border-color: var(--amber-500); background: #1c1503; }
.price-amount { font-size: 2.5rem; font-weight: 900; color: var(--amber-400); line-height: 1; }
.price-period { font-size: .85rem; color: var(--stone-400); }
.feature-list { list-style: none; margin: 1rem 0 1.5rem; }
.feature-list li { padding: .35rem 0; font-size: .9rem; color: var(--stone-300); }
.feature-list li::before { content: '✓ '; color: var(--green-400); }
.feature-list li.no::before { content: '✕ '; color: var(--stone-600); }
.feature-list li.no { color: var(--stone-600); }

/* ---- Reference ---- */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.ref-card { background: var(--stone-800); border: 1px solid var(--stone-700); border-radius: var(--radius); }
.ref-card summary { padding: .75rem 1rem; cursor: pointer; font-weight: 600; color: var(--stone-200); user-select: none; }
.ref-card summary:hover { color: var(--amber-400); }
.ref-card .ref-body { padding: 0 1rem 1rem; font-size: .85rem; color: var(--stone-300); line-height: 1.6; }

/* ---- Utilities ---- */
.flex          { display: flex; }
.flex-1        { flex: 1; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2         { gap: .5rem; }
.gap-4         { gap: 1rem; }
.mt-1          { margin-top: .25rem; }
.mt-2          { margin-top: .5rem; }
.mt-4          { margin-top: 1rem; }
.mb-4          { margin-bottom: 1rem; }
.mb-6          { margin-bottom: 1.5rem; }
.w-full        { width: 100%; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.sr-only       { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.hidden        { display: none !important; }

/* ---- Loading spinner ---- */
.spinner { display: inline-block; width: 1.2rem; height: 1.2rem; border: 2px solid var(--stone-600); border-top-color: var(--amber-400); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal { background: var(--stone-800); border: 1px solid var(--stone-600); border-radius: var(--radius); padding: 1.5rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-wide { max-width: 920px; }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; }
.modal-footer { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1.25rem; }

/* ---- Inventory / Spell slots ---- */
.slot-pips { display: flex; gap: .35rem; flex-wrap: wrap; }
.slot-pip { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--stone-600); cursor: pointer; transition: background .1s; }
.slot-pip.used { background: var(--stone-700); }
.slot-pip.avail { background: var(--amber-500); border-color: var(--amber-400); }

/* ---- Admin ---- */
.admin-tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 1px solid var(--stone-700); padding-bottom: .75rem; }
.admin-tab { font-size: .9rem; color: var(--stone-400); padding: .4rem .75rem; border-radius: var(--radius); text-decoration: none; }
.admin-tab:hover { color: var(--stone-100); background: var(--stone-800); text-decoration: none; }
.admin-tab-active { color: var(--amber-400) !important; background: var(--stone-800); font-weight: 600; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px; background: var(--stone-700); color: var(--stone-300); text-transform: uppercase; letter-spacing: .04em; }
.badge-admin { background: var(--amber-600); color: var(--stone-950); }
.badge-pro { background: #166534; color: var(--green-400); }
.badge-warn { background: #92400e; color: var(--amber-300); }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; color: var(--stone-300); font-size: .95rem; }
.checkbox-label input { width: auto; accent-color: var(--amber-500); }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--stone-700); }
.data-table th { color: var(--stone-400); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table tr:hover td { background: var(--stone-900); }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .admin-grid { grid-template-columns: 1fr; } }
.admin-help { font-size: .875rem; color: var(--stone-400); line-height: 1.55; }
.admin-help h3 { font-size: .95rem; color: var(--stone-200); margin-bottom: .75rem; }
.admin-help ol { padding-left: 1.15rem; margin-bottom: 1rem; }
.admin-help li { margin-bottom: .65rem; }
.admin-help li strong { color: var(--stone-300); }
.admin-help a { color: var(--amber-400); }
.admin-help .help-block { background: var(--stone-900); border: 1px solid var(--stone-700); border-radius: var(--radius); padding: .75rem; margin-bottom: 1rem; font-size: .8rem; word-break: break-all; }
.admin-help .help-block-label { font-size: .75rem; color: var(--stone-500); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
