/* Lokarta Browser Edition - Dark Gothic Fantasy Theme & Layout Styles */

:root {
  --bg-primary: #0a0b10;
  --bg-panel: #14161f;
  --bg-panel-header: #1e2130;
  --bg-card: #0b0d14;
  --border-color: #2e344d;
  --border-highlight: #4c5680;
  --gold-accent: #e5b95c;
  --gold-glow: rgba(229, 185, 92, 0.35);
  --blue-accent: #38bdf8;
  --blue-glow: rgba(56, 189, 248, 0.35);
  --text-primary: #e2e8f0;
  --text-muted: #94a3b8;
  --hp-red: #ef4444;
  --hp-red-glow: rgba(239, 68, 68, 0.4);
  --mp-blue: #3b82f6;
  --mp-blue-glow: rgba(59, 130, 246, 0.4);
  --xp-gold: #f59e0b;
  --xp-gold-glow: rgba(245, 158, 11, 0.4);
  --font-display: 'Cinzel', 'Trajan Pro', 'Palatino', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at center, #11131c, #050609);
  position: relative;
}

/* ==========================================================================
   App Header
   ========================================================================== */

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background-color: var(--bg-panel-header);
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  flex-shrink: 0;
  z-index: 10;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 6px var(--gold-accent));
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 3px;
  color: var(--gold-accent);
  text-shadow: 0 0 8px var(--gold-glow);
}

.tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  border-left: 1px solid var(--border-color);
  padding-left: 10px;
}

.system-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.engine-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background-color: #0b0d14;
  color: var(--blue-accent);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.audio-btn, .header-btn {
  cursor: pointer;
  background-color: #1a1e2e;
  color: var(--gold-accent);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.audio-btn:hover, .header-btn:hover {
  background-color: #2a3148;
  border-color: var(--gold-accent);
  box-shadow: 0 0 8px var(--gold-glow);
}

.audio-btn.muted {
  color: var(--text-muted);
  opacity: 0.7;
}

/* ==========================================================================
   Main Game Frame Layout
   ========================================================================== */

.main-frame {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.center-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 2px solid var(--border-color);
  position: relative;
}

.viewport-panel {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #050608;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.canvas-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: crosshair;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Touch controls overlay for mobile */
.touch-controls {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: none;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
  z-index: 20;
  opacity: 0.75;
}

.touch-btn {
  background: rgba(20, 24, 38, 0.85);
  border: 1px solid var(--gold-accent);
  color: var(--gold-accent);
  border-radius: 6px;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
}

.touch-btn:active {
  background: var(--gold-accent);
  color: #050608;
}

/* ==========================================================================
   Sidebar HUD & Panels
   ========================================================================== */

.sidebar-hud {
  width: 440px;
  min-width: 380px;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-panel);
  overflow-y: auto;
  gap: 8px;
  padding: 8px;
  flex-shrink: 0;
}

.hud-panel {
  background-color: #0e1017;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.panel-header {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 1.5px;
  color: var(--gold-accent);
  background-color: var(--bg-panel-header);
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-color);
  border-radius: 5px 5px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Status Bars Panel */
.status-panel-inner {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  border-bottom: 1px solid #1e2230;
  padding-bottom: 4px;
}

.vocation-tag {
  display: flex;
  align-items: center;
  gap: 6px;
}

.level-badge {
  background-color: #272115;
  color: var(--gold-accent);
  border: 1px solid var(--gold-accent);
  border-radius: 3px;
  padding: 1px 5px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.floor-tag .label {
  color: var(--text-muted);
}

.floor-tag .val {
  color: var(--blue-accent);
  font-weight: 600;
}

.meter-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meter-info {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.meter-label {
  color: var(--text-muted);
  font-weight: 700;
}

.meter-values {
  color: var(--text-primary);
}

.meter-bar-track {
  height: 10px;
  background-color: #0b0c12;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.meter-bar-fill {
  height: 100%;
  transition: width 0.15s ease-out;
}

.hp-fill {
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  box-shadow: 0 0 6px var(--hp-red-glow);
}

.mp-fill {
  background: linear-gradient(90deg, #1d4ed8, #3b82f6);
  box-shadow: 0 0 6px var(--mp-blue-glow);
}

.xp-fill {
  background: linear-gradient(90deg, #d97706, #fbbf24);
  box-shadow: 0 0 6px var(--xp-gold-glow);
}

.skill-boosts-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: #a78bfa;
  background-color: #12131e;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid #23273e;
}

.active-buff-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #facc15;
}

/* ==========================================================================
   Paperdoll Slots (4 Slots: Main Hand, Off Hand, Armor, Relic)
   ========================================================================== */

.paperdoll-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
}

.paperdoll-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #0b0c12;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 3px;
  position: relative;
  transition: border-color 0.2s, background-color 0.2s;
  min-height: 75px;
}

.paperdoll-slot:hover {
  border-color: var(--border-highlight);
  background-color: #121520;
}

.paperdoll-slot .slot-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 2px;
}

.paperdoll-slot .slot-content {
  font-size: 22px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paperdoll-slot .slot-item-name {
  font-size: 0.65rem;
  text-align: center;
  color: var(--gold-accent);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.paperdoll-slot .unequip-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #2b1115;
  border: 1px solid #7f1d1d;
  color: #f87171;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paperdoll-slot .unequip-btn:hover {
  background: #7f1d1d;
  color: #fff;
}

/* ==========================================================================
   Backpack Slots (6 Slots)
   ========================================================================== */

.backpack-slots-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 8px;
}

.backpack-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #0b0c12;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 2px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 70px;
}

.backpack-slot:hover {
  border-color: var(--gold-accent);
  background-color: #161926;
}

.backpack-slot .slot-num {
  position: absolute;
  top: 1px;
  left: 3px;
  font-size: 0.58rem;
  color: #64748b;
  font-family: var(--font-mono);
}

.backpack-slot .slot-content {
  font-size: 20px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.backpack-slot .item-qty {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--blue-accent);
  font-family: var(--font-mono);
}

.backpack-slot .slot-item-name {
  font-size: 0.62rem;
  text-align: center;
  color: var(--text-primary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.backpack-slot .slot-actions {
  display: flex;
  gap: 2px;
  margin-top: 3px;
}

.backpack-slot .use-btn, .backpack-slot .drop-btn {
  font-size: 0.58rem;
  padding: 1px 4px;
  border-radius: 2px;
  border: 1px solid var(--border-color);
  background-color: #1e2230;
  color: var(--text-primary);
  cursor: pointer;
}

.backpack-slot .use-btn:hover {
  background-color: #2563eb;
  border-color: #3b82f6;
}

.backpack-slot .drop-btn:hover {
  background-color: #991b1b;
  border-color: #ef4444;
}

/* ==========================================================================
   Action Bar (10 Slots in 2 Rows of 5)
   ========================================================================== */

.action-slots-container {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-slots-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
}

.action-slot-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: #0d0f17;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 5px 3px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  color: var(--text-primary);
  min-height: 80px;
  overflow: hidden;
}

.action-slot-btn:hover:not(.on-cooldown) {
  border-color: var(--gold-accent);
  background-color: #1b1e2c;
  transform: translateY(-1px);
  box-shadow: 0 0 8px rgba(229, 185, 92, 0.25);
}

.action-slot-btn.on-cooldown {
  opacity: 0.65;
  filter: grayscale(0.4);
}

.action-slot-btn .hotkey-badge {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--gold-accent);
  font-weight: 700;
  z-index: 2;
}

.action-slot-btn .btn-icon {
  font-size: 26px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  z-index: 2;
}

.action-slot-btn .btn-name {
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  z-index: 2;
}

.action-slot-btn .btn-cost {
  font-size: 0.6rem;
  color: var(--blue-accent);
  font-family: var(--font-mono);
  z-index: 2;
}

.action-slot-btn .cooldown-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  z-index: 5;
}

.action-slot-btn .charge-bar-track {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4;
}

.action-slot-btn .charge-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #e5b95c);
  transition: width 0.05s linear;
}

/* ==========================================================================
   Combat & Event Log
   ========================================================================== */

.combat-log-panel {
  height: 130px;
  min-height: 110px;
  background-color: var(--bg-panel);
  border-top: 2px solid var(--border-color);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.log-entries-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background-color: #08090d;
}

.log-line {
  line-height: 1.4;
  word-break: break-word;
}

.log-time {
  color: #64748b;
  margin-right: 6px;
}

.log-combat {
  color: #f87171;
}

.log-spell {
  color: #67e8f9;
}

.log-loot {
  color: #4ade80;
}

.log-system {
  color: #e2e8f0;
}

.log-warning {
  color: #fbbf24;
}

.log-victory {
  color: #f472b6;
  font-weight: 700;
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(5, 6, 10, 0.88);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

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

/* Title Screen Modal */
.title-screen-modal {
  background: radial-gradient(circle at center, #151824, #08090f);
  border: 2px solid var(--gold-accent);
  box-shadow: 0 0 30px rgba(229, 185, 92, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  padding: 36px 40px;
  width: 520px;
  max-width: 90vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.torch-flicker-container {
  display: flex;
  justify-content: space-between;
  font-size: 28px;
  margin-bottom: -15px;
}

.title-torch {
  animation: flicker 1.8s infinite alternate ease-in-out;
}

.right-torch {
  animation-delay: 0.9s;
}

@keyframes flicker {
  0% { transform: scale(1.0) rotate(-2deg); filter: drop-shadow(0 0 8px #f59e0b); }
  50% { transform: scale(1.15) rotate(3deg); filter: drop-shadow(0 0 16px #ef4444); }
  100% { transform: scale(0.95) rotate(-1deg); filter: drop-shadow(0 0 10px #f59e0b); }
}

.title-emblem {
  font-size: 40px;
  margin-bottom: 6px;
  filter: drop-shadow(0 0 12px var(--gold-accent));
}

.title-main {
  font-family: var(--font-display);
  font-size: 2.8rem;
  letter-spacing: 6px;
  color: var(--gold-accent);
  text-shadow: 0 0 16px var(--gold-glow);
  margin-bottom: 2px;
}

.title-subtitle {
  font-size: 1rem;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.title-tagline {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--blue-accent);
  letter-spacing: 1px;
  margin-top: 4px;
}

.continue-summary-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--blue-accent);
  border-radius: 6px;
  padding: 10px 14px;
  text-align: left;
  font-size: 0.85rem;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.continue-summary-card .save-tag {
  color: var(--blue-accent);
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.continue-summary-card .save-details {
  color: var(--text-primary);
}

.continue-summary-card .save-stats {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

.title-menu-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.title-btn {
  background: linear-gradient(180deg, #1e2438, #101320);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 1.5px;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease;
}

.title-btn:hover {
  background: linear-gradient(180deg, #2e3755, #1a1e32);
  border-color: var(--gold-accent);
  color: var(--gold-accent);
  box-shadow: 0 0 12px var(--gold-glow);
  transform: translateY(-1px);
}

.title-btn.continue-btn {
  border-color: var(--blue-accent);
  color: var(--blue-accent);
}

.title-btn.continue-btn:hover {
  background: linear-gradient(180deg, #0369a1, #0c4a6e);
  color: #fff;
  border-color: #7dd3fc;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.title-btn.new-game-btn {
  border-color: var(--gold-accent);
  color: var(--gold-accent);
}

.title-footer {
  font-size: 0.72rem;
  color: #64748b;
  font-family: var(--font-mono);
  border-top: 1px solid #1e2233;
  padding-top: 12px;
}

/* Character Select Modal (4 Vocations) */
.character-select-modal {
  background: #141722;
  border: 2px solid var(--border-highlight);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(76, 86, 128, 0.3);
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.character-select-modal .modal-header {
  text-align: center;
}

.character-select-modal .modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-accent);
  letter-spacing: 4px;
  margin-bottom: 2px;
}

.character-select-modal .modal-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 2px;
}

.prompt {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-primary);
}

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

.vocation-card {
  background: #0b0d14;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.vocation-card:hover {
  border-color: var(--gold-accent);
  box-shadow: 0 0 15px var(--gold-glow);
}

.vocation-card .card-icon {
  font-size: 32px;
  text-align: center;
}

.vocation-card h3 {
  font-family: var(--font-display);
  color: var(--gold-accent);
  text-align: center;
  font-size: 1.05rem;
}

.stats-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: #151824;
  padding: 6px;
  border-radius: 4px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
}

.stat-label {
  color: var(--text-muted);
}

.stat-val.hp {
  color: var(--hp-red);
  font-weight: 700;
}

.stat-val.mp {
  color: var(--mp-blue);
  font-weight: 700;
}

.vocation-card .desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.select-btn, .action-btn {
  background: linear-gradient(180deg, #2b324d, #171b2b);
  border: 1px solid var(--gold-accent);
  color: var(--gold-accent);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 1px;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: auto;
  transition: all 0.2s;
}

.select-btn:hover, .action-btn:hover {
  background: var(--gold-accent);
  color: #0a0b10;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* ==========================================================================
   Fate Grant Draft Modal (5 Cards)
   ========================================================================== */

.fate-grant-modal {
  background: radial-gradient(circle at center, #181b2a, #0b0d14);
  border: 2px solid var(--gold-accent);
  box-shadow: 0 0 40px rgba(229, 185, 92, 0.4), inset 0 0 20px rgba(0, 0, 0, 0.8);
  border-radius: 10px;
  padding: 24px;
  max-width: 900px;
  width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.fate-grant-modal .modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-accent);
  letter-spacing: 3px;
  text-shadow: 0 0 12px var(--gold-glow);
}

.fate-grant-modal .modal-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.fate-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 10px 0;
}

.fate-card {
  background: #0d101a;
  border: 2px solid #2e344d;
  border-radius: 8px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  min-height: 180px;
}

.fate-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-accent);
  box-shadow: 0 4px 15px rgba(229, 185, 92, 0.3);
}

.fate-card.selected {
  border-color: #38bdf8;
  background: #111a2e;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.6);
  transform: translateY(-6px);
}

.fate-card.rarity-common { border-color: #64748b; }
.fate-card.rarity-rare { border-color: #3b82f6; }
.fate-card.rarity-epic { border-color: #a855f7; }
.fate-card.rarity-legendary { border-color: #f59e0b; }

.fate-card .card-icon {
  font-size: 32px;
  margin-top: 4px;
}

.fate-card .card-title {
  font-family: var(--font-display);
  font-size: 0.82rem;
  color: var(--gold-accent);
  font-weight: 700;
}

.fate-card .card-stat-bonus {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #38bdf8;
  font-weight: 600;
}

.fate-card .card-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.fate-card .card-select-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #1e293b;
  border: 1px solid #475569;
  color: #cbd5e1;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fate-card.selected .card-select-badge {
  background: #38bdf8;
  border-color: #7dd3fc;
  color: #041226;
  font-weight: bold;
}

.fate-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.confirm-draft-btn {
  background: linear-gradient(180deg, #1d4ed8, #1e3a8a);
  border: 1px solid #60a5fa;
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-draft-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.5);
  transform: translateY(-1px);
}

.confirm-draft-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #475569;
}

/* Guide / How to Play Modal */
.guide-modal {
  background: #141724;
  border: 2px solid var(--gold-accent);
  border-radius: 8px;
  padding: 24px;
  max-width: 580px;
  width: 90vw;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 85vh;
  overflow-y: auto;
}

.guide-modal .modal-header {
  text-align: center;
}

.guide-modal .modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-accent);
}

.guide-modal .modal-header .subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.guide-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.guide-section h3 {
  font-family: var(--font-display);
  color: var(--gold-accent);
  font-size: 1rem;
  margin-bottom: 4px;
}

.guide-section p {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  margin-top: 4px;
}

.guide-list code {
  background: #0b0c14;
  border: 1px solid var(--border-color);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--blue-accent);
  font-family: var(--font-mono);
}

/* Result Modals (Victory / Defeat) */
.result-modal {
  background: #141722;
  border: 2px solid var(--gold-accent);
  border-radius: 8px;
  padding: 24px;
  max-width: 480px;
  width: 90vw;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-modal h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold-accent);
}

.defeat-modal {
  border-color: var(--hp-red);
}

.defeat-modal h2 {
  color: var(--hp-red);
}

.result-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.character-summary {
  background: #0b0d14;
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-back-action {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 900px) {
  .main-frame {
    flex-direction: column;
  }

  .sidebar-hud {
    width: 100%;
    max-width: 100%;
    height: 320px;
    border-top: 2px solid var(--border-color);
  }

  .center-stage {
    border-right: none;
    height: 50vh;
  }

  .combat-log-panel {
    height: 90px;
    min-height: 80px;
  }

  .touch-controls {
    display: grid;
  }

  .vocation-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .fate-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
