/* A cottage window and a household notebook, rather than a wall of cards. */
:root {
  --bg: #eee7d7; --bg-2: #e7dfcc; --panel: #faf6eb; --panel-2: #f0e8d6;
  --ink: #343d32; --ink-dim: #616653; --ink-faint: #72745f; --line: #cfc7b2;
  --pink: #9b4933; --green: #4b6944; --gold: #795b24; --blue: #376c7a;
  --red: #ab3741; --danger-ink: #ab3741; --accent-ink: #fff8ec;
  --heading: #344b37; --button: #e8e0ce; --hover: #dbe2ce; --field: #fffcf4;
  --selected: #e0e7d3; --frame: #9e805c; --primary: #a44e36; --primary-hover: #8e3f2c;
  --radius: 8px; --radius-sm: 6px; --shadow: none;
}
:root[data-theme="dark"] {
  --bg: #202722; --bg-2: #2d352d; --panel: #29312a; --panel-2: #323b31;
  --ink: #e9e4d4; --ink-dim: #c0c4ae; --ink-faint: #a9b19d; --line: #4b5546;
  --pink: #efaa8c; --green: #b4cb96; --gold: #e0bf7a; --blue: #99cbd3;
  --red: #f3a0a4; --danger-ink: #f3a0a4;
  --heading: #e7e9ce; --button: #394334; --hover: #46533d; --field: #202820;
  --selected: #435239; --frame: #8f7b58; --primary: #ad5035; --primary-hover: #98452e;
}
body { background: var(--bg); font-family: 'Segoe UI', system-ui, sans-serif; }
h1, h2, h3, h4 { color: var(--heading); }
button, input, select { border: 1px solid var(--line); border-radius: 6px; }
button { background: var(--button); box-shadow: none; }
button:hover:not(:disabled) { background: var(--hover); border-color: var(--green); }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green); outline-offset: 4px;
}
button.primary { background: var(--primary); color: var(--accent-ink); border-color: var(--primary); box-shadow: 0 2px 0 #0003; }
button.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
input, select { background: var(--field); color: var(--ink); }
input::placeholder { color: var(--ink-faint); opacity: 1; }
.display-settings { width: min(1120px, 100%); margin: 0 auto; padding: 12px 28px 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; color: var(--ink-dim); font-size: 11px; }
.display-settings select { font: inherit; min-height: 36px; padding: 5px 24px 5px 10px; }
.display-settings button { font: inherit; min-height: 36px; padding: 5px 10px; }
#ambience-toggle { margin-right: auto; }
main { width: min(1120px, 100%); gap: 18px; padding-top: 6px; }
.topbar { border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.save-status { display: flex; align-items: center; justify-content: flex-end; gap: 12px; color: var(--ink-dim); font-size: 11px; min-height: 18px; margin: -10px 0 -6px; }
.save-status[data-state="unsaved"] { justify-content: flex-start; padding: 12px; margin: 0; border: 1px solid var(--red); color: var(--danger-ink); background: var(--panel); font-size: 13px; }
.save-status button { min-height: 44px; }
.return-updates, .practice-panel { border-top: 1px solid var(--line); padding: 16px 0; font-size: 13px; }
.return-updates summary, .practice-panel summary { min-height: 44px; cursor: pointer; font-weight: 650; }
.practice-area { padding: 14px; background: var(--panel-2); border-radius: 6px; }
.practice-area > button { min-height: 44px; margin: 4px; }
.brand, .gate-story .brand { color: var(--heading); font-family: Georgia, serif; font-weight: 700; font-size: 34px; letter-spacing: -1.5px; }
.brand span { color: var(--pink); }
.panel, .gate-card, .feature-panels > .panel { background: var(--panel); border-color: var(--line); border-radius: 8px; box-shadow: none; }
.panel.room-panel { border: 0; border-bottom: 1px solid var(--line); padding: 0 0 15px; background: transparent; }
.room-panel > span { color: var(--ink-dim); }
#room-code { color: var(--ink); font: 12px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.room-panel button { min-height: 38px; }
.room-panel small { max-width: 240px; text-align: right; }
.character-picker { padding: 12px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); }
.character-picker summary { font-size: 13px; }
.character-picker summary span { color: var(--pink); }
.character-options button { position: relative; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); padding: 0 6px 14px; }
.character-options button[aria-pressed="true"] { background: var(--selected); border: 2px solid var(--green); padding: 0 5px 13px; }
.character-options button[aria-pressed="true"]::after { content: '✓'; position: absolute; top: 7px; right: 8px; color: var(--green); font-size: 12px; }
.character-options canvas { max-height: 104px; object-fit: contain; }
.character-options strong { font-size: 12px; }
.character-options small { font-size: 11px; }
#appearance-status:empty { display: none; }
.empty { display: grid; grid-template-columns: 1.12fr 1fr; padding: 0; overflow: hidden; text-align: left; }
.setup-scene { margin: 0; padding: 18px; display: flex; flex-direction: column; justify-content: center; background: var(--panel-2); border-right: 1px solid var(--line); }
.setup-scene canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border: 5px solid var(--frame); border-radius: 100px 100px 4px 4px; }
.setup-scene figcaption { margin: 14px 0 0; text-align: center; font: italic 17px Georgia, serif; color: var(--ink-dim); }
.setup-copy { padding: 28px; min-width: 0; }
.eyebrow { color: var(--ink-dim); font-size: 10px; letter-spacing: .13em; }
.setup-copy > .eyebrow { margin: 0 0 10px; }
.setup-copy h2 { font-size: 38px; letter-spacing: -.045em; line-height: 1.1; }
.setup-copy > p:not(.eyebrow) { font-size: 13px; line-height: 1.65; color: var(--ink-dim); }
.setup-copy .character-picker { border: 0; padding: 10px 0 4px; }
.setup-copy .character-picker > summary, .setup-copy .character-picker > p:first-of-type { display: none; }
.setup-copy .character-options { gap: 8px; }
.setup-copy #new-pet-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 16px; justify-content: stretch; }
#new-pet-form label { grid-column: 1 / -1; font-size: 12px; font-weight: 600; }
#new-pet-form input { width: 100%; min-width: 0; }
.setup-copy .setup-footnote { font-size: 11px !important; margin-bottom: 0; }
.columns { gap: 28px; }
.columns .panel { border: 0; border-top: 2px solid var(--line); border-radius: 0; background: transparent; padding: 18px 0 0; }
.columns h3 { font-size: 19px; }
.notes h3::before { display: none; }
.note-list li, .log-list li { border-color: var(--line); }
.note-list li { background: var(--panel); }
.stage { background: transparent; border: 0; border-radius: 0; padding: 8px 0 0; column-gap: 28px; }
.stage-head { margin-bottom: 18px; }
.stage-head h2 { font-size: 42px; }
.screen, .screen.puppet-theatre { border: 5px solid var(--frame); border-radius: 40px 40px 6px 6px; box-shadow: 0 3px 0 #0002; }
.puppet-goal { background: var(--panel); border-color: var(--line); border-radius: 6px; outline: none; border-left: 3px solid var(--pink); }
.puppet-goal h3 { font-size: 22px; }
.puppet-steps .done { color: var(--green); border-color: var(--green); }
.puppet-steps li, .puppet-contributions { border-color: var(--line); }
.visit-focus h3 { font-size: 25px; }
.pill, .pill.form { background: var(--panel-2); color: var(--ink-dim); border-color: var(--line); border-radius: 4px; }
.pill.form { color: var(--gold); }
.ambient-caption, .puppet-caption { background: transparent; color: var(--ink-dim); border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font: italic 14px/1.6 Georgia, serif; padding: 10px 0; }
.action, .action:nth-child(n) { background: var(--panel); border-color: var(--line); border-radius: 6px; min-height: 100px; }
.action .story-icon { width: 52px; height: 52px; }
.actions { border-top-style: solid; }
.care-panel, .life-panel, .more-care, .pet-details { border-color: var(--line); }
.care-panel > summary, .life-panel > summary, .feature-panels > details > summary { color: var(--heading); }
.care-panel details, .wish-album, .incident-card, .expedition-card, .outing-result,
.destination, .shop-item, .trophy, .skill-game:not(:empty), .coop-game:not(:empty) { background: var(--panel-2); border-color: var(--line); border-radius: 6px; }
.feature-panels > .panel { border-width: 1px 0 0; border-radius: 0; padding: 20px 0; background: transparent; }
.shop-item h4, .destination h4 { color: var(--heading); }
.gauge, .bond { background: var(--panel-2); }
.meter, .scale { background: var(--line); }
.puppet-costumes button, .wish-sticker.collected, .game-pads button, .reaction-pad, .catch-lanes button { background: var(--panel); border-color: var(--line); }
.wish-sticker { border-color: var(--line); }
.wish-sticker.collected { box-shadow: none; }
.game-pads button.lit, button.lit, button.lit:disabled { background: #f0d18e; color: #343324; border-color: #9c7946; }
.location-art, .outing-workshop, .memory { border-color: var(--line); }
.route-track span { background: var(--panel-2); color: var(--ink-dim); }
.route-track .current { background: var(--gold); color: var(--bg); }
.memorial { background: var(--panel); }
.gate { min-height: calc(100dvh - 48px); padding-top: 30px; padding-bottom: 50px; gap: 60px; }
.gate-story h2 { color: var(--heading); }
.gate-story h2 { max-width: none; font-size: clamp(36px, 4vw, 52px); line-height: 1.05; margin: 18px 0 14px; }
.gate-card { border-radius: 6px; outline: none; border-top: 3px solid var(--green); }
.welcome-art { border-color: var(--frame); border-radius: 60px 60px 4px 4px; box-shadow: none; }
.room-modes { background: var(--bg-2); border-radius: 6px; }
.room-modes button[aria-pressed="true"] { background: var(--panel); color: var(--heading); border-color: var(--line); box-shadow: none; }
.gate-card label { color: var(--ink); }
.gate-footnote { text-transform: none; font-style: italic; }
.ambience-badge, .mood-badge { background: #faf3e3ed; color: #4a563b; border-color: #bdad8b; }
.toast { background: var(--ink); color: var(--bg); border-color: var(--line); }
@media (max-width: 800px) {
  .empty { grid-template-columns: 1fr 1.1fr; }
  .setup-copy { padding: 22px; }
  .setup-copy h2 { font-size: 30px; }
  .setup-scene { padding: 14px; }
}
@media (max-width: 620px) {
  .display-settings { padding: 10px 16px 0; }
  .display-settings > label { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .display-settings select { min-height: 44px; }
  .display-settings button { min-height: 44px; }
  main { padding: 4px 16px 32px; gap: 14px; }
  .topbar { gap: 8px; }
  .topbar .brand { width: auto; margin-right: auto; font-size: 30px; }
  .topbar .presence { width: 100%; order: 4; }
  .topbar .conn { margin-left: 4px; }
  .room-panel { gap: 8px; }
  .room-panel > span { flex-basis: 100%; }
  .room-panel button { min-height: 44px; }
  .empty { display: flex; flex-direction: column; }
  .setup-scene { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 20px 12px; }
  .setup-scene canvas { max-width: 340px; align-self: center; border-radius: 50px 50px 4px 4px; }
  .setup-scene figcaption { font-size: 14px; margin-top: 9px; }
  .setup-copy { padding: 20px; }
  .setup-copy h2 { font-size: 32px; }
  .setup-copy .character-options small { display: block; font-size: 10px; }
  .character-options strong { font-size: 11px; }
  .character-options canvas { max-height: 85px; }
  .setup-copy #new-pet-form { grid-template-columns: 1fr; }
  #new-pet-form button { min-height: 48px; }
  .columns { grid-template-columns: 1fr; gap: 22px; }
  .stage-head h2 { font-size: 34px; }
  .stage .screen-wrap { width: 100%; }
  .stage .screen { max-width: none; }
  .puppet-goal { padding: 16px; }
  .character-picker { padding: 12px 0; }
  .gate { padding: 18px 20px 36px; }
  .gate-story h2 { font-size: 38px; }
  .gate-story .welcome-art { max-width: 340px; width: 100%; }
  .gate-card { padding: 24px; }
  .gate-story > p { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled) { transform: none; }
}
