:root {
  --bgPrimary: hsl(210, 15%, 5%);
  --bgSurface: hsl(210, 10%, 9%);
  --bgPanel: hsl(210, 12%, 7%);
  --borderGothic: hsl(38, 25%, 25%);
  --textPrimary: hsl(40, 15%, 85%);
  --textMuted: hsl(40, 10%, 60%);
  --accentCrimson: hsl(356, 75%, 38%);
  --accentGold: hsl(43, 74%, 49%);
  --accentMana: hsl(217, 85%, 55%);
  --accentAurora: hsl(150, 70%, 45%);
  --accentVoid: hsl(271, 76%, 53%);
  --accentSuccess: hsl(140, 60%, 45%);
  
  --fontHeading: 'Cinzel', serif;
  --fontMono: 'Share Tech Mono', monospace;
  --fontLore: 'IM Fell English', serif;
}

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

body {
  background-color: var(--bgPrimary);
  color: var(--textPrimary);
  font-family: var(--fontMono);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

/* Base styles */
h1, h2, h3, h4, .panel-header {
  font-family: var(--fontHeading);
}

.view {
  display: none;
  height: 100%;
  width: 100%;
}

.view.active {
  display: flex;
}

/* Form inputs & buttons */
input[type="text"],
input[type="password"],
input[type="email"] {
  width: 100%;
  background: var(--bgSurface);
  border: 1px solid var(--borderGothic);
  color: var(--textPrimary);
  padding: 0.75rem 1rem;
  font-family: var(--fontMono);
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
  border-color: var(--accentGold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accentCrimson), hsl(356, 75%, 25%));
  color: #fff;
  border: 1px solid var(--accentCrimson);
  padding: 0.75rem 1.5rem;
  font-family: var(--fontHeading);
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  box-shadow: 0 4px 15px rgba(170, 20, 35, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, hsl(356, 85%, 45%), var(--accentCrimson));
  box-shadow: 0 6px 20px rgba(170, 20, 35, 0.5);
  transform: translateY(-2px);
}

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

.btn-large {
  font-size: 1.3rem;
  padding: 1rem 2rem;
}

/* Login Screen */
#view-login {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.aurora-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at center, rgba(11, 13, 14, 0.3) 0%, rgba(11, 13, 14, 0.85) 75%), url('/img/bg.png') center/cover no-repeat;
  z-index: -1;
  filter: contrast(1.1) brightness(0.95);
}

.game-logo-img {
  max-width: 325px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.35));
  margin-bottom: 0.5rem;
  transition: transform 0.3s ease, filter 0.3s ease;
}
.game-logo-img:hover {
  transform: scale(1.04);
  filter: drop-shadow(0 0 18px rgba(212, 175, 55, 0.5));
}

.login-container {
  max-width: 480px;
  width: 100%;
  z-index: 10;
  text-align: center;
}

.world-title {
  font-size: 4rem;
  letter-spacing: 0.2em;
  color: var(--accentGold);
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
  margin-bottom: 0.5rem;
}

.world-subtitle {
  font-family: var(--fontLore);
  font-size: 1.2rem;
  color: var(--accentAurora);
  margin-bottom: 2rem;
  font-style: italic;
}

.login-card {
  background: rgba(20, 25, 30, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--borderGothic);
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.login-tabs {
  display: flex;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--borderGothic);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--textMuted);
  font-family: var(--fontHeading);
  padding: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s;
}

.tab-btn.active {
  color: var(--accentGold);
  border-bottom: 2px solid var(--accentGold);
}

.form-panel {
  display: none;
}
.form-panel.active {
  display: block;
}

.form-error {
  color: var(--accentCrimson);
  margin-top: 1rem;
  min-height: 1.5em;
}

.login-lore {
  font-family: var(--fontLore);
  color: var(--textMuted);
  margin-top: 1.25rem;
  font-style: italic;
}

/* Lore Link Button on Main Page */
.lore-link-container {
  margin-top: 1.25rem;
  text-align: center;
}

.btn-lore-link {
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--borderGothic);
  color: var(--accentGold);
  font-family: var(--fontHeading);
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.btn-lore-link:hover {
  background: var(--accentGold);
  color: #000;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

/* Popout Card Modal Styling */
.popout-card {
  position: relative;
  max-width: 680px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(12, 14, 18, 0.96);
  backdrop-filter: blur(16px);
  border: 2px solid var(--accentGold);
  border-radius: 8px;
  padding: 1.75rem;
  box-shadow: 0 0 50px rgba(212, 175, 55, 0.25), 0 20px 40px rgba(0, 0, 0, 0.9);
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .popout-card {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.popout-close {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: none;
  border: none;
  color: var(--accentGold);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease;
}

.popout-close:hover {
  color: var(--accentCrimson);
}

.popout-header {
  text-align: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 0.75rem;
}

.popout-title {
  font-family: var(--fontHeading);
  color: var(--accentGold);
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

.popout-subtitle {
  font-family: var(--fontLore);
  color: var(--textMuted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
  font-style: italic;
}

/* Popout Card Tabs */
.popout-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--borderGothic);
  padding-bottom: 0.5rem;
}

.popout-tab-btn {
  flex: 1;
  background: rgba(20, 25, 35, 0.6);
  border: 1px solid var(--borderGothic);
  color: var(--textMuted);
  font-family: var(--fontHeading);
  font-size: 0.88rem;
  padding: 0.55rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.popout-tab-btn.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accentGold);
  border-color: var(--accentGold);
  font-weight: bold;
}

.popout-tab-content {
  display: none;
}

.popout-tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

/* Cookie Consent Banner */
.cookie-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100vw;
  background: rgba(10, 12, 16, 0.95);
  backdrop-filter: blur(12px);
  border-top: 2px solid var(--accentGold);
  padding: 0.85rem 1.5rem;
  z-index: 900;
  gap: 1.25rem;
  box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.8);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.35s ease;
}

.cookie-banner.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.cookie-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.cookie-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.cookie-text {
  color: var(--textPrimary);
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
}

.cookie-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.btn-cookie-accept {
  background: var(--accentGold);
  color: #000;
  border: none;
  font-family: var(--fontHeading);
  font-weight: bold;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cookie-accept:hover {
  background: #fff;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}

.btn-cookie-privacy {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--borderGothic);
  color: var(--accentGold);
  font-family: var(--fontHeading);
  font-size: 0.85rem;
  padding: 0.55rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cookie-privacy:hover {
  background: rgba(212, 175, 55, 0.2);
  color: #fff;
}

.privacy-tab-content {
  display: none;
}

.privacy-tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-in-out;
}

@media (max-width: 768px) {
  .cookie-banner {
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    text-align: center;
  }
  .cookie-content {
    flex-direction: column;
    gap: 0.3rem;
  }
  .cookie-actions {
    width: 100%;
    justify-content: center;
  }
}

/* Deep Lore & World Overview Section */
.world-lore-card {
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--borderGothic);
  border-top: 3px solid var(--accentGold);
  padding: 1.75rem;
  margin-top: 1.5rem;
  border-radius: 4px;
  text-align: left;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7);
}

.lore-section-title {
  font-family: var(--fontHeading);
  color: var(--accentGold);
  font-size: 1.35rem;
  text-align: center;
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  padding-bottom: 0.5rem;
}

.lore-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}
.lore-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.lore-subtitle {
  font-family: var(--fontHeading);
  color: var(--accentAurora);
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lore-paragraph {
  color: var(--textPrimary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.lore-quote {
  font-family: var(--fontLore);
  color: var(--textMuted);
  font-style: italic;
  font-size: 0.88rem;
  border-left: 3px solid var(--accentGold);
  padding-left: 0.85rem;
  margin: 0.75rem 0;
  line-height: 1.5;
}

.why-play-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.why-card {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 0.85rem;
  border-radius: 4px;
}

.why-title {
  font-family: var(--fontHeading);
  color: var(--accentGold);
  font-size: 0.92rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.why-desc {
  font-size: 0.82rem;
  color: var(--textMuted);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .why-play-grid {
    grid-template-columns: 1fr;
  }
}

/* Layout Grid for Game */
.game-grid {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  height: 100vh;
  width: 100vw;
  gap: 1px;
  background: var(--borderGothic);
}

.panel {
  background: var(--bgPanel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Character Creation Container */
#view-charcreate {
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  overflow-y: auto;
  height: 100vh;
  box-sizing: border-box;
}
.charcreate-container {
  max-width: 960px;
  width: 100%;
  background: rgba(15, 15, 18, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--borderGothic);
  padding: 2.5rem;
  box-shadow: 0 0 50px rgba(0,0,0,0.9);
  box-sizing: border-box;
  margin: auto 0;
}
.section-title {
  color: var(--accentGold);
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bgSurface);
}
::-webkit-scrollbar-thumb {
  background: var(--borderGothic);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accentGold);
}
