:root {
  --bg: #0e0f12;
  --ink: #1a1a1a;
  --paper: #f7f2e8;
  --paper-edge: #e7ddcf;
  --muted-ink: #666;
  --rule: rgba(0,0,0,0.12);

  --page-w: 720px;
  --page-pad-y: 54px;
  --page-pad-x: 56px;
  --radius: 14px;
}

/* Base */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -100px, #1a1d26 0%, var(--bg) 55%, #0b0c10 100%);
  color: #e7e7e7;
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
}

a { color: #c8d6ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 42px;
}

/* Landing page cards can stay “app-like”, but we’ll lightly bookify them */
.card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 18px;
  margin: 14px 0;
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}

h1 { margin: 0 0 8px; font-size: 42px; letter-spacing: 0.2px; }
h1.small { font-size: 22px; margin-bottom: 4px; }
h2 { margin: 0 0 10px; font-size: 20px; }

.muted { color: rgba(255,255,255,0.75); }
.tiny { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: center; }
.space-between { justify-content: space-between; }

/* Buttons for landing */
.button {
  background: #2f67ff;
  border: none;
  color: white;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.button.secondary { background: rgba(255,255,255,0.12); }
.button:hover { filter: brightness(1.05); }

input, textarea {
  width: 100%;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 10px 12px;
  color: #e7e7e7;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
label { display: block; margin: 10px 0 6px; font-family: ui-sans-serif, system-ui; }


/* ------------------------------
   BOOK PAGE (Gameplay)
   ------------------------------ */

.book-shell {
  display: grid;
  place-items: center;
  margin-top: 14px;
}

.page {
  width: min(var(--page-w), calc(100vw - 24px));
  background: linear-gradient(180deg, var(--paper) 0%, #f3ecdf 100%);
  color: var(--ink);
  border-radius: var(--radius);
  border: 1px solid var(--paper-edge);
  box-shadow:
    0 28px 70px rgba(0,0,0,0.55),
    0 2px 0 rgba(255,255,255,0.35) inset;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg,
    #efe4d4 0%,
    var(--paper) 10%,
    var(--paper) 90%,
    #efe4d4 100%);
}

/* subtle “paper” texture without relying on shades too much */
.page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.015),
      rgba(0,0,0,0.015) 1px,
      rgba(255,255,255,0) 2px,
      rgba(255,255,255,0) 6px
    );
  pointer-events: none;
  opacity: 0.55;
}

.page::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 48px;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), rgba(0,0,0,0));
  opacity: 0.16;
  pointer-events: none;
}

.page-inner {
  position: relative;
  padding: var(--page-pad-y) var(--page-pad-x);
}

/* Running header */
.running-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 18px;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.running-header .left {
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 12px;
  color: rgba(0,0,0,0.65);
}
.running-header .right {
  font-size: 12px;
  color: rgba(0,0,0,0.55);
}

/* Scene typography */
.scene-title {
  margin: 0 0 14px;
  font-size: 26px;
  letter-spacing: 0.2px;
}

.scene-body p {
  margin: 0 0 14px;
  line-height: 1.65;
  font-size: 18px;
}
.scene-body small { font-size: 12px; color: rgba(0,0,0,0.6); }

/* Footer with page number */
.page-footer {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: center;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: rgba(0,0,0,0.55);
  font-size: 12px;
}

/* “Turn the page” controls */
.turn-bar {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Make the input feel like a printed field */
.turn-bar input[type="number"] {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.25);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  width: 140px;
}
.turn-bar input[disabled] {
  opacity: 0.75;
}

/* Book-like “page turn” button */
.turn-bar button {
  background: transparent;
  border: 1px solid rgba(0,0,0,0.35);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.turn-bar button:hover {
  background: rgba(0,0,0,0.04);
}

/* Diegetic error box */
.error {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid #111;
  background: rgba(0,0,0,0.03);
  border-radius: 10px;
  font-family: ui-sans-serif, system-ui;
  font-size: 13px;
}

@media (max-width: 520px) {
  :root { --page-pad-x: 22px; --page-pad-y: 32px; }
  .scene-body p { font-size: 17px; }
  .turn-bar { grid-template-columns: 1fr; }
  .turn-bar input[type="number"] { width: 100%; }
}

/* Drop cap: apply to the first paragraph when enabled */
.scene-body.dropcap p:first-of-type::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: 0.9;
  padding-right: 0.12em;
  padding-top: 0.06em;
  font-weight: 700;
}
.running-header .left {
  font-variant: small-caps;
  letter-spacing: 0.6px;
}

.section-break {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
  color: rgba(0,0,0,0.55);
  font-family: ui-sans-serif, system-ui;
  font-size: 12px;
}
.section-break::before,
.section-break::after {
  content: "";
  flex: 1;
  border-top: 1px solid rgba(0,0,0,0.18);
}
.section-break .mark {
  letter-spacing: 2px;
}
.page-corner {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, rgba(0,0,0,0.10), rgba(0,0,0,0));
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
  opacity: 0.15;
  pointer-events: none;
}

