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

body {
  font-family: 'Courier New', monospace;
  background: #0a0a0f;
  color: #c8c8d0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── NAV ─────────────────────────────────────────────── */
#navbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #111118;
  border-bottom: 1px solid #2a2a35;
  flex-wrap: wrap;
}

.nav-title {
  font-size: 18px;
  font-weight: bold;
  color: #c33;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-btn {
  background: none;
  border: 1px solid #333;
  color: #888;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.nav-btn:hover { color: #c33; border-color: #c33; }
.nav-btn.active { color: #fff; border-color: #c33; background: rgba(200, 50, 50, 0.15); }

.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.nav-auth button {
  background: #222;
  border: 1px solid #444;
  color: #aaa;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

.nav-auth button:hover { border-color: #c33; color: #fff; }

.nav-auth .username {
  color: #c33;
  font-weight: bold;
}

/* ── SCREENS ─────────────────────────────────────────── */
#screenContainer {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
}

.screen { display: none; }
.screen.active { display: block; }

/* ── COMMON ELEMENTS ─────────────────────────────────── */
h1 {
  font-size: 24px;
  color: #c33;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

h2 {
  font-size: 18px;
  color: #e44;
  margin-bottom: 12px;
}

h3 {
  font-size: 15px;
  color: #c33;
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #1a1a22;
  border: 1px solid #c33;
  color: #c33;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn:hover { background: rgba(200, 50, 50, 0.2); color: #fff; }
.btn-small { padding: 5px 12px; font-size: 12px; }
.btn-danger { border-color: #666; color: #888; }
.btn-danger:hover { border-color: #f44; color: #f44; background: rgba(255, 50, 50, 0.1); }
.btn-success { border-color: #4a4; color: #4a4; }
.btn-success:hover { background: rgba(50, 200, 50, 0.1); color: #6f6; }

.card {
  background: #111118;
  border: 1px solid #2a2a35;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.card:hover { border-color: #c33; }

.card-title {
  font-size: 16px;
  font-weight: bold;
  color: #e44;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 12px;
  color: #666;
}

/* ── FORMS ───────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: #0d0d14;
  border: 1px solid #2a2a35;
  color: #c8c8d0;
  font-family: inherit;
  font-size: 14px;
  border-radius: 4px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #c33;
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group { flex: 1; }

/* ── CHARACTER SHEET ─────────────────────────────────── */
.sheet-section {
  background: #111118;
  border: 1px solid #2a2a35;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.sheet-section h3 {
  border-bottom: 1px solid #2a2a35;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  width: 100px;
}

.stat-value {
  font-size: 16px;
  font-weight: bold;
  color: #e44;
}

.hp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hp-bar button {
  width: 28px;
  height: 28px;
  background: #1a1a22;
  border: 1px solid #444;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-bar button:hover { border-color: #c33; }

.hp-current {
  font-size: 22px;
  font-weight: bold;
  color: #c33;
  min-width: 40px;
  text-align: center;
}

.hp-max { font-size: 14px; color: #666; }

.ability-card {
  background: #0d0d14;
  border: 1px solid #2a2a35;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 8px;
}

.ability-name {
  font-weight: bold;
  color: #c33;
  font-size: 14px;
}

.ability-trigger {
  font-size: 11px;
  color: #888;
  margin: 2px 0;
}

.ability-effect {
  font-size: 12px;
  color: #aaa;
}

.ability-pick:not(.ability-disabled):hover {
  border-color: #c33;
  background: rgba(200, 50, 50, 0.08);
}

.ability-disabled {
  opacity: 0.35;
  cursor: default !important;
}

.ability-remove:hover {
  border-color: #f44 !important;
  color: #f44 !important;
}

/* ── HP BUTTONS (play view) ──────────────────────────── */
.hp-btn {
  width: 48px;
  height: 48px;
  background: #1a1a22;
  border: 2px solid #c33;
  color: #c33;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all 0.15s;
}

.hp-btn:hover { background: rgba(200, 50, 50, 0.2); color: #fff; }
.hp-btn:active { transform: scale(0.95); }

.edge-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(200, 50, 50, 0.2);
  border: 1px solid #c33;
  border-radius: 3px;
  font-size: 11px;
  color: #c33;
  margin: 2px;
}

.weapon-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #1a1a22;
}

.weapon-type {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
}

.weapon-name {
  font-size: 14px;
  color: #c8c8d0;
}

/* ── BACKPACK ────────────────────────────────────────── */
.backpack-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.backpack-slot {
  width: 60px;
  height: 60px;
  background: #0d0d14;
  border: 1px solid #2a2a35;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #666;
  cursor: pointer;
}

.backpack-slot.filled { border-color: #c33; color: #c33; }

/* ── COIN TRACKER ────────────────────────────────────── */
.coin-tracker {
  display: flex;
  gap: 8px;
  align-items: center;
}

.coin-pip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #c33;
  cursor: pointer;
  transition: all 0.2s;
}

.coin-pip.used { background: #c33; }
.coin-pip:hover { border-color: #fff; }

/* ── CAMP TRACKER ────────────────────────────────────── */
.silo-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.silo-label {
  width: 100px;
  font-size: 13px;
  color: #888;
}

.silo-fill {
  flex: 1;
  height: 20px;
  background: #0d0d14;
  border: 1px solid #2a2a35;
  border-radius: 3px;
  overflow: hidden;
}

.silo-fill-inner {
  height: 100%;
  background: #c33;
  transition: width 0.3s;
}

.silo-count {
  font-size: 13px;
  color: #c33;
  min-width: 50px;
  text-align: right;
}

.silo-btn {
  width: 36px;
  height: 36px;
  background: #1a1a22;
  border: 1px solid #444;
  color: #ccc;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  flex-shrink: 0;
}

.silo-btn:hover { border-color: #c33; color: #c33; }
.silo-btn:active { transform: scale(0.95); }

/* ── RULEBOOK ────────────────────────────────────────── */
.search-box {
  width: 100%;
  padding: 10px 14px;
  background: #0d0d14;
  border: 1px solid #2a2a35;
  color: #c8c8d0;
  font-family: inherit;
  font-size: 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.search-box:focus { outline: none; border-color: #c33; }

.rulebook-section {
  background: #111118;
  border: 1px solid #2a2a35;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}

.rulebook-section h3 {
  color: #c33;
  cursor: pointer;
}

.rulebook-section h3:hover { color: #e66; }

.rulebook-content {
  font-size: 13px;
  line-height: 1.6;
  color: #aaa;
  margin-top: 8px;
}

.rulebook-content strong { color: #c33; }

.highlight { background: rgba(200, 50, 50, 0.3); padding: 0 2px; border-radius: 2px; }

.expandable-group {
  margin-top: 12px;
  border-top: 1px solid #2a2a35;
  padding-top: 8px;
}

.expandable-header {
  display: flex;
  align-items: center;
  padding: 6px 0;
  user-select: none;
}

.expandable-header:hover .expand-arrow { color: #c33 !important; }

/* ── EDGE BUTTONS ────────────────────────────────────── */
.edge-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: #0d0d14;
  border: 1px solid #2a2a35;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: #888;
  transition: all 0.15s;
}

.edge-btn:hover { border-color: #c33; }

.edge-btn.edge-active {
  border-color: #c33;
  background: rgba(200, 50, 50, 0.12);
  color: #c8c8d0;
}

.edge-btn-name {
  font-weight: bold;
  color: #c33;
  min-width: 100px;
  font-size: 14px;
}

.edge-btn.edge-active .edge-btn-name { color: #f55; }

.edge-btn-desc {
  font-size: 12px;
  color: #666;
  flex: 1;
}

.edge-btn.edge-active .edge-btn-desc { color: #999; }

/* ── MODAL ───────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #111118;
  border: 1px solid #c33;
  border-radius: 8px;
  padding: 24px;
  max-width: 420px;
  width: 90%;
}

.modal h2 { margin-bottom: 16px; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

/* ── MAP PALETTE ─────────────────────────────────────── */
.palette-swatch {
  width: 36px;
  height: 36px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
  transition: border-color 0.15s;
}

.palette-swatch:hover { border-color: #fff; }
.palette-swatch.palette-active { border-color: #fff; box-shadow: 0 0 6px rgba(255,255,255,0.3); }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 600px) {
  #navbar { padding: 8px; }
  .nav-title { font-size: 14px; }
  .nav-btn { padding: 5px 8px; font-size: 11px; }
  .form-row { flex-direction: column; gap: 0; }
  h1 { font-size: 20px; }
}
