/*
 * The Magdalenian Cave Art Experience - Stylesheet
 * Copyright (c) 2025 Marco Birkedahl Jørgensen
 * Licensed under CC BY-NC-ND 4.0
 * https://creativecommons.org/licenses/by-nc-nd/4.0/
 * 
 * Educational and non-commercial use only.
 * All commercial rights reserved.
 */

:root {
  /* Primitive Color Tokens */
  --color-white: rgba(255, 255, 255, 1);
  --color-black: rgba(0, 0, 0, 1);
  --color-cream-50: rgba(252, 252, 249, 1);
  --color-cream-100: rgba(255, 255, 253, 1);
  --color-gray-200: rgba(245, 245, 245, 1);
  --color-gray-300: rgba(167, 169, 169, 1);
  --color-gray-400: rgba(119, 124, 124, 1);
  --color-slate-500: rgba(98, 108, 113, 1);
  --color-brown-600: rgba(94, 82, 64, 1);
  --color-charcoal-700: rgba(31, 33, 33, 1);
  --color-charcoal-800: rgba(38, 40, 40, 1);
  --color-slate-900: rgba(19, 52, 59, 1);
  --color-teal-300: rgba(50, 184, 198, 1);
  --color-teal-400: rgba(45, 166, 178, 1);
  --color-teal-500: rgba(33, 128, 141, 1);
  --color-teal-600: rgba(29, 116, 128, 1);
  --color-teal-700: rgba(26, 104, 115, 1);
  --color-teal-800: rgba(41, 150, 161, 1);
  --color-red-400: rgba(255, 84, 89, 1);
  --color-red-500: rgba(192, 21, 47, 1);
  --color-orange-400: rgba(230, 129, 97, 1);
  --color-orange-500: rgba(168, 75, 47, 1);

  /* RGB versions for opacity control */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;
  --color-slate-500-rgb: 98, 108, 113;
  --color-red-500-rgb: 192, 21, 47;
  --color-red-400-rgb: 255, 84, 89;
  --color-orange-500-rgb: 168, 75, 47;
  --color-orange-400-rgb: 230, 129, 97;

  /* Background color tokens (Light Mode) */
  --color-bg-1: rgba(59, 130, 246, 0.08); /* Light blue */
  --color-bg-2: rgba(245, 158, 11, 0.08); /* Light yellow */
  --color-bg-3: rgba(34, 197, 94, 0.08); /* Light green */
  --color-bg-4: rgba(239, 68, 68, 0.08); /* Light red */
  --color-bg-5: rgba(147, 51, 234, 0.08); /* Light purple */
  --color-bg-6: rgba(249, 115, 22, 0.08); /* Light orange */
  --color-bg-7: rgba(236, 72, 153, 0.08); /* Light pink */
  --color-bg-8: rgba(6, 182, 212, 0.08); /* Light cyan */

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
  --color-select-caret: rgba(var(--color-slate-900-rgb), 0.8);

  /* Common style patterns */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for opacity control */
  --color-success-rgb: 33, 128, 141;
  --color-error-rgb: 192, 21, 47;
  --color-warning-rgb: 168, 75, 47;
  --color-info-rgb: 98, 108, 113;

  /* Typography */
  --font-family-base: "FKGroteskNeue", "Geist", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 550;
  --font-weight-bold: 600;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.01em;

  /* Spacing */
  --space-0: 0;
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-base: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
    0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
  :root {
    /* RGB versions for opacity control (Dark Mode) */
    --color-gray-400-rgb: 119, 124, 124;
    --color-teal-300-rgb: 50, 184, 198;
    --color-gray-300-rgb: 167, 169, 169;
    --color-gray-200-rgb: 245, 245, 245;

    /* Background color tokens (Dark Mode) */
    --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
    --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
    --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
    --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
    --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
    --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
    --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
    --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

    /* Semantic Color Tokens (Dark Mode) */
    --color-background: var(--color-charcoal-700);
    --color-surface: var(--color-charcoal-800);
    --color-text: var(--color-gray-200);
    --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
    --color-primary: var(--color-teal-300);
    --color-primary-hover: var(--color-teal-400);
    --color-primary-active: var(--color-teal-800);
    --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
    --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
    --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
    --color-border: rgba(var(--color-gray-400-rgb), 0.3);
    --color-error: var(--color-red-400);
    --color-success: var(--color-teal-300);
    --color-warning: var(--color-orange-400);
    --color-info: var(--color-gray-300);
    --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
    --color-btn-primary-text: var(--color-slate-900);
    --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
    --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
    --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    --button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

    /* Common style patterns - updated for dark mode */
    --focus-ring: 0 0 0 3px var(--color-focus-ring);
    --focus-outline: 2px solid var(--color-primary);
    --status-bg-opacity: 0.15;
    --status-border-opacity: 0.25;
    --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    /* RGB versions for dark mode */
    --color-success-rgb: var(--color-teal-300-rgb);
    --color-error-rgb: var(--color-red-400-rgb);
    --color-warning-rgb: var(--color-orange-400-rgb);
    --color-info-rgb: var(--color-gray-300-rgb);
  }
}

/* Data attribute for manual theme switching */
[data-color-scheme="dark"] {
  /* RGB versions for opacity control (dark mode) */
  --color-gray-400-rgb: 119, 124, 124;
  --color-teal-300-rgb: 50, 184, 198;
  --color-gray-300-rgb: 167, 169, 169;
  --color-gray-200-rgb: 245, 245, 245;

  /* Colorful background palette - Dark Mode */
  --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
  --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
  --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
  --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
  --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
  --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
  --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
  --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

  /* Semantic Color Tokens (Dark Mode) */
  --color-background: var(--color-charcoal-700);
  --color-surface: var(--color-charcoal-800);
  --color-text: var(--color-gray-200);
  --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
  --color-primary: var(--color-teal-300);
  --color-primary-hover: var(--color-teal-400);
  --color-primary-active: var(--color-teal-800);
  --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
  --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
  --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-error: var(--color-red-400);
  --color-success: var(--color-teal-300);
  --color-warning: var(--color-orange-400);
  --color-info: var(--color-gray-300);
  --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
  --color-btn-primary-text: var(--color-slate-900);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.15);
  --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

  /* Common style patterns - updated for dark mode */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for dark mode */
  --color-success-rgb: var(--color-teal-300-rgb);
  --color-error-rgb: var(--color-red-400-rgb);
  --color-warning-rgb: var(--color-orange-400-rgb);
  --color-info-rgb: var(--color-gray-300-rgb);
}

[data-color-scheme="light"] {
  /* RGB versions for opacity control (light mode) */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);

  /* RGB versions for light mode */
  --color-success-rgb: var(--color-teal-500-rgb);
  --color-error-rgb: var(--color-red-500-rgb);
  --color-warning-rgb: var(--color-orange-500-rgb);
  --color-info-rgb: var(--color-slate-500-rgb);
}

/* Base styles */
html {
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-4xl);
}
h2 {
  font-size: var(--font-size-3xl);
}
h3 {
  font-size: var(--font-size-2xl);
}
h4 {
  font-size: var(--font-size-xl);
}
h5 {
  font-size: var(--font-size-lg);
}
h6 {
  font-size: var(--font-size-md);
}

p {
  margin: 0 0 var(--space-16) 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--color-primary-hover);
}

code,
pre {
  font-family: var(--font-family-mono);
  font-size: calc(var(--font-size-base) * 0.95);
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-4);
}

pre {
  padding: var(--space-16);
  margin: var(--space-16) 0;
  overflow: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  border: none;
  text-decoration: none;
  position: relative;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--primary:active {
  background: var(--color-primary-active);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}

.btn--secondary:hover {
  background: var(--color-secondary-hover);
}

.btn--secondary:active {
  background: var(--color-secondary-active);
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn--outline:hover {
  background: var(--color-secondary);
}

.btn--sm {
  padding: var(--space-4) var(--space-12);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-10) var(--space-20);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn--full-width {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form elements */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

textarea.form-control {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
}

select.form-control {
  padding: var(--space-8) var(--space-12);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-caret-light);
  background-repeat: no-repeat;
  background-position: right var(--space-12) center;
  background-size: 16px;
  padding-right: var(--space-32);
}

/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
  select.form-control {
    background-image: var(--select-caret-dark);
  }
}

/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
  background-image: var(--select-caret-dark);
}

[data-color-scheme="light"] select.form-control {
  background-image: var(--select-caret-light);
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: var(--focus-outline);
}

.form-label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--space-16);
}

/* Card component */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__body {
  padding: var(--space-16);
}

.card__header,
.card__footer {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

/* Status indicators - simplified with CSS variables */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.status--success {
  background-color: rgba(
    var(--color-success-rgb, 33, 128, 141),
    var(--status-bg-opacity)
  );
  color: var(--color-success);
  border: 1px solid
    rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}

.status--error {
  background-color: rgba(
    var(--color-error-rgb, 192, 21, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-error);
  border: 1px solid
    rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}

.status--warning {
  background-color: rgba(
    var(--color-warning-rgb, 168, 75, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-warning);
  border: 1px solid
    rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}

.status--info {
  background-color: rgba(
    var(--color-info-rgb, 98, 108, 113),
    var(--status-bg-opacity)
  );
  color: var(--color-info);
  border: 1px solid
    rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}

/* Container layout */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-16);
  padding-left: var(--space-16);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
  }
}
@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Utility classes */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-4 {
  gap: var(--space-4);
}
.gap-8 {
  gap: var(--space-8);
}
.gap-16 {
  gap: var(--space-16);
}

.m-0 {
  margin: 0;
}
.mt-8 {
  margin-top: var(--space-8);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mx-8 {
  margin-left: var(--space-8);
  margin-right: var(--space-8);
}
.my-8 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.p-0 {
  padding: 0;
}
.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}
.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}
.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}
.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

.block {
  display: block;
}
.hidden {
  display: none;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
  border: 1px solid var(--color-border-secondary);
}

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2')
    format('woff2');
}

/* END PERPLEXITY DESIGN SYSTEM */
/* ========================================
   MAGDALENIAN CAVE ART EXPERIENCE - STYLES
   Highly Visual & Atmospheric Design
   ======================================== */

:root {
  /* Color Palette - Earthy & Warm */
  --ochre-red: #8B4513;
  --ochre-yellow: #DAA520;
  --ochre-orange: #CD853F;
  --charcoal-black: #1C1C1C;
  --cave-dark: #0a0806;
  --stone-gray: #8B8680;
  --limestone: #F5DEB3;
  --earth-brown: #5C4033;
  --fire-orange: #FF6B35;
  --fire-yellow: #FDB813;
  --sky-blue: #87CEEB;
  --grass-green: #6B8E23;
  
  /* Fonts */
  --font-title: 'Cinzel', serif;
  --font-body: 'Merriweather', serif;
  
  /* Effects */
  --glow-primary: 0 0 20px rgba(218, 165, 32, 0.6);
  --glow-fire: 0 0 30px rgba(255, 140, 0, 0.8);
  --shadow-deep: 0 10px 40px rgba(0, 0, 0, 0.8);
}

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

body {
  font-family: var(--font-body);
  background: var(--cave-dark);
  color: var(--limestone);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* ========================================
   TITLE SCREEN - Fade In Animation
   ======================================== */

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.screen.active {
  opacity: 1;
  visibility: visible;
}

#title-screen {
  background: radial-gradient(ellipse at center, #2C1810 0%, #0a0806 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.title-content {
  text-align: center;
  z-index: 10;
  animation: fadeInUp 1.5s ease-out;
}

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

.cave-art-logo {
  margin-bottom: 2rem;
  animation: drawPath 3s ease-in-out;
}

.logo-svg {
  width: 200px;
  height: 100px;
}

.aurochs-outline {
  fill: none;
  stroke: var(--ochre-red);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 400;
  stroke-dashoffset: 400;
  animation: drawStroke 3s ease-out forwards;
}

@keyframes drawStroke {
  to {
    stroke-dashoffset: 0;
  }
}

.dot, .horn {
  fill: var(--ochre-red);
  opacity: 0;
  animation: fadeIn 0.5s ease 2s forwards;
}

.horn {
  fill: none;
  stroke: var(--ochre-red);
  stroke-width: 2;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

.main-title {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--ochre-yellow);
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: 3px;
}

.subtitle {
  font-size: 1.2rem;
  color: var(--limestone);
  margin-bottom: 3rem;
  font-style: italic;
  line-height: 1.6;
}

.btn-primary {
  padding: 1.2rem 3rem;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-title);
  background: linear-gradient(135deg, var(--ochre-red) 0%, var(--ochre-orange) 100%);
  color: var(--limestone);
  border: 3px solid var(--ochre-yellow);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-deep);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.btn-primary:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 50px rgba(218, 165, 32, 0.6);
}

.glow-pulse {
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(218, 165, 32, 0.8);
  }
}

.title-info {
  margin-top: 3rem;
  font-size: 0.9rem;
  opacity: 0.7;
}

.copyright-notice {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  opacity: 0.6;
  line-height: 1.6;
}

.creator-link {
  color: var(--accent-gold);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  border-bottom: 1px solid transparent;
}

.creator-link:hover {
  opacity: 1;
  color: #f4c542;
  border-bottom-color: var(--accent-gold);
}

.creator-link:focus {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Floating Particles */
.floating-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

/* ========================================
   NAVIGATION BAR
   ======================================== */

#top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(180deg, rgba(26, 20, 16, 0.98) 0%, rgba(26, 20, 16, 0.85) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
  border-bottom: 2px solid var(--ochre-yellow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.nav-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--ochre-yellow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-logo-link:hover {
  transform: scale(1.1);
  opacity: 0.9;
}

.nav-logo-link:focus {
  outline: 2px solid var(--ochre-yellow);
  outline-offset: 4px;
  border-radius: 4px;
}

.nav-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--ochre-yellow);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

.nav-logo-link:hover .nav-logo-icon {
  border-color: var(--fire-yellow);
  box-shadow: 0 4px 12px rgba(218, 165, 32, 0.6);
}

.period-icon {
  font-size: 1.5rem;
}

.nav-buttons {
  display: flex;
  gap: 1rem;
}

.nav-btn {
  padding: 0.8rem 1.5rem;
  background: rgba(94, 82, 64, 0.6);
  border: 2px solid var(--stone-gray);
  border-radius: 10px;
  color: var(--limestone);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  min-width: 100px;
}

.nav-btn:hover {
  background: rgba(94, 82, 64, 0.9);
  border-color: var(--ochre-yellow);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(218, 165, 32, 0.4);
}

.nav-btn.active {
  background: var(--ochre-red);
  border-color: var(--ochre-yellow);
  border-width: 3px;
  box-shadow: var(--glow-primary);
}

.nav-icon {
  font-size: 1.8rem;
}

.nav-label {
  font-size: 0.85rem;
}

.nav-actions {
  display: flex;
  gap: 0.8rem;
}

.icon-btn {
  width: 50px;
  height: 50px;
  background: rgba(94, 82, 64, 0.6);
  border: 2px solid var(--stone-gray);
  border-radius: 50%;
  font-size: 1.5rem;
  color: var(--limestone);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Experience display (nav) */
.xp-display {
  /* Keep rectangular shape but adopt the shared icon visuals */
  min-width: 86px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
  /* Use same base background and border as .icon-btn so it visually matches */
  background: rgba(94, 82, 64, 0.6);
  border: 2px solid var(--stone-gray);
  color: var(--limestone);
  font-size: 0.95rem;
  border-radius: 12px; /* rectangular with rounded corners */
}

.xp-display #xp-count {
  font-weight: 800;
  color: var(--limestone);
}

.icon-btn:hover {
  background: rgba(94, 82, 64, 0.9);
  border-color: var(--ochre-yellow);
  transform: scale(1.1);
}

/* ========================================
   INVENTORY & TOOLS PANELS
   ======================================== */

#inventory-panel, #tools-panel {
  display: none; /* Hidden - now using modal */
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: rgba(26, 20, 16, 0.95);
  border: 3px solid var(--ochre-yellow);
  border-radius: 12px;
  padding: 1rem;
  min-width: 300px;
  max-width: 400px;
  z-index: 90;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-deep);
}

#tools-panel {
  left: auto;
  right: 20px;
  border-color: var(--ochre-red);
}

#inventory-panel h3, #tools-panel h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: var(--ochre-yellow);
  margin-bottom: 0.8rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#tools-panel h3 {
  color: var(--ochre-red);
}

#inventory-grid, #tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 0.6rem;
}

.inventory-item, .tool-item {
  position: relative;
  aspect-ratio: 1;
  background: rgba(60, 50, 40, 0.8);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.3rem;
}

.inventory-item:hover, .tool-item:hover {
  border-color: var(--ochre-yellow);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.6);
  z-index: 10;
}

.item-icon {
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

.item-count {
  position: absolute;
  bottom: 3px;
  right: 3px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.item-name {
  font-size: 0.65rem;
  text-align: center;
  color: var(--limestone);
  line-height: 1.1;
}

/* ========================================
   SCENE CONTAINER
   ======================================== */

#scene-container {
  position: absolute;
  top: 80px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

.scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.scene.active {
  opacity: 1;
  visibility: visible;
}

.scene-title-overlay {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 100; /* Higher z-index to stay on top */
  background: rgba(0, 0, 0, 0.85);
  padding: 1.5rem 2rem;
  border-radius: 16px;
  border: 3px solid var(--ochre-yellow);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  max-width: 500px;
  box-shadow: var(--shadow-deep);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scene-title-overlay:hover {
  opacity: 0.95;
  transform: translateX(-50%) translateY(-2px);
}

.scene-title-overlay h2 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--ochre-yellow);
  margin-bottom: 0.8rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.scene-title-overlay p {
  font-size: 1rem;
  color: var(--limestone);
}

.info-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  background: rgba(139, 69, 19, 0.8);
  border: 2px solid var(--ochre-yellow);
  border-radius: 50%;
  color: var(--limestone);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
  z-index: 10;
}

.info-close-btn:hover {
  background: var(--ochre-red);
  transform: rotate(90deg) scale(1.1);
}

/* ========================================
   LANDSCAPE SCENE - Parallax Layers
   ======================================== */

#landscape-scene {
  background: linear-gradient(180deg, #87CEEB 0%, #B0D4E3 40%, #D4C5A9 70%, #8B7355 100%);
  transition: background 10s ease-in-out;
}

#landscape-scene.night-mode {
  background: linear-gradient(180deg, #0B1026 0%, #1A1A3E 40%, #2C3E50 70%, #2A1A0A 100%);
}

#landscape-scene.rainy-mode {
  background: linear-gradient(180deg, #6B7A8F 0%, #8B9AAF 40%, #A4B3C8 70%, #8B7355 100%);
}

.parallax-layer {
  position: absolute;
  width: 100%;
  height: 100%;
}

/* Sky Layer */
.sky-layer {
  background: linear-gradient(180deg, #4A90E2 0%, #87CEEB 50%, #B0D4E3 100%);
  z-index: 1;
  transition: background 10s ease-in-out;
}

.sun {
  position: absolute;
  top: 80px;
  right: 120px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #FDB813 0%, #FF8C00 70%);
  border-radius: 50%;
  box-shadow: 0 0 60px rgba(253, 184, 19, 0.8);
  animation: sunGlow 4s ease-in-out infinite;
  transition: opacity 8s ease-in-out;
}

@keyframes sunGlow {
  0%, 100% { box-shadow: 0 0 60px rgba(253, 184, 19, 0.6); }
  50% { box-shadow: 0 0 100px rgba(253, 184, 19, 1); }
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 100px;
  animation: cloudFloat 60s linear infinite;
  transition: background 8s ease-in-out;
}

.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 100px;
  transition: background 8s ease-in-out;
}

.cloud-1 {
  width: 100px;
  height: 40px;
  top: 100px;
  left: -100px;
}

.cloud-1::before {
  width: 50px;
  height: 50px;
  top: -20px;
  left: 10px;
}

.cloud-1::after {
  width: 60px;
  height: 40px;
  top: -15px;
  right: 10px;
}

.cloud-2 {
  width: 120px;
  height: 50px;
  top: 150px;
  left: -200px;
  animation-delay: -20s;
}

.cloud-2::before {
  width: 60px;
  height: 60px;
  top: -25px;
  left: 15px;
}

.cloud-2::after {
  width: 70px;
  height: 50px;
  top: -20px;
  right: 15px;
}

.cloud-3 {
  width: 80px;
  height: 35px;
  top: 120px;
  left: -150px;
  animation-delay: -40s;
}

@keyframes cloudFloat {
  from { transform: translateX(0); }
  to { transform: translateX(calc(100vw + 200px)); }
}

/* Hills */
.hills-distant {
  bottom: 30%;
  background: 
    linear-gradient(135deg, transparent 0%, rgba(107, 142, 35, 0.3) 20%, transparent 40%),
    linear-gradient(-135deg, transparent 0%, rgba(85, 107, 47, 0.3) 20%, transparent 40%),
    linear-gradient(to bottom, 
      transparent 0%, 
      #7BA428 30%,
      #6B8E23 40%, 
      #5F7A1F 60%,
      #556B2F 80%,
      #4A5F28 100%
    );
  clip-path: polygon(0 70%, 15% 50%, 30% 60%, 50% 45%, 70% 55%, 85% 50%, 100% 65%, 100% 100%, 0 100%);
  z-index: 2;
  transition: background 10s ease-in-out;
  filter: brightness(1.1);
}

.hills-mid {
  bottom: 20%;
  background: 
    radial-gradient(ellipse at 20% 40%, rgba(139, 162, 47, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 30%, rgba(107, 142, 35, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(85, 107, 47, 0.3) 0%, transparent 50%),
    linear-gradient(to bottom, 
      transparent 0%, 
      #6B8E23 40%,
      #556B2F 50%, 
      #4F6328 70%,
      #4A5F28 90%,
      #3F5020 100%
    );
  clip-path: polygon(0 75%, 20% 55%, 40% 65%, 60% 50%, 80% 60%, 100% 70%, 100% 100%, 0 100%);
  z-index: 3;
  transition: background 10s ease-in-out;
}

/* New mountain range layers for added detail and depth */
.mountain-range-far {
  bottom: 33%;
  z-index: 2.2;
  background: linear-gradient(to bottom, #6e7b74 0%, #556b5f 40%, rgba(60,60,60,0.0) 100%),
              radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.03) 0%, transparent 40%);
  clip-path: polygon(0 65%, 6% 55%, 18% 62%, 28% 52%, 40% 58%, 54% 48%, 66% 56%, 78% 50%, 88% 56%, 100% 60%, 100% 100%, 0 100%);
  filter: contrast(0.95) saturate(0.9) brightness(0.95);
  background-size: auto, 200px 200px;
}

.mountain-range-mid {
  bottom: 28%;
  z-index: 2.6;
  /* layered gradients to simulate strata and light on ridges */
  background: linear-gradient(180deg, #7a6f62 0%, #655a4c 40%, #4f473f 70%, rgba(30,30,30,0.0) 100%),
              linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 30%);
  clip-path: polygon(0 68%, 10% 53%, 25% 62%, 38% 48%, 52% 60%, 68% 46%, 85% 58%, 100% 66%, 100% 100%, 0 100%);
  filter: saturate(0.95) contrast(0.98) blur(0.2px);
  box-shadow: inset 0 -30px 40px rgba(0,0,0,0.15);
}

/* Near mountain/rock layer (sharp peaks and ridgelines) */
.mountain-range-near {
  bottom: 24%;
  z-index: 3.2;
  background: linear-gradient(180deg, #8b7360 0%, #6f5846 50%, #544436 85%),
    radial-gradient(ellipse at 25% 30%, rgba(255,255,255,0.035) 0%, transparent 35%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6'><circle cx='3' cy='3' r='0.6' fill='%23000000' opacity='0.03'/></svg>");
  background-blend-mode: normal, overlay, multiply;
  clip-path: polygon(0 70%, 8% 52%, 22% 64%, 36% 46%, 50% 66%, 64% 44%, 78% 60%, 92% 48%, 100% 68%, 100% 100%, 0 100%);
  transform-origin: center bottom;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.35));
}

/* Subtle ridge highlights using pseudo element to avoid extra markup */
.mountain-range-near::after,
.mountain-range-mid::after,
.mountain-range-far::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 30%);
  mix-blend-mode: overlay;
  opacity: 0.9;
}

/* Add a textural soil/rock band to the ground layer */
.ground-layer {
  bottom: 0;
  height: 40%;
  background: linear-gradient(180deg, #8B7355 0%, #6B5844 50%, #5C4033 100%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.02) 0px, rgba(0,0,0,0.02) 2px, transparent 2px, transparent 6px),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.03) 0%, transparent 40%);
  z-index: 4;
  transition: background 10s ease-in-out;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.25);
}

/* Enhance grass with layered blades and stones */
.grass-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  overflow: hidden;
  background-image: linear-gradient(to top, rgba(40,30,20,0.6) 0%, transparent 40%),
                    radial-gradient(circle at 10% 60%, rgba(255,255,255,0.02) 0%, transparent 25%);
}

.grass-layer::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  background-image: linear-gradient(90deg, rgba(74,95,40,0.2) 0%, rgba(107,142,35,0.12) 50%, rgba(74,95,40,0.2) 100%);
  mix-blend-mode: multiply;
}

/* Slight parallax motion helpers for JS (optional) */
.parallax-transform-slow { transform: translateY(0); will-change: transform; }
.parallax-transform-mid { transform: translateY(0); will-change: transform; }
.parallax-transform-fast { transform: translateY(0); will-change: transform; }

/* Ground */
.ground-layer {
  bottom: 0;
  height: 40%;
  background: linear-gradient(180deg, #8B7355 0%, #6B5844 50%, #5C4033 100%);
  z-index: 4;
  transition: background 10s ease-in-out;
}

.river {
  position: absolute;
  bottom: 10%;
  left: 0;
  width: 100%;
  height: 60px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(70, 130, 180, 0.6) 10%,
    rgba(70, 130, 180, 0.8) 30%,
    rgba(70, 130, 180, 0.7) 70%,
    rgba(70, 130, 180, 0.5) 90%,
    transparent 100%
  );
  clip-path: polygon(0 40%, 20% 30%, 40% 45%, 60% 35%, 80% 50%, 100% 40%, 100% 70%, 80% 80%, 60% 65%, 40% 75%, 20% 70%, 0 80%);
  animation: riverShimmer 3s ease-in-out infinite;
}

@keyframes riverShimmer {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 0.9; }
}

/* Moon and Stars */
.moon {
  position: absolute;
  top: 100px;
  right: 150px;
  width: 70px;
  height: 70px;
  background: radial-gradient(circle at 30% 30%, #F4F4F4 0%, #D3D3D3 70%);
  border-radius: 50%;
  box-shadow: 0 0 40px rgba(244, 244, 244, 0.6);
  opacity: 0;
  transition: opacity 8s ease-in-out;
}

.moon::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 10px;
  width: 12px;
  height: 12px;
  background: rgba(169, 169, 169, 0.3);
  border-radius: 50%;
}

.moon::after {
  content: '';
  position: absolute;
  bottom: 20px;
  right: 15px;
  width: 8px;
  height: 8px;
  background: rgba(169, 169, 169, 0.3);
  border-radius: 50%;
}

.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 8s ease-in-out;
}

.stars::before,
.stars::after {
  content: '✦';
  position: absolute;
  color: rgba(255, 255, 255, 0.8);
  animation: twinkle 3s ease-in-out infinite;
}

.stars::before {
  top: 15%;
  left: 20%;
  font-size: 12px;
}

.stars::after {
  top: 25%;
  right: 30%;
  font-size: 10px;
  animation-delay: 1.5s;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Additional cloud */
.cloud-4 {
  width: 100px;
  height: 40px;
  top: 90px;
  left: -180px;
  animation-delay: -30s;
}

/* Weather Effects */
.weather-effects {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}

.rain-container {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 6s ease-in-out;
}

.rain-drop {
  position: absolute;
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, transparent, rgba(174, 194, 224, 0.5));
  animation: rainFall 1s linear infinite;
}

@keyframes rainFall {
  0% {
    transform: translateY(-100px);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Grass Layer */
.grass-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  overflow: hidden;
}

.grass-blade {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 20px;
  background: linear-gradient(to top, #4A5F28, #6B8E23);
  transform-origin: bottom center;
  animation: grassSway 3s ease-in-out infinite;
}

@keyframes grassSway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* Tree Layers */
.tree-layer-mid {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tree-layer-front {
  position: absolute;
  width: 100%;
  height: 100%;
  bottom: 0;
  pointer-events: none;
}

.tree {
  position: absolute;
  bottom: 0;
}

.tree-trunk {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  background: linear-gradient(to right, #4A3428, #6B4A3A, #4A3428);
  border-radius: 2px;
}

.tree-foliage {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-style: solid;
}

/* Small tree style */
.tree.small .tree-trunk {
  width: 6px;
  height: 25px;
}

.tree.small .tree-foliage {
  bottom: 20px;
  border-width: 0 15px 25px 15px;
  border-color: transparent transparent #4A5F28 transparent;
}

.tree.small .tree-foliage::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 12px 20px 12px;
  border-color: transparent transparent #556B2F transparent;
}

.tree.small .tree-foliage::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 10px 18px 10px;
  border-color: transparent transparent #6B8E23 transparent;
}

/* Medium tree style */
.tree.medium .tree-trunk {
  width: 10px;
  height: 40px;
}

.tree.medium .tree-foliage {
  bottom: 35px;
  border-width: 0 20px 35px 20px;
  border-color: transparent transparent #556B2F transparent;
}

.tree.medium .tree-foliage::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 15px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 18px 30px 18px;
  border-color: transparent transparent #6B8E23 transparent;
}

.tree.medium .tree-foliage::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 25px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 15px 25px 15px;
  border-color: transparent transparent #7BA428 transparent;
}

/* Large tree style */
.tree.large .tree-trunk {
  width: 12px;
  height: 50px;
}

.tree.large .tree-foliage {
  bottom: 45px;
  border-width: 0 25px 45px 25px;
  border-color: transparent transparent #4A5F28 transparent;
}

.tree.large .tree-foliage::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 22px 38px 22px;
  border-color: transparent transparent #556B2F transparent;
}

.tree.large .tree-foliage::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 30px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 18px 30px 18px;
  border-color: transparent transparent #6B8E23 transparent;
}

/* Distant tree style (on hills) */
.tree.distant .tree-trunk {
  width: 5px;
  height: 20px;
  opacity: 0.8;
}

.tree.distant .tree-foliage {
  bottom: 18px;
  border-width: 0 12px 20px 12px;
  border-color: transparent transparent #556B2F transparent;
  opacity: 0.8;
}

.tree.distant .tree-foliage::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 10px 15px 10px;
  border-color: transparent transparent #6B8E23 transparent;
}

/* Tree sway animation */
.tree {
  animation: treeSway 4s ease-in-out infinite;
}

@keyframes treeSway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(0.5deg); }
  75% { transform: rotate(-0.5deg); }
}

.tree:nth-child(2n) {
  animation-delay: -1s;
}

.tree:nth-child(3n) {
  animation-delay: -2s;
}

/* Character sprite animation for cave explorer / red ochre mini-game */
.character-sprite { pointer-events: auto; }
.character-sprite .character-img {
  width: 36px;
  height: 46px;
  display: block;
  will-change: transform;
  /* Idle bob animation */
  animation: charIdle 1200ms ease-in-out infinite;
  transform-origin: center bottom;
}
.character-sprite.running .character-img {
  /* Running/state animation (faster, more pronounced) */
  animation: charRun 360ms steps(4) infinite;
}
.character-sprite.facing-left .character-img {
  /* Mirror using scaleX; implemented as separate rule so animation transform isn't overridden */
  transform: scaleX(-1);
}

@keyframes charIdle {
  0% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
  100% { transform: translateY(0); }
}

@keyframes charRun {
  0% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

/* Sprite-sheet support (SVG sheet) */
.character-sprite .sprite-sheet {
  width: 36px;
  height: 44px;
  display: block;
  background-image: url('./cha1_sprites.svg');
  background-repeat: no-repeat;
  /* total sheet width: 288px (8 frames of 36px) */
  background-size: 288px 44px;
  image-rendering: pixelated;
  transform-origin: center bottom;
  z-index: 96; /* above fallback image */
}
.character-sprite .sprite-sheet { animation: spriteIdle 1200ms steps(1) infinite; }
.character-sprite.running .sprite-sheet { animation: spriteRun 600ms steps(6) infinite; }
.character-sprite.jumping .sprite-sheet { animation: spriteJump 240ms steps(1) both; }

@keyframes spriteRun {
  from { background-position: 0 0; }
  to { background-position: -252px 0; } /* show frames 0..6 (6 steps), end at last run frame */
}
@keyframes spriteIdle {
  from { background-position: 0 0; }
  to { background-position: 0 0; }
}
@keyframes spriteJump {
  from { background-position: 0 0; }
  to { background-position: -252px 0; }
}

/* Night mode trees */
.night-mode .tree-foliage,
.night-mode .tree-foliage::before,
.night-mode .tree-foliage::after {
  filter: brightness(0.6);
  transition: filter 10s ease-in-out;
}

/* Day/Night Classes */
.night-mode .sky-layer {
  background: linear-gradient(180deg, #0B1026 0%, #1A1A3E 50%, #2C3E50 100%);
  transition: background 10s ease-in-out;
}

.night-mode .sun {
  opacity: 0;
  transition: opacity 8s ease-in-out;
}

.night-mode .moon {
  opacity: 1;
  transition: opacity 8s ease-in-out;
}

.night-mode .stars {
  opacity: 1;
  transition: opacity 8s ease-in-out;
}

.night-mode .cloud {
  background: rgba(100, 100, 120, 0.4);
  transition: background 8s ease-in-out;
}

.night-mode .cloud::before,
.night-mode .cloud::after {
  background: rgba(100, 100, 120, 0.4);
  transition: background 8s ease-in-out;
}

.night-mode .hills-distant {
  background: 
    linear-gradient(135deg, transparent 0%, rgba(58, 74, 47, 0.3) 20%, transparent 40%),
    linear-gradient(-135deg, transparent 0%, rgba(44, 58, 34, 0.3) 20%, transparent 40%),
    linear-gradient(to bottom, 
      transparent 0%, 
      #4A5F2F 30%,
      #3A4A2F 40%, 
      #324028 60%,
      #2C3A22 80%,
      #1F2A18 100%
    );
  transition: background 10s ease-in-out;
  filter: brightness(0.8);
}

.night-mode .hills-mid {
  background: 
    radial-gradient(ellipse at 20% 40%, rgba(58, 74, 47, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 30%, rgba(44, 58, 34, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(32, 42, 24, 0.2) 0%, transparent 50%),
    linear-gradient(to bottom, 
      transparent 0%, 
      #3A4A2F 40%,
      #2C3A22 50%, 
      #283420 70%,
      #1F2A18 90%,
      #182010 100%
    );
  transition: background 10s ease-in-out;
}

.night-mode .ground-layer {
  background: linear-gradient(180deg, #4A3A2A 0%, #3A2A1A 50%, #2A1A0A 100%);
  transition: background 10s ease-in-out;
}

/* Rainy Mode */
.rainy-mode .rain-container {
  opacity: 1;
  transition: opacity 6s ease-in-out;
}

.rainy-mode .cloud {
  background: rgba(120, 120, 130, 0.8);
  transition: background 8s ease-in-out;
}

.rainy-mode .cloud::before,
.rainy-mode .cloud::after {
  background: rgba(120, 120, 130, 0.8);
  transition: background 8s ease-in-out;
}

.rainy-mode .sky-layer {
  background: linear-gradient(180deg, #6B7A8F 0%, #8B9AAF 50%, #A4B3C8 100%);
  transition: background 8s ease-in-out;
}

/* Foreground */
.foreground-layer {
  bottom: 0;
  z-index: 5;
}

.gathering-spots {
  position: absolute;
  bottom: 15%;
  left: 5%;
  right: 5%;
  height: 50%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1rem;
  padding: 1rem;
}

.gather-btn {
  position: relative;
  background: radial-gradient(circle, rgba(218, 165, 32, 0.3) 0%, transparent 70%);
  border: 3px solid var(--ochre-yellow);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: gatherPulse 2s ease-in-out infinite;
}

@keyframes gatherPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 40px rgba(218, 165, 32, 0.8);
    transform: scale(1.05);
  }
}

.gather-btn:hover {
  border-width: 4px;
  border-color: var(--fire-yellow);
  transform: scale(1.1) !important;
  box-shadow: 0 0 50px rgba(253, 184, 19, 1) !important;
  z-index: 10;
}

.gather-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.8));
}

.gather-label {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ========================================
   WORKSHOP SCENE
   ======================================== */

#workshop-scene {
  background: linear-gradient(180deg, #87CEEB 0%, #B0D4E3 40%, #D4C5A9 70%, #8B7355 100%);
}

.workshop-bg {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    /* Ground/grass layer at bottom */
    linear-gradient(to top, 
      #5a7c4a 0%,
      #6b8c5b 15%,
      rgba(107, 140, 91, 0.8) 30%,
      transparent 50%
    );
}

/* Campfire */
.fire-pit {
  position: absolute;
  bottom: 20%;
  left: 15%;
  width: 150px;
  height: 150px;
  z-index: 5;
}

.fire-pit::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 180px;
  height: 25px;
  background: 
    /* Stones around campfire */
    radial-gradient(ellipse at 20% 50%, #5a5a5a 0%, #4a4a4a 40%, transparent 45%),
    radial-gradient(ellipse at 40% 50%, #666666 0%, #555555 40%, transparent 45%),
    radial-gradient(ellipse at 60% 50%, #5c5c5c 0%, #4c4c4c 40%, transparent 45%),
    radial-gradient(ellipse at 80% 50%, #636363 0%, #535353 40%, transparent 45%),
    radial-gradient(ellipse at 30% 80%, #585858 0%, #484848 35%, transparent 40%),
    radial-gradient(ellipse at 70% 80%, #606060 0%, #505050 35%, transparent 40%),
    /* Ground shadow */
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
}

.fire-pit::after {
  content: '';
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 40px;
  background: 
    /* Wood logs */
    linear-gradient(95deg, transparent 0%, transparent 20%, #4a3426 20%, #5c4433 30%, #4a3426 40%, transparent 40%, transparent 60%, #5c4433 60%, #6d5544 70%, #5c4433 80%, transparent 80%),
    linear-gradient(85deg, transparent 0%, transparent 15%, #563d2e 15%, #6d5544 25%, #563d2e 35%, transparent 35%, transparent 55%, #4a3426 55%, #5c4433 65%, #4a3426 75%, transparent 75%);
  border-radius: 5px;
  z-index: -1;
}

.flames {
  position: relative;
  width: 100%;
  height: 100%;
}

.flame {
  position: absolute;
  bottom: 20px;
  width: 40px;
  height: 80px;
  background: linear-gradient(to top, var(--fire-orange) 0%, var(--fire-yellow) 50%, transparent 100%);
  border-radius: 50% 50% 0 0;
  transform-origin: bottom center;
  filter: blur(5px);
}

.flame-1 {
  left: 30%;
  animation: flicker1 0.3s ease-in-out infinite;
}

.flame-2 {
  left: 50%;
  transform: translateX(-50%);
  height: 100px;
  animation: flicker2 0.4s ease-in-out infinite;
}

.flame-3 {
  right: 30%;
  animation: flicker3 0.35s ease-in-out infinite;
}

@keyframes flicker1 {
  0%, 100% { transform: scaleY(1) scaleX(1); opacity: 0.9; }
  50% { transform: scaleY(1.15) scaleX(0.9); opacity: 1; }
}

@keyframes flicker2 {
  0%, 100% { transform: translateX(-50%) scaleY(1); opacity: 0.95; }
  50% { transform: translateX(-50%) scaleY(1.2); opacity: 1; }
}

@keyframes flicker3 {
  0%, 100% { transform: scaleY(0.95) scaleX(1); opacity: 0.85; }
  50% { transform: scaleY(1.1) scaleX(0.95); opacity: 1; }
}

.smoke {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 100px;
  background: radial-gradient(ellipse at bottom, rgba(100, 100, 100, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  animation: smokeRise 3s ease-out infinite;
}

@keyframes smokeRise {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translateX(-50%) translateY(-100px) scale(1.5);
    opacity: 0;
  }
}

/* Grinding Area */
.grinding-area {
  position: absolute;
  bottom: 25%;
  left: 40%;
  width: 120px;
  height: 80px;
  background: radial-gradient(ellipse, #696969 0%, #505050 70%);
  border-radius: 50%;
  box-shadow: inset 0 10px 20px rgba(0, 0, 0, 0.6);
  z-index: 4;
}

.grinding-stone::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 60%;
  background: radial-gradient(circle, #808080 0%, #606060 100%);
  border-radius: 50%;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.8);
}

/* Tool Bench */
.tool-bench {
  position: absolute;
  bottom: 20%;
  right: 20%;
  width: 200px;
  height: 100px;
  background: linear-gradient(180deg, #5C4033 0%, #4A3526 100%);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  z-index: 4;
}

/* Workshop Content */
.workshop-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 900px;
  z-index: 10;
}

.crafting-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
  margin-bottom: 160px; /* Space for inventory panels */
  padding: 0 1rem;
  position: relative;
  z-index: 10;
}

.craft-section {
  background: rgba(26, 20, 16, 0.95);
  border: 3px solid var(--ochre-yellow);
  border-radius: 16px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 15;
}

.craft-section h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--ochre-yellow);
  margin-bottom: 1rem;
  text-align: center;
  text-transform: uppercase;
}

.craft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.craft-card {
  background: rgba(60, 50, 40, 0.9);
  position: relative; /* for tooltip positioning */
  border: 3px solid var(--stone-gray);

/* Tooltip for craft cards (shows have/need and XP shortfall) */
.craft-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) scale(0.98);
  background: rgba(26, 20, 16, 0.98);
  color: var(--limestone, #efe7d6);
  border: 1px solid rgba(255, 196, 77, 0.12);
  padding: 10px 12px;
  border-radius: 8px;
  min-width: 200px;
  box-shadow: 0 8px 28px rgba(6, 6, 6, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 1200;
  font-size: 0.92rem;
}

.craft-card:hover .craft-tooltip,
.craft-card:focus-within .craft-tooltip,
.craft-card:focus .craft-tooltip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.craft-tooltip .tooltip-line { margin: 4px 0; }
.craft-tooltip .tooltip-line:first-child { margin-top: 0; }
.craft-tooltip .tooltip-line:last-child { margin-bottom: 0; font-weight: 600; }
  border-radius: 12px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 140px;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.craft-card:hover {
  border-color: var(--ochre-yellow);
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 30px rgba(218, 165, 32, 0.6);
  z-index: 50; /* Bring to front on hover */
}

.craft-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.craft-card.disabled:hover {
  transform: none;
  box-shadow: none;
  z-index: 1;
}

.craft-card.crafted {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.2);
  opacity: 0.7;
}

.craft-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.craft-name {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--limestone);
  margin-bottom: 0.3rem;
}

.craft-requirements {
  font-size: 0.75rem;
  color: var(--ochre-yellow);
  font-style: italic;
}

.craft-status {
  font-size: 0.7rem;
  font-weight: bold;
  margin-top: 0.5rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  text-align: center;
}

.craft-status.ready {
  background: var(--ochre-yellow);
  color: var(--charcoal-black);
  animation: craftPulse 2s ease-in-out infinite;
}

@keyframes craftPulse {
  0%, 100% { 
    opacity: 1; 
    box-shadow: 0 0 10px rgba(218, 165, 32, 0.5);
  }
  50% { 
    opacity: 0.85;
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.8);
  }
}

.craft-status.crafted {
  background: #4CAF50;
  color: white;
}

/* ========================================
   CAVE SCENE - Dark & Atmospheric
   ======================================== */

#cave-scene {
  background: 
    /* Rock formations - various grey stones */
    radial-gradient(ellipse at 12% 15%, rgba(85, 82, 78, 0.4) 0%, transparent 8%),
    radial-gradient(ellipse at 25% 22%, rgba(65, 63, 60, 0.45) 0%, transparent 10%),
    radial-gradient(ellipse at 38% 18%, rgba(75, 72, 68, 0.35) 0%, transparent 9%),
    radial-gradient(ellipse at 52% 25%, rgba(70, 68, 65, 0.4) 0%, transparent 11%),
    radial-gradient(ellipse at 68% 20%, rgba(80, 77, 73, 0.38) 0%, transparent 8.5%),
    radial-gradient(ellipse at 82% 17%, rgba(60, 58, 55, 0.42) 0%, transparent 9.5%),
    radial-gradient(ellipse at 15% 45%, rgba(72, 70, 67, 0.36) 0%, transparent 12%),
    radial-gradient(ellipse at 30% 52%, rgba(68, 65, 62, 0.4) 0%, transparent 10%),
    radial-gradient(ellipse at 45% 48%, rgba(78, 75, 71, 0.35) 0%, transparent 11%),
    radial-gradient(ellipse at 60% 55%, rgba(63, 61, 58, 0.43) 0%, transparent 9%),
    radial-gradient(ellipse at 75% 50%, rgba(74, 71, 68, 0.37) 0%, transparent 10.5%),
    radial-gradient(ellipse at 88% 48%, rgba(82, 79, 75, 0.39) 0%, transparent 8%),
    radial-gradient(ellipse at 10% 75%, rgba(67, 65, 62, 0.41) 0%, transparent 11%),
    radial-gradient(ellipse at 28% 78%, rgba(76, 73, 70, 0.36) 0%, transparent 9.5%),
    radial-gradient(ellipse at 42% 82%, rgba(71, 68, 65, 0.38) 0%, transparent 10%),
    radial-gradient(ellipse at 58% 77%, rgba(64, 62, 59, 0.44) 0%, transparent 12%),
    radial-gradient(ellipse at 72% 85%, rgba(79, 76, 72, 0.34) 0%, transparent 9%),
    radial-gradient(ellipse at 90% 80%, rgba(69, 67, 64, 0.4) 0%, transparent 10.5%),
    /* Darker crevices between rocks */
    radial-gradient(ellipse at 20% 30%, rgba(30, 28, 26, 0.6) 0%, transparent 5%),
    radial-gradient(ellipse at 48% 38%, rgba(28, 26, 24, 0.65) 0%, transparent 4.5%),
    radial-gradient(ellipse at 65% 65%, rgba(32, 30, 28, 0.55) 0%, transparent 5.5%),
    radial-gradient(ellipse at 35% 70%, rgba(25, 23, 21, 0.7) 0%, transparent 4%),
    /* Stone texture variations */
    radial-gradient(ellipse at 50% 50%, rgba(55, 53, 50, 0.3) 0%, transparent 30%),
    radial-gradient(ellipse at 25% 60%, rgba(60, 58, 55, 0.25) 0%, transparent 25%),
    radial-gradient(ellipse at 75% 40%, rgba(50, 48, 46, 0.28) 0%, transparent 28%),
    /* Base grey cave gradient */
    radial-gradient(ellipse at 50% 30%, #4a4742 0%, #3e3b37 20%, #35322e 40%, #2c2925 60%, #24211e 80%, #1c1916 100%);
  position: relative;
}

#cave-scene::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(80, 64, 48, 0.1) 0%, transparent 30%),
    radial-gradient(ellipse at 80% 30%, rgba(70, 56, 42, 0.1) 0%, transparent 25%),
    radial-gradient(ellipse at 40% 70%, rgba(60, 48, 36, 0.1) 0%, transparent 35%);
  pointer-events: none;
  z-index: 0;
}

.cave-darkness {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 10% 90%, rgba(255, 140, 0, 0.15) 0%, transparent 40%),
    radial-gradient(ellipse at 10% 90%, rgba(10, 8, 6, 0.6) 0%, rgba(10, 8, 6, 0.95) 50%);
  z-index: 1;
  animation: ambientFlicker 4s ease-in-out infinite;
}

@keyframes ambientFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.95; }
}

/* Torch Light Effect */
.torch-light {
  position: absolute;
  bottom: 80px;
  left: 80px;
  width: 600px;
  height: 600px;
  z-index: 2;
  pointer-events: none;
}

.light-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 30% 30%, 
      rgba(255, 180, 60, 0.5) 0%,
      rgba(255, 140, 40, 0.35) 15%,
      rgba(255, 120, 20, 0.25) 30%,
      rgba(255, 100, 0, 0.15) 45%,
      rgba(200, 80, 0, 0.08) 60%,
      transparent 100%
    );
  border-radius: 50%;
  animation: torchFlicker 2s ease-in-out infinite, torchMove 5s ease-in-out infinite;
  filter: blur(20px);
}

@keyframes torchFlicker {
  0% { opacity: 0.85; transform: scale(1) translateY(0); }
  25% { opacity: 0.95; transform: scale(1.08) translateY(-5px); }
  50% { opacity: 0.9; transform: scale(1.05) translateY(-2px); }
  75% { opacity: 0.88; transform: scale(1.03) translateY(-8px); }
  100% { opacity: 0.85; transform: scale(1) translateY(0); }
}

@keyframes torchMove {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(10px, -15px) scale(1.05); }
  50% { transform: translate(-8px, -10px) scale(0.98); }
  75% { transform: translate(12px, -20px) scale(1.03); }
}

.torch-flame {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 60px;
  height: 80px;
}

/* Additional warm glow overlay */
#cave-scene::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 10% 85%, rgba(255, 140, 0, 0.08) 0%, transparent 35%),
    radial-gradient(ellipse at 8% 88%, rgba(255, 100, 0, 0.05) 0%, transparent 25%);
  pointer-events: none;
  z-index: 1;
  animation: warmGlow 3s ease-in-out infinite;
}

@keyframes warmGlow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Cave Wall Details */
.cave-wall-details {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.rock-formation {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse at 30% 30%, #3a302a, #2a2018);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.rock-1 {
  width: 180px;
  height: 150px;
  top: 15%;
  right: 5%;
  border-radius: 40% 60% 50% 50%;
  opacity: 0.4;
}

.rock-2 {
  width: 220px;
  height: 180px;
  bottom: 10%;
  right: 15%;
  border-radius: 50% 40% 60% 50%;
  opacity: 0.3;
}

.rock-3 {
  width: 160px;
  height: 140px;
  top: 40%;
  left: 3%;
  border-radius: 60% 50% 50% 40%;
  opacity: 0.35;
}

.stalactite {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: 0.3;
}

.stalactite-1 {
  left: 20%;
  border-width: 0 15px 100px 15px;
  border-color: transparent transparent #3a302a transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.stalactite-2 {
  right: 25%;
  border-width: 0 12px 80px 12px;
  border-color: transparent transparent #2a2018 transparent;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.cave-wall-texture {
  position: absolute;
  width: 100%;
  height: 100%;
  background: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 10px,
      rgba(60, 48, 32, 0.05) 10px,
      rgba(60, 48, 32, 0.05) 20px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 10px,
      rgba(50, 40, 30, 0.05) 10px,
      rgba(50, 40, 30, 0.05) 20px
    );
  z-index: 1;
}

/* Painting Area */
.painting-area {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

#painting-canvas {
  border: none;
  border-radius: 8px;
  background: 
    /* Granular texture - lots of tiny spots */
    radial-gradient(circle at 8% 12%, rgba(55, 48, 40, 0.3) 0%, transparent 0.8%),
    radial-gradient(circle at 23% 8%, rgba(50, 43, 36, 0.25) 0%, transparent 0.6%),
    radial-gradient(circle at 15% 25%, rgba(52, 45, 38, 0.28) 0%, transparent 0.7%),
    radial-gradient(circle at 34% 18%, rgba(48, 42, 35, 0.26) 0%, transparent 0.65%),
    radial-gradient(circle at 45% 9%, rgba(54, 47, 39, 0.29) 0%, transparent 0.75%),
    radial-gradient(circle at 52% 22%, rgba(51, 44, 37, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 67% 14%, rgba(49, 43, 36, 0.28) 0%, transparent 0.65%),
    radial-gradient(circle at 78% 19%, rgba(53, 46, 38, 0.3) 0%, transparent 0.8%),
    radial-gradient(circle at 85% 11%, rgba(50, 44, 37, 0.26) 0%, transparent 0.7%),
    radial-gradient(circle at 92% 24%, rgba(52, 45, 37, 0.28) 0%, transparent 0.75%),
    radial-gradient(circle at 12% 38%, rgba(51, 45, 38, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 28% 42%, rgba(49, 42, 35, 0.29) 0%, transparent 0.8%),
    radial-gradient(circle at 38% 48%, rgba(53, 46, 39, 0.26) 0%, transparent 0.65%),
    radial-gradient(circle at 47% 39%, rgba(50, 43, 36, 0.28) 0%, transparent 0.7%),
    radial-gradient(circle at 59% 45%, rgba(52, 45, 38, 0.27) 0%, transparent 0.75%),
    radial-gradient(circle at 71% 41%, rgba(51, 44, 37, 0.3) 0%, transparent 0.8%),
    radial-gradient(circle at 83% 47%, rgba(49, 43, 36, 0.26) 0%, transparent 0.7%),
    radial-gradient(circle at 91% 38%, rgba(54, 47, 39, 0.28) 0%, transparent 0.75%),
    radial-gradient(circle at 9% 58%, rgba(50, 44, 37, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 19% 64%, rgba(52, 45, 38, 0.29) 0%, transparent 0.8%),
    radial-gradient(circle at 31% 61%, rgba(48, 42, 35, 0.26) 0%, transparent 0.65%),
    radial-gradient(circle at 43% 68%, rgba(53, 46, 38, 0.28) 0%, transparent 0.75%),
    radial-gradient(circle at 56% 62%, rgba(51, 44, 37, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 68% 66%, rgba(49, 43, 36, 0.3) 0%, transparent 0.8%),
    radial-gradient(circle at 77% 59%, rgba(52, 45, 38, 0.26) 0%, transparent 0.7%),
    radial-gradient(circle at 88% 65%, rgba(50, 44, 37, 0.28) 0%, transparent 0.75%),
    radial-gradient(circle at 14% 78%, rgba(51, 45, 38, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 26% 82%, rgba(53, 46, 39, 0.29) 0%, transparent 0.8%),
    radial-gradient(circle at 37% 76%, rgba(49, 42, 35, 0.26) 0%, transparent 0.65%),
    radial-gradient(circle at 49% 84%, rgba(52, 45, 37, 0.28) 0%, transparent 0.75%),
    radial-gradient(circle at 61% 79%, rgba(50, 43, 36, 0.27) 0%, transparent 0.7%),
    radial-gradient(circle at 73% 85%, rgba(51, 44, 38, 0.3) 0%, transparent 0.8%),
    radial-gradient(circle at 84% 77%, rgba(48, 43, 36, 0.26) 0%, transparent 0.7%),
    radial-gradient(circle at 95% 81%, rgba(54, 47, 39, 0.28) 0%, transparent 0.75%),
    /* Larger mineral deposits and color variations */
    radial-gradient(ellipse at 18% 15%, rgba(65, 58, 48, 0.25) 0%, transparent 8%),
    radial-gradient(ellipse at 42% 28%, rgba(58, 52, 44, 0.22) 0%, transparent 6%),
    radial-gradient(ellipse at 65% 35%, rgba(62, 55, 46, 0.24) 0%, transparent 7%),
    radial-gradient(ellipse at 82% 22%, rgba(60, 54, 45, 0.23) 0%, transparent 6.5%),
    radial-gradient(ellipse at 25% 58%, rgba(63, 56, 47, 0.26) 0%, transparent 7.5%),
    radial-gradient(ellipse at 54% 64%, rgba(59, 53, 44, 0.23) 0%, transparent 6%),
    radial-gradient(ellipse at 78% 72%, rgba(61, 55, 46, 0.24) 0%, transparent 7%),
    radial-gradient(ellipse at 35% 88%, rgba(64, 57, 48, 0.25) 0%, transparent 8%),
    /* Subtle noise texture */
    repeating-linear-gradient(
      0deg,
      rgba(40, 35, 28, 0.02) 0px,
      rgba(38, 33, 27, 0.02) 1px,
      rgba(42, 36, 29, 0.02) 2px
    ),
    /* Base limestone color */
    linear-gradient(135deg, 
      #3d3529 0%, 
      #3a3226 15%,
      #352e23 30%, 
      #322b21 45%,
      #2f281f 60%,
      #2c251d 75%,
      #29221b 90%,
      #261f18 100%
    );
  cursor: crosshair;
  box-shadow: 
    inset 0 0 100px rgba(0, 0, 0, 0.95),
    inset 8px 8px 40px rgba(0, 0, 0, 0.85),
    inset -8px -8px 40px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(0, 0, 0, 0.8),
    0 10px 35px rgba(0, 0, 0, 0.95);
  position: relative;
  filter: contrast(1.15) brightness(0.85);
}

#painting-canvas::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 400px 350px at 20% 90%, 
      rgba(255, 180, 60, 0.5) 0%, 
      rgba(255, 140, 40, 0.35) 15%,
      rgba(255, 120, 30, 0.25) 25%,
      rgba(200, 100, 30, 0.15) 35%,
      rgba(150, 80, 20, 0.08) 45%,
      transparent 60%
    ),
    radial-gradient(ellipse 300px 280px at 85% 85%, 
      rgba(255, 160, 50, 0.4) 0%, 
      rgba(255, 130, 35, 0.25) 20%,
      rgba(200, 100, 25, 0.12) 35%,
      transparent 50%
    );
  pointer-events: none;
  border-radius: 8px;
  animation: canvasLightDance 3.5s ease-in-out infinite;
  mix-blend-mode: screen;
}

#painting-canvas::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 350px 320px at 15% 92%, 
      rgba(255, 140, 40, 0.35) 0%, 
      rgba(200, 110, 30, 0.2) 20%,
      rgba(150, 90, 25, 0.1) 35%,
      transparent 50%
    ),
    radial-gradient(ellipse 280px 250px at 90% 88%, 
      rgba(255, 150, 45, 0.3) 0%, 
      rgba(180, 100, 30, 0.15) 25%,
      transparent 45%
    );
  pointer-events: none;
  border-radius: 8px;
  animation: canvasLightFlicker 2.5s ease-in-out infinite;
  mix-blend-mode: screen;
}

@keyframes canvasLightDance {
  0% { 
    opacity: 0.85;
    transform: translate(0, 0) scale(1);
  }
  15% { 
    opacity: 1;
    transform: translate(-10px, 4px) scale(1.08);
  }
  30% { 
    opacity: 0.7;
    transform: translate(5px, -6px) scale(0.95);
  }
  45% { 
    opacity: 0.95;
    transform: translate(-7px, 8px) scale(1.05);
  }
  60% { 
    opacity: 0.75;
    transform: translate(8px, -4px) scale(0.98);
  }
  75% { 
    opacity: 0.9;
    transform: translate(-6px, 10px) scale(1.03);
  }
  90% { 
    opacity: 0.8;
    transform: translate(4px, 5px) scale(1.01);
  }
  100% { 
    opacity: 0.85;
    transform: translate(0, 0) scale(1);
  }
}

@keyframes canvasLightFlicker {
  0% { 
    opacity: 0.7;
  }
  10% { 
    opacity: 0.9;
  }
  20% { 
    opacity: 0.6;
  }
  35% { 
    opacity: 1;
  }
  45% { 
    opacity: 0.55;
  }
  55% { 
    opacity: 0.85;
  }
  70% { 
    opacity: 0.65;
  }
  80% { 
    opacity: 0.95;
  }
  90% { 
    opacity: 0.75;
  }
  100% { 
    opacity: 0.7;
  }
}

/* Painting Toolbar */
.painting-toolbar {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 20, 16, 0.98);
  border: 3px solid var(--ochre-yellow);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: center;
  z-index: 50;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-deep);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.toolbar-group label {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--ochre-yellow);
  font-weight: 600;
  text-transform: uppercase;
}

.palette-swatches, .tool-swatches, .template-swatches {
  display: flex;
  gap: 0.5rem;
}

.paint-swatch, .tool-swatch, .template-swatch {
  width: 50px;
  height: 50px;
  border: 3px solid var(--stone-gray);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.paint-swatch:hover, .tool-swatch:hover, .template-swatch:hover {
  border-color: var(--ochre-yellow);
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.6);
}

.paint-swatch.active, .tool-swatch.active, .template-swatch.active {
  border-color: var(--fire-yellow);
  border-width: 4px;
  box-shadow: 0 0 30px rgba(253, 184, 19, 0.8);
  transform: scale(1.1);
}

.paint-swatch.disabled, .tool-swatch.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

.toolbar-actions {
  display: flex;
  gap: 0.8rem;
}

.btn-secondary {
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  background: rgba(94, 82, 64, 0.8);
  color: var(--limestone);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: rgba(94, 82, 64, 1);
  border-color: var(--ochre-yellow);
  transform: translateY(-2px);
}

.btn-secondary:disabled,
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(50, 50, 50, 0.5);
  border-color: rgba(100, 100, 100, 0.5);
}

.btn-secondary:disabled:hover,
.btn-primary:disabled:hover {
  transform: none;
  background: rgba(50, 50, 50, 0.5);
}

/* ========================================
   PARTICLE SYSTEM
   ======================================== */

#particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly 1s ease-out forwards;
}

@keyframes particleFly {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx), var(--ty)) scale(0.5);
  }
}

/* ========================================
   MODALS
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: rgba(26, 20, 16, 0.98);
  border: 4px solid var(--ochre-yellow);
  border-radius: 20px;
  padding: 1rem 1.5rem;
  max-width: 98vw;
  max-height: 98vh;
  width: 98vw;
  height: 98vh;
  /* Allow internal scrolling when content is taller than the modal so controls remain reachable */
  overflow: auto;
  position: relative;
  box-shadow: var(--shadow-deep);
  animation: modalSlideIn 0.4s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  background: rgba(139, 69, 19, 0.8);
  border: 2px solid var(--ochre-yellow);
  border-radius: 50%;
  color: var(--limestone);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Arial, sans-serif;
}

.modal-close:hover {
  background: var(--ochre-red);
  transform: rotate(90deg) scale(1.1);
}

.modal-content h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--ochre-yellow);
  margin-bottom: 0.3rem;
  margin-top: 0;
  text-align: center;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Inventory Modal */
.inventory-modal-content {
  /* Allow the inventory modal to be wider on desktop while remaining responsive on small screens */
  max-width: 1100px;
  width: min(92vw, 1100px);
  max-height: 90vh;
  height: auto;
  padding: 1.25rem 1.75rem;
}

.inventory-sections {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

/* Desktop: show inventory sections side-by-side for more density */
@media (min-width: 900px) {
  .inventory-sections {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.inventory-section {
  background: rgba(60, 50, 40, 0.5);
  border: 2px solid var(--stone-gray);
  border-radius: 12px;
  padding: 1.5rem;
}

.inventory-section h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--ochre-yellow);
  margin-bottom: 1rem;
  text-align: center;
  text-transform: uppercase;
}

.inventory-grid-large {
  display: grid;
  /* on small screens keep compact tiles, on larger screens use slightly larger tiles */
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.75rem;
}

@media (min-width: 900px) {
  .inventory-grid-large {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
  }
}

.inventory-grid-large .inventory-item,
.inventory-grid-large .tool-item,
.inventory-grid-large .paint-item {
  position: relative;
  aspect-ratio: 1;
  background: rgba(60, 50, 40, 0.9);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  padding: 0.45rem;
}

.inventory-grid-large .inventory-item:hover,
.inventory-grid-large .tool-item:hover,
.inventory-grid-large .paint-item:hover {
  border-color: var(--ochre-yellow);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.6);
  z-index: 10;
}

.inventory-grid-large .item-icon {
  font-size: 2.25rem;
  margin-bottom: 0.25rem;
}

@media (min-width: 900px) {
  .inventory-grid-large .item-icon {
    font-size: 2.75rem;
  }
  .inventory-grid-large .item-name {
    font-size: 0.78rem;
  }
  .inventory-grid-large .item-count {
    font-size: 0.85rem;
    padding: 3px 7px;
  }
}

.inventory-grid-large .item-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--ochre-yellow);
}

.inventory-grid-large .item-name {
  font-size: 0.7rem;
  color: var(--limestone);
  text-align: center;
  margin-top: 0.3rem;
}

.empty-inventory {
  text-align: center;
  color: var(--stone-gray);
  font-style: italic;
  padding: 2rem;
  font-size: 1rem;
}

/* Challenges Modal */
.challenges-modal-content {
  max-width: 800px;
  max-height: 90vh;
}

.badges-grid-large {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.5rem;
}

.badges-grid-large .badge-item {
  aspect-ratio: 1;
  background: rgba(60, 50, 40, 0.8);
  border: 3px solid var(--stone-gray);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  position: relative;
  transition: all 0.3s ease;
  padding: 1rem;
}

.badges-grid-large .badge-item.earned {
  border-color: var(--ochre-yellow);
  background: rgba(218, 165, 32, 0.2);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
  animation: badgeGlow 2s ease-in-out infinite;
}

@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(218, 165, 32, 0.5); }
  50% { box-shadow: 0 0 30px rgba(218, 165, 32, 0.8); }
}

.badges-grid-large .badge-item.locked {
  opacity: 0.3;
  filter: grayscale(1);
}

.badges-grid-large .badge-item:hover:not(.locked) {
  transform: scale(1.1) rotate(5deg);
  border-color: var(--ochre-yellow);
  z-index: 10;
}

.badges-grid-large .badge-name {
  font-size: 0.75rem;
  color: var(--limestone);
  text-align: center;
  margin-top: 0.5rem;
  font-weight: bold;
  font-family: var(--font-title);
}

.badges-grid-large .badge-description {
  font-size: 0.65rem;
  color: var(--stone-gray);
  text-align: center;
  margin-top: 0.3rem;
  font-style: italic;
}

/* Codex Tabs */
.codex-tabs {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.codex-tab {
  padding: 0.7rem 1.3rem;
  background: rgba(60, 50, 40, 0.8);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  color: var(--limestone);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.codex-tab:hover {
  border-color: var(--ochre-yellow);
  background: rgba(60, 50, 40, 1);
}

.codex-tab.active {
  background: var(--ochre-red);
  border-color: var(--ochre-yellow);
  border-width: 3px;
}

.codex-body {
  color: var(--limestone);
  line-height: 1.8;
  font-size: 1rem;
}

.codex-body h3 {
  font-family: var(--font-title);
  color: var(--ochre-yellow);
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.codex-body p {
  margin-bottom: 1rem;
}

.codex-body ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.codex-body li {
  margin-bottom: 0.5rem;
}

.codex-body strong {
  color: var(--ochre-orange);
}

.codex-body .formula {
  font-family: 'Courier New', monospace;
  color: var(--fire-orange);
  font-weight: bold;
}

/* Help Content */
.help-content {
  display: grid;
  gap: 1.5rem;
}

.help-section h3 {
  font-family: var(--font-title);
  color: var(--ochre-yellow);
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
}

.help-section p {
  line-height: 1.7;
  font-size: 1rem;
}

/* ========================================
   NOTIFICATION TOAST
   ======================================== */

#notification {
  position: fixed;
  top: 80px;
  right: 20px;
  transform: translateX(150%);
  background: rgba(26, 20, 16, 0.98);
  border: 3px solid var(--ochre-yellow);
  border-radius: 12px;
  padding: 1rem 2rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--limestone);
  z-index: 2000;
  box-shadow: var(--shadow-deep);
  backdrop-filter: blur(10px);
  transition: transform 0.4s ease;
  text-align: center;
  min-width: 300px;
  max-width: 400px;
}

#notification.show {
  transform: translateX(0);
}

/* ========================================
   TUTORIAL OVERLAY
   ======================================== */

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.tutorial-box {
  background: linear-gradient(135deg, #2C1810 0%, #1a1410 100%);
  border: 4px solid var(--ochre-yellow);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 600px;
  min-width: 400px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
  animation: tutorialSlideIn 0.4s ease;
}

@keyframes tutorialSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.tutorial-step h3 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--ochre-yellow);
  margin-bottom: 1rem;
  text-align: center;
}

.tutorial-step p {
  font-family: var(--font-body);
  font-size: 1.1rem;
  color: var(--limestone);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.tutorial-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
  .gathering-spots {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .crafting-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  
  .scene-title-overlay {
    bottom: 10px;
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
  }
  
  .scene-title-overlay:hover {
    transform: translateY(-2px);
  }
}

/* Particle effects for grinding */
.grinding-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  animation: grindParticle 1s ease-out forwards;
}

@keyframes grindParticle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--px), var(--py)) scale(0.3);
  }
}

@media (max-width: 768px) {
  .main-title {
    font-size: 2.5rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  .btn-primary {
    padding: 1rem 2rem;
    font-size: 1.1rem;
  }
  
  .nav-buttons {
    gap: 0.5rem;
  }
  
  .nav-btn {
    min-width: 80px;
    padding: 0.6rem 1rem;
  }
  
  .nav-icon {
    font-size: 1.5rem;
  }
  
  .nav-label {
    font-size: 0.75rem;
  }
  
  .gathering-spots {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  .gather-btn {
    min-height: 100px;
  }
  
  .gather-icon {
    font-size: 2.5rem;
  }
  
  .gather-label {
    font-size: 0.75rem;
  }
  
  .painting-toolbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    top: 20px;
  }
  
  .toolbar-group {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  
  .toolbar-group label {
    margin-bottom: 0.5rem;
  }
  
  .palette-swatches,
  .tool-swatches,
  .template-swatches {
    flex-wrap: wrap;
  }
  
  .paint-swatch,
  .tool-swatch,
  .template-swatch {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
  }
  
  #painting-canvas {
    width: 95vw !important;
    height: auto !important;
    max-height: 50vh;
  }
  
  #inventory-panel,
  #tools-panel {
    min-width: 200px;
    max-width: 300px;
    bottom: 10px;
    left: 10px;
  }
  
  #tools-panel {
    right: 10px;
    left: auto;
  }
  
  #badges-display {
    top: 90px;
    left: 10px;
    min-width: 100px;
  }
  
  .badges-title {
    font-size: 0.7rem;
  }
  
  .badge-item {
    font-size: 1.2rem;
  }
  
  .minigame-content {
    padding: 1rem;
    width: 98vw;
    height: 95vh;
    min-height: 500px;
    max-height: 95vh;
    overflow-y: auto;
  }
  
  .minigame-container {
    height: calc(90vh - 200px);
    min-height: 400px;
  }
  
  .tree {
    width: 60px;
    height: 90px;
  }
  
  .tree-canopy {
    width: 50px;
    height: 50px;
  }
  
  .resource-deposit {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }
  
  .cave-map {
    width: 95%;
    height: 250px;
  }
  
  .template-canvas {
    width: 95%;
    height: 200px;
  }
  
  .animal-reference {
    font-size: 5rem;
  }
  
  .modal-content {
    max-width: 98%;
    max-height: 95vh;
    width: 98vw;
    height: 95vh;
    padding: 1.5rem;
  }
  
  .codex-tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .codex-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
  }
  
  .result-icon {
    font-size: 4rem;
  }
  
  .result-text {
    font-size: 2rem;
  }
  
  .result-reward {
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
  }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(26, 20, 16, 0.5);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--ochre-yellow);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ochre-red);
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus indicators */
*:focus-visible {
  outline: 3px solid var(--ochre-yellow);
  outline-offset: 2px;
}

button:focus-visible,
.nav-btn:focus-visible,
.icon-btn:focus-visible {
  box-shadow: 0 0 0 4px rgba(218, 165, 32, 0.4);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --ochre-yellow: #FFD700;
    --ochre-red: #FF4500;
    --limestone: #FFFFFF;
    --charcoal-black: #000000;
  }
}

/* Keyboard shortcuts styling */
kbd {
  display: inline-block;
  padding: 3px 8px;
  font-family: monospace;
  font-size: 0.9em;
  color: var(--charcoal-black);
  background-color: var(--limestone);
  border: 1px solid #999;
  border-radius: 3px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  margin: 0 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--ochre-red);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 10000;
}

.skip-link:focus {
  top: 0;
}

/* ========================================
   UTILITY ANIMATIONS
   ======================================== */

.shake {
  animation: shake 0.5s ease;
}

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

.pop-in {
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.fly-to-inventory {
  animation: flyToInventory 0.8s ease-out;
}

@keyframes flyToInventory {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-400px, 300px) scale(0.3);
  }
}

/* ========================================
   BADGES DISPLAY
   ======================================== */

#badges-display {
  display: none; /* Hidden - now using modal */
  position: fixed;
  top: 100px;
  left: 20px;
  background: rgba(26, 20, 16, 0.95);
  border: 3px solid var(--ochre-yellow);
  border-radius: 12px;
  padding: 0.8rem;
  z-index: 80;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-deep);
  min-width: 140px;
}

.badges-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--ochre-yellow);
  margin-bottom: 0.5rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#badges-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.badge-item {
  aspect-ratio: 1;
  background: rgba(60, 50, 40, 0.8);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  position: relative;
  transition: all 0.3s ease;
}

.badge-item.earned {
  border-color: var(--ochre-yellow);
  background: rgba(218, 165, 32, 0.2);
  box-shadow: 0 0 15px rgba(218, 165, 32, 0.4);
}

.badge-item.locked {
  opacity: 0.3;
  filter: grayscale(100%);
}

/* Workshop mini-game specific styles */
.grinding-circle {
  position: absolute;
  width: 300px;
  height: 300px;
  border: 4px solid var(--stone-gray);
  border-radius: 50%;
  background: radial-gradient(circle, #696969 0%, #505050 100%);
  box-shadow: inset 0 20px 40px rgba(0, 0, 0, 0.6);
}

.grinding-motion {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, #808080 0%, #606060 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  cursor: move;
  transition: transform 0.1s;
}

.pigment-chunks {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pigment-chunk {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 30%;
  transition: all 0.3s ease;
}

.rhythm-indicator {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.rhythm-beat {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--ochre-yellow);
  background: rgba(218, 165, 32, 0.2);
  transition: all 0.2s;
}

.rhythm-beat.active {
  background: var(--ochre-yellow);
  transform: scale(1.2);
  box-shadow: 0 0 20px var(--ochre-yellow);
}

/* ========================================
   MINI-GAME MODAL
   ======================================== */

.minigame-content {
  max-width: 95vw;
  width: 95vw;
  height: 95vh;
  min-height: 600px;
  padding: 2rem;
}

.minigame-instructions {
  background: rgba(60, 50, 40, 0.8);
  border: 2px solid var(--ochre-yellow);
  border-radius: 8px;
  padding: 0.3rem 0.75rem;
  margin-bottom: 0.4rem;
  text-align: center;
  color: var(--limestone);
  font-size: 0.75rem;
  line-height: 1.2;
  flex-shrink: 0;
  max-height: 65px;
  overflow: auto;
}

.minigame-container {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  background: linear-gradient(180deg, #87CEEB 0%, #B0D4E3 40%, #8B7355 100%);
  border: 3px solid var(--stone-gray);
  border-radius: 12px;
  /* Allow the inner minigame area to scroll when content (like many rock cards) is larger than available space */
  overflow: auto;
  margin-bottom: 0.75rem;
  max-height: calc(95vh - 260px); /* leave room for header/instructions/controls */
}

.minigame-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
  min-height: 60px;
}

.minigame-fact {
  background: rgba(218, 165, 32, 0.15);
  border: 2px solid var(--ochre-yellow);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  color: var(--ochre-yellow);
  font-size: 0.75rem;
  line-height: 1.3;
  text-align: center;
  font-style: italic;
  flex-shrink: 0;
  max-height: 50px;
  overflow: hidden;
}

/* ========================================
   ENHANCED MINI-GAME VISUALS
   ======================================== */

/* Parallax Landscape Layers */
.minigame-parallax {
  position: absolute;
  width: 100%;
  height: 100%;
  transition: transform 0.1s linear;
}

.minigame-sky {
  background: linear-gradient(180deg, #4A90E2 0%, #87CEEB 40%, #B0D4E3 100%);
  z-index: 1;
}

.minigame-mountains {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(to bottom, transparent 0%, #6B8E23 40%, #556B2F 100%);
  clip-path: polygon(0 60%, 10% 45%, 20% 55%, 30% 40%, 40% 50%, 50% 35%, 60% 45%, 70% 30%, 80% 40%, 90% 50%, 100% 55%, 100% 100%, 0 100%);
  z-index: 2;
}

.minigame-forest {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(to bottom, rgba(107, 142, 35, 0) 0%, rgba(107, 142, 35, 0.6) 30%, #556B2F 100%);
  z-index: 3;
}

.minigame-ground {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 30%;
  background: linear-gradient(180deg, #8B7355 0%, #6B5844 50%, #5C4033 100%);
  z-index: 4;
  box-shadow: inset 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Weather Effects */
.weather-clouds {
  position: absolute;
  width: 120px;
  height: 50px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50px;
  animation: weatherCloudDrift 40s linear infinite;
  z-index: 2;
}

.weather-clouds::before,
.weather-clouds::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}

.weather-clouds::before {
  width: 60px;
  height: 60px;
  top: -25px;
  left: 20px;
}

.weather-clouds::after {
  width: 70px;
  height: 50px;
  top: -20px;
  right: 20px;
}

@keyframes weatherCloudDrift {
  from { transform: translateX(-150px); }
  to { transform: translateX(calc(100vw + 150px)); }
}

.weather-rain {
  position: absolute;
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, transparent, rgba(100, 150, 200, 0.6));
  animation: rainFall 0.5s linear infinite;
}

@keyframes rainFall {
  from { transform: translateY(-20px); opacity: 1; }
  to { transform: translateY(420px); opacity: 0; }
}

/* Enhanced Character Sprite */
.character-sprite {
  position: absolute;
  width: 32px;
  height: 48px;
  background: linear-gradient(135deg, var(--ochre-red) 0%, var(--ochre-orange) 100%);
  border-radius: 50% 50% 0 0;
  transition: left 0.1s, bottom 0.1s;
  z-index: 10;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.character-sprite::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 16px;
  background: var(--earth-brown);
  border-radius: 50%;
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.3);
}

.character-sprite::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 8px;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  z-index: -1;
}

.character-sprite.walking {
  animation: characterWalk 0.4s steps(2) infinite;
}

@keyframes characterWalk {
  0% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.character-sprite.carrying::after {
  content: '📦';
  position: absolute;
  top: -10px;
  right: -8px;
  font-size: 1rem;
}

/* Game obstacles */
.obstacle {
  position: absolute;
  background: var(--stone-gray);
  border-radius: 50%;
}

.obstacle.rock {
  width: 40px;
  height: 30px;
  background: linear-gradient(135deg, #696969 0%, #505050 100%);
  border-radius: 40%;
}

.obstacle.water {
  width: 100px;
  height: 40px;
  background: rgba(70, 130, 180, 0.6);
  border-radius: 50%;
  animation: waterShimmer 2s ease-in-out infinite;
}

@keyframes waterShimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.8; }
}

/* Enhanced Resource Deposits */
.resource-deposit {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: depositGlow 2s ease-in-out infinite;
  border: 4px solid rgba(218, 165, 32, 0.6);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), inset 0 -4px 8px rgba(0, 0, 0, 0.2);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.3), transparent 60%);
  backdrop-filter: blur(2px);
}

.resource-deposit::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: inherit;
  filter: blur(10px);
  opacity: 0.6;
  z-index: -1;
}

.resource-deposit.quality-high {
  border-color: #FFD700;
  animation: qualityPulse 1.5s ease-in-out infinite;
}

.resource-deposit.quality-medium {
  border-color: #DAA520;
}

.resource-deposit.quality-low {
  border-color: #8B7355;
  opacity: 0.7;
}

@keyframes qualityPulse {
  0%, 100% {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.5);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 50px rgba(255, 215, 0, 0.8);
    transform: scale(1.05);
  }
}

.resource-deposit:hover {
  transform: scale(1.2);
}

@keyframes depositGlow {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(218, 165, 32, 0.4), 0 8px 20px rgba(0, 0, 0, 0.4);
  }
  50% { 
    box-shadow: 0 0 40px rgba(218, 165, 32, 0.8), 0 12px 30px rgba(0, 0, 0, 0.5);
  }
}

/* Stamina & Resource Bars */
.stat-bar-container {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 250px;
  z-index: 100;
}

.stat-bar {
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid var(--ochre-yellow);
  border-radius: 10px;
  padding: 8px;
  backdrop-filter: blur(5px);
}

.stat-bar-label {
  color: var(--ochre-yellow);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-bar-fill {
  height: 20px;
  background: linear-gradient(90deg, var(--fire-orange) 0%, var(--fire-yellow) 100%);
  border-radius: 4px;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.75rem;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.stat-bar-fill.low {
  background: linear-gradient(90deg, #C00000 0%, #FF4444 100%);
}

.stat-bar-fill.high {
  background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 30px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--stone-gray);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ochre-red) 0%, var(--ochre-yellow) 100%);
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.9rem;
}

/* Temperature gauge */
.temperature-gauge {
  width: 100%;
  height: 40px;
  background: linear-gradient(90deg, 
    #4A90E2 0%, 
    #4CAF50 25%,
    #FDB813 50%,
    #FF6B35 75%,
    #C00000 100%
  );
  border: 3px solid var(--stone-gray);
  border-radius: 12px;
  position: relative;
  margin-bottom: 1rem;
}

.temp-indicator {
  position: absolute;
  top: -5px;
  width: 4px;
  height: 50px;
  background: white;
  box-shadow: 0 0 10px white;
  transition: left 0.3s;
}

/* Enhanced Trees for Wood Gathering */
.tree {
  position: absolute;
  width: 80px;
  height: 120px;
  cursor: pointer;
  transition: all 0.3s ease;
  filter: drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.3));
}

.tree:hover {
  transform: scale(1.1);
  filter: drop-shadow(6px 6px 12px rgba(0, 0, 0, 0.5)) brightness(1.1);
}

.tree:hover {
  transform: scale(1.1);
}

.tree-trunk {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 45px;
  background: linear-gradient(90deg, #5C4033 0%, #4A3526 50%, #5C4033 100%);
  border-radius: 4px;
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.4), 2px 2px 6px rgba(0, 0, 0, 0.3);
}

.tree-trunk::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 30%;
  bottom: 0;
  background: linear-gradient(to top, rgba(92, 64, 51, 0.5), transparent);
  border-radius: 4px;
}

.tree-canopy {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 70px;
  background: radial-gradient(circle at 30% 30%, #8BC34A, var(--grass-green) 60%, #556B2F);
  border-radius: 50%;
  box-shadow: inset -4px -4px 12px rgba(0, 0, 0, 0.3), 4px 4px 12px rgba(0, 0, 0, 0.3);
}

.tree-canopy::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 20%;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  filter: blur(4px);
}

.tree.pine .tree-canopy {
  border-radius: 50% 50% 0 0;
  background: linear-gradient(135deg, #3d6026 0%, #2d5016 50%, #1d4010 100%);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  width: 60px;
  height: 80px;
}

.tree.juniper .tree-canopy {
  background: radial-gradient(circle at 30% 30%, #556B2F, #3d5016 60%, #2d4010);
}

.tree.oak .tree-canopy {
  background: radial-gradient(circle at 30% 30%, #7CB342, #6B8E23 60%, #556B2F);
  border-radius: 40%;
}

.tree.willow .tree-canopy {
  background: radial-gradient(ellipse at 30% 30%, #9CCC65, #7CB342 60%, #6B8E23);
  border-radius: 50% 50% 60% 60%;
}

.tree.correct {
  border: 4px solid #4CAF50;
  border-radius: 12px;
  padding: 8px;
  background: rgba(76, 175, 80, 0.2);
  box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), inset 0 0 20px rgba(76, 175, 80, 0.2);
  animation: correctPulse 0.5s ease-out;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1.1); }
}

.tree.wrong {
  border: 4px solid #C00000;
  border-radius: 12px;
  padding: 8px;
  opacity: 0.4;
  background: rgba(192, 0, 0, 0.2);
  box-shadow: 0 0 20px rgba(192, 0, 0, 0.4);
  animation: wrongShake 0.5s ease-out;
  filter: grayscale(70%);
}

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

/* Enhanced Fire Pit */
.minigame-fire {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 120px;
}

.minigame-fire::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 20px;
  background: radial-gradient(ellipse, rgba(92, 64, 51, 0.8) 0%, transparent 70%);
  border-radius: 50%;
}

/* Stone Lamp Visualization */
.stone-lamp {
  position: absolute;
  width: 100px;
  height: 60px;
  background: linear-gradient(135deg, #696969 0%, #505050 100%);
  border-radius: 50% 50% 40% 40%;
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.stone-lamp::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 60%;
  background: radial-gradient(ellipse, rgba(255, 140, 0, 0.6) 0%, rgba(255, 140, 0, 0.2) 50%, transparent 70%);
  border-radius: 50%;
}

.lamp-flame {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 40px;
  background: linear-gradient(to top, var(--fire-orange) 0%, var(--fire-yellow) 70%, transparent 100%);
  border-radius: 50% 50% 0 0;
  animation: flicker1 0.3s ease-in-out infinite;
  filter: blur(2px);
}

/* Grinding Stone Visualization */
.grinding-visualization {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 20px auto;
}

.grinding-base {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #696969 0%, #505050 100%);
  border-radius: 50%;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.4);
}

.grinding-stone {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 50%;
  background: radial-gradient(ellipse, #808080 0%, #606060 100%);
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  animation: grindRotate 2s linear infinite paused;
}

.grinding-stone.active {
  animation-play-state: running;
}

@keyframes grindRotate {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.pigment-pile {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 20px;
  border-radius: 50%;
  transition: all 0.3s ease;
}

/* Paint Mixing Visualization */
.mixing-bowl {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 20px auto;
  background: radial-gradient(circle at 30% 30%, #8B7355 0%, #5C4033 100%);
  border-radius: 50%;
  box-shadow: inset 0 15px 40px rgba(0, 0, 0, 0.6), 0 10px 30px rgba(0, 0, 0, 0.5);
}

.mixing-bowl::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border-radius: 50%;
  border: 3px solid rgba(92, 64, 51, 0.4);
}

.paint-mixture {
  position: absolute;
  top: 30px;
  left: 30px;
  right: 30px;
  bottom: 30px;
  border-radius: 50%;
  transition: background 0.5s ease;
  box-shadow: inset 0 -10px 20px rgba(0, 0, 0, 0.4);
}

.mixing-stick {
  position: absolute;
  top: 10%;
  left: 50%;
  width: 8px;
  height: 60%;
  background: linear-gradient(90deg, #4A3526 0%, #5C4033 50%, #4A3526 100%);
  border-radius: 4px;
  transform-origin: top center;
  animation: mixStir 2s linear infinite paused;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.mixing-stick.active {
  animation-play-state: running;
}

@keyframes mixStir {
  0% { transform: translateX(-50%) rotate(0deg); }
  100% { transform: translateX(-50%) rotate(360deg); }
}

/* Brush Making Visualization */
.brush-construction {
  position: relative;
  width: 300px;
  height: 200px;
  margin: 20px auto;
}

.brush-handle {
  position: absolute;
  left: 20%;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 12px;
  background: linear-gradient(90deg, #5C4033 0%, #6B5844 100%);
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.brush-bristles {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 60px;
  background: linear-gradient(to bottom, #8B7355 0%, #D2B48C 100%);
  clip-path: polygon(30% 0%, 70% 0%, 100% 100%, 0% 100%);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.5s ease;
}

.brush-bristles.visible {
  opacity: 1;
}

/* Cave Mapping Visualization */
.cave-map {
  position: relative;
  width: 90%;
  height: 90%;
  margin: 20px auto;
  background: linear-gradient(135deg, #2C1810 0%, #1a1410 50%, #0a0806 100%);
  border: 4px solid var(--stone-gray);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), 0 10px 30px rgba(0, 0, 0, 0.6);
}

.cave-passage {
  position: absolute;
  background: rgba(139, 115, 85, 0.2);
  border: 2px solid rgba(218, 165, 32, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.cave-passage:hover {
  background: rgba(218, 165, 32, 0.3);
  border-color: var(--ochre-yellow);
  box-shadow: 0 0 20px rgba(218, 165, 32, 0.5);
}

.cave-passage.lit {
  background: rgba(255, 140, 0, 0.3);
  border-color: var(--fire-orange);
  box-shadow: 0 0 30px rgba(255, 140, 0, 0.6);
}

.light-source-icon {
  position: absolute;
  font-size: 1.5rem;
  animation: lightFlicker 1s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 140, 0, 0.8));
}

@keyframes lightFlicker {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Template Creation Canvas */
.template-canvas {
  position: relative;
  width: 90%;
  height: 300px;
  margin: 10px auto;
  background: linear-gradient(135deg, #3C3020 0%, #2C2418 100%);
  border: 4px solid var(--stone-gray);
  border-radius: 12px;
  box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.6), 0 8px 20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.template-grid {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(218, 165, 32, 0.1) 19px, rgba(218, 165, 32, 0.1) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(218, 165, 32, 0.1) 19px, rgba(218, 165, 32, 0.1) 20px);
}

.animal-reference {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 8rem;
  opacity: 0.3;
  filter: grayscale(100%);
}

.drawing-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Quality Indicators */
.quality-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

.quality-badge.excellent {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #1C1C1C;
  border: 2px solid #FFF;
}

.quality-badge.good {
  background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
  color: white;
  border: 2px solid #CDDC39;
}

.quality-badge.poor {
  background: linear-gradient(135deg, #8B7355 0%, #6B5844 100%);
  color: white;
  border: 2px solid #5C4033;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.minigame-fire .flame {
  filter: blur(3px);
}

/* Enhanced Success/Failure Overlay */
.result-overlay {
  /* Make the result overlay fixed so it remains visible above scrolling modal content */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.95) 100%);
  z-index: 3000;
  animation: fadeIn 0.5s;
  backdrop-filter: blur(5px);
}

.result-overlay::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(218, 165, 32, 0.1) 0%, transparent 50%);
  animation: resultGlow 2s ease-in-out infinite;
}

@keyframes resultGlow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

.result-icon {
  font-size: 6rem;
  margin-bottom: 1.5rem;
  animation: iconBounce 0.6s ease-out;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
  z-index: 1;
}

@keyframes iconBounce {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  60% { transform: scale(1.2) rotate(10deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-text {
  font-family: var(--font-title);
  font-size: 3rem;
  color: var(--ochre-yellow);
  margin-bottom: 1rem;
  text-shadow: 0 0 20px rgba(218, 165, 32, 0.6), 0 4px 8px rgba(0, 0, 0, 0.8);
  animation: textGlow 1s ease-out;
  z-index: 1;
  letter-spacing: 3px;
}

@keyframes textGlow {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

.result-reward {
  font-size: 1.3rem;
  color: var(--limestone);
  margin-bottom: 2rem;
  padding: 1rem 2rem;
  background: rgba(218, 165, 32, 0.2);
  border: 2px solid var(--ochre-yellow);
  border-radius: 12px;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: rewardSlide 0.8s ease-out 0.3s both;
  z-index: 1;
}

@keyframes rewardSlide {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.result-details {
  font-size: 1rem;
  color: var(--ochre-orange);
  margin-bottom: 1.5rem;
  text-align: center;
  max-width: 400px;
  line-height: 1.6;
  z-index: 1;
}

.result-overlay .btn-primary {
  z-index: 1;
  animation: buttonAppear 1s ease-out 0.5s both;
}

@keyframes buttonAppear {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* ========================================
   MOUNTAIN EXPEDITION - ENHANCED STYLES
   ======================================== */

.mountain-journey-ui {
  font-family: var(--font-body);
}

.stat-panel {
  background: rgba(139, 69, 19, 0.3);
  padding: 10px;
  border-radius: 8px;
  border: 2px solid rgba(218, 165, 32, 0.4);
}

.stat-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--ochre-yellow);
  margin-bottom: 5px;
  text-align: center;
}

.stat-bar-bg {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  overflow: hidden;
  height: 16px;
  margin-bottom: 5px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

.stat-bar-fill {
  height: 100%;
  transition: width 0.5s ease, background 0.3s ease;
  border-radius: 4px;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-size: 0.8rem;
  font-weight: bold;
  color: white;
  text-align: center;
}

.expedition-landscape {
  animation: fadeIn 1s ease-out;
}

.expedition-character {
  animation: characterWalk 0.5s steps(2) infinite;
}

@keyframes characterWalk {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes cloudDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 200px)); }
}

.expedition-action-btn {
  min-width: 150px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.expedition-action-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(218, 165, 32, 0.5);
}

.rock-sample-card.tested {
  cursor: not-allowed;
  pointer-events: none;
}

/* Grinding Particles */
.grinding-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFloat 1s ease-out forwards;
}

@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--px), var(--py)) scale(0.5);
  }
}

/* Enhanced Lighting for Expedition */
.expedition-ground::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 30px,
    rgba(92, 64, 51, 0.1) 30px,
    rgba(92, 64, 51, 0.1) 60px
  );
  pointer-events: none;
}

/* Weather Effects */
.expedition-rain {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.raindrop {
  position: absolute;
  width: 2px;
  height: 20px;
  background: linear-gradient(to bottom, transparent, rgba(174, 214, 241, 0.8));
  animation: rainFall 0.5s linear infinite;
  top: -20px;
}

@keyframes rainFall {
  0% { 
    transform: translateY(0); 
    opacity: 0.8; 
  }
  100% { 
    transform: translateY(calc(100vh + 20px)); 
    opacity: 0; 
  }
}

/* Success Celebration Particles */
.celebration-particle {
  position: absolute;
  font-size: 2rem;
  animation: celebrationFloat 2s ease-out forwards;
  pointer-events: none;
}

@keyframes celebrationFloat {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(0);
  }
  100% {
    opacity: 0;
    transform: translate(var(--tx, 0), var(--ty, -100px)) rotate(360deg) scale(1);
  }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .mountain-journey-ui {
    min-width: 90%;
    padding: 15px;
  }
  
  .expedition-character {
    font-size: 3rem;
  }
  
  .rock-sample-card {
    min-width: 90px;
  }
  
  .expedition-action-btn {
    font-size: 0.9rem;
    padding: 10px 18px;
    min-width: 120px;
  }
}

/* Event Log Styles */
#event-log {
  scrollbar-width: thin;
  scrollbar-color: rgba(218, 165, 32, 0.5) rgba(0, 0, 0, 0.3);
}

#event-log::-webkit-scrollbar {
  width: 6px;
}

#event-log::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

#event-log::-webkit-scrollbar-thumb {
  background: rgba(218, 165, 32, 0.5);
  border-radius: 3px;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(218, 165, 32, 0.2);
  font-family: var(--font-body);
  line-height: 1.4;
}

.log-entry:first-child {
  color: var(--ochre-yellow);
  font-weight: bold;
}

/* Rock Testing Enhanced Styles */
.btn-test-small {
  background: rgba(94, 82, 64, 0.7);
  border: 2px solid var(--stone-gray);
  border-radius: 6px;
  color: var(--limestone);
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-body);
  font-weight: 600;
}

.btn-test-small:hover:not(:disabled) {
  background: rgba(94, 82, 64, 1);
  border-color: var(--ochre-yellow);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.btn-test-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-identify:hover {
  background: rgba(76, 175, 80, 0.5) !important;
  border-color: #66BB6A !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.5);
}

.rock-sample-card.identified {
  cursor: not-allowed;
  pointer-events: none;
}

.test-results {
  background: rgba(0, 0, 0, 0.4);
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
}

.test-results > div {
  transition: opacity 0.5s ease;
}

/* Riverbank landscape visuals - redesigned */
.landscape-explorer {
  /* Match the sprite/image size so children fully cover the wrapper */
  width: 36px;
  height: 44px;
  /* Keep a neutral default so scenes that intentionally use the wrapper without an image
     still get a visual marker. This will be removed automatically when an image or
     sprite-sheet child is present (see :has rule below). */
  background: linear-gradient(180deg, rgba(139,69,19,0.9) 0%, rgba(101,67,33,0.95) 100%);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: transform 0.15s ease;
  position: absolute;
}

/* If the wrapper contains an actual image or sprite, hide the decorative background so
   the sprite is visible without the old rounded rectangle showing behind it. Uses
   the modern :has() selector to detect children. */
.landscape-explorer:has(.character-img),
.landscape-explorer:has(.sprite-sheet) {
  background: transparent !important;
  box-shadow: none !important;
}

/* Also hide decorative pseudo-elements (small head/shadow) when a real image/sprite is present
   to avoid showing the old rounded/colored artifact behind the sprite. */
.landscape-explorer:has(.character-img)::before,
.landscape-explorer:has(.sprite-sheet)::before,
.landscape-explorer:has(.character-img)::after,
.landscape-explorer:has(.sprite-sheet)::after {
  display: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Generic: hide decorative pseudo-elements on any character wrapper when a real
   image or sprite-sheet child is present. Covers cave, platformer, expedition, etc. */
.character-sprite:has(.character-img)::before,
.character-sprite:has(.sprite-sheet)::before,
.character-sprite:has(.character-img)::after,
.character-sprite:has(.sprite-sheet)::after,
.expedition-character:has(.character-img)::before,
.expedition-character:has(.sprite-sheet)::before,
.expedition-character:has(.character-img)::after,
.expedition-character:has(.sprite-sheet)::after {
  display: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.landscape-explorer.walking {
  transform: translateY(-3px);
}

/* Improved deposit visuals */
.resource-deposit {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 -2px 8px rgba(0,0,0,0.25);
  cursor: default;
  transition: transform 180ms ease, opacity 180ms ease;
  border: 2px solid rgba(255,255,255,0.15);
}

.resource-deposit.collected {
  transform: scale(1.3) rotate(15deg);
  opacity: 0.4;
}

/* Landscape layers styling */
.riverbank-sky,
.distant-hills,
.ochre-ledge,
.riverbank-ground,
.landscape-river {
  pointer-events: none;
}

.ochre-ledge::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 5%;
  right: 5%;
  height: 30%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(139,69,19,0.15) 20%, 
    rgba(139,69,19,0.25) 50%, 
    rgba(139,69,19,0.15) 80%, 
    transparent 100%);
  border-radius: 4px;
}

.riverbank-ground::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 25%;
  background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, transparent 100%);
}

/* Simplified - removed old hazard styles */

/* Pyrolysis visuals and controls */
.pyro-smoke {
  border-radius: 50%;
  background: radial-gradient(circle, rgba(220,220,220,0.28) 0%, rgba(160,160,160,0.16) 30%, rgba(0,0,0,0) 70%);
  filter: blur(10px) saturate(0.7);
  opacity: 0;
  transition: opacity 240ms ease, transform 400ms ease;
  pointer-events: none;
}

.pyro-ember {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255,160,80,1);
  box-shadow: 0 0 12px rgba(255,140,40,0.85);
  transition: box-shadow 200ms ease, background 200ms ease;
}

/* Styling for inline pyro controls to look slightly more compact */
#minigame-controls .btn-secondary.wood-type.active {
  border-color: #4CAF50;
  background: rgba(76,175,80,0.12);
}

#minigame-controls input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, #444 0%, #777 100%);
}

#minigame-controls input[type="checkbox"] {
  width: 18px; height: 18px;
}

/* Tree identification enhancements */
.tree.interactive { cursor: pointer; transition: transform 180ms ease, box-shadow 180ms ease; }
.tree.interactive:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.tree.inspected { outline: 3px solid rgba(218,165,32,0.25); box-shadow: 0 8px 24px rgba(218,165,32,0.08); }
.tree.collected { opacity: 0.6; transform: scale(0.98) translateY(-4px); filter: saturate(1.1); }
.tree.wrong { filter: grayscale(60%) brightness(0.9); }

.tree-tip {
  pointer-events: none;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(10,10,10,0.85);
  color: var(--limestone);
  border: 2px solid rgba(218,165,32,0.55);
  box-shadow: 0 6px 18px rgba(0,0,0,0.6);
}

/* small resin particle styling used by createParticleBurst */
.resin-particle { width:8px; height:8px; border-radius:50%; background:#FFD166; box-shadow:0 2px 6px rgba(255,180,80,0.8); }

/* Platformer character styles (Ochre Expedition look) */
.character-sprite.platformer-char {
  background: rgba(255,255,255,0.02);
  box-shadow: none;
}
.character-sprite.platformer-char::before,
.character-sprite.platformer-char::after {
  display: none !important;
}
.character-sprite.platformer-char.running {
  transform-origin: center;
}
.character-sprite.platformer-char.facing-left {
  transform: scaleX(-1);
}

