/* ---------- Root & Base (Wyrd Neutral Palette) ---------- */
:root {
  --bg: #061A24;            /* Deep sea / void */
  --bg-alt: #0F2A39;        /* Mid-teal for gradients */
  --bg-card: #171E26;       /* Neutral card background */
  --accent-teal: #3FA7D6;   /* High-contrast teal glow */
  --accent-brown: #6E3B1C;  /* Heraldry brown */
  --accent-gold: #A5A56F;   /* Grassland gold */
  --text-main: #E6EBEE;     /* Misty off-white */
  --text-muted: #A1B7C1;    /* Fog blue-grey */
  --border: #2F3F4A;        /* Fog edge steel-blue */
  --radius-lg: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 18px 40px rgba(0,0,0,0.45);
}

* {
  box-sizing: border-box;
}

/* RedFlower font */
@font-face {
  font-family: "RedFlower";
  src: url("RedFlower.otf") format("opentype");
  font-display: swap;
}

/* Use RedFlower for titles */
h1,
.title {
  font-family: "RedFlower", serif;
}

body {
  margin: 0;
  font-family: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background:
    radial-gradient(circle at top, #243B4A 0, var(--bg) 55%, #020307 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ---------- Shell & Header ---------- */
.shell {
  width: 100%;
  max-width: 1100px;
  background: radial-gradient(circle at top left, var(--bg-alt), var(--bg-card) 45%, #090D13 100%);
  border-radius: 24px;
  padding: 24px 24px 28px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(63, 167, 214, 0.35);
  position: relative;
  overflow: hidden;
}

header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  padding-bottom: 12px;
}

header h1 {
  font-family: 'RedFlower', 'Rurik', 'Poppins', serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-gold);
  text-shadow: 0 0 12px rgba(63,167,214,0.6);
}

/* Search bar used on Nation Profiles page */
.search-bar {
      width: 100%;
      max-width: 400px;
      margin: 0 auto 24px auto;
      display: flex;
      justify-content: center;
}
.search-bar input {
      width: 100%;
      padding: 10px 14px;
      border-radius: 8px;
      border: 1px solid var(--border, #2F3F4A);
      background: #0F2A39;
      color: var(--text-main, #E6EBEE);
      font-size: 1rem;
      outline: none;
      box-shadow: 0 2px 8px rgba(0,0,0,0.08);
      margin-bottom: 12px;
}
.highlight {
      background: #ffe066;
      color: #222;
      padding: 0 2px;
      border-radius: 3px;
      font-weight: bold;
}


/* Larger title style used on pages like Roll the Bones */
header h1.title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  text-align: center;
}

.tagline {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Nav links */
.nav-links {
  margin-top: 8px;
}

.nav-link {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--accent-teal);
  text-decoration: none;
  border-bottom: 1px dotted rgba(63,167,214,0.7);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-link:hover {
  text-decoration: underline;
}

.inline-link {
  color: var(--accent-teal);
  text-decoration: none;
  border-bottom: 1px dotted rgba(63,167,214,0.4);
}

.inline-link:hover {
  text-decoration: underline;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 18px;
}

@media (max-width: 880px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Cards (soft map-like gradients) ---------- */
.card {
  background:
    radial-gradient(circle at top left, rgba(63,167,214,0.18), transparent 55%),
    radial-gradient(circle at bottom right, rgba(110,59,28,0.22), transparent 60%),
    linear-gradient(145deg, rgba(23,30,38,0.98), rgba(10,14,21,0.98));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: 0 0 24px rgba(0,0,0,0.55);
}

.quiz-card h2,
.results-card h2,
.profiles-card h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 1rem;
  font-family: 'Poppins', system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Typography Helpers ---------- */
.tiny {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---------- Error Banner ---------- */
.error-banner {
  display: none;
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #ff6b81;
  background: rgba(85, 20, 32, 0.7);
  color: #ffd6de;
  font-size: 0.8rem;
}

.error-banner.active {
  display: block;
}

/* ---------- Shared accessibility / controls ---------- */
/* Pause all CSS animations when the body has .animations-paused */
.animations-paused * {
  animation-play-state: paused !important;
}

/* Pause/Play toggle button (shared) */
.anim-toggle {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 9999;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: none;
  background: rgba(10,14,20,0.72);
  color: var(--text-main);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}


/* ---------- Quiz Progress ---------- */
.quiz-progress {
  margin-top: 10px;
  margin-bottom: 8px;
}

.quiz-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.quiz-progress-bar {
  margin-top: 4px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(18,22,36,0.9);
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-teal), #7DE0FF);
}

/* ---------- Questions ---------- */
#questions .question-block {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(47,63,74,0.95);
  background: rgba(11,16,24,0.96);
}

/* Table / Roll UI from bones.css (consolidated) */
.table-wrapper {
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid rgba(46,53,84,0.95);
  overflow: hidden;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mapping-table th,
.mapping-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(32,36,52,0.9);
}

.mapping-table thead {
  background: rgba(11,15,25,0.95);
}

.mapping-table tbody tr:nth-child(even) {
  background: rgba(12,16,27,0.85);
}

.roll-panel {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(46,53,84,0.9);
  padding: 10px;
  background: rgba(8,10,18,0.85);
}

.roll-input-block {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

.roll-input-block label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#manualRoll {
  width: 72px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(73,84,124,0.9);
  background: #05070c;
  color: var(--text-main);
  font-size: 0.8rem;
}

.divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.divider span {
  opacity: 0.75;
}

.reborn-panel {
  border-radius: 12px;
  border: 1px solid rgba(101,87,140,0.9);
  background: rgba(18,12,28,0.9);
  padding: 10px;
}

.reborn-panel h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--accent-teal);
}

.info-box {
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(101,87,140,0.8);
  background: rgba(15,11,28,0.85);
}

.reborn-inputs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.reborn-input {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reborn-input input {
  width: 72px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(73,84,124,0.9);
  background: #05070c;
  color: var(--text-main);
  font-size: 0.8rem;
}

.reborn-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hidden { display: none; }

.question-title {
  margin: 0 0 4px;
  font-size: 0.96rem;
  font-family: 'Poppins', system-ui, sans-serif;
}

.question-help {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Options */
.options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.87rem;
}

.option-label {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  cursor: pointer;
}

.option-label input[type="radio"] {
  margin-top: 3px;
}

/* ---------- Controls ---------- */
.controls {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Buttons */
.button-primary {
  font-family: 'Poppins', system-ui, sans-serif;
  background: radial-gradient(circle at top left, var(--accent-teal), #7DE0FF);
  color: #02050A;
  border: none;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 14px rgba(63,167,214,0.6);
  transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.button-primary:hover {
  box-shadow: 0 0 22px rgba(63,167,214,0.85);
  transform: translateY(-1px);
}

.button-ghost {
  font-family: 'Poppins', system-ui, sans-serif;
  border: 1px solid var(--accent-brown);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20,14,10,0.8);
  color: var(--accent-gold);
  cursor: pointer;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 12px rgba(110,59,28,0.5);
  transition: box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.button-ghost:hover {
  box-shadow: 0 0 18px rgba(110,59,28,0.8);
  transform: translateY(-1px);
}

.button-ghost.small-ghost {
  margin-top: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
}

.nav-ghost {
  opacity: 0.85;
}

.nav-primary {
  opacity: 0.95;
}

.submit-btn {
  display: none; /* shown only on last question */
}

/* ---------- Results ---------- */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pill {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(165,165,111,0.8);
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: radial-gradient(circle at top, rgba(165,165,111,0.15), transparent);
}

.results-body {
  margin-top: 12px;
}

/* Result rows */
.result-row {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(63,71,106,0.9);
  background:
    radial-gradient(circle at top, rgba(63,167,214,0.16), transparent 65%),
    rgba(9,11,20,0.95);
  margin-bottom: 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.result-row:hover {
  border-color: var(--accent-teal);
  box-shadow: 0 0 16px rgba(63,167,214,0.5);
  transform: translateY(-1px);
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.result-name {
  font-weight: 600;
}

.result-percent {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Bar */
.result-bar-wrap {
  margin-top: 4px;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(18,22,36,0.9);
  overflow: hidden;
}

.result-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-teal), #7DE0FF);
}

/* ---------- Origin Summary Block ---------- */
.origin-summary-block {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(46,53,84,0.9);
}

.origin-summary-header h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-family: 'Poppins', system-ui, sans-serif;
}

#origin-summary-text {
  width: 100%;
  margin-top: 6px;
  border-radius: 10px;
  border: 1px solid rgba(73,84,124,0.9);
  background: #05070c;
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 8px;
  resize: vertical;
  min-height: 90px;
}

#wyrd-canvas{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -1;
}


.copy-status {
  min-height: 1em;
  margin-top: 2px;
}

/* ---------- Profile Snapshot ---------- */
.profile-snapshot {
  margin-top: 13px;
  border-radius: 12px;
  border: 1px solid rgba(63,71,106,0.9);
  background: rgba(9,11,20,0.85);
  padding: 10px 12px;
  font-size: 0.82rem;
}

.profile-snapshot h3 {
  margin-top: 0;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-family: 'Poppins', system-ui, sans-serif;
}

/* ---------- Nation Profiles (extra breathing room) ---------- */
.profiles-card {
  margin-top: 24px;
  padding-top: 22px;
}

.profiles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profiles-card > p {
  margin-top: 6px;
  margin-bottom: 14px;
}

.profiles-grid {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.nation-profile {
  border-radius: 14px;
  border: 1px solid rgba(63,71,106,0.9);
  background:
    radial-gradient(circle at top, rgba(110,59,28,0.25), transparent 60%),
    radial-gradient(circle at bottom, rgba(63,167,214,0.12), transparent 65%),
    rgba(9,11,20,0.96);
  padding: 14px 16px;
  font-size: 0.84rem;
  line-height: 1.7;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.nation-profile h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--accent-gold);
}

.nation-profile:hover {
  border-color: var(--accent-brown);
  box-shadow: 0 0 18px rgba(110,59,28,0.6);
  transform: translateY(-1px);
}

/* Highlight when clicked from results */
.highlight-flash {
  box-shadow: 0 0 18px rgba(63,167,214,0.8) !important;
}
