/* ==========================================================
   HARRY'S ARK: THE GREAT DELUGE - MAIN STYLESHEET
   Design Theme: Nautical Brass, Weathered Timber, Storm Ocean
   ========================================================== */

:root {
  --bg-dark: #070b14;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --bg-panel: rgba(15, 23, 42, 0.85);

  --wood-dark: #2a1506;
  --wood-mid: #4a2810;
  --wood-light: #7c4a1e;
  --wood-border: #925327;

  --brass: #eab308;
  --brass-light: #fde047;
  --brass-glow: rgba(234, 179, 8, 0.35);

  --sea-blue: #0284c7;
  --sea-light: #38bdf8;
  --sea-deep: #031e3d;

  --danger-red: #ef4444;
  --warning-amber: #f59e0b;
  --success-emerald: #10b981;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-gold: #fde68a;

  --font-serif: 'Cinzel', 'Georgia', serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-glow: 0 0 20px rgba(234, 179, 8, 0.15);
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(2, 132, 199, 0.12) 0%, transparent 60%),
    radial-gradient(circle at 10% 80%, rgba(124, 74, 30, 0.08) 0%, transparent 50%);
}

/* Rain Canvas Ambient Background */
#ambient-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

#app {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 32px 16px;
}

/* ==========================================================
   TOP BAR & HUD
   ========================================================== */
.top-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin: 12px 0 16px 0;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(234, 179, 8, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px rgba(234, 179, 8, 0.5));
}

.brand-titles h1 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  letter-spacing: 1px;
  color: var(--brass-light);
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.region-badge {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--sea-light);
}

/* Status Meters */
.status-meters {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.meter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}

.meter-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.meter-track {
  width: 100%;
  height: 9px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.meter-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

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

.meter-fill.flood {
  background: linear-gradient(90deg, #38bdf8, #ef4444);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Icon Buttons */
.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(234, 179, 8, 0.15);
  border-color: var(--brass);
  color: var(--brass-light);
  box-shadow: 0 0 10px var(--brass-glow);
}

/* Primary Game Buttons */
.btn-primary {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: #fff;
  border: 1px solid #fde047;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.4);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.6);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

/* ==========================================================
   RESOURCE STRIP
   ========================================================== */
.resource-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 16px;
  margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.res-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.res-item .val {
  font-weight: 700;
  color: var(--brass-light);
}

/* ==========================================================
   NAVIGATION TABS
   ========================================================== */
.nav-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  color: var(--brass-light);
  background: rgba(234, 179, 8, 0.12);
  font-weight: 600;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -11px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brass);
  border-radius: 99px;
  box-shadow: 0 0 10px var(--brass);
}

.tab-badge {
  background: var(--danger-red);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 99px;
  font-family: var(--font-sans);
}

/* Main View Container */
.view-container {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.view-container.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================
   MODALS
   ========================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-window {
  background: #0f172a;
  border: 1px solid var(--brass);
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), var(--shadow-glow);
  overflow: hidden;
}

#modal-stall .modal-window {
  max-width: 460px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  font-family: var(--font-serif);
  color: var(--brass-light);
  font-size: 1.25rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--brass);
  color: var(--text-main);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 0.9rem;
  max-width: 360px;
  animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
