/* ===================================================
   Chronicles of Eldoria: Dark Fantasy Premium Styling
   Gothic Ornate Aesthetics, Mobile-First Ergonomics
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #080c14;
  --bg-card: rgba(18, 24, 38, 0.88);
  --bg-card-hover: rgba(26, 35, 54, 0.95);
  --border-gold: #d4af37;
  --border-gold-glow: rgba(212, 175, 55, 0.35);
  --gold-accent: #f59e0b;
  --gold-light: #fde047;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --crimson-hp: #ef4444;
  --emerald-st: #10b981;
  --mana-blue: #3b82f6;
  --radius-lg: 12px;
  --radius-md: 8px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* --- COMPACT TOP HUD BAR --- */
.game-hud {
  display: flex;
  flex-direction: column;
  padding: 6px 14px;
  background: linear-gradient(180deg, #101726 0%, rgba(13, 19, 32, 0.96) 100%);
  border-bottom: 2px solid var(--border-gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
  z-index: 100;
  gap: 5px;
  flex-shrink: 0;
}

.hud-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.hud-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.hud-badge-icon {
  font-size: 22px;
  filter: drop-shadow(0 2px 5px rgba(245, 158, 11, 0.6));
}

.hud-profile-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.hud-hero-name {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--gold-light);
  letter-spacing: 0.4px;
}

.hud-rank-name {
  font-size: 11px;
  color: var(--text-muted);
}

.hud-economy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gold-counter {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  color: #fbbf24;
  text-shadow: 0 1px 6px rgba(251, 191, 36, 0.5);
}

.hud-controls {
  display: flex;
  gap: 6px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 6px;
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-xs:active {
  background: #334155;
  transform: scale(0.95);
}

/* --- HUD BARS ROW --- */
.hud-bars-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

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

.bar-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.bar-title {
  color: var(--text-muted);
}

.bar-track {
  height: 9px;
  background: #0f172a;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.8);
}

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

.hp-fill {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.stamina-fill {
  background: linear-gradient(90deg, #059669, #10b981);
}

.xp-fill {
  background: linear-gradient(90deg, #7c3aed, #a855f7);
}

/* --- BUTTON STYLES --- */
button {
  cursor: pointer;
  border: none;
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease;
}

.gold-btn {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  color: #fffbeb;
  font-weight: 600;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.gold-btn:hover, .gold-btn:active {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}

.action-btn {
  background: #1e293b;
  color: #e2e8f0;
  font-weight: 600;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 9px 16px;
}

.purple-btn {
  background: linear-gradient(180deg, #6d28d9 0%, #4c1d95 100%);
  border-color: #c084fc;
}

.red-btn {
  background: linear-gradient(180deg, #b91c1c 0%, #7f1d1d 100%);
  border-color: #f87171;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.pulse-btn {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.btn-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* --- SCREENS --- */
.screen-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* --- TOWN SCREEN --- */
#town-screen {
  flex: 1;
  background: linear-gradient(rgba(8, 12, 20, 0.72), rgba(8, 12, 20, 0.88)), url('../assets/images/town_square.jpg') center/cover no-repeat;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.town-banner-header {
  text-align: center;
  margin-bottom: 16px;
}

.town-main-title {
  font-family: 'Cinzel', serif;
  font-size: 26px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 2px;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.9);
}

.town-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  margin-top: 2px;
}

.town-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  max-width: 1000px;
  margin: 0 auto;
}

.town-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.town-card:active {
  transform: scale(0.98);
}

.highlight-card {
  border: 1.5px solid var(--border-gold);
  background: linear-gradient(135deg, rgba(24, 30, 48, 0.95) 0%, rgba(45, 32, 16, 0.9) 100%);
}

.card-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.card-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 17px;
  color: #fef08a;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}

.card-badge {
  align-self: flex-start;
  margin-top: 12px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.pulse-badge {
  background: #b45309;
  color: #fef3c7;
}

/* --- PANEL VIEWS --- */
.panel-view {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(13, 19, 32, 0.96);
  backdrop-filter: blur(16px);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.panel-header h2 {
  font-family: 'Cinzel', serif;
  color: #fde047;
  font-size: 20px;
}

.back-btn {
  background: #1e293b;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
}

.npc-dialogue-box {
  display: flex;
  gap: 12px;
  background: rgba(30, 41, 59, 0.6);
  border-left: 4px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 18px;
}

.npc-avatar {
  font-size: 34px;
}

.npc-text {
  flex: 1;
}

.npc-text strong {
  color: #fef08a;
  font-family: 'Cinzel', serif;
  font-size: 14.5px;
}

.npc-text p {
  margin: 4px 0 10px 0;
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.45;
  font-style: italic;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  color: #fbbf24;
  margin: 16px 0 12px 0;
}

.section-lead {
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 16px;
  line-height: 1.45;
}

/* --- QUESTS & SHOP --- */
.quests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quest-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(22, 30, 48, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.quest-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.quest-title-row h4 {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  color: #fef08a;
}

.quest-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 12px;
  font-weight: 600;
}

.quest-badge.available { background: #065f46; color: #a7f3d0; }
.quest-badge.in-progress { background: #1e3a8a; color: #bfdbfe; }
.quest-badge.ready { background: #b45309; color: #fef3c7; }
.quest-badge.completed { background: #374151; color: #9ca3af; }
.quest-badge.locked { background: #3f3f46; color: #a1a1aa; }

.quest-desc {
  font-size: 12.5px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.quest-reward {
  font-size: 12px;
  color: #fbbf24;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.shop-item-card {
  background: rgba(22, 30, 48, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shop-item-card.rarity-legendary { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.35); }
.shop-item-card.rarity-epic { border-color: #a855f7; }
.shop-item-card.rarity-rare { border-color: #3b82f6; }

.item-icon-box { font-size: 26px; }
.item-header-row { display: flex; justify-content: space-between; font-weight: 700; font-size: 13.5px; }
.item-name { color: #f1f5f9; }
.item-price { color: #fbbf24; }
.item-stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; }
.stat-atk { color: #ef4444; }
.stat-def { color: #3b82f6; }
.stat-hp { color: #10b981; }
.stat-heal { color: #34d399; }
.item-desc { font-size: 11.5px; color: #94a3b8; flex: 1; }

/* --- RANKS LADDER & SAVE SLOTS --- */
.ranks-ladder { display: flex; flex-direction: column; gap: 10px; }
.rank-card {
  display: flex; gap: 12px; background: rgba(22, 30, 48, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: var(--radius-md);
  padding: 12px; align-items: center;
}
.rank-card.rank-active {
  border-color: var(--border-gold); background: rgba(45, 34, 18, 0.85);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.35);
}
.rank-badge-icon { font-size: 28px; }
.rank-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.rank-title-row h4 { font-family: 'Cinzel', serif; font-size: 15px; color: #fde047; }
.rank-desc { font-size: 12px; color: #94a3b8; margin-bottom: 4px; }
.rank-bonuses { font-size: 11.5px; color: #cbd5e1; }
.rank-status.current { color: #fbbf24; font-weight: 700; font-size: 11.5px; }
.rank-status.passed { color: #10b981; font-size: 11.5px; }
.rank-status.req { color: #94a3b8; font-size: 11.5px; }

.save-slots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.save-slot-card {
  background: rgba(22, 30, 48, 0.7); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md); padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.slot-occupied { border-color: rgba(212, 175, 55, 0.4); }
.slot-header { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: #fde047; }
.slot-date { font-size: 10.5px; color: #94a3b8; font-weight: normal; }
.slot-rank { font-weight: 600; color: #e2e8f0; font-size: 12.5px; }
.slot-stat { font-size: 11.5px; color: #cbd5e1; }
.slot-note { font-size: 11px; color: #94a3b8; font-style: italic; }
.empty-text { font-size: 12px; color: #64748b; padding: 10px 0; }
.slot-actions { display: flex; gap: 6px; margin-top: 4px; }

/* --- DUNGEONS LIST --- */
.dungeons-list { display: flex; flex-direction: column; gap: 12px; }
.dungeon-card {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(22, 30, 48, 0.85); border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-md); padding: 16px; gap: 12px; flex-wrap: wrap;
}
.dungeon-header-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.dungeon-header-row h3 { font-family: 'Cinzel', serif; font-size: 16.5px; color: #fef08a; }
.dungeon-diff { font-size: 11px; padding: 2px 7px; border-radius: 10px; }
.diff-ok { background: #065f46; color: #a7f3d0; }
.diff-warn { background: #7f1d1d; color: #fecaca; }
.dungeon-desc { font-size: 12.5px; color: #94a3b8; margin-bottom: 8px; }
.dungeon-features { display: flex; gap: 10px; font-size: 11.5px; color: #cbd5e1; flex-wrap: wrap; }
.maiden-highlight { color: #f43f5e; font-weight: 700; }
.boss-highlight { color: #fbbf24; font-weight: 700; }

/* --- DUNGEON SCREEN & CANVAS --- */
#dungeon-screen {
  flex: 1;
  position: relative;
  background: #0a0e17;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}

#dungeon-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* ===================================================
   ENHANCED MOBILE TOUCH CONTROLS (JOYSTICK & DIAMOND)
   =================================================== */
.touch-controls-layer {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 10px) + 14px);
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 50;
  touch-action: none;
}

/* --- Virtual Analog Joystick --- */
.joystick-wrapper {
  pointer-events: auto;
  touch-action: none;
}

.joystick-base {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 2px solid rgba(212, 175, 55, 0.5);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), inset 0 2px 6px rgba(255, 255, 255, 0.1);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  backdrop-filter: blur(4px);
}

.joystick-handle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d97706, #78350f);
  border: 2px solid #fde047;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.7);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
  pointer-events: none;
  transition: transform 0.05s ease-out;
}

.joy-dir {
  position: absolute;
  font-size: 11px;
  color: rgba(253, 224, 71, 0.5);
  pointer-events: none;
}
.joy-u { top: 5px; left: 50%; transform: translateX(-50%); }
.joy-d { bottom: 5px; left: 50%; transform: translateX(-50%); }
.joy-l { left: 6px; top: 50%; transform: translateY(-50%); }
.joy-r { right: 6px; top: 50%; transform: translateY(-50%); }

/* --- Action Button Cluster --- */
.touch-action-cluster {
  position: relative;
  width: 150px;
  height: 140px;
  pointer-events: auto;
  touch-action: none;
}

.touch-main-btn {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f59e0b, #b45309);
  border: 2.5px solid #fef08a;
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7), inset 0 2px 3px rgba(255, 255, 255, 0.4);
  touch-action: none;
}

.touch-main-btn:active {
  transform: scale(0.92);
  background: radial-gradient(circle at 35% 35%, #fbbf24, #d97706);
}

.touch-sub-btn {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.88);
  border: 2px solid var(--border-gold);
  color: #fff;
  font-size: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  touch-action: none;
}

.touch-sub-btn:active {
  transform: scale(0.92);
  background: rgba(51, 65, 85, 0.95);
}

/* Ergonomic arc positioning */
.touch-btn-roll {
  left: 20px;
  bottom: 12px;
}

.touch-btn-interact {
  right: 8px;
  top: 10px;
}

.touch-btn-potion {
  left: 26px;
  top: 18px;
}

.potion-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fff;
}

/* --- MODALS & DIALOGUES --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 14px;
  touch-action: manipulation;
}

.modal-box {
  background: rgba(15, 23, 42, 0.98);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9);
  text-align: center;
}

.modal-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.5px;
}

.modal-title {
  font-family: 'Cinzel', serif;
  color: #fbbf24;
  font-size: 18px;
  margin: 6px 0 10px 0;
}

.modal-text {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.45;
  margin-bottom: 14px;
}

.modal-highlight {
  font-weight: 600;
  color: #fef08a;
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.stacked-buttons {
  flex-direction: column;
}

/* --- RESCUE CUTSCENE MODAL --- */
.rescue-modal-box {
  max-width: 580px;
}

.rescue-art-container {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
  border: 1.5px solid var(--border-gold);
}

.rescue-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rescue-title {
  font-family: 'Cinzel', serif;
  color: #f43f5e;
  font-size: 20px;
  margin-bottom: 8px;
}

.dialogue-speech {
  background: rgba(30, 41, 59, 0.5);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.45;
  font-style: italic;
  margin-bottom: 12px;
  text-align: left;
}

.rescue-rewards {
  font-size: 13px;
  color: #fbbf24;
  margin-bottom: 16px;
}

/* --- TRAP & PUZZLE MODAL --- */
.puzzle-wrapper {
  background: rgba(15, 23, 42, 0.98);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 20px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9);
  text-align: center;
}

.puzzle-header {
  margin-bottom: 14px;
}

.puzzle-badge {
  font-size: 11px;
  font-weight: 700;
  color: #ef4444;
  letter-spacing: 0.5px;
}

.puzzle-title {
  font-family: 'Cinzel', serif;
  color: #fbbf24;
  font-size: 20px;
  margin: 3px 0 6px 0;
}

.puzzle-desc {
  font-size: 12.5px;
  color: #94a3b8;
  line-height: 1.35;
}

.puzzle-target-runes {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fef08a;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.target-symbol {
  font-size: 22px;
  color: #06b6d4;
  text-shadow: 0 0 10px rgba(6, 182, 212, 0.7);
}

.rune-dials-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.dial {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dial-label {
  font-size: 12px;
  color: #cbd5e1;
}

.current-rune {
  font-size: 26px;
  color: #fbbf24;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.dial-controls {
  display: flex;
  gap: 6px;
}

.tumblers-stage {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}

.tumbler-pin-box {
  width: 60px;
  height: 95px;
  background: #1e293b;
  border: 2px solid #64748b;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tumbler-pin-box:active {
  border-color: #fbbf24;
}

.pin-success {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.2);
}

.pin-shake {
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.pin-head {
  font-weight: 700;
  color: #fde047;
  font-size: 13px;
}

.pin-status {
  font-size: 9.5px;
  color: #94a3b8;
}

.memory-stage {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.memory-tile {
  background: #1e293b;
  border: 2px solid #475569;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.tile-active {
  background: #f59e0b;
  border-color: #fde047;
  transform: scale(1.04);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.8);
}

.mem-icon { font-size: 26px; }
.mem-name { font-size: 12px; font-weight: 600; }

.puzzle-timer {
  font-size: 13px;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 10px;
}

.timer-warning {
  color: #ef4444;
  animation: pulse-glow 0.8s infinite;
}

.puzzle-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- BANNER TOAST --- */
.game-banner {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 300;
  text-align: center;
  max-width: 90%;
}

.game-banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.banner-gold {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  border: 1px solid #fbbf24;
  color: #fef3c7;
}

.banner-red {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%);
  border: 1px solid #f87171;
  color: #fee2e2;
}

/* --- MOBILE SPECIFIC OVERRIDES --- */
@media (max-width: 600px) {
  .game-hud {
    padding: 6px 10px;
  }

  .town-main-title {
    font-size: 22px;
  }

  .town-hub-grid {
    grid-template-columns: 1fr;
  }

  .shop-grid {
    grid-template-columns: 1fr;
  }

  .touch-controls-layer {
    bottom: calc(env(safe-area-inset-bottom, 8px) + 12px);
    left: 10px;
    right: 10px;
  }
}
