:root {
  color: #f3f2ef;
  background: #0b0e16;
  font-family:
    Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-width: 960px;
  height: 100%;
  min-height: 640px;
  margin: 0;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #111522;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 58px;
  padding: 0 22px;
  color: rgb(245 241 234 / 88%);
  background: rgb(11 14 22 / 86%);
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  backdrop-filter: blur(18px);
}

.brand,
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-family: "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0.08em;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #e5b7a5;
  border: 1px solid rgb(229 183 165 / 48%);
  border-radius: 50%;
}

.scene-label {
  color: rgb(244 239 232 / 62%);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.top-actions {
  justify-content: flex-end;
}

.top-actions button,
.suggestions button {
  cursor: pointer;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 999px;
}

.top-actions button {
  padding: 7px 13px;
  color: rgb(245 241 234 / 72%);
}

.top-actions button[aria-expanded="true"] {
  color: #f1c7b5;
  background: rgb(231 184 164 / 12%);
  border-color: rgb(231 184 164 / 42%);
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid #f0c1ae;
  outline-offset: 3px;
}

.stage {
  position: relative;
  height: calc(100% - 58px);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(12 17 31 / 4%), rgb(8 11 19 / 88%)),
    linear-gradient(115deg, #18283c 0%, #26364b 46%, #111722 100%);
}

.stage::before,
.stage::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.stage::before {
  inset: 0;
  opacity: 0.35;
  background:
    repeating-linear-gradient(
      104deg,
      transparent 0 28px,
      rgb(210 230 244 / 16%) 29px,
      transparent 31px 52px
    );
  transform: translateY(-15%);
}

.stage::after {
  right: -10%;
  bottom: 31%;
  width: 64%;
  height: 28%;
  background: linear-gradient(90deg, transparent, rgb(233 172 124 / 20%));
  filter: blur(40px);
}

.stage-sky {
  position: absolute;
  inset: 0 0 44%;
  background:
    radial-gradient(circle at 68% 30%, rgb(247 194 145 / 18%), transparent 24%),
    linear-gradient(180deg, #15243b, transparent);
}

.station-sign {
  position: absolute;
  top: 16%;
  left: 10%;
  padding: 14px 24px;
  color: rgb(229 220 204 / 65%);
  font-family: "Noto Serif SC", serif;
  font-size: 22px;
  letter-spacing: 0.35em;
  background: rgb(26 31 40 / 70%);
  border: 1px solid rgb(255 255 255 / 12%);
  transform: rotate(-1deg);
}

.character {
  position: absolute;
  right: 16%;
  bottom: 22%;
  width: 280px;
  height: 510px;
  filter: drop-shadow(0 34px 36px rgb(0 0 0 / 40%));
}

.character-hair,
.character-face,
.character-coat {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.character-hair {
  top: 20px;
  width: 204px;
  height: 250px;
  background: #28242d;
  border-radius: 52% 48% 44% 48% / 36% 40% 60% 64%;
  box-shadow:
    -42px 80px 0 -25px #28242d,
    48px 90px 0 -28px #211f27;
}

.character-face {
  top: 62px;
  z-index: 2;
  width: 142px;
  height: 176px;
  background: linear-gradient(145deg, #f4d5c4, #dfb39f);
  border-radius: 48% 48% 46% 46% / 40% 42% 58% 60%;
}

.eye,
.mouth {
  position: absolute;
  display: block;
  background: #4c3838;
}

.eye {
  top: 82px;
  width: 18px;
  height: 9px;
  border-radius: 50%;
}

.eye--left {
  left: 31px;
}

.eye--right {
  right: 31px;
}

.mouth {
  bottom: 35px;
  left: 50%;
  width: 24px;
  height: 7px;
  border-radius: 0 0 50% 50%;
  transform: translateX(-50%);
}

.character-coat {
  bottom: 0;
  z-index: 1;
  width: 260px;
  height: 320px;
  background: linear-gradient(115deg, #c9baa6, #817a72);
  border-radius: 46% 46% 7% 7% / 20% 20% 5% 5%;
  clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}

.chapter-chip {
  position: absolute;
  top: 7%;
  left: 50%;
  padding: 6px 14px;
  color: rgb(245 239 231 / 62%);
  font-family: "Noto Serif SC", serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 999px;
  transform: translateX(-50%);
}

.dialogue-panel {
  position: absolute;
  right: 7%;
  bottom: 116px;
  left: 7%;
  z-index: 10;
  height: 154px;
  padding: 17px 24px;
  overflow: hidden;
  background: linear-gradient(100deg, rgb(13 17 27 / 94%), rgb(24 26 34 / 84%));
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 14px;
  box-shadow: 0 22px 56px rgb(0 0 0 / 38%);
  backdrop-filter: blur(18px);
}

.beat-list {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0 8px 0 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-color: rgb(231 184 164 / 30%) transparent;
}

.beat {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
}

.beat strong {
  color: #f0c4b2;
  font-family: "Noto Serif SC", serif;
  font-size: 15px;
  font-weight: 600;
}

.beat p {
  margin: 0;
  color: rgb(250 247 242 / 88%);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
  line-height: 1.7;
}

.beat--narration,
.beat--system {
  display: block;
}

.beat--narration p,
.beat--system p {
  color: rgb(245 241 234 / 58%);
  font-style: italic;
}

.beat--action strong,
.beat--action p {
  color: rgb(211 224 231 / 70%);
}

.suggestions {
  position: absolute;
  right: 8%;
  bottom: 255px;
  z-index: 12;
  display: flex;
  gap: 10px;
}

.suggestions button {
  padding: 8px 13px;
  color: rgb(245 241 234 / 72%);
  background: rgb(15 19 29 / 64%);
  backdrop-filter: blur(12px);
}

.composer {
  position: absolute;
  right: 7%;
  bottom: 42px;
  left: 7%;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.composer textarea {
  min-height: 58px;
  padding: 13px 16px;
  resize: none;
  color: rgb(250 247 242 / 92%);
  outline: none;
  background: rgb(12 15 24 / 86%);
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 12px;
}

.composer textarea:disabled,
.composer button:disabled {
  cursor: wait;
}

.composer button {
  min-width: 72px;
  cursor: pointer;
  border-radius: 12px;
}

.continue-button {
  color: rgb(245 241 234 / 75%);
  background: rgb(24 28 39 / 88%);
  border: 1px solid rgb(255 255 255 / 13%);
}

.send-button {
  color: #201918;
  background: #e7b8a4;
  border: 0;
}

.send-button:disabled {
  cursor: default;
  opacity: 0.42;
}

.turn-status {
  position: absolute;
  right: 18%;
  bottom: 18px;
  z-index: 14;
  margin: 0;
  color: rgb(241 196 178 / 72%);
  font-size: 11px;
  pointer-events: none;
}

.statusline {
  position: absolute;
  right: 8%;
  bottom: 15px;
  left: 8%;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  color: rgb(242 238 231 / 28%);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.state-screen {
  display: grid;
  width: 100%;
  height: calc(100% - 58px);
  place-content: center;
  gap: 8px;
  color: rgb(245 241 234 / 70%);
}

.state-screen--error {
  color: #f1b5ad;
}

.panel-scrim {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  background: rgb(4 6 11 / 46%);
  backdrop-filter: blur(4px);
}

.side-panel {
  display: flex;
  width: min(480px, 48vw);
  min-width: 400px;
  height: 100%;
  flex-direction: column;
  color: rgb(247 243 237 / 88%);
  background:
    linear-gradient(160deg, rgb(31 35 46 / 98%), rgb(14 17 26 / 98%)),
    #151923;
  border-left: 1px solid rgb(255 255 255 / 12%);
  box-shadow: -28px 0 70px rgb(0 0 0 / 42%);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 26px 28px 19px;
  border-bottom: 1px solid rgb(255 255 255 / 9%);
}

.panel-header h2 {
  margin: 5px 0 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 23px;
  font-weight: 500;
}

.panel-eyebrow {
  color: rgb(239 196 177 / 65%);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.panel-close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  color: rgb(245 241 234 / 62%);
  font-size: 24px;
  line-height: 1;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 50%;
}

.panel-content {
  flex: 1;
  padding: 24px 28px 34px;
  overflow-y: auto;
}

.panel-content section + section {
  margin-top: 30px;
}

.panel-content h3 {
  margin: 0 0 12px;
  color: rgb(245 241 234 / 56%);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.card-list,
.history-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card-list li {
  padding: 15px 16px;
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 11px;
}

.card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.card-title strong {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 15px;
  font-weight: 500;
}

.card-title span,
.card-list small {
  color: rgb(240 193 173 / 66%);
  font-size: 10px;
}

.card-list p {
  margin: 8px 0;
  color: rgb(245 241 234 / 62%);
  font-size: 13px;
  line-height: 1.65;
}

.empty-copy,
.panel-intro,
.panel-note {
  color: rgb(245 241 234 / 48%);
  font-size: 13px;
  line-height: 1.7;
}

.empty-copy {
  margin: 0;
  padding: 16px;
  text-align: center;
  background: rgb(255 255 255 / 3%);
  border-radius: 10px;
}

.panel-intro {
  margin: 0 0 24px;
}

.relationship-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.relationship-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  min-height: 52px;
  padding: 0 16px;
  background: rgb(255 255 255 / 4%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
}

.relationship-row dt {
  color: rgb(245 241 234 / 56%);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.relationship-row dd {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  color: #efc3b0;
  font-family: "Noto Serif SC", "Songti SC", serif;
}

.relationship-row dd::before {
  width: 52px;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, rgb(239 195 176 / 18%), rgb(239 195 176 / 75%));
  border-radius: 999px;
}

.panel-note {
  margin: 20px 0 0;
}

.history-list {
  position: relative;
}

.history-list::before {
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 12px;
  width: 1px;
  content: "";
  background: rgb(231 184 164 / 28%);
}

.history-list li {
  position: relative;
  padding-left: 28px;
}

.history-list li::before {
  position: absolute;
  top: 18px;
  left: 8px;
  z-index: 1;
  width: 9px;
  height: 9px;
  content: "";
  background: #252a36;
  border: 2px solid rgb(231 184 164 / 70%);
  border-radius: 50%;
}

.history-list button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  cursor: pointer;
  color: rgb(245 241 234 / 72%);
  text-align: left;
  background: rgb(255 255 255 / 3%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 9px;
}

.history-list button.selected {
  color: #f2c8b6;
  background: rgb(231 184 164 / 9%);
  border-color: rgb(231 184 164 / 35%);
}

.history-list small {
  color: rgb(245 241 234 / 38%);
}

.rewind-placeholder {
  display: grid;
  gap: 9px;
  margin-top: 22px;
  padding: 16px;
  background: rgb(7 9 15 / 36%);
  border: 1px solid rgb(255 255 255 / 8%);
  border-radius: 10px;
}

.rewind-placeholder span {
  color: rgb(245 241 234 / 55%);
  font-size: 11px;
}

.rewind-placeholder button {
  padding: 11px 14px;
  color: rgb(26 20 20 / 64%);
  background: rgb(231 184 164 / 54%);
  border: 0;
  border-radius: 9px;
}

.rewind-placeholder small {
  color: rgb(245 241 234 / 34%);
}
