:root {
  --ink: #2a2420;
  --ink-soft: #5a5045;
  --parchment: #f4ecdd;
  --parchment-raised: #ffffff;
  --rule: #d8cbb0;
  --accent: #7a3b2e;
  --accent-hover: #5f2c22;
  --reveal-bg: #faf5ea;
  --hover-bg: #fffdf8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e8e0d2;
    --ink-soft: #a89e8c;
    --parchment: #1c1814;
    --parchment-raised: #272220;
    --rule: #453d34;
    --accent: #c17a5e;
    --accent-hover: #d99579;
    --reveal-bg: #221d19;
    --hover-bg: #322c27;
  }
}

:root[data-theme="dark"] {
  --ink: #e8e0d2;
  --ink-soft: #a89e8c;
  --parchment: #1c1814;
  --parchment-raised: #272220;
  --rule: #453d34;
  --accent: #c17a5e;
  --accent-hover: #d99579;
  --reveal-bg: #221d19;
  --hover-bg: #322c27;
}

* {
  box-sizing: border-box;
}

button {
  color: inherit;
  font-family: inherit;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.55;
  transition: background 0.2s ease, color 0.2s ease;
}

#app {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.title-block {
  text-align: center;
  margin-bottom: 2rem;
}

.title-block h1 {
  font-size: 1.9rem;
  margin: 0 0 0.4rem;
  letter-spacing: 0.02em;
}

.title-block p {
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
}

.card {
  background: var(--parchment-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
}

.start-list {
  display: grid;
  gap: 0.75rem;
}

.start-card {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.start-card .start-title {
  font-size: 1.15rem;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.start-card .start-location {
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-style: italic;
}

.junction-title {
  font-size: 1.4rem;
  margin: 0 0 0.15rem;
}

.junction-location {
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-style: italic;
  margin: 0 0 1rem;
  text-transform: capitalize;
}

.junction-text p {
  margin: 0 0 0.9rem;
}

.ambient-note {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 0.92rem;
  border-left: 3px solid var(--rule);
  padding-left: 0.75rem;
  margin: 1rem 0;
}

section.explore, section.choices {
  margin-top: 1.5rem;
}

h2.section-heading {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3rem;
}

label.var-label {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

input.var-input {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  margin-bottom: 1rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--parchment-raised);
  color: var(--ink);
}

input.var-input:focus {
  outline: none;
  border-color: var(--accent);
}

button.option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--parchment-raised);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
  font-family: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button.option:hover {
  border-color: var(--accent);
  background: var(--hover-bg);
}

button.choice-option {
  border-color: var(--accent);
  font-weight: 600;
}

button.choice-option:hover {
  background: var(--accent);
  color: var(--parchment-raised);
}

div.free-text-choice {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--parchment-raised);
}

div.free-text-choice .var-label {
  margin-bottom: 0.4rem;
}

div.free-text-choice .var-input {
  margin-bottom: 0.6rem;
}

div.free-text-choice button.choice-option {
  width: auto;
  display: inline-block;
}

.reveal {
  margin: 0.4rem 0 0.9rem 0.2rem;
  padding: 0.6rem 0.85rem;
  border-left: 3px solid var(--accent);
  background: var(--reveal-bg);
  font-size: 0.95rem;
  white-space: pre-line;
}

.ending-banner {
  text-align: center;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin: 1.75rem 0 0.5rem;
}

.toolbar {
  margin-top: 2rem;
  text-align: center;
}

button.link-button {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

button.link-button:hover {
  color: var(--accent-hover);
}

button.theme-toggle {
  position: fixed;
  top: 0.9rem;
  right: 0.9rem;
  background: var(--parchment-raised);
  border: 1px solid var(--rule);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

button.theme-toggle:hover {
  border-color: var(--accent);
}

@media (max-width: 480px) {
  #app {
    padding: 1.25rem 0.9rem 3rem;
  }
}
