:root {
  --bg: #F5F2EA;
  --surface: #FFFFFF;
  --navy: #101B33;
  --blue: #234A8F;
  --silver: #C9D2DF;
  --gold: #D4AF37;
  --ivory: #F1E8D8;
  --champagne: #E8D6A3;
  --violet: #6D5BD0;
  --text-dark: #242424;
  --text-muted: #6E7280;
  --gradient: linear-gradient(135deg, #234A8F, #D4AF37);
  
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-dark);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, .brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--navy);
}

a {
  text-decoration: none;
  color: var(--blue);
  transition: color 0.2s ease;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* TOP SECURITY BANNER */
.top-security-banner {
  background-color: #000000;
  color: var(--silver);
  text-align: center;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  position: relative;
  z-index: 101;
}

.btn-primary {
  background: var(--gradient);
  color: var(--surface);
  padding: 12px 24px;
  border-radius: 16px;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-2px);
  color: var(--surface);
  opacity: 0.9;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--ivory);
  color: var(--gold);
  border: 1px solid var(--navy);
  padding: 12px 24px;
  border-radius: 16px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
  display: inline-block;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: var(--champagne);
}

.btn-secondary:active {
  transform: translateY(1px);
}

/* HEADER */
.floating-crest-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--navy);
  border-bottom: 2px solid var(--gold);
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crown-emblem {
  width: 24px;
  height: 24px;
  background: var(--silver);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M2 18h20v2H2v-2zm1-2l3-10 4 4 2-6 2 6 4-4 3 10H3z"/></svg>') no-repeat center / contain;
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M2 18h20v2H2v-2zm1-2l3-10 4 4 2-6 2 6 4-4 3 10H3z"/></svg>') no-repeat center / contain;
}

.brand-text {
  color: var(--surface);
  font-size: 1.25rem;
  letter-spacing: 0.5px;
}

.header-center nav ul {
  display: flex;
  gap: 2rem;
}

.header-center nav ul li a {
  color: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
}

.header-center nav ul li a:hover {
  color: var(--gold);
}

/* CELESTIAL GATE */
.celestial-gate {
  max-width: 800px;
  margin: 3rem auto 2rem;
  background: linear-gradient(to bottom, var(--surface), var(--ivory));
  border-radius: 24px;
  border: 1px solid var(--silver);
  padding: 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.celestial-pattern {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(var(--silver) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.2;
  pointer-events: none;
}

.celestial-gate h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.gold-divider {
  height: 2px;
  width: 60px;
  background: var(--gold);
  margin: 0 auto 1.5rem;
  position: relative;
  z-index: 1;
}

.celestial-gate p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.gate-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.celestial-gate-img {
  margin: 2rem auto 0;
  max-width: 600px;
  height: auto;
  border-radius: 12px;
  border: 2px solid var(--gold);
}

/* MOON COURT GAME PAVILION */
.moon-court {
  max-width: 1600px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 250px minmax(auto, 1050px) 250px;
  gap: 2rem;
  justify-content: center;
  align-items: start;
}

/* ROYAL TABLET */
.royal-tablet {
  background: var(--surface);
  border: 1px solid var(--silver);
  border-radius: 16px;
  padding: 1.5rem;
  position: relative;
}

.royal-tablet::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0; right: 0;
  border: 1px solid var(--ivory);
  border-radius: 16px;
  margin: 4px;
  pointer-events: none;
}

.tablet-item {
  margin-bottom: 1.5rem;
  text-align: center;
}

.tablet-item:last-child {
  margin-bottom: 0;
}

.crown-icon {
  color: var(--gold);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.tablet-item h3 {
  font-size: 1rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

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

.tablet-divider {
  height: 1px;
  background: var(--gold);
  opacity: 0.3;
  margin: 1rem auto;
  width: 80%;
}

/* GAME CENTER */
.game-center {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
}

.game-frame {
  background: var(--surface);
  border: 4px solid var(--gold);
  border-radius: 22px;
  padding: 12px;
  position: relative;
}

.game-inner-border {
  border: 2px solid var(--navy);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}

.game-inner-border iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.silver-corner {
  position: absolute;
  width: 20px; height: 20px;
  background: var(--silver);
  border-radius: 50%;
}
.corner-tl { top: -10px; left: -10px; }
.corner-tr { top: -10px; right: -10px; }
.corner-bl { bottom: -10px; left: -10px; }
.corner-br { bottom: -10px; right: -10px; }

.game-controls {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* CROWN LEDGER */
.crown-ledger {
  background: var(--navy);
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 1.5rem;
  color: var(--surface);
}

.crown-ledger h3 {
  color: var(--gold);
  margin-bottom: 1rem;
  text-align: center;
  font-size: 1.25rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  padding-bottom: 0.5rem;
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ledger-item {
  display: flex;
  flex-direction: column;
}

.ledger-label {
  font-size: 0.75rem;
  color: var(--silver);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ledger-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--surface);
}

/* STARLIT PROCESSION */
.starlit-procession {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
}

.starlit-procession::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 5%;
  right: 5%;
  height: 1px;
  background: var(--gold);
  z-index: 0;
}

.station {
  flex: 1;
  text-align: center;
  position: relative;
  z-index: 1;
  padding: 0 1rem;
}

.station-icon {
  width: 48px;
  height: 48px;
  background: var(--navy);
  border: 2px solid var(--gold);
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  font-size: 1.25rem;
}

.station h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

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

/* ROYAL ARCHIVE SALON */
.royal-archive {
  max-width: 1000px;
  margin: 0 auto 4rem;
  background: var(--ivory);
  border: 1px solid var(--silver);
  border-radius: 24px;
  display: flex;
  overflow: hidden;
}

.archive-left {
  flex: 1;
  background: var(--navy);
}

.archive-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 360px;
}

.archive-right {
  flex: 1;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.archive-right h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.archive-right p {
  color: var(--text-dark);
  margin-bottom: 1rem;
}

/* MESSENGER HALL */
.messenger-hall {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.messenger-col {
  background: var(--surface);
  border: 1px solid var(--silver);
  border-radius: 16px;
  padding: 2rem;
}

.messenger-col h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--navy);
  border-bottom: 1px solid var(--ivory);
  padding-bottom: 0.5rem;
}

.support-email {
  font-family: monospace;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 4px;
  display: block;
  margin: 1rem 0;
  word-break: break-all;
}

.faq-item {
  margin-bottom: 1rem;
}

.faq-item h4 {
  font-size: 0.95rem;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

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

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--silver);
  border-radius: 8px;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-dark);
}

.contact-form textarea {
  resize: vertical;
  min-height: 80px;
}

.form-msg {
  display: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.form-msg.success {
  display: block;
  background: #d4edda;
  color: #155724;
}

/* FOOTER */
.legal-footer {
  background: var(--navy);
  color: var(--surface);
  padding: 3rem 2rem 1.5rem;
  text-align: center;
  border-top: 2px solid var(--gold);
}

.footer-emblem {
  width: 32px;
  height: 32px;
  margin: 0 auto 1.5rem;
  background: var(--gold);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2L15 8L22 9L17 14L18.5 21L12 17.5L5.5 21L7 14L2 9L9 8L12 2Z"/></svg>') no-repeat center / contain;
  mask: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2L15 8L22 9L17 14L18.5 21L12 17.5L5.5 21L7 14L2 9L9 8L12 2Z"/></svg>') no-repeat center / contain;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.footer-nav a {
  color: var(--silver);
  font-size: 0.85rem;
}

.footer-nav a:hover {
  color: var(--surface);
}

.legal-notice {
  font-size: 0.8rem;
  color: var(--silver);
  max-width: 800px;
  margin: 0 auto 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.copyright {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* COOKIE POPUP */
.cookie-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 27, 51, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cookie-overlay.active {
  visibility: visible;
  opacity: 1;
}

.cookie-card {
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 24px;
  padding: 2rem;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.cookie-overlay.active .cookie-card {
  transform: translateY(0);
}

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

.cookie-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.cookie-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.cookie-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* LEGAL PAGES */
.legal-page-layout {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 2rem;
}

.legal-doc {
  background: var(--ivory);
  border: 1px solid var(--silver);
  border-radius: 16px;
  padding: 3rem;
  position: relative;
}

.legal-doc::before {
  content: '';
  position: absolute;
  top: 8px; bottom: 8px; left: 8px; right: 8px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  pointer-events: none;
  opacity: 0.3;
}

.legal-doc h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
  color: var(--navy);
}

.legal-doc h2 {
  font-size: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.5rem;
}

.legal-doc p, .legal-doc ul {
  margin-bottom: 1rem;
  color: var(--text-dark);
}

.legal-doc ul {
  list-style: disc;
  padding-left: 2rem;
}

.return-home {
  display: inline-block;
  margin: 1.5rem 0;
  font-weight: 600;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
  .moon-court {
    grid-template-columns: 1fr;
  }
  .royal-tablet, .crown-ledger {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
  }
  .royal-tablet {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
  }
  .tablet-item {
    margin-bottom: 0;
  }
  .tablet-divider {
    display: none;
  }
}

@media (max-width: 900px) {
  .messenger-hall {
    grid-template-columns: 1fr;
  }
  .starlit-procession {
    flex-direction: column;
    gap: 2rem;
  }
  .starlit-procession::before {
    display: none;
  }
  .royal-archive {
    flex-direction: column;
  }
  .header-center {
    display: none;
  }
}