:root {
  --bg: #F5FAF7;
  --surface: #FFFFFF;
  --emerald: #2E8B57;
  --jade: #4AAE88;
  --mint: #BDEFE3;
  --silver: #E6EDF4;
  --gold: #D9B95B;
  --blue: #B9DFF7;
  --bark: #78624F;
  --moss: #8EB79E;
  --text: #23352B;
  --muted: #6F7C73;
  --grad: linear-gradient(135deg, #2E8B57, #4AAE88);
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-weight: normal;
  color: var(--text);
}

a {
  text-decoration: none;
  color: var(--emerald);
  transition: all 0.25s ease;
}

/* Typography */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Buttons */
.btn-primary, .cta-btn, button[type="submit"], .game-controls button, .cookie-actions button {
  display: inline-block;
  background: var(--grad);
  color: var(--surface);
  padding: 10px 24px;
  border-radius: 20px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  text-decoration: none;
  font-size: 1rem;
}

.btn-primary:hover, .cta-btn:hover, button[type="submit"]:hover, .game-controls button:hover, .cookie-actions button:hover {
  box-shadow: 0 0 15px var(--emerald);
  transform: translateY(-2px);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--emerald);
  padding: 10px 24px;
  border-radius: 20px;
  border: 1px solid var(--emerald);
  font-weight: 500;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: var(--emerald);
  color: var(--surface);
  box-shadow: 0 0 15px var(--emerald);
}

/* Floating Canopy Header */
.floating-canopy {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #F5FAF7;
  border-bottom: 1px solid var(--emerald);
  box-shadow: 0 4px 15px rgba(46,139,87,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 40px;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Palatino Linotype", serif;
  font-size: 1.5rem;
  color: var(--emerald);
}

.logo svg {
  width: 24px;
  height: 24px;
  fill: var(--emerald);
  filter: drop-shadow(0 0 5px var(--mint));
}

.floating-canopy nav {
  display: flex;
  gap: 24px;
}

.floating-canopy nav a {
  color: var(--text);
  font-weight: 500;
}

.floating-canopy nav a:hover {
  color: var(--emerald);
  text-shadow: 0 0 8px var(--mint);
}

/* Layout constraints for homepage to stay ~2200px */
.home-section {
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Sky Bridge Welcome */
.sky-bridge {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 20px;
}

.sky-bridge h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--emerald);
}

.sky-bridge p {
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 25px;
}

.sky-bridge .actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Crystal Throne Court */
.throne-court {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-frame-container {
  width: 100%;
  max-width: 1020px;
  background: var(--surface);
  border: 4px solid var(--surface);
  outline: 2px solid var(--gold);
  border-radius: 26px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  margin-bottom: 20px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.game-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 22px;
  display: block;
}

.emerald-corner {
  position: absolute;
  width: 30px;
  height: 30px;
  background: var(--emerald);
  z-index: 10;
  pointer-events: none;
}
.emerald-corner.top-left { top: 0; left: 0; border-bottom-right-radius: 15px; border-top-left-radius: 22px; }
.emerald-corner.top-right { top: 0; right: 0; border-bottom-left-radius: 15px; border-top-right-radius: 22px; }
.emerald-corner.bottom-left { bottom: 0; left: 0; border-top-right-radius: 15px; border-bottom-left-radius: 22px; }
.emerald-corner.bottom-right { bottom: 0; right: 0; border-top-left-radius: 15px; border-bottom-right-radius: 22px; }

.game-controls {
  display: flex;
  gap: 15px;
}

/* Root Compass Garden */
.compass-garden {
  padding: 60px 20px 20px;
  display: flex;
  justify-content: center;
}

.compass-circle {
  position: relative;
  width: 320px;
  height: 320px;
}

.compass-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: var(--bg);
  border: 1px solid var(--emerald);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald);
}

.magical-stone {
  position: absolute;
  width: 110px;
  height: 110px;
  background: var(--surface);
  border: 1px solid var(--mint);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  transition: all 0.25s ease;
  padding: 10px;
}

.magical-stone:hover {
  box-shadow: 0 0 15px var(--emerald);
  color: var(--emerald);
  transform: scale(1.05);
}

.stone-top { top: -20px; left: 50%; margin-left: -55px; }
.stone-bottom { bottom: -20px; left: 50%; margin-left: -55px; }
.stone-left { top: 50%; left: -20px; margin-top: -55px; }
.stone-right { top: 50%; right: -20px; margin-top: -55px; }

/* Ancient Wisdom Gallery */
.wisdom-gallery {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.scroll-panel {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--mint);
  border-radius: 12px;
  overflow: hidden;
  height: 140px;
  transition: all 0.25s ease;
}

.scroll-panel:hover {
  box-shadow: 0 4px 15px rgba(46,139,87,0.1);
}

.scroll-panel img {
  width: 220px;
  height: 100%;
  object-fit: cover;
  border-right: 1px solid var(--mint);
}

.panel-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
}

.panel-content h3 {
  color: var(--emerald);
  margin-bottom: 5px;
}

.panel-content p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.panel-content a {
  font-weight: 500;
  font-size: 0.9rem;
}

/* Royal Messenger Hall */
.messenger-hall {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: var(--surface);
  border: 1px solid var(--silver);
  border-radius: 16px;
  padding: 40px;
}

.contact-info h2 {
  font-size: 2rem;
  color: var(--emerald);
  margin-bottom: 15px;
}

.contact-info p {
  margin-bottom: 20px;
  color: var(--muted);
}

.messenger-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.messenger-form input, .messenger-form textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--silver);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  transition: all 0.25s ease;
}

.messenger-form input:focus, .messenger-form textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 5px var(--mint);
}

.messenger-form textarea {
  resize: vertical;
  min-height: 100px;
}

/* Kingdom Footer */
.kingdom-footer {
  background: var(--bg);
  padding: 60px 40px 20px;
  border-top: 1px solid var(--mint);
}

.directory-tablets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto 40px;
}

.stone-tablet {
  background: var(--surface);
  border: 2px solid var(--silver);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
  transition: all 0.25s ease;
}

.stone-tablet:hover {
  border-color: var(--mint);
  box-shadow: 0 4px 12px rgba(46,139,87,0.05);
}

.stone-tablet h4 {
  color: var(--emerald);
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.stone-tablet p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 15px;
}

.stone-tablet ul {
  list-style: none;
}

.stone-tablet ul li {
  margin-bottom: 8px;
}

.stone-tablet ul li a {
  color: var(--text);
  font-size: 0.9rem;
}

.stone-tablet ul li a:hover {
  color: var(--emerald);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-divider {
  height: 1px;
  background: var(--emerald);
  margin-bottom: 20px;
  opacity: 0.3;
}

.footer-bottom svg {
  width: 30px;
  height: 30px;
  fill: var(--emerald);
  margin-bottom: 15px;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 800px;
  margin: 0 auto;
}

/* Cookie Popup */
.cookie-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(245, 250, 247, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.scroll-case {
  background: var(--surface);
  border: 2px solid var(--emerald);
  border-radius: 16px;
  padding: 30px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(46,139,87,0.15);
}

.cookie-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.scroll-case p {
  margin-bottom: 20px;
  color: var(--text);
  font-size: 0.95rem;
}

.cookie-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* Subpages Content */
.page-container {
  max-width: 800px;
  margin: 60px auto;
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--mint);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.page-container h1 {
  color: var(--emerald);
  margin-bottom: 20px;
  font-size: 2.2rem;
}

.page-container h2 {
  color: var(--jade);
  margin: 25px 0 15px;
  font-size: 1.5rem;
}

.page-container p, .page-container ul {
  margin-bottom: 15px;
  color: var(--muted);
}

.page-container ul {
  padding-left: 20px;
}

.btn-return {
  display: inline-block;
  margin-bottom: 30px;
  font-size: 0.9rem;
  color: var(--emerald);
}

.btn-return:hover {
  text-shadow: 0 0 5px var(--mint);
}

/* Responsive */
@media (max-width: 900px) {
  .messenger-hall { grid-template-columns: 1fr; }
  .floating-canopy { padding: 15px 20px; }
  .floating-canopy nav { display: none; /* simple hide for mobile on this demo */ }
}
@media (max-width: 600px) {
  .scroll-panel { flex-direction: column; height: auto; }
  .scroll-panel img { width: 100%; height: 150px; border-right: none; border-bottom: 1px solid var(--mint); }
  .compass-circle { width: 260px; height: 260px; }
  .magical-stone { width: 90px; height: 90px; font-size: 0.8rem; }
  .stone-top { margin-left: -45px; }
  .stone-bottom { margin-left: -45px; }
  .stone-left { margin-top: -45px; }
  .stone-right { margin-top: -45px; }
}