:root {
  color-scheme: light;
  --paper: #f4efe5;
  --paper-deep: #e9e0d0;
  --ink: #253431;
  --ink-soft: #65716a;
  --green: #45634f;
  --green-dark: #294333;
  --sage: #dce4d4;
  --copper: #b66f48;
  --line: rgba(48, 63, 54, 0.16);
  --white: #fffdf8;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Baskerville, Georgia, serif;
  --sans: Inter, 'Segoe UI', system-ui, sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #c37b51; outline-offset: 3px; }

.site-header, .console-header {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 5vw, 82px);
  border-bottom: 1px solid var(--line);
  background: rgba(248, 245, 237, .9);
  position: relative;
  z-index: 5;
}
.wordmark { display: inline-flex; align-items: center; gap: 16px; }
.wordmark-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--green); color: var(--green-dark); border-radius: 50%; font-size: 17px; font-weight: 700; letter-spacing: -.08em; }
.wordmark-divider { height: 26px; width: 1px; background: var(--line); }
.wordmark-tagline { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink-soft); }
.preview-pill, .private-pill, .world-state { display: inline-flex; align-items: center; gap: 9px; color: var(--green); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; background: #bf875c; border-radius: 50%; box-shadow: 0 0 0 4px rgba(191, 135, 92, .14); }

.world-section {
  height: min(78vh, 760px);
  min-height: 520px;
  position: relative;
  overflow: hidden;
  background: #eee5d5;
  border-bottom: 1px solid rgba(68, 83, 69, .12);
}
#world-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#world-canvas:active { cursor: grabbing; }
.world-topline, .world-bottomline { position: absolute; left: clamp(22px, 5vw, 82px); right: clamp(22px, 5vw, 82px); z-index: 2; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.world-topline { top: 28px; }
.world-topline > div { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { margin: 0; font-size: 10px; font-weight: 700; letter-spacing: .17em; color: #788174; text-transform: uppercase; }
.world-location { font-family: var(--serif); font-size: 19px; color: var(--ink); }
.world-state { padding: 10px 15px; border-radius: 30px; background: rgba(250, 247, 239, .76); backdrop-filter: blur(10px); color: #54694f; letter-spacing: .04em; font-size: 10px; }
.state-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #a9784b; }
.world-bottomline { bottom: 25px; align-items: flex-end; }
.world-caption { font-family: var(--serif); font-style: italic; font-size: 16px; color: #54614f; }
.world-controls { display: flex; align-items: center; gap: 9px; pointer-events: auto; }
.icon-button { width: 37px; height: 37px; border: 1px solid rgba(59, 78, 63, .24); border-radius: 50%; background: rgba(250, 247, 239, .72); color: var(--green); cursor: pointer; font-size: 21px; line-height: 1; transition: background .2s, transform .2s; }
.icon-button:hover { background: var(--white); transform: translateY(-2px); }
.camera-select { max-width: 155px; height: 37px; padding: 0 28px 0 11px; border: 1px solid rgba(59, 78, 63, .24); border-radius: 20px; background: rgba(250, 247, 239, .8); color: var(--green-dark); font-size: 10px; font-weight: 600; cursor: pointer; }
.world-callout { position: absolute; left: 50%; bottom: 78px; z-index: 3; padding: 9px 14px; transform: translate(-50%, 8px); border: 1px solid rgba(59, 78, 63, .15); border-radius: 20px; background: rgba(250, 247, 239, .88); color: var(--green-dark); font-family: var(--serif); font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.world-callout.visible { transform: translate(-50%, 0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.drag-hint { margin-left: 7px; color: #738071; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.scene-glow { position: absolute; inset: auto 0 0; height: 150px; background: linear-gradient(0deg, rgba(237, 228, 211, .45), transparent); pointer-events: none; }

.intro-section { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(35px, 9vw, 140px); align-items: center; padding: 110px clamp(26px, 12vw, 180px) 100px; max-width: 1500px; margin: auto; }
.intro-copy { max-width: 560px; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.04em; }
.intro-copy h1 { margin: 20px 0 22px; font-size: clamp(54px, 7.2vw, 94px); line-height: .98; }
.intro-copy h1 em, .journal-page h1 em { color: var(--green); font-weight: 500; }
.intro-lede { max-width: 465px; font-size: 18px; line-height: 1.65; color: #53615a; }
.intro-note { max-width: 450px; margin-top: 28px; border-left: 1px solid #bf885f; padding-left: 17px; color: #7b8174; font-size: 13px; line-height: 1.7; }
.character-card { width: min(100%, 385px); justify-self: center; padding: 14px; background: #e8dfd0; box-shadow: 0 24px 65px rgba(69, 64, 48, .11); transform: rotate(1.5deg); }
.character-art-wrap { height: 350px; overflow: hidden; background: #eee5d7; }
.character-art-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 37%; }
.character-card-footer { display: flex; justify-content: space-between; align-items: center; padding: 18px 5px 6px; }
.character-name { font-family: var(--serif); font-size: 24px; }

.facts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact-card { position: relative; min-height: 240px; padding: 38px clamp(24px, 6vw, 92px); background: #f7f3ea; }
.fact-icon { display: block; margin-bottom: 28px; color: var(--copper); font-size: 24px; }
.fact-card strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 23px; font-weight: 500; }
.fact-card p { max-width: 300px; color: #778076; font-size: 13px; line-height: 1.65; }

.life-panels { display: grid; grid-template-columns: 1.1fr .9fr; gap: 55px; padding: 96px clamp(26px, 12vw, 180px); max-width: 1500px; margin: auto; }
.life-timeline h2 { margin: 15px 0 19px; font-size: clamp(33px, 4vw, 49px); line-height: 1.08; }
.timeline-empty { max-width: 510px; border-left: 1px solid var(--copper); padding: 4px 0 4px 16px; color: #788176; font-size: 13px; line-height: 1.7; }
.timeline-entry { display: grid; grid-template-columns: 100px 1fr; gap: 16px; max-width: 590px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.timeline-entry time { color: #8d8d7e; font-size: 10px; }
.timeline-entry strong { font-weight: 500; }
.journal-entry { padding: 18px 0; border-bottom: 1px solid var(--line); }
.journal-entry p { margin: 10px 0 0; color: #5e6b60; font-family: var(--serif); font-size: 19px; line-height: 1.55; }
.life-details { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.life-details article { padding: 20px 22px; background: #f8f5ed; }
.life-details strong { display: block; margin-top: 9px; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.life-details p { margin: 6px 0 0; color: #7b8479; font-size: 11px; line-height: 1.55; }

.journal-teaser { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; padding: 110px clamp(26px, 12vw, 180px) 120px; max-width: 1500px; margin: auto; }
.journal-teaser h2 { margin: 18px 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.08; }
.journal-empty { max-width: 440px; align-self: center; padding: 28px 0 15px; color: #70796f; font-size: 14px; line-height: 1.7; }
.journal-line { display: block; width: 55px; height: 1px; background: #ba7954; }
.journal-signature { display: block; margin-top: 26px; color: #9b7357; font-family: var(--serif); font-style: italic; }
.site-footer { min-height: 80px; display: flex; align-items: center; gap: 22px; padding: 20px clamp(22px, 5vw, 82px); border-top: 1px solid var(--line); color: #81877c; font-size: 11px; }
.footer-brand { font-size: 14px; font-weight: 700; color: var(--green); letter-spacing: -.08em; }
.footer-status { margin-left: auto; }

.console-page { background: #f3f0e8; }
.console-header nav { display: flex; align-items: center; gap: 28px; font-size: 12px; color: #718075; }
.console-header nav a { padding: 8px 0; }
.console-header nav a.active { color: var(--green-dark); border-bottom: 1px solid var(--copper); }
.text-button { border: 0; background: transparent; color: #8b6850; font-size: 12px; cursor: pointer; }
.console-main { width: min(1080px, calc(100% - 48px)); margin: 0 auto; padding: 56px 0 100px; }
.console-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 31px; }
.console-heading h1 { margin: 8px 0 0; font-size: clamp(40px, 5vw, 58px); }
.private-pill { border: 1px solid rgba(62, 86, 65, .2); border-radius: 30px; padding: 9px 12px; color: var(--green); font-size: 9px; }
.notice { margin: 0 0 24px; padding: 14px 17px; border-radius: 9px; font-size: 13px; line-height: 1.55; }
.notice-soft { background: #e9eee4; color: #54684f; }
.notice-warn { background: #f3e4d5; color: #805a3d; }
.admin-status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.status-card { min-height: 112px; padding: 19px; border: 1px solid var(--line); background: #fbf9f3; border-radius: 10px; }
.status-card span { display: block; margin-bottom: 10px; color: #828a7f; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.status-card strong { display: block; font-family: var(--serif); font-size: 20px; font-weight: 500; }
.admin-panel, .tool-card { margin-top: 15px; padding: 25px; border: 1px solid var(--line); border-radius: 11px; background: #fbf9f3; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 19px; }
.panel-heading h2, .tool-card h2 { margin: 6px 0 0; font-size: 25px; }
.status-tag { padding: 8px 12px; background: #efe6d8; border-radius: 20px; color: #8b6449; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.admin-panel > p { max-width: 690px; color: #758075; font-size: 13px; line-height: 1.7; }
.birth-guard { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 26px; padding: 17px; background: #f1ece1; border-radius: 8px; }
.birth-guard > div { display: flex; align-items: center; gap: 14px; }
.guard-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 50%; background: #dedbcc; color: #7d7c69; font-size: 20px; }
.birth-guard strong, .birth-guard span:not(.guard-icon) { display: block; }
.birth-guard strong { font-size: 12px; }
.birth-guard span:not(.guard-icon) { margin-top: 4px; color: #81877c; font-size: 11px; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.control-row > div:first-child strong, .control-row > div:first-child span { display: block; }
.control-row > div:first-child strong { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.control-row > div:first-child span { margin-top: 6px; color: #7c8679; font-size: 11px; }
.button-group { display: flex; flex-wrap: wrap; gap: 8px; }
.button { min-height: 41px; padding: 0 16px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: .025em; transition: transform .18s, background .18s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled, .button-disabled { cursor: not-allowed; opacity: .46; }
.button-accent { background: var(--green-dark); color: #fffdf7; }
.button-accent:hover:not(:disabled) { background: #365842; }
.button-outline { background: transparent; border-color: #9aab96; color: var(--green-dark); }
.button-muted { background: #e9e8de; color: #59695d; }
.button-danger { background: #8e5949; color: #fff8ef; }
.empty-state { padding: 21px; border: 1px dashed rgba(95, 112, 94, .24); border-radius: 7px; color: #81877c; font-size: 12px; line-height: 1.65; }
.admin-event { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.admin-event strong { font-size: 12px; font-weight: 600; }
.admin-event span { flex: 0 0 auto; color: #828a7f; font-size: 10px; }
.small-link { color: var(--green); font-size: 11px; font-weight: 700; }
.readiness-list { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.readiness-item { display: flex; align-items: center; gap: 10px; padding: 11px; background: #f3f0e8; border-radius: 6px; color: #778176; font-size: 11px; }
.readiness-item::before { content: ''; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #bd8962; }
.readiness-item.ready::before { background: #63896a; box-shadow: 0 0 0 3px rgba(99, 137, 106, .13); }

.studio-main { width: min(1180px, calc(100% - 48px)); }
.studio-layout { display: grid; grid-template-columns: minmax(285px, .78fr) minmax(390px, 1.22fr); gap: 26px; align-items: start; }
.portrait-column { position: sticky; top: 20px; }
.portrait-frame { position: relative; width: min(100%, 405px); aspect-ratio: 9 / 16; margin: 0 auto; overflow: hidden; background: #e9e0cf; border-radius: 12px; box-shadow: inset 0 0 0 8px #e4ddcf, 0 16px 45px rgba(54, 63, 49, .16); }
#studio-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.portrait-overlay { position: absolute; left: 0; right: 0; top: 0; padding: 22px 16px; display: flex; align-items: center; justify-content: space-between; color: #fffdf5; text-shadow: 0 1px 5px rgba(0,0,0,.35); font-weight: 700; letter-spacing: .08em; font-size: 10px; pointer-events: none; }
.portrait-overlay span:first-child { font-family: var(--serif); font-size: 21px; }
.caption-preview { position: absolute; left: 7%; right: 7%; bottom: 13%; text-align: center; font-size: 15px; font-weight: 700; line-height: 1.35; color: white; text-shadow: 0 1px 5px rgba(0,0,0,.8); pointer-events: none; }
.record-controls { display: flex; justify-content: center; gap: 8px; margin-top: 17px; }
.microcopy { color: #858b80; font-size: 10px; line-height: 1.55; text-align: center; }
.studio-tools { display: grid; gap: 13px; }
.tool-card { margin: 0; }
.tool-card label { display: block; margin: 17px 0 7px; color: #56655b; font-size: 11px; font-weight: 700; }
.tool-card input, .tool-card textarea, .tool-card select, .login-card input { width: 100%; min-height: 41px; padding: 10px 12px; color: var(--ink); background: #fffdf8; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
.tool-card textarea { resize: vertical; }
.tool-inline { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.tool-inline select { width: 100px; }
.hidden { display: none !important; }
.event-choice { position: relative; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #f4f1e9; color: var(--ink); text-align: left; cursor: pointer; }
.event-choice + .event-choice { margin-top: 8px; }
.event-choice.selected { border-color: var(--green); background: #e8eee4; }
.event-range-marker { float: right; margin: -2px 0 0 8px; padding: 3px 6px; border-radius: 999px; background: #dce6d8; color: #405947; font: 600 9px/1.2 var(--sans); font-style: normal; letter-spacing: .08em; }
.event-range-marker.end { background: #f0e1d3; color: #805337; }
.event-choice strong, .event-choice span { display: block; }
.event-choice strong { font-size: 12px; }
.event-choice span { margin-top: 4px; color: #7a8478; font-size: 10px; }
.replay-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.replay-speed { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; }
.replay-speed label { margin: 0; }
.replay-speed select { width: auto; min-width: 74px; min-height: 38px; padding: 6px 9px; }
.replay-timeline-label { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.replay-timeline-label output { color: var(--green); font-size: 11px; font-variant-numeric: tabular-nums; }
.range-label { margin-bottom: 5px !important; }
.tool-card input[type="range"] { min-height: 24px; padding: 0; accent-color: var(--green); }
.checkbox-row { display: flex !important; align-items: center; gap: 8px; color: #778075 !important; font-weight: 500 !important; }
.checkbox-row input { width: auto; min-height: 0; accent-color: var(--green); }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: radial-gradient(ellipse at 80% 10%, #e6e9d9, transparent 40%), var(--paper); }
.login-card { width: min(100%, 410px); padding: 35px; border: 1px solid var(--line); border-radius: 12px; background: #fbf9f3; box-shadow: 0 18px 60px rgba(52, 66, 54, .1); }
.login-card > .wordmark { margin-bottom: 44px; }
.login-card h1 { margin: 9px 0; font-size: 40px; }
.login-card > p:not(.eyebrow) { color: #7b8479; font-size: 13px; line-height: 1.65; }
.login-card form { margin: 24px 0 18px; }
.login-card label { display: block; margin-bottom: 7px; color: #5c6a60; font-size: 11px; font-weight: 700; }
.login-card form button { width: 100%; margin-top: 12px; }
.form-error { min-height: 16px; color: #9b5948; font-size: 11px; }
.journal-page { min-height: calc(100vh - 160px); padding: 110px clamp(26px, 15vw, 230px); }
.journal-page h1 { margin: 20px 0 45px; font-size: clamp(46px, 7vw, 76px); line-height: 1.03; }
.journal-page .journal-empty { max-width: 550px; padding: 23px; background: #faf7ef; border: 1px solid var(--line); }

@media (max-width: 760px) {
  .site-header, .console-header { height: 65px; padding: 0 18px; }
  .wordmark { gap: 10px; }
  .wordmark-mark { width: 36px; height: 36px; font-size: 15px; }
  .wordmark-tagline { font-size: 12px; }
  .preview-pill { font-size: 8px; letter-spacing: .03em; }
  .world-section { height: 63vh; min-height: 445px; max-height: 650px; }
  .world-topline, .world-bottomline { left: 18px; right: 18px; }
  .world-topline { top: 17px; }
  .world-state { padding: 8px 10px; font-size: 8px; }
  .world-location { font-size: 16px; }
  .world-caption { font-size: 13px; }
  .drag-hint { display: none; }
  .world-controls { gap: 6px; }
  .icon-button { width: 34px; height: 34px; }
  .camera-select { max-width: 118px; height: 34px; padding-left: 8px; font-size: 9px; }
  .world-callout { bottom: 68px; max-width: calc(100% - 36px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .intro-section { grid-template-columns: 1fr; gap: 38px; padding: 73px 25px 70px; }
  .intro-copy h1 { font-size: clamp(55px, 15vw, 76px); }
  .intro-lede { font-size: 16px; }
  .character-card { width: min(86%, 340px); justify-self: center; }
  .character-art-wrap { height: 315px; }
  .facts-row { grid-template-columns: 1fr; }
  .fact-card { min-height: 0; padding: 26px 27px; }
  .fact-icon { margin-bottom: 16px; }
  .fact-card p { margin-bottom: 0; }
  .life-panels { grid-template-columns: 1fr; gap: 34px; padding: 70px 26px; }
  .journal-teaser { grid-template-columns: 1fr; gap: 17px; padding: 75px 26px 80px; }
  .journal-teaser h2 { font-size: 39px; }
  .journal-empty { padding-top: 20px; }
  .site-footer { gap: 11px; flex-wrap: wrap; font-size: 9px; }
  .footer-status { flex-basis: 100%; margin-left: 25px; }
  .console-header nav { gap: 11px; font-size: 9px; }
  .console-header nav a:nth-child(3) { display: none; }
  .text-button { font-size: 10px; }
  .console-main, .studio-main { width: min(100% - 28px, 650px); padding: 38px 0 70px; }
  .console-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .admin-status-grid { grid-template-columns: 1fr 1fr; }
  .admin-panel { padding: 18px; }
  .birth-guard, .control-row { align-items: flex-start; flex-direction: column; }
  .birth-guard .button { width: 100%; }
  .control-row .button-group { width: 100%; }
  .button-group .button { flex: 1; }
  .readiness-list { grid-template-columns: 1fr; }
  .studio-layout { grid-template-columns: 1fr; }
  .portrait-column { position: static; }
  .portrait-frame { width: min(76vw, 330px); }
  .studio-tools { margin-top: 14px; }
  .tool-card { padding: 18px; }
  .private-pill { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

