/* ===== Reset & Custom Properties ===== */

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

:root,
[data-theme="parchment"] {
  --bg:             #f5e6c8;
  --bg-card:        #ede0c4;
  --bg-card-locked: #ddd5c0;
  --text:           #2c1810;
  --text-muted:     #6b5c4d;
  --border:         #4a3520;
  --accent-teal:    #2d8a6e;
  --accent-gold:    #c8a84e;
  --badge-active-bg: rgba(45, 138, 110, 0.1);
  --title-shadow:   rgba(74, 53, 32, 0.4);
}

[data-theme="night-camp"] {
  --bg:             #1a1a2e;
  --bg-card:        #24243e;
  --bg-card-locked: #1e1e32;
  --text:           #e8dcc8;
  --text-muted:     #9a8e7e;
  --border:         #3a3a5c;
  --accent-teal:    #4ecdc4;
  --accent-gold:    #e8b84e;
  --badge-active-bg: rgba(78, 205, 196, 0.12);
  --title-shadow:   rgba(0, 0, 0, 0.6);
}

[data-theme="tavern"] {
  --bg:             #2a1f14;
  --bg-card:        #3a2d1e;
  --bg-card-locked: #2e2318;
  --text:           #f0dcc0;
  --text-muted:     #a89070;
  --border:         #5c4428;
  --accent-teal:    #5daa68;
  --accent-gold:    #e0a830;
  --badge-active-bg: rgba(93, 170, 104, 0.15);
  --title-shadow:   rgba(0, 0, 0, 0.5);
}

[data-theme="stone-keep"] {
  --bg:             #d0cec7;
  --bg-card:        #c4c2ba;
  --bg-card-locked: #b8b6ae;
  --text:           #1c1c24;
  --text-muted:     #5a5a66;
  --border:         #3c3c4a;
  --accent-teal:    #2878a0;
  --accent-gold:    #a08830;
  --badge-active-bg: rgba(40, 120, 160, 0.1);
  --title-shadow:   rgba(60, 60, 74, 0.3);
}

[data-theme="enchanted-forest"] {
  --bg:             #0f1a10;
  --bg-card:        #1a2c18;
  --bg-card-locked: #142212;
  --text:           #d8e8cc;
  --text-muted:     #7a9a6a;
  --border:         #2a4a22;
  --accent-teal:    #50c878;
  --accent-gold:    #d4aa30;
  --badge-active-bg: rgba(80, 200, 120, 0.12);
  --title-shadow:   rgba(0, 0, 0, 0.6);
}

:root {
  --font-pixel: 'Press Start 2P', monospace;
  --font-body:  -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --shadow-sm: 4px 4px 0 var(--border);
  --shadow-md: 6px 6px 0 var(--border);
  --shadow-lg: 8px 8px 0 var(--border);
}


/* ===== Base ===== */

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-pixel);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

main {
  width: 100%;
  max-width: 960px;
  padding: 2rem 1.5rem;
}


/* ===== Hero Section ===== */

.hero {
  text-align: center;
  padding-top: 2rem;
  margin-bottom: 4rem;
}

.hero-frame {
  display: inline-block;
  border: 4px solid var(--border);
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
  line-height: 0;
}

.hero-image {
  display: block;
  width: 280px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hero-preamble {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 0.5rem;
}

.hero-name {
  font-family: var(--font-pixel);
  font-size: 2rem;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: 2px;
}

/* ===== Quest Board ===== */

.quest-board {
  margin-bottom: 4rem;
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--accent-gold);
  text-shadow: 2px 2px 0 var(--title-shadow);
}

.quests {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}


/* ===== Quest Card ===== */

.quest-card {
  background: var(--bg-card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quest-card:not(.quest-card--locked):hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

/* Locked state */
.quest-card--locked {
  background: var(--bg-card-locked);
  opacity: 0.55;
  filter: grayscale(20%);
  cursor: default;
}

/* Badge */
.quest-badge {
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.3rem 0.6rem;
  display: inline-block;
  width: fit-content;
  border: 2px solid;
}

.quest-badge--active {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
  background: var(--badge-active-bg);
}

.quest-badge--locked {
  color: var(--text-muted);
  border-color: var(--text-muted);
}

/* Card content */
.quest-title {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  line-height: 1.8;
  color: var(--text);
}

.quest-summary {
  font-size: 0.7rem;
  line-height: 1.8;
}

.quest-description {
  font-size: 0.55rem;
  color: var(--text-muted);
  line-height: 2.2;
}

/* Quest action button */
.quest-link {
  display: inline-block;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--text);
  background: var(--accent-gold);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem 1rem;
  text-decoration: none;
  width: fit-content;
  margin-top: auto;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.quest-link:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--border);
}

.quest-link:active {
  transform: translate(4px, 4px);
  box-shadow: none;
}


/* ===== Manifesto ===== */

.manifesto {
  max-width: 680px;
  margin: 0 auto 4rem;
  border: 3px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--bg-card);
  padding: 2rem;
}

.manifesto .section-title {
  margin-bottom: 1.5rem;
}

.manifesto p {
  font-size: 0.55rem;
  line-height: 2.4;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.manifesto p:last-child {
  margin-bottom: 0;
  color: var(--text);
}


/* ===== Footer ===== */

.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-family: var(--font-pixel);
  font-size: 0.45rem;
  color: var(--text-muted);
  line-height: 2.2;
  margin-top: auto;
  width: 100%;
}


/* ===== Theme Switcher ===== */

.theme-switcher {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--bg-card);
  border: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 0.6rem;
  z-index: 100;
}

.theme-swatches {
  display: flex;
  gap: 0.5rem;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease;
}

.theme-btn:hover {
  transform: scale(1.15);
}

.theme-btn[aria-pressed="true"] {
  outline: 3px solid var(--accent-gold);
  outline-offset: 1px;
}

.theme-btn--parchment        { background: #f5e6c8; }
.theme-btn--night-camp       { background: #1a1a2e; }
.theme-btn--tavern           { background: #2a1f14; }
.theme-btn--stone-keep       { background: #d0cec7; }
.theme-btn--enchanted-forest { background: #0f1a10; }

/* Pixel checkbox */
.theme-save-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.theme-save-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-save-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

.theme-save-checkbox:checked + .theme-save-check {
  background: var(--accent-gold);
  /* Pixel checkmark via box-shadow */
  box-shadow:
    inset 2px  0px 0 var(--border),
    inset 0px  2px 0 var(--border),
    inset -2px 0px 0 var(--border),
    inset 0px -2px 0 var(--border);
}

.theme-save-checkbox:focus-visible + .theme-save-check {
  outline: 2px solid var(--accent-gold);
  outline-offset: 1px;
}

.theme-save-text {
  font-family: var(--font-pixel);
  font-size: 0.35rem;
  color: var(--text-muted);
  line-height: 1;
}


/* ===== Responsive ===== */

@media (max-width: 480px) {
  .hero-image {
    width: 220px;
  }

  .hero-preamble {
    font-size: 0.45rem;
  }

  .hero-name {
    font-size: 1.5rem;
  }

  .hero-tagline {
    font-size: 0.6rem;
  }

  .section-title {
    font-size: 0.9rem;
  }
}

@media (min-width: 768px) {
  main {
    padding: 3rem 2rem;
  }

  .hero {
    padding-top: 3rem;
  }

  .hero-image {
    width: 340px;
  }

  .hero-name {
    font-size: 2.5rem;
  }
}
