:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "Noto Serif SC", serif;
  background: #11131c;
  color: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }

.novel-stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0c0d13;
}

.scene {
  position: relative;
  width: min(100vw, 1440px);
  aspect-ratio: 16 / 9;
  min-height: min(100vh, 810px);
  overflow: hidden;
  isolation: isolate;
  background: #647d9a;
}

.scene-background {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(12, 17, 34, .18), transparent 48%, rgba(12, 9, 20, .58));
}

.character {
  position: absolute;
  z-index: 1;
  bottom: 10%;
  left: 50%;
  height: 83%;
  max-width: 62%;
  transform: translateX(-50%);
  filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .35));
  object-fit: contain;
  object-position: bottom;
}

.character-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.character-layer .character { pointer-events: auto; }

.top-bar {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff9ef;
  text-shadow: 0 2px 6px #111;
}

.top-bar strong { letter-spacing: .15em; font-size: clamp(14px, 1.4vw, 22px); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions span, .top-actions select, .top-actions button {
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(25, 21, 33, .45);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
}
.top-actions button { padding: 6px 16px; }
.top-actions button { padding: 4px 11px; }
.top-actions button:hover { background: rgba(167, 107, 118, .75); }

.dialogue-history {
  position: absolute;
  z-index: 2;
  top: 78px;
  left: 24px;
  right: 24px;
  bottom: 30%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}
.history-line {
  max-width: 75%;
  padding: 6px 16px;
  border-radius: 20px;
  color: rgba(255,255,255,.9);
  background: rgba(25, 21, 33, .3);
  font-size: clamp(12px, 1.2vw, 16px);
}
.history-line.player {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: rgba(54, 72, 91, .72);
  text-align: right;
}
.history-line.character {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: rgba(93, 55, 78, .78);
}
.history-line.system {
  align-self: center;
  background: rgba(30, 30, 42, .78);
  color: #f0c4b8;
}

.dialogue-box {
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  bottom: 8%;
  min-height: 22%;
  padding: 30px 42px 25px;
  border: 1px solid rgba(255, 246, 232, .8);
  border-radius: 8px;
  background: linear-gradient(110deg, rgba(47, 37, 57, .88), rgba(32, 27, 45, .68));
  box-shadow: 0 4px 20px rgba(0,0,0,.3), inset 0 0 25px rgba(255, 215, 187, .08);
  backdrop-filter: blur(4px);
}
.speaker {
  position: absolute;
  top: -19px;
  left: 26px;
  padding: 7px 30px;
  border: 1px solid rgba(255, 238, 216, .85);
  border-radius: 20px;
  background: linear-gradient(100deg, #b97883, #79516d);
  color: #fff7ec;
  font-weight: bold;
  letter-spacing: .12em;
}
.dialogue-text { min-height: 58px; padding-top: 6px; white-space: pre-wrap; line-height: 1.85; font-size: clamp(15px, 1.6vw, 24px); }
.next-mark {
  position: absolute;
  right: 16px;
  bottom: 10px;
  color: #eab9ac;
  animation: blink 1.2s infinite;
}
@keyframes blink { 50% { opacity: .25; transform: translateY(3px); } }

.input-bar {
  position: absolute;
  z-index: 5;
  left: 5%;
  right: 5%;
  bottom: 1%;
  display: flex;
  opacity: 1;
}
.input-bar input {
  flex: 1;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 5px 0 0 5px;
  padding: 8px 12px;
  background: rgba(20, 18, 30, .85);
  color: white;
}
.input-bar button {
  border: 0;
  padding: 0 20px;
  border-radius: 0 5px 5px 0;
  background: #b97883;
  color: white;
}
.input-bar button:disabled,
.input-bar input:disabled {
  cursor: wait;
  opacity: .55;
}
.event-button {
  position: absolute;
  z-index: 5;
  right: 28px;
  bottom: 26%;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 20px;
  padding: 8px 17px;
  background: rgba(39, 28, 48, .55);
  color: #fff5ed;
}
.event-button:hover { background: #aa667a; }

.screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(11, 10, 18, .72);
  backdrop-filter: blur(7px);
}
.setup-screen, .character-screen {
  overflow: auto;
  padding: 24px;
  background: linear-gradient(135deg, rgba(20, 17, 31, .96), rgba(54, 35, 57, .92));
}
.setup-panel, .character-panel {
  width: min(94vw, 900px);
  max-height: 92vh;
  overflow: auto;
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid rgba(255, 239, 215, .55);
  border-radius: 12px;
  background: rgba(25, 22, 38, .92);
  box-shadow: 0 24px 90px rgba(0,0,0,.5);
}
.setup-heading h1 { margin: 8px 0 10px; color: #fff3e1; font-weight: 400; letter-spacing: .08em; }
.setup-heading p { margin: 0 0 24px; color: #cdbdc9; line-height: 1.8; }
.setup-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.setup-grid label, .character-import label {
  display: grid;
  gap: 7px;
  color: #e9d8d1;
  font-size: 13px;
}
.setup-grid input, .character-import input, .prompt-import textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 5px;
  padding: 10px 12px;
  color: #fff;
  background: rgba(9, 10, 18, .72);
}
.prompt-import { margin-top: 20px; }
.prompt-import-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; color: #e9d8d1; font-size: 13px; }
.prompt-import-head label { display: grid; gap: 7px; }
.prompt-import-head span { color: #c3a6b0; font-size: 12px; }
.prompt-import textarea { margin-top: 9px; resize: vertical; line-height: 1.6; }
.character-import { display: grid; grid-template-columns: 1fr 180px; gap: 24px; align-items: center; margin-top: 18px; }
.character-import > div:first-child { display: grid; gap: 14px; }
.character-preview { min-height: 150px; display: grid; place-items: center; border: 1px dashed #aa7a84; border-radius: 8px; color: #cdbdc9; background: rgba(255,255,255,.04); background-position: center; background-size: contain; background-repeat: no-repeat; }
.setup-actions { display: flex; justify-content: flex-end; gap: 14px; margin-top: 22px; }
.setup-actions .primary-button { margin: 0; }
.setup-warning { margin: 20px 0 0; color: #aa99a7; font-size: 12px; line-height: 1.7; }
.character-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 22px 0; }
.character-card { min-height: 220px; display: grid; align-content: end; padding: 18px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; color: #fff; text-align: left; background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(104,62,83,.55)); }
.character-card:hover { border-color: #eab9ac; background-color: #704b68; }
.character-card .card-avatar { height: 130px; margin: -4px -4px 12px; border-radius: 6px; background-position: center; background-size: contain; background-repeat: no-repeat; }
.character-card strong { font-size: 20px; font-weight: 400; }
.character-card small { margin-top: 5px; color: #d3c3cf; }
.conversation-topbar { display: flex; align-items: center; gap: 12px; }
.conversation-topbar #conversationLocation { flex: 1; }
.conversation-screen.is-expanded .conversation-art { display: none; }
.conversation-screen.is-expanded .dialogue-history { top: 72px; bottom: 24%; left: 10%; right: 10%; max-width: 760px; margin: 0 auto; overflow-y: auto; pointer-events: auto; }
.conversation-screen.is-expanded .dialogue-box { left: 10%; right: 10%; max-width: 760px; margin: 0 auto; }
@media (max-width: 700px) {
  .setup-grid, .character-import { grid-template-columns: 1fr; }
  .prompt-import-head { display: grid; }
  .character-preview { min-height: 110px; }
}
.title-screen {
  background: linear-gradient(90deg, rgba(16, 15, 28, .76), rgba(16, 15, 28, .25)), url("/static/assets/background.svg") center / cover;
}
.title-content { width: min(90%, 520px); text-align: center; text-shadow: 0 3px 14px #15111e; }
.eyebrow { color: #eab9ac; letter-spacing: .35em; font-size: 12px; }
.title-content h1 { margin: 20px 0 12px; color: #fff3e1; font-size: clamp(48px, 9vw, 100px); font-weight: 400; letter-spacing: .22em; }
.title-subtitle { margin-bottom: 48px; color: rgba(255,244,232,.8); }
.primary-button, .text-button, .menu-grid button, .item-card button {
  border: 1px solid rgba(255, 239, 215, .72);
  border-radius: 4px;
  color: #fff7ec;
  background: linear-gradient(100deg, #9f6471, #6d4c68);
}
.primary-button { display: block; min-width: 180px; margin: 12px auto; padding: 12px 30px; }
.text-button { border: 0; background: transparent; padding: 8px 18px; color: #f0c4b8; }
.primary-button:hover, .menu-grid button:hover, .item-card button:hover { background: #bf7b83; }
.panel-overlay { z-index: 30; }
#townMapPanel {
  z-index: 10;
  display: block;
  overflow: hidden;
  background: #d8d0c2;
  backdrop-filter: none;
}
#townMapPanel .town-map-panel {
  width: min(100vw, 1440px);
  min-height: 100%;
  height: 100%;
  max-height: 100vh;
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  column-gap: 28px;
  align-content: center;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  box-shadow: none;
}
#townMapPanel .town-map-panel::-webkit-scrollbar { width: 10px; }
#townMapPanel .town-map-panel::-webkit-scrollbar-track { background: #b8ad9e; }
#townMapPanel .town-map-panel::-webkit-scrollbar-thumb { border: 2px solid #b8ad9e; background: #704237; }
.map-dashboard {
  display: grid;
  grid-column: 1;
  grid-row: 1 / 3;
  grid-template-columns: 1fr;
  gap: 18px;
  align-content: start;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-right: 1px solid #a79888;
  color: #eee5da;
  background: transparent;
}
.map-dashboard-title h1 { margin: 4px 0; font-family: "Noto Serif SC", serif; font-size: clamp(24px, 3vw, 38px); font-weight: 400; }
.map-dashboard-title p { margin: 0; color: #bfb2a8; font-size: 12px; }
.map-alert {
  display: grid;
  gap: 3px;
  padding: 10px 14px;
  border-left: 4px solid #bc6549;
  background: #30292a;
}
.map-alert span { color: #d78a65; font-size: 10px; letter-spacing: .18em; }
.map-alert b { color: #f0dfc8; font-size: 15px; }
.map-alert small { color: #b9a79c; font-size: 11px; }
.map-resources, .map-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.map-resources { grid-column: 1; }
.map-stats { grid-column: 1; margin-top: 0; }
.map-resources span, .map-stats span {
  border: 1px solid #665953;
  padding: 5px 8px;
  color: #d8cbc0;
  background: #282222;
  font-size: 11px;
}
.map-resources button {
  border: 1px solid #9a6d5d;
  padding: 5px 9px;
  color: #f0dfc8;
  background: #663329;
  cursor: pointer;
}
.map-resources button:hover { background: #8a4636; }
.map-menu-button {
  position: absolute;
  top: 18px;
  right: 42px;
  border: 1px solid #9a6d5d;
  padding: 7px 14px;
  color: #f0dfc8;
  background: #663329;
  cursor: pointer;
}
.map-menu-button:hover,
.map-menu-button:focus-visible { background: #8a4636; }
.map-resources b, .map-stats b { color: #d78a65; }
.map-affection { top: 24px; right: 42px; }
.town-map-panel > .activity-panel-heading {
  grid-column: 1;
  grid-row: 3;
  margin: 0;
  padding: 18px 0 0;
  border-bottom: 0;
}
.town-map-panel > .town-map {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  width: min(100%, 780px);
  aspect-ratio: 1 / .86;
  min-height: 0;
  max-height: calc(100vh - 68px);
  margin: 0 auto;
}
.town-map-panel > .map-notice {
  grid-column: 1;
  grid-row: 4;
  margin: 14px 0 0;
}
.town-map-panel > .lead-picker {
  inset: 20px;
}
.menu-panel, .sub-panel {
  position: relative;
  width: min(90%, 620px);
  max-height: 82vh;
  overflow: auto;
  padding: 42px;
  border: 1px solid rgba(255, 239, 215, .64);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(46, 34, 55, .97), rgba(24, 23, 38, .97));
  box-shadow: 0 20px 80px rgba(0,0,0,.5);
}
.menu-panel h2, .sub-panel h2 { margin: 0 0 28px; color: #f6d8c2; font-weight: 400; letter-spacing: .16em; }
.close-panel { position: absolute; top: 12px; right: 16px; border: 0; background: transparent; color: #e9c9b9; font-size: 28px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.menu-grid button { padding: 15px; }
.save-list { display: grid; gap: 10px; margin-bottom: 20px; }
.save-slot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.05); }
.save-slot strong { color: #f4d2bd; }
.save-slot small { display: block; margin-top: 5px; color: #bcaeba; }
.save-slot button { border: 0; padding: 6px 10px; background: #77516b; color: #fff; }
.status-card { text-align: center; }
.status-portrait { display: grid; place-items: center; width: 130px; height: 130px; margin: 0 auto 12px; border: 1px solid #bd8a8b; border-radius: 50%; background: radial-gradient(circle, #a77785, #3e2d4d); color: #fff0e7; font-size: 20px; }
.status-role { color: #c9aeb5; }
.stat-row { display: flex; justify-content: space-between; margin: 14px auto; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.13); max-width: 360px; }
.stat-row strong { color: #eeb3a4; }
.status-note { color: #cab8c4; line-height: 1.8; }
.item-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid rgba(255,255,255,.18); }
.item-card p { margin: 6px 0 0; color: #c9bac5; font-size: 13px; }
.item-card button { margin-left: auto; padding: 8px 14px; }
.item-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #d59a9d; border-radius: 8px; color: #f1b3b0; font-size: 26px; }
.settings-card label { display: flex; justify-content: space-between; align-items: center; margin: 20px 0; color: #e9d8d1; }
.settings-card input[type="range"] { accent-color: #b97883; }
.activity-panel {
  position: relative;
  width: min(92%, 760px);
  max-height: 88vh;
  overflow: auto;
  padding: 34px;
  border: 2px solid #43332f;
  background: #d8d0c2;
  color: #2d2522;
  box-shadow: 0 18px 70px rgba(0,0,0,.55);
}
.activity-panel .close-panel { color: #5a332b; }
.activity-panel-heading { border-bottom: 1px solid #9c887b; padding-bottom: 14px; }
.activity-panel-heading h2 { margin: 4px 0; font-family: "Noto Serif SC", serif; font-size: 28px; }
.activity-panel-heading p { margin: 0; color: #66544d; }
.farm-toolbar { display: flex; justify-content: space-between; margin: 16px 0 10px; color: #69564e; font-size: 13px; }
.farm-toolbar b { color: #7a352b; font-size: 20px; }
.farm-plots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.farm-plot {
  min-height: 100px;
  border: 2px solid #5b4035;
  color: #ead2ae;
  background: linear-gradient(135deg, #6b432e, #3e2d29);
  box-shadow: inset 0 0 0 3px rgba(218, 172, 119, .12);
  font-family: "Noto Serif SC", serif;
  cursor: pointer;
}
.farm-plot:hover { background: linear-gradient(135deg, #80553a, #51352d); }
.farm-plot.planted { color: #392b27; background: #a4a46f; cursor: default; }
.crop-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.crop-option {
  padding: 11px 8px;
  border: 1px solid #80695e;
  color: #4a3731;
  background: #eee3d2;
}
.crop-option b, .crop-option small { display: block; }
.crop-option small { margin-top: 4px; color: #836052; }
.crop-option.selected { border: 2px solid #7d3328; background: #f4d0b5; }
.generic-activity { display: grid; justify-items: center; padding: 34px 20px 14px; text-align: center; }
.generic-activity-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border: 2px solid #7d3328;
  color: #7d3328;
  font-size: 42px;
}
.generic-activity p { max-width: 430px; line-height: 1.8; color: #5f4c45; }
.generic-activity .primary-button { margin-top: 8px; border-color: #572c27; }
.town-map-panel {
  position: relative;
  width: min(100%, 1180px);
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 34px 42px;
  border: 0;
  background: #d8d0c2;
  color: #2d2522;
  box-shadow: 0 18px 70px rgba(0,0,0,.55);
}
.town-map-panel .activity-panel-heading { margin-bottom: 14px; }
.town-map {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 3px solid #4f3d37;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.32) 0 1px, transparent 2px),
    #b3b18d;
  background-size: 19px 19px, auto;
}
.map-road { position: absolute; background: #d5c8a9; border: 2px solid rgba(94,77,61,.38); }
.road-main { top: 49%; left: -5%; width: 110%; height: 58px; transform: rotate(-8deg); }
.road-cross { top: -10%; left: 47%; width: 62px; height: 120%; transform: rotate(20deg); }
.map-location {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 5px 9px;
  border: 1px solid #6d5b4b;
  color: #55463d;
  background: rgba(235,224,193,.8);
  font: 13px "Noto Serif SC", serif;
  cursor: pointer;
}
.map-location:hover, .map-location:focus-visible {
  color: #fff3e3;
  background: #7d3328;
}
.map-location small, .map-location em {
  display: block;
  color: #856d5e;
  font: 10px "Microsoft YaHei", sans-serif;
  font-style: normal;
}
.map-location em { margin-top: 3px; color: #9c4e3b; }
.map-location:hover small, .map-location:focus-visible small,
.map-location:hover em, .map-location:focus-visible em { color: #f0c7a6; }
.location-garden { top: 63%; left: 44%; }
.map-affection {
  position: absolute;
  z-index: 31;
  top: 20px;
  right: 24px;
}
.location-plaza { top: 37%; left: 40%; }
.location-river { top: 14%; left: 8%; }
.location-lab { top: 12%; right: 9%; }
.location-market { bottom: 13%; right: 10%; }
.map-characters { position: absolute; inset: 0; }
.map-character {
  position: absolute;
  display: grid;
  gap: 2px;
  min-width: 108px;
  padding: 8px 7px;
  border: 2px solid #4e302a;
  color: #f5e5d2;
  background: #71352d;
  box-shadow: 2px 3px 0 rgba(53,38,31,.3);
  text-align: left;
  cursor: pointer;
}
.map-character:hover, .map-character:focus-visible { background: #994a38; transform: translateY(-2px); }
.map-character small { color: #e5c4a8; font-size: 10px; }
.map-character.npc { border-color: #62594b; color: #403832; background: #e4d6ba; }
.map-character.npc small { color: #756454; }
.map-character[data-lead="shenbaike"] { top: 55%; left: 17%; }
.map-character[data-lead="linye"] { top: 18%; left: 31%; }
.map-character[data-lead="guxingzhou"] { top: 22%; right: 18%; }
.map-character[data-lead="xujing"] { bottom: 12%; left: 41%; }
.map-character[data-lead="baiyu"] { bottom: 8%; right: 23%; }
.map-character[data-npc="mayor"] { top: 4%; left: 51%; }
.map-character[data-npc="merchant"] { bottom: 6%; left: 6%; }
.map-character[data-npc="gardener"] { top: 57%; right: 5%; }
.map-notice {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 4px solid #7d3328;
  color: #654d43;
  background: #eee3d2;
}
.lead-picker {
  position: absolute;
  inset: 34px 42px;
  z-index: 4;
  padding: 24px;
  background: rgba(216,208,194,.97);
}
.lead-picker-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  color: #4a3731;
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
}
.lead-picker-heading button {
  border: 1px solid #80695e;
  padding: 6px 12px;
  color: #63453b;
  background: #eee3d2;
}
.lead-picker-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.lead-picker-option {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 2px solid #593229;
  color: #f5e5d2;
  background: linear-gradient(#79382c, #4d2421);
  text-align: left;
  cursor: pointer;
}
.lead-picker-option:hover, .lead-picker-option:focus-visible { background: #994a38; }
.lead-picker-option small { color: #e5c4a8; }
.lead-picker-option span { color: #f1cbb0; font-size: 11px; }

@media (max-width: 700px) {
  .scene { min-height: 100vh; aspect-ratio: auto; }
  .character { height: 64%; bottom: 25%; }
  .dialogue-box { left: 3%; right: 3%; bottom: 10%; min-height: 26%; padding: 28px 22px 18px; }
  .top-bar { left: 12px; right: 12px; }
  .top-actions span { display: none; }
  .event-button { right: 14px; bottom: 33%; }
  .menu-panel, .sub-panel { padding: 32px 22px; }
  .menu-grid { grid-template-columns: 1fr; }
}

/* Daily activity hub */
.scene {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr) 260px;
  aspect-ratio: 9 / 16;
  min-height: min(100vh, 960px);
  max-height: 100vh;
  background: #d7d0c3;
  color: #271f1c;
}
.top-bar {
  position: relative;
  inset: auto;
  z-index: 8;
  padding: 8px 18px;
  gap: 14px;
  color: #eee8dd;
  background: #171719;
  text-shadow: none;
}
.day-switch {
  border: 0;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: #181617;
  background: #eee8dd;
  font-size: 24px;
  line-height: 20px;
}
.game-brand { display: grid; gap: 2px; min-width: 150px; }
.game-brand strong { font-family: "Noto Serif SC", serif; letter-spacing: .18em; }
.game-brand span { color: #aaa09b; font-size: 11px; }
.resource-strip { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.resource-strip span, .resource-strip button {
  border: 1px solid #6f625c;
  padding: 5px 8px;
  color: #e8dfd3;
  background: #2a2524;
  font-size: 11px;
}
.resource-strip b { color: #d89268; }
.resource-strip button { cursor: pointer; }
.event-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 8px solid #292426;
  border-top: 0;
  background: #827a79;
}
.event-stage .scene-background { z-index: 0; }
.event-stage .scene-shade { z-index: 1; background: linear-gradient(180deg, rgba(12, 12, 15, .12), rgba(22, 14, 21, .68)); }
.event-stage .character-layer { z-index: 2; }
.event-stage .character { height: 94%; bottom: -3%; }
.event-copy {
  position: absolute;
  z-index: 4;
  top: 22px;
  left: 26px;
  max-width: 390px;
  color: #f6eee3;
  text-shadow: 0 2px 6px #211b1e;
}
.event-kicker, .section-kicker { color: #d78a65; font-size: 10px; letter-spacing: .22em; }
.event-copy h1 { margin: 8px 0 5px; font-size: clamp(20px, 3vw, 34px); font-weight: 400; }
.event-copy p { margin: 0; max-width: 340px; color: #e1d7cd; line-height: 1.6; font-size: 13px; }
.event-stage .dialogue-history { top: auto; bottom: 18px; left: 20px; right: 20px; max-height: 30%; }
.event-stage .dialogue-box {
  left: 5%;
  right: 5%;
  bottom: 5%;
  min-height: 0;
  padding: 18px 26px 15px;
  border-color: rgba(235, 219, 198, .7);
  background: rgba(27, 24, 28, .82);
}
.event-stage .dialogue-text { min-height: 32px; font-size: clamp(13px, 1.6vw, 19px); line-height: 1.55; }
.event-stage .speaker { top: -15px; padding: 4px 18px; font-size: 12px; }
.activity-deck {
  position: relative;
  z-index: 6;
  overflow: auto;
  padding: 16px 22px 14px;
  border-top: 6px solid #252123;
  background: #d8d0c2;
  background-image: linear-gradient(rgba(255,255,255,.16), rgba(255,255,255,.16)), repeating-linear-gradient(0deg, transparent 0 7px, rgba(71,53,43,.035) 8px);
}
.deck-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 10px; }
.deck-heading h2 { margin: 3px 0 0; font-family: "Noto Serif SC", serif; font-size: 18px; font-weight: 700; }
.affection-chip { border: 1px solid #50443e; padding: 5px 9px; color: #fff5e7; background: #63302a; font-size: 12px; }
.activity-grid { display: grid; grid-template-columns: repeat(6, minmax(82px, 1fr)); gap: 9px; }
.activity-card {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-height: 122px;
  padding: 9px 5px;
  border: 2px solid #342a28;
  color: #f4e8d9;
  background: linear-gradient(#79382c, #4d2421);
  box-shadow: inset 0 0 0 2px rgba(235, 207, 176, .2), 2px 3px 0 rgba(43, 32, 29, .25);
}
.activity-card:hover, .activity-card:focus-visible { background: linear-gradient(#9b4b37, #602920); transform: translateY(-2px); }
.activity-icon { display: grid; place-items: center; width: 40px; height: 40px; margin: 2px 0 4px; border: 1px solid #e2b28f; color: #f0c7a6; font-family: "Noto Serif SC", serif; font-size: 22px; }
.activity-card strong { font-size: 14px; }
.activity-card small { color: #d9bfa9; font-size: 10px; }
.activity-deck .input-bar { position: relative; inset: auto; margin-top: 12px; }
.activity-deck .input-bar input { border-color: #96877d; color: #302725; background: rgba(255,255,255,.55); }
.activity-deck .input-bar button { background: #2d2524; }

.conversation-screen {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) auto 58px;
  background: #171719;
}
.conversation-topbar {
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 18px;
  border-bottom: 1px solid #554b48;
  color: #eee5da;
  background: #242021;
  font-size: 13px;
}
.conversation-topbar > span:last-child { margin-left: auto; color: #d78a65; }
.back-button {
  border: 1px solid #82716a;
  padding: 5px 10px;
  color: #eee5da;
  background: transparent;
}
.conversation-art {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 8px solid #292426;
  border-top: 0;
}
.conversation-background {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
}
.conversation-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 14, 18, .16), rgba(22, 14, 21, .64));
}
.conversation-character {
  position: absolute;
  inset: 0;
  background: center bottom / contain no-repeat;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.4));
}
.conversation-screen .dialogue-history {
  position: absolute;
  z-index: 3;
  top: 65px;
  left: 22px;
  right: 22px;
  bottom: 155px;
}
.conversation-screen .dialogue-box {
  position: absolute;
  z-index: 4;
  left: 7%;
  right: 7%;
  bottom: 72px;
  min-height: 92px;
  padding: 24px 28px 16px;
  border: 1px solid rgba(235, 219, 198, .7);
  border-radius: 4px;
  background: rgba(27, 24, 28, .88);
}
.conversation-screen .dialogue-text { min-height: 40px; font-size: clamp(14px, 1.7vw, 21px); }
.conversation-screen .input-bar {
  position: relative;
  z-index: 5;
  inset: auto;
  display: flex;
  margin: 0 7% 14px;
}
.conversation-screen .input-bar input { border-color: #76665e; background: #282324; }
.conversation-screen .input-bar button { background: #7b392d; }

@media (min-width: 1000px) {
  .scene { aspect-ratio: 16 / 9; grid-template-rows: 62px minmax(0, 1fr) 250px; }
  .activity-deck { padding-left: 32px; padding-right: 32px; }
}
@media (max-width: 700px) {
  .scene { grid-template-rows: 62px minmax(0, 1fr) 310px; aspect-ratio: auto; }
  .top-bar { padding: 8px 10px; }
  .game-brand { min-width: 0; }
  .game-brand span, .resource-strip span:nth-child(-n+2) { display: none; }
  .resource-strip { gap: 4px; }
  .event-copy { top: 16px; left: 16px; right: 16px; }
  .event-copy p { font-size: 12px; }
  .activity-deck { padding: 13px 12px 10px; }
  .activity-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .activity-card { min-height: 94px; }
  .activity-icon { width: 30px; height: 30px; font-size: 17px; }
  .conversation-screen { grid-template-rows: 52px minmax(0, 1fr) auto 58px; }
  .conversation-topbar { padding: 8px 10px; }
  .conversation-screen .dialogue-box { left: 4%; right: 4%; bottom: 70px; padding: 22px 18px 12px; }
  .conversation-screen .input-bar { margin-left: 4%; margin-right: 4%; }
  .activity-panel { padding: 24px 16px; }
  .farm-plot { min-height: 78px; }
  .town-map-panel {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    gap: 0;
    padding: 22px 14px 40px;
  }
  .map-dashboard {
    grid-column: 1;
    grid-row: 1;
    grid-template-columns: 1fr;
    margin: -22px -14px 16px;
    padding: 16px 14px;
    border-right: 0;
    border-bottom: 1px solid #a79888;
  }
  .map-alert { grid-column: 1; }
  .map-resources, .map-stats { grid-column: 1; }
  .map-menu-button { top: 12px; right: 14px; }
  .town-map-panel > .activity-panel-heading {
    grid-column: 1;
    grid-row: 2;
    padding: 0 0 14px;
  }
  .town-map-panel > .town-map {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    aspect-ratio: auto;
    min-height: 500px;
    max-height: none;
  }
  .town-map-panel > .map-notice {
    grid-column: 1;
    grid-row: 4;
  }
  .lead-picker { inset: 22px 14px; padding: 16px; }
  .lead-picker-options { grid-template-columns: 1fr; }
  .setup-screen,
  .character-screen {
    display: block;
    overflow-y: auto;
    padding: 12px;
  }
  .setup-panel,
  .character-panel {
    width: 100%;
    max-height: none;
    margin: 0 auto;
    padding: 20px 16px;
  }
  .setup-grid { grid-template-columns: 1fr; }
  .prompt-import-head { display: grid; gap: 8px; align-items: start; }
  .character-import { grid-template-columns: 1fr; gap: 14px; }
  .character-preview { min-height: 120px; }
  .setup-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .setup-actions .primary-button,
  .setup-actions .text-button { width: 100%; }
  #townMapPanel .town-map-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto;
    align-content: start;
  }
  #townMapPanel .town-map-panel > .town-map {
    margin-top: 0;
  }
  .map-location {
    max-width: 43%;
    padding: 5px 6px;
    font-size: 11px;
  }
  .map-location small,
  .map-location em { font-size: 9px; }
}

/* World direction: high-tech city, hidden anomaly, observation interface */
:root {
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: #070d15;
  color: #dce8f0;
}
body { background: #070d15; }
.novel-stage { background: #070d15; }
.scene { background: #0c151f; }
.town-map-panel {
  background:
    linear-gradient(rgba(18, 45, 59, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 45, 59, .08) 1px, transparent 1px),
    #0c151f;
  background-size: 28px 28px, 28px 28px, auto;
  color: #dce8f0;
}
.map-dashboard {
  border-right-color: #284657;
  background: linear-gradient(180deg, rgba(15, 33, 45, .96), rgba(10, 21, 31, .96));
}
.map-dashboard-title h1,
.activity-panel-heading h2 {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  letter-spacing: .08em;
  font-weight: 600;
}
.map-dashboard-title p,
.activity-panel-heading p { color: #91aab8; }
.section-kicker,
.event-kicker { color: #6ec1d2; }
.map-alert {
  border-left-color: #d98b4d;
  background: rgba(57, 48, 37, .82);
}
.map-alert span { color: #e2a35e; }
.map-alert b { color: #f3ddba; }
.map-alert small { color: #bcae99; }
.map-resources span,
.map-stats span {
  border-color: #315466;
  color: #a8c0cc;
  background: rgba(12, 27, 38, .86);
}
.map-resources b,
.map-stats b { color: #72c4d2; }
.map-menu-button {
  border-color: #397487;
  color: #c9edf1;
  background: #123849;
}
.map-menu-button:hover,
.map-menu-button:focus-visible { background: #1d5b6d; }
.town-map {
  border-color: #315365;
  background:
    radial-gradient(circle at 20% 20%, rgba(101, 193, 205, .15) 0 1px, transparent 2px),
    linear-gradient(rgba(36, 87, 100, .18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 87, 100, .18) 1px, transparent 1px),
    #142a35;
  background-size: 19px 19px, 34px 34px, 34px 34px, auto;
}
.map-road { background: #203d49; border-color: rgba(101, 193, 205, .35); }
.map-location {
  border-color: #397487;
  color: #cde5e9;
  background: rgba(15, 42, 54, .9);
}
.map-location:hover,
.map-location:focus-visible {
  background: #1e6575;
  color: #f2fbfb;
}
.map-location small { color: #8eb6bf; }
.map-location em { color: #d59857; }
.map-location:hover small,
.map-location:focus-visible small,
.map-location:hover em,
.map-location:focus-visible em { color: #e5f5f4; }
.map-notice {
  border-left-color: #d98b4d;
  color: #a7c0ca;
  background: rgba(17, 38, 49, .9);
}
.activity-panel,
.town-map-panel .activity-panel-heading { color: #dce8f0; }
.activity-panel {
  border-color: #315365;
  background: #10212b;
}
.farm-plot {
  border-color: #376879;
  color: #bde0e4;
  background: linear-gradient(135deg, #1d4b58, #102b38);
}
.farm-plot:hover { background: linear-gradient(135deg, #286779, #173b4a); }
.crop-option {
  border-color: #376879;
  color: #c9e2e5;
  background: #19333e;
}
.crop-option.selected { border-color: #d98b4d; background: #4a3a2c; }
.conversation-screen { background: #09131b; }
.conversation-topbar { border-bottom-color: #315365; background: #0d222d; }
.back-button {
  border-color: #397487;
  color: #c9edf1;
  background: transparent;
}
.conversation-screen .input-bar button { background: #1c6573; }
.title-screen {
  background: linear-gradient(90deg, rgba(5, 14, 23, .9), rgba(10, 28, 38, .48)), url("/static/assets/background.svg") center / cover;
}
.title-content h1 { color: #dff3f2; letter-spacing: .14em; }
.title-subtitle { color: #a8c0c9; }
.primary-button,
.menu-grid button,
.item-card button {
  border-color: #4c93a2;
  background: linear-gradient(100deg, #1e6575, #174252);
}
.primary-button:hover,
.menu-grid button:hover,
.item-card button:hover { background: #2a8090; }
.text-button { color: #8fd1d7; }
.lead-picker {
  background: rgba(13, 31, 41, .98);
}
.lead-picker-heading { color: #dce8f0; }
.lead-picker-heading button {
  border-color: #397487;
  color: #b8dce2;
  background: #17333f;
}
.lead-picker-option {
  border-color: #397487;
  color: #d8edf0;
  background: linear-gradient(#1b5261, #123442);
}
.lead-picker-option:hover,
.lead-picker-option:focus-visible { background: #287589; }
