@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Cardo:wght@400;700&display=swap');

:root {
  --bg: #140c08;
  --panel: #1d120b;
  --card: #24150d;
  --text: #f4eddc;
  --muted: #cbbd9c;
  --accent: #c9a252;
  --bad: #a3232f;
  --good: #3f8451;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Cardo', 'Times New Roman', serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20% 18%, rgba(255, 232, 196, 0.08), transparent 40%),
    radial-gradient(circle at 80% 28%, rgba(168, 128, 72, 0.12), transparent 36%),
    radial-gradient(circle at 30% 70%, rgba(106, 78, 46, 0.08), transparent 40%),
    repeating-linear-gradient(25deg, rgba(255,255,255,0.03) 0, rgba(255,255,255,0.03) 12px, rgba(0,0,0,0.08) 12px, rgba(0,0,0,0.08) 16px),
    linear-gradient(120deg, rgba(71, 48, 29, 0.82), rgba(24, 15, 9, 0.96));
  background-attachment: fixed;
  background-size: cover;
}

h1, h2, h3, .group-label {
  font-family: 'MedievalSharp', 'Cardo', 'Times New Roman', serif;
  letter-spacing: 0.03em;
}

.header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(201, 162, 82, 0.35);
  background: linear-gradient(180deg, rgba(38, 24, 14, 0.82), rgba(22, 14, 8, 0.78));
  box-shadow: 0 3px 12px rgba(0,0,0,0.35);
}

.header h1 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

.sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.app {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 12px;
  max-width: 980px;
  margin: 0 auto;
}

.panel {
  background: linear-gradient(145deg, rgba(38, 24, 14, 0.95), rgba(24, 15, 9, 0.98));
  border: 1px solid rgba(201, 162, 82, 0.35);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,240,210,0.05);
}

.panel.panel-empty {
  display: none;
}

#actions {
  column-count: 1;
  column-gap: 24px;
  break-inside: avoid;
}

@media (min-width: 768px) {
  #actions {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  #actions {
    column-count: 3;
  }
}

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

.card {
  flex: 1 1 260px;
  padding: 10px;
  background: linear-gradient(160deg, rgba(42, 26, 15, 0.95), rgba(30, 19, 11, 0.96));
  border-radius: 10px;
  border: 1px solid rgba(201, 162, 82, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.04);
}

.class-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.class-card {
  padding: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.class-card:hover {
  border-color: rgba(201, 162, 82, 0.55);
  box-shadow: 0 0 10px rgba(201, 162, 82, 0.25);
}

.class-card h2 {
  font-size: 13px;
  margin: 0 0 4px 0;
}

.class-card .kv {
  grid-template-columns: 30px 1fr;
  gap: 2px 6px;
  font-size: 11px;
}

.class-card button {
  margin-top: auto;
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
}

.card h2 {
  margin: 0 0 4px 0;
  font-size: 15px;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--muted);
}

.kv b { color: var(--text); font-weight: 600; }

.buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-group {
  margin-bottom: 20px;
  break-inside: avoid;
}

.button-group:last-child {
  margin-bottom: 0;
}

.button-group .buttons {
  gap: 6px;
  flex-wrap: wrap;
}

.group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin: 0 0 6px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(201, 162, 82, 0.35);
}

button {
  appearance: none;
  border: 1px solid rgba(201, 162, 82, 0.65);
  background: linear-gradient(135deg, #7b5327, #4b2f16 70%);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'MedievalSharp', 'Cardo', 'Times New Roman', serif;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.5),
    inset 0 -3px 6px rgba(0,0,0,0.45),
    0 4px 10px rgba(0,0,0,0.4);
  transition: filter 0.16s ease, transform 0.1s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

button:hover {
  border-color: rgba(255, 214, 142, 0.85);
  background: linear-gradient(135deg, #8d632f, #5a3a1c);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.55),
    inset 0 -3px 6px rgba(0,0,0,0.5),
    0 6px 12px rgba(0,0,0,0.45);
}
button:active {
  transform: translateY(1px);
  filter: brightness(0.95);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.55),
    0 2px 6px rgba(0,0,0,0.35);
}
button:disabled { opacity: 0.45; cursor: not-allowed; }

.bad { color: var(--bad); }
.good { color: var(--good); }

.npc-talk-btn { margin: 0 6px 6px 0; }

#log {
  max-height: 320px;
  overflow: auto;
}

@media (min-width: 1200px) {
  .app {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    align-items: start;
    max-width: 1200px;
  }

  #hud {
    grid-column: 1;
    grid-row: 1;
  }

  #actions {
    grid-column: 1;
    grid-row: 2;
  }

  #log {
    grid-column: 2;
    grid-row: 1 / span 2;
    max-height: calc(100vh - 140px);
    min-height: 360px;
    position: sticky;
    top: 16px;
    align-self: start;
  }
}

.logLine {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
  color: #c6b994;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(201, 162, 82, 0.2);
}

.footer {
  padding: 12px 20px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid rgba(201, 162, 82, 0.3);
}

/* === NPC Shop Styles === */
.shop-panel { max-width: 600px; margin: 0 auto; }
.shop-greeting { color: #d8c7a5; font-style: italic; margin-bottom: 8px; }
.shop-gold { font-size: 1.1em; margin-bottom: 8px; padding: 4px 8px; background: linear-gradient(135deg, rgba(87, 57, 28, 0.9), rgba(54, 32, 17, 0.9)); border: 1px solid rgba(201, 162, 82, 0.4); border-radius: 6px; display: inline-block; color: #f7efd8; box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.35); }
.shop-message { padding: 6px 10px; margin: 6px 0; border-radius: 6px; background: rgba(63, 118, 74, 0.35); color: #d5e5c2; font-size: 0.95em; border: 1px solid rgba(63, 118, 74, 0.45); }
.shop-tabs { display: flex; gap: 4px; margin: 10px 0 8px; }
.shop-tab { padding: 6px 18px; border: 1px solid rgba(201, 162, 82, 0.45); background: linear-gradient(180deg, rgba(255, 241, 214, 0.08), rgba(108, 76, 38, 0.18)); color: var(--text); cursor: pointer; border-radius: 6px 6px 0 0; font-size: 0.95em; box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.3); }
.shop-tab.active { background: linear-gradient(180deg, rgba(201, 162, 82, 0.35), rgba(117, 81, 41, 0.35)); color: #fef7e7; border-bottom-color: rgba(201, 162, 82, 0.35); font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.35); }
.shop-items { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.shop-item { background: linear-gradient(160deg, rgba(49, 32, 20, 0.88), rgba(31, 20, 12, 0.9)); border: 1px solid rgba(201, 162, 82, 0.25); border-radius: 8px; padding: 8px 10px; box-shadow: inset 0 1px 0 rgba(255,240,210,0.05); }
.shop-item-disabled { opacity: 0.6; }
.shop-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.shop-item-name { font-weight: bold; font-size: 0.95em; color: var(--text); }
.shop-item-rarity { font-size: 0.8em; color: #d6c599; }
.shop-item-count { font-size: 0.9em; color: #b7a67e; }
.shop-item-desc { font-size: 0.85em; color: #c4b598; margin-bottom: 4px; }
.shop-item-stats { font-size: 0.85em; color: #7fa56b; margin-bottom: 4px; }
.shop-item-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.shop-item-stock { font-size: 0.85em; color: #b3a37a; }
.shop-item-price { font-size: 0.9em; color: #e8c76f; }
.shop-buy-btn, .shop-sell-btn { padding: 3px 12px; border-radius: 6px; border: 1px solid #4d7c45; background: linear-gradient(135deg, #3f6b35, #2b472a); color: #e8f5d7; cursor: pointer; font-size: 0.85em; box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.25), 0 2px 6px rgba(0,0,0,0.3); }
.shop-sell-btn { background: linear-gradient(135deg, #8a5f2d, #5c3a18); border-color: rgba(201, 162, 82, 0.6); color: #f7edd5; }
.shop-buy-btn:hover:not(:disabled), .shop-sell-btn:hover { background: linear-gradient(135deg, #4f7d45, #325733); box-shadow: inset 0 1px 0 rgba(255,240,210,0.35), 0 4px 8px rgba(0,0,0,0.35); }
.shop-buy-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.shop-empty { color: #b7a88b; font-style: italic; padding: 20px 0; text-align: center; }

/* === Bestiary Panel Styles === */
.bestiary-panel { max-width: 700px; margin: 0 auto; }
.bestiary-summary { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; margin-bottom: 12px; background: rgba(201, 162, 82, 0.16); border-radius: 8px; font-size: 0.9em; color: var(--muted); border: 1px solid rgba(201, 162, 82, 0.28); }
.bestiary-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.bestiary-entry { background: rgba(255, 244, 214, 0.04); border: 1px solid rgba(201, 162, 82, 0.22); border-radius: 8px; padding: 10px 12px; transition: border-color 0.2s, box-shadow 0.2s; box-shadow: inset 0 1px 0 rgba(255,240,210,0.04); }
.bestiary-entry:hover { border-color: rgba(201, 162, 82, 0.45); box-shadow: 0 6px 12px rgba(0,0,0,0.25); }
.bestiary-unknown { opacity: 0.5; }
.bestiary-boss { border-color: rgba(162, 35, 47, 0.4); background: rgba(162, 35, 47, 0.12); }
.bestiary-boss:hover { border-color: rgba(162, 35, 47, 0.6); }
.bestiary-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.bestiary-name { font-weight: 700; font-size: 1em; color: var(--text); }
.bestiary-boss-tag { font-size: 0.75em; color: var(--bad); font-weight: 700; padding: 2px 6px; background: rgba(162, 35, 47, 0.16); border-radius: 4px; border: 1px solid rgba(162, 35, 47, 0.35); }
.bestiary-element { font-size: 0.8em; color: var(--muted); text-transform: capitalize; }
.bestiary-description { font-size: 0.85em; color: var(--muted); font-style: italic; margin-bottom: 6px; padding: 4px 8px; background: rgba(255, 244, 214, 0.05); border-radius: 4px; }
.bestiary-stats { font-size: 0.85em; color: var(--accent); margin-bottom: 4px; }
.bestiary-rewards { font-size: 0.85em; color: #e5c36f; margin-bottom: 4px; }
.bestiary-defeats { font-size: 0.8em; color: var(--good); }
.bestiary-close-btn { display: block; margin: 12px auto 0; padding: 8px 24px; font-size: 0.95em; }

/* === Bestiary Shield Info === */
.bestiary-shield-info { margin-top: 8px; padding: 8px 10px; background: rgba(201, 162, 82, 0.12); border: 1px solid rgba(201, 162, 82, 0.25); border-radius: 6px; font-size: 0.85em; display: flex; flex-direction: column; gap: 4px; }
.bestiary-shield-info > div { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.bestiary-element-tag { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; border: 1px solid rgba(201, 162, 82, 0.35); background: rgba(255, 244, 214, 0.08); }
.bestiary-el-fire { background: rgba(184, 72, 38, 0.2); border-color: rgba(184, 72, 38, 0.45); }
.bestiary-el-ice { background: rgba(132, 186, 201, 0.2); border-color: rgba(132, 186, 201, 0.45); }
.bestiary-el-lightning { background: rgba(224, 191, 86, 0.22); border-color: rgba(224, 191, 86, 0.5); }
.bestiary-el-holy { background: rgba(223, 207, 150, 0.25); border-color: rgba(223, 207, 150, 0.5); }
.bestiary-el-shadow { background: rgba(115, 74, 140, 0.25); border-color: rgba(115, 74, 140, 0.5); }
.bestiary-el-nature { background: rgba(78, 128, 70, 0.22); border-color: rgba(78, 128, 70, 0.5); }
.bestiary-el-physical { background: rgba(180, 158, 130, 0.25); border-color: rgba(180, 158, 130, 0.5); }

/* === Shield Break Combat UI === */
.shield-break-hud { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; margin: 6px 0; background: rgba(201, 162, 82, 0.12); border: 1px solid rgba(201, 162, 82, 0.24); border-radius: 6px; box-shadow: inset 0 1px 0 rgba(255,240,210,0.04); }
.shield-display { font-size: 18px; letter-spacing: 2px; }
.shield-full { color: var(--accent); }
.shield-empty { color: rgba(255, 244, 214, 0.2); }
.shield-broken { color: var(--bad); }
.weakness-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(255, 244, 214, 0.06); border: 1px solid rgba(201, 162, 82, 0.35); font-size: 13px; margin: 0 1px; }
.break-state-display { padding: 4px 10px; border-radius: 4px; font-size: 0.85em; font-weight: 700; }
.break-active { background: rgba(162, 35, 47, 0.16); color: var(--bad); border: 1px solid rgba(162, 35, 47, 0.35); animation: break-pulse 1s ease-in-out infinite; }
.break-active span { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 0.9em; }
.shield-hint { font-size: 0.8em; color: var(--muted); flex-basis: 100%; margin-top: 2px; }

/* Shield break animation */
@keyframes break-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes shield-break-flash { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.2); opacity: 0.5; color: var(--bad); } 100% { transform: scale(1); opacity: 1; } }
.shield-break-animation { animation: shield-break-flash 0.5s ease-in-out; }

/* ========================================
   Combat Log Formatter Styles
   Added by Claude Opus 4.6 (Day 343)
   ======================================== */
.log-damage-dealt { color: #5fa269; }
.log-damage-received { color: #c0403b; }
.log-healing { color: #4f9e73; }
.log-status { color: #d2a150; }
.log-shield { color: #8c6fb4; }
.log-ability { color: #b76d3f; }
.log-flee { color: #d5b35b; }
.log-victory { color: #e8c36d; font-weight: bold; }
.log-defeat { color: #8c1f1f; font-weight: bold; }
.log-companion { color: #6ba9c0; }
.log-item { color: #9fbf6a; }
.log-info { color: #b2a48a; }
.log-icon {
  margin-right: 6px;
  font-size: 0.9em;
  display: inline-block;
  width: 1.2em;
  text-align: center;
}

/* Gradient Button Styles */
button.gradient,
.btn-gradient {
  appearance: none;
  background: linear-gradient(135deg, var(--gradient-start, #d8b56a), var(--gradient-end, #8a5a2a));
  border: 1px solid rgba(255, 226, 184, 0.6);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  font-family: 'MedievalSharp', 'Cardo', 'Times New Roman', serif;
  transition: all 0.2s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.6),
    inset 0 -3px 6px rgba(0,0,0,0.45),
    0 4px 12px rgba(0,0,0,0.4);
}

button.gradient:hover,
.btn-gradient:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.7),
    inset 0 -3px 6px rgba(0,0,0,0.5),
    0 6px 14px rgba(0,0,0,0.45);
  transform: translateY(-1px);
}

button.gradient:active,
.btn-gradient:active {
  filter: brightness(0.97);
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 6px rgba(0,0,0,0.55),
    0 2px 6px rgba(0,0,0,0.35);
}

button.gradient:disabled,
.btn-gradient:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: saturate(0.5);
  transform: none;
  box-shadow: none;
}

/* Gradient button variants */
button.gradient-success,
.btn-gradient-success {
  background: linear-gradient(135deg, #4f7f3f, var(--good, #3f8451));
}

button.gradient-danger,
.btn-gradient-danger {
  background: linear-gradient(135deg, #9d2a2a, var(--bad, #a3232f));
}

button.gradient-primary,
.btn-gradient-primary {
  background: linear-gradient(135deg, var(--gradient-start, #d8b56a), var(--gradient-end, var(--accent)));
}

/* Form Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(201, 162, 82, 0.3);
  background: rgba(255, 244, 214, 0.06);
  color: var(--text);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(201, 162, 82, 0.5) 50%),
    linear-gradient(135deg, rgba(201, 162, 82, 0.5) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  appearance: none;
}

textarea { min-height: 90px; resize: vertical; }

input::placeholder,
textarea::placeholder { color: var(--muted); }

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(201, 162, 82, 0.65);
  box-shadow: 0 0 0 3px rgba(201, 162, 82, 0.2);
  outline: none;
  background: rgba(255, 244, 214, 0.1);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .app { padding: 10px; }
  .panel { padding: 10px; }
  .row { flex-direction: column; }
  .kv { grid-template-columns: 1fr; }
  .buttons { flex-direction: column; align-items: stretch; }
  button, .btn-gradient, .btn-gradient-success, .btn-gradient-danger, .btn-gradient-primary {
    width: 100%;
    padding: 12px 14px;
  }
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    padding: 12px 14px;
  }
  .shop-tabs { flex-wrap: wrap; }
  .shop-item-header,
  .shop-item-footer,
  .bestiary-entry-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .shop-item { padding: 10px; }
  .bestiary-summary { flex-direction: column; align-items: flex-start; gap: 6px; }
}


/* === Accessibility: Reduced Motion === */
.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* === Dungeon Floor Map === */
.dungeon-map-panel {
  padding: 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.dungeon-map-panel h2 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.dungeon-map-progress {
  font-size: 0.85rem;
  color: var(--color-muted, #b7a88b);
  margin-bottom: 12px;
}

.dungeon-map-floors {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dungeon-map-floor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(201, 162, 82, 0.3);
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dungeon-map-floor--locked {
  opacity: 0.4;
  background: rgba(0, 0, 0, 0.25);
}

.dungeon-map-floor--unvisited {
  background: rgba(255, 244, 214, 0.06);
}

.dungeon-map-floor--current {
  background: rgba(201, 162, 82, 0.2);
  border-color: rgba(201, 162, 82, 0.45);
  box-shadow: 0 0 8px rgba(201, 162, 82, 0.25);
}

.dungeon-map-floor--cleared {
  background: rgba(63, 132, 81, 0.16);
  border-color: rgba(63, 132, 81, 0.35);
}

.dungeon-map-floor-num {
  font-size: 0.75rem;
  color: var(--color-muted, #b7a88b);
  min-width: 20px;
  text-align: right;
}

.dungeon-map-theme-icon {
  font-size: 1rem;
  min-width: 22px;
  text-align: center;
}

.dungeon-map-floor-name {
  flex: 1;
  font-size: 0.9rem;
}

.dungeon-map-boss-badge {
  font-size: 0.7rem;
  background: rgba(201, 140, 64, 0.2);
  color: #e8c36d;
  border: 1px solid rgba(201, 140, 64, 0.45);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: bold;
}

.dungeon-map-status-icon {
  font-size: 0.9rem;
  min-width: 22px;
  text-align: center;
}

.dungeon-map-connector {
  text-align: center;
  color: var(--color-muted, #9c8a71);
  font-size: 0.8rem;
  line-height: 1;
  padding: 1px 0;
  margin-left: 31px;
}

/* Dark theme overrides for dungeon map */
.dark-theme .dungeon-map-floor--current {
  background: rgba(201, 162, 82, 0.24);
}

.dark-theme .dungeon-map-floor--cleared {
  background: rgba(63, 132, 81, 0.2);
}

/* ============================================================
   World Event Banner & Notification Styles
   ============================================================ */

.world-event-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(201, 162, 82, 0.16);
  border: 1px solid rgba(201, 162, 82, 0.35);
  font-size: 0.82rem;
  flex-wrap: wrap;
  margin-bottom: 6px;
  box-shadow: inset 0 1px 0 rgba(255,240,210,0.04);
}

.world-event-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.world-event-name {
  font-weight: bold;
  color: var(--accent);
  flex-shrink: 0;
}

.world-event-name::after {
  content: ':';
}

.world-event-desc {
  color: #d4cba7;
  flex: 1;
  min-width: 120px;
}

.world-event-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.world-event-moves {
  font-size: 0.75rem;
  color: #b7a88b;
  white-space: nowrap;
}

.world-event-progress-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 244, 214, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.world-event-progress-fill {
  height: 100%;
  background: #d7b35e;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.world-event-dismiss-btn {
  background: none;
  border: none;
  color: #bda67c;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  margin-left: 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.world-event-dismiss-btn:hover {
  color: #f4eddc;
  background: rgba(255, 244, 214, 0.08);
}

/* Rarity-based color theming */
.world-event-rarity-common .world-event-name { color: #b7a88b; }
.world-event-rarity-uncommon .world-event-name { color: #4f8a4f; }
.world-event-rarity-rare .world-event-name { color: #4f6f9c; }
.world-event-rarity-epic .world-event-name { color: #8a5aa9; }
.world-event-rarity-legendary .world-event-name { color: #d79c44; }

.world-event-rarity-uncommon { border-color: rgba(79, 138, 79, 0.5); background: rgba(79, 138, 79, 0.12); }
.world-event-rarity-rare { border-color: rgba(79, 111, 156, 0.5); background: rgba(79, 111, 156, 0.12); }
.world-event-rarity-epic { border-color: rgba(138, 90, 169, 0.5); background: rgba(138, 90, 169, 0.14); }
.world-event-rarity-legendary { border-color: rgba(215, 156, 68, 0.6); background: rgba(215, 156, 68, 0.16); }

/* World Event Notification (full-screen popup on event start) */
.world-event-notification {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.world-event-notification-inner {
  background: linear-gradient(150deg, #24150d, #1a1009);
  border: 2px solid #c9a252;
  border-radius: 12px;
  padding: 32px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 28px rgba(0,0,0,0.5);
}

.world-event-notification-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.world-event-notification-title {
  font-size: 0.85rem;
  color: #b7a88b;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 4px;
}

.world-event-notification-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: #e8c36d;
  margin: 0 0 12px;
}

.world-event-notification-desc {
  color: #d4cba7;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.world-event-notification-duration {
  font-size: 0.8rem;
  color: #b7a88b;
  margin-bottom: 20px;
}

.world-event-notification-close {
  background: linear-gradient(135deg, #c9a252, #8a5a2a);
  color: #1a1009;
  border: none;
  border-radius: 6px;
  padding: 10px 28px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.7), 0 4px 12px rgba(0,0,0,0.35);
}

.world-event-notification-close:hover {
  background: linear-gradient(135deg, #ddb76c, #9d6d32);
}

/* World Event Badge (small inline badge) */
.world-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: bold;
  background: rgba(201, 162, 82, 0.16);
  border: 1px solid rgba(201, 162, 82, 0.35);
  color: #e8c36d;
}

/* Keyboard shortcut hint */
.keyboard-hint {
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(201, 162, 82, 0.3);
  font-size: 0.85rem;
  color: #cbbd9c;
}
.keyboard-hint kbd {
  display: inline-block;
  background: #2f1f12;
  border: 1px solid rgba(201, 162, 82, 0.45);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
  color: #f4eddc;
  margin: 0 2px;
  box-shadow: inset 0 1px 0 rgba(255,240,210,0.25);
}

.character-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: linear-gradient(130deg, rgba(201, 162, 82, 0.12), rgba(255, 240, 210, 0.06));
  border: 1px solid rgba(201, 162, 82, 0.28);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.08), 0 6px 14px rgba(0,0,0,0.35);
}

.character-avatar-large {
  font-size: 48px;
  line-height: 1;
  padding: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 240, 210, 0.32), rgba(201, 162, 82, 0.16));
  border: 2px solid rgba(201, 162, 82, 0.75);
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255, 240, 210, 0.45);
  text-shadow: 0 2px 4px rgba(0,0,0,0.45);
  animation: avatar-pulse 2.6s ease-in-out infinite;
}

.character-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.character-class {
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
}

@keyframes avatar-pulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 8px 16px rgba(0,0,0,0.45), 0 0 12px rgba(201, 162, 82, 0.38), inset 0 1px 0 rgba(255, 240, 210, 0.45);
  }
  50% {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.5), 0 0 18px rgba(201, 162, 82, 0.55), inset 0 1px 0 rgba(255, 240, 210, 0.55);
  }
}

/* === Achievements Panel === */
.achievements-panel {
  background: linear-gradient(140deg, rgba(40, 25, 15, 0.96), rgba(22, 13, 8, 0.98));
  border: 1px solid rgba(201, 162, 82, 0.38);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.38), inset 0 1px 0 rgba(255, 240, 210, 0.06);
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.achievements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(201, 162, 82, 0.35);
  background: linear-gradient(120deg, rgba(201, 162, 82, 0.14), rgba(255, 244, 214, 0.06));
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.08);
}

.achievements-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.close-btn {
  appearance: none;
  border: 1px solid rgba(201, 162, 82, 0.65);
  background: linear-gradient(135deg, #7b5327, #4b2f16 70%);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'MedievalSharp', 'Cardo', 'Times New Roman', serif;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 210, 0.45),
    inset 0 -3px 6px rgba(0,0,0,0.45),
    0 4px 10px rgba(0,0,0,0.35);
  transition: all 0.16s ease;
}

.close-btn:hover {
  border-color: rgba(255, 214, 142, 0.85);
  background: linear-gradient(135deg, #8d632f, #5a3a1c);
  transform: translateY(-1px);
}

.close-btn:active {
  transform: translateY(1px);
}

.achievements-stats {
  padding: 10px 12px;
  background: rgba(255, 244, 214, 0.05);
  border: 1px solid rgba(201, 162, 82, 0.28);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.06);
}

.overall-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.progress-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.achievements-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.achievement-tab {
  padding: 8px 14px;
  border: 1px solid rgba(201, 162, 82, 0.35);
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(255, 241, 214, 0.08), rgba(108, 76, 38, 0.18));
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.1s ease;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.3);
}

.achievement-tab:hover {
  border-color: rgba(201, 162, 82, 0.5);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}

.achievement-tab.active {
  background: linear-gradient(180deg, rgba(201, 162, 82, 0.32), rgba(117, 81, 41, 0.3));
  border-color: rgba(201, 162, 82, 0.55);
  color: #fef7e7;
  box-shadow: 0 8px 14px rgba(0,0,0,0.35);
}

.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 4px;
}

.achievement-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 244, 214, 0.05);
  border: 1px solid rgba(201, 162, 82, 0.24);
  border-radius: 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.05);
}

.achievement-item:hover {
  border-color: rgba(201, 162, 82, 0.45);
  box-shadow: 0 8px 14px rgba(0,0,0,0.35);
  background: rgba(201, 162, 82, 0.08);
}

.achievement-item.locked {
  opacity: 0.6;
  background: rgba(0, 0, 0, 0.25);
  border-style: dashed;
}

.achievement-item.unlocked {
  border-color: rgba(63, 132, 81, 0.45);
  background: rgba(63, 132, 81, 0.12);
}

.achievement-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 240, 210, 0.24), rgba(201, 162, 82, 0.12));
  border: 1px solid rgba(201, 162, 82, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1.2rem;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.25), 0 4px 10px rgba(0,0,0,0.35);
}

.achievement-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achievement-name {
  font-weight: 700;
  color: var(--text);
  font-size: 1rem;
}

.achievement-description {
  color: var(--muted);
  font-size: 0.92rem;
}

.achievement-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 9px;
  background: rgba(255, 244, 214, 0.14);
  border: 1px solid rgba(201, 162, 82, 0.35);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.16);
}

.progress-fill {
  position: absolute;
  inset: 0;
  width: var(--progress, 0%);
  background: linear-gradient(135deg, #c9a252, #8a5a2a);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.35);
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: #e2d5b2;
}

.overall-progress .progress-text {
  text-align: right;
}

.no-achievements {
  text-align: center;
  padding: 22px 0;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 720px) {
  .achievements-panel { padding: 12px; }
  .achievements-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .achievements-list { max-height: 360px; }
  .achievement-item { grid-template-columns: 44px 1fr; }
  .achievement-tab { width: 100%; text-align: center; border-radius: 8px; }
  .overall-progress { grid-template-columns: 1fr; }
}
