@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Noto+Sans+TC:wght@300;400;500;700&display=swap');

:root {
  --bg-color: #080a0f;
  --bg-dots: rgba(212, 175, 55, 0.03);
  --card-bg: rgba(18, 22, 30, 0.75);
  --card-bg-hover: rgba(26, 32, 44, 0.85);
  --card-border: rgba(212, 175, 55, 0.15);
  --card-border-active: rgba(212, 175, 55, 0.6);
  --gold: #cca43b;
  --gold-glow: rgba(204, 164, 59, 0.3);
  --gold-light: #f3e5ab;
  --portal-red: #ef4444;
  --portal-red-glow: rgba(239, 68, 68, 0.4);
  --magic-purple: #8b5cf6;
  --magic-purple-glow: rgba(139, 92, 246, 0.4);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --transition-speed: 0.3s;
}

/* Global Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(var(--bg-dots) 1px, transparent 0),
    radial-gradient(var(--bg-dots) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  color: var(--text-main);
  font-family: 'Noto Sans TC', sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #080a0f;
}
::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-light);
}

/* Typography */
h1, h2, h3, h4 {
  font-family: 'Cinzel', 'Noto Sans TC', serif;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  letter-spacing: 1px;
}

h1 {
  font-size: 2.8rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.8rem;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 0.5rem;
  margin: 2rem 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

h2::before {
  content: '✦';
  font-size: 1.2rem;
  color: var(--gold);
}

h3 {
  font-size: 1.3rem;
  margin: 1.5rem 0 0.8rem 0;
}

p {
  color: var(--text-main);
  margin-bottom: 1rem;
  text-align: justify;
}

strong {
  color: var(--gold-light);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-speed);
}

a:hover {
  color: var(--gold-light);
  text-decoration: underline;
}

/* Header & Navigation */
header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(8, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  transition: all var(--transition-speed);
}

header.scrolled {
  padding: 5px 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all var(--transition-speed);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--bg-color);
  background: var(--gold);
  text-decoration: none;
  box-shadow: 0 0 10px var(--gold-glow);
}

/* Hero Section */
.hero-section {
  padding: 140px 20px 60px 20px;
  text-align: center;
  position: relative;
  background: linear-gradient(180deg, rgba(20, 25, 35, 0.4) 0%, rgba(8, 10, 15, 0) 100%);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 10px auto 20px auto;
  font-family: 'Cinzel', serif;
}

.hero-badge {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(204, 164, 59, 0.1);
  border: 1px solid var(--gold);
  border-radius: 20px;
  color: var(--gold-light);
  font-size: 0.85rem;
  margin-bottom: 15px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Main Container */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 80px 20px;
}

.content-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 40px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.content-card:hover {
  border-color: rgba(212, 175, 55, 0.3);
}

/* Grid layout for Introduction Features */
.intro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.feature-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 20px;
  transition: all var(--transition-speed);
}

.feature-box:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--gold);
  transform: translateY(-3px);
}

.feature-title {
  color: var(--gold-light);
  font-size: 1.1rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Table Style */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 8px;
  border: 1px solid var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background: rgba(10, 12, 18, 0.6);
}

th, td {
  padding: 12px 15px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

th {
  background: rgba(204, 164, 59, 0.15);
  color: var(--gold-light);
  font-weight: 600;
  font-size: 0.95rem;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Orb of the Moons Interactive Simulator */
.simulator-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 30px;
  margin-top: 25px;
}

.grid-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.orb-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 320px;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--card-border);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.grid-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  aspect-ratio: 1;
  transition: all var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.grid-cell:hover:not(.player-cell) {
  background: rgba(204, 164, 59, 0.15);
  border-color: var(--gold);
  color: var(--gold-light);
  transform: scale(1.08);
  box-shadow: 0 0 8px var(--gold-glow);
}

.grid-cell.active:not(.player-cell) {
  background: var(--gold) !important;
  color: var(--bg-color) !important;
  border-color: var(--gold-light) !important;
  box-shadow: 0 0 15px var(--gold-glow) !important;
}

.grid-cell.player-cell {
  background: rgba(139, 92, 246, 0.15);
  border: 2px solid var(--magic-purple);
  color: var(--magic-purple);
  cursor: default;
  font-size: 1.1rem;
  box-shadow: 0 0 10px var(--magic-purple-glow);
}

.simulator-info {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
  position: relative;
  overflow: hidden;
}

.simulator-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold);
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.info-number {
  font-size: 0.85rem;
  font-weight: bold;
  background: rgba(204, 164, 59, 0.1);
  padding: 2px 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  color: var(--gold-light);
}

.info-name {
  font-size: 1.4rem;
  color: var(--gold-light);
  margin-bottom: 5px;
}

.info-type {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.info-description {
  flex-grow: 1;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 20px;
}

.info-badge {
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 4px;
}

.badge-shrine {
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid var(--magic-purple);
  color: #c084fc;
}

.badge-city {
  background: rgba(204, 164, 59, 0.2);
  border: 1px solid var(--gold);
  color: var(--gold-light);
}

.badge-dungeon {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--portal-red);
  color: #fca5a5;
}

.badge-empty {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
}

/* Rune Quests Grid */
.runes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.rune-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 20px;
  transition: all var(--transition-speed);
  position: relative;
}

.rune-card:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

.rune-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.rune-name {
  font-size: 1.15rem;
  color: var(--gold-light);
  font-weight: bold;
}

.rune-mantra {
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

.rune-location {
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 10px;
  font-weight: 500;
}

.rune-desc {
  font-size: 0.9rem;
  color: var(--text-main);
  text-align: justify;
}

/* Pirate Maps Grid */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.map-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 24px;
  transition: all var(--transition-speed);
  display: flex;
  flex-direction: column;
}

.map-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--gold);
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  transform: scale(1.02);
}

.map-card-number {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: var(--gold);
  margin-bottom: 5px;
  font-weight: bold;
}

.map-card-title {
  font-size: 1.1rem;
  color: var(--gold-light);
  font-weight: bold;
  margin-bottom: 12px;
}

.map-card-content {
  font-size: 0.9rem;
  color: var(--text-main);
  flex-grow: 1;
}

.map-card-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Timeline Layout */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 30px auto;
  padding: 20px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  width: 2px;
  background: var(--card-border);
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -1px;
}

.timeline-item {
  padding: 10px 40px;
  position: relative;
  background: transparent;
  width: 50%;
}

.timeline-item:nth-child(odd) {
  left: 0;
  text-align: right;
}

.timeline-item:nth-child(even) {
  left: 50%;
  text-align: left;
}

.timeline-item::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  right: -8px;
  background-color: var(--bg-color);
  border: 3px solid var(--gold);
  border-radius: 50%;
  top: 15px;
  z-index: 1;
  transition: all var(--transition-speed);
}

.timeline-item:nth-child(even)::after {
  left: -8px;
}

.timeline-item:hover::after {
  background-color: var(--gold-light);
  box-shadow: 0 0 10px var(--gold-glow);
  transform: scale(1.2);
}

.timeline-content {
  padding: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  position: relative;
}

.timeline-item:hover .timeline-content {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.03);
}

.timeline-title {
  color: var(--gold-light);
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-weight: bold;
}

.timeline-text {
  font-size: 0.9rem;
  color: var(--text-main);
}

/* Callout Box */
.callout-box {
  background: rgba(204, 164, 59, 0.05);
  border-left: 4px solid var(--gold);
  padding: 20px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
}

.callout-title {
  font-family: 'Cinzel', serif;
  color: var(--gold-light);
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Footer */
footer {
  border-top: 1px solid var(--card-border);
  padding: 40px 20px;
  text-align: center;
  background: #06080b;
}

.footer-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Responsive Styles */
@media (max-width: 900px) {
  .simulator-container {
    grid-template-columns: 1fr;
  }
  
  .timeline::before {
    left: 30px;
  }
  
  .timeline-item {
    width: 100%;
    padding-left: 70px;
    padding-right: 20px;
    text-align: left !important;
  }
  
  .timeline-item:nth-child(even) {
    left: 0;
  }
  
  .timeline-item::after {
    left: 22px !important;
    right: auto !important;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .nav-links {
    display: none; /* In production, we'd add a burger menu, but for walkthrough we keep it clean. */
  }
  
  .hero-section {
    padding-top: 100px;
  }
  
  .content-card {
    padding: 20px;
  }
}
