:root {
  color-scheme: dark;
  --ink: #312617;
  --paper: #e6cf95;
  --paper-light: #f1dfaa;
  --paper-deep: #b17b37;
  --line: #6e3e1f;
  --white: #fff8df;
  --soft-white: rgba(255, 248, 223, 0.88);
  --shadow: rgba(17, 12, 7, 0.52);
  --glass: rgba(18, 15, 10, 0.38);
  --book-paper: #f3e4b7;
  --book-paper-soft: rgba(246, 234, 198, 0.94);
  --book-ink: #342817;
  --book-line: rgba(124, 91, 43, 0.34);
  --book-gold: #b48a42;
  --book-mist: rgba(222, 238, 231, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #090806;
  color: var(--white);
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.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;
}

.game-frame {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-width: 320px;
  overflow: hidden;
  background: #111;
}

.game-frame.is-creation {
  background: #020202;
}

.scene-background {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  transform: scale(1.012);
}

.game-frame.is-creation .scene-background {
  background-image: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(77, 68, 54, 0.24), transparent 18%),
    radial-gradient(circle at 60% 56%, rgba(55, 80, 78, 0.16), transparent 28%),
    #020202;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.18), transparent 28%, rgba(0, 0, 0, 0.34)),
    radial-gradient(circle at center, transparent 44%, rgba(0, 0, 0, 0.34) 100%);
  pointer-events: none;
}

.hud-top {
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  color: var(--soft-white);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.brand-mark {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.brand-logo {
  display: block;
  width: 112px;
  height: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.62));
}

.brand-mark small,
.account-strip {
  font-size: 13px;
}

.account-strip {
  display: flex;
  gap: 12px;
  align-items: center;
}

.world-time-chip {
  position: relative;
  min-width: 180px;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 223, 0.28);
  border-radius: 4px;
  padding: 7px 12px;
  background: rgba(24, 17, 10, 0.38);
  color: var(--soft-white);
}

.world-time-chip::after {
  position: absolute;
  left: 0;
  bottom: 0;
  width: var(--clock-progress, 0%);
  height: 2px;
  background: #d8b461;
  content: "";
  transition: width 240ms ease;
}

.world-time-chip span,
.world-time-chip small {
  position: relative;
  z-index: 1;
  display: block;
}

.world-time-chip span {
  font-size: 14px;
  line-height: 1.2;
}

.world-time-chip small {
  margin-top: 2px;
  color: rgba(255, 248, 223, 0.72);
  font-size: 11px;
}

.account-strip button,
.dialogue-actions button,
.close-view,
.clear-history {
  border: 1px solid rgba(255, 248, 223, 0.38);
  border-radius: 4px;
  background: rgba(24, 17, 10, 0.34);
  color: var(--white);
}

.account-strip button,
.dialogue-actions button,
.close-view,
.clear-history {
  height: 30px;
  padding: 0 10px;
}

.play-area {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.current-subarea-layer {
  position: absolute;
  inset: 72px clamp(18px, 5vw, 72px) 76px;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  pointer-events: none;
  transition:
    filter 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.current-subarea-toolbar {
  align-self: start;
  width: min(720px, 100%);
  padding: 12px 16px;
  color: var(--white);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.72);
  background: linear-gradient(90deg, rgba(20, 27, 20, 0.7), rgba(20, 27, 20, 0.34), transparent);
  border-left: 3px solid rgba(216, 180, 97, 0.78);
  pointer-events: none;
}

.current-subarea-toolbar .eyebrow {
  color: rgba(255, 248, 223, 0.72);
}

.current-subarea-toolbar h2 {
  margin: 0;
  color: var(--white);
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0;
}

.game-frame.has-active-overlay .current-subarea-layer,
.game-frame.has-dialogue .current-subarea-layer {
  filter: blur(2px) brightness(0.74);
  opacity: 0.9;
  transform: scale(1.006);
}

.game-frame.is-creation .current-subarea-layer {
  display: none;
}

.current-subarea-interactions {
  position: relative;
  min-height: 0;
}

.current-subarea-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 10px 14px;
  color: rgba(255, 248, 223, 0.78);
  background: rgba(24, 17, 10, 0.46);
  border-radius: 4px;
  transform: translate(-50%, -50%);
}

.dialogue-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.game-frame.has-dialogue .dialogue-layer {
  pointer-events: auto;
}

.game-frame.has-choice-overlay .dialogue-layer {
  pointer-events: auto;
}

.dialogue-layer.is-dimmed {
  opacity: 0.34;
  pointer-events: none;
}

.standing-portrait {
  position: absolute;
  right: clamp(18px, 5vw, 72px);
  bottom: 44px;
  z-index: 2;
  width: min(36vw, 420px);
  min-width: 240px;
  max-height: 78vh;
  margin: 0;
  pointer-events: none;
}

.creator-avatar {
  position: absolute;
  right: clamp(36px, 12vw, 190px);
  bottom: clamp(92px, 18vh, 190px);
  z-index: 2;
  width: min(30vw, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  transition: opacity 180ms ease;
}

.creator-avatar::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(0, 0, 0, 0.96) 0 34%, transparent 35%),
    conic-gradient(from 12deg, rgba(255, 248, 223, 0.04), rgba(143, 126, 87, 0.24), rgba(255, 248, 223, 0.02), rgba(72, 97, 92, 0.22), rgba(255, 248, 223, 0.04));
  filter: blur(0.3px) drop-shadow(0 0 40px rgba(255, 248, 223, 0.18));
}

.creator-avatar::after {
  content: "";
  position: absolute;
  inset: 28%;
  border: 1px solid rgba(255, 248, 223, 0.18);
  border-radius: 38% 62% 46% 54%;
  transform: rotate(-18deg);
}

.creator-avatar span {
  position: absolute;
  inset: 42% 24%;
  border-top: 1px solid rgba(255, 248, 223, 0.26);
  transform: rotate(7deg);
}

.game-frame.is-creation .creator-avatar {
  opacity: 1;
}

.game-frame.is-creation .standing-portrait {
  display: none;
}

.standing-portrait img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78vh;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.58));
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, rgba(0, 0, 0, 0.86) 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 72%, rgba(0, 0, 0, 0.86) 86%, transparent 100%);
}

.dialogue-window {
  position: absolute;
  top: clamp(70px, 9vh, 110px);
  right: clamp(24px, 6vw, 96px);
  z-index: 3;
  width: min(760px, 58vw);
  min-height: 192px;
  padding: 18px 22px 20px;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(133, 77, 31, 0.18), transparent 16%, transparent 84%, rgba(133, 77, 31, 0.16)),
    rgba(232, 204, 139, 0.94);
  border: 4px solid var(--line);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 199, 0.5),
    0 18px 36px var(--shadow);
}

.dialogue-window::before,
.dialogue-window::after,
.content-view::before,
.auth-card::before,
.history-drawer::before,
.choice-box::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(91, 48, 19, 0.36);
  pointer-events: none;
}

.dialogue-window__head,
.content-view__head,
.history-drawer__head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(72, 45, 22, 0.72);
  font-size: 13px;
}

.dialogue-window h1,
.content-view h2,
.history-drawer h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.1;
}

.dialogue-window h1 {
  font-size: 24px;
}

.dialogue-actions {
  display: flex;
  gap: 8px;
}

.dialogue-actions button {
  color: var(--ink);
  background: rgba(255, 244, 203, 0.46);
  border-color: rgba(91, 48, 19, 0.38);
}

.dialogue-lines {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  min-height: 84px;
  margin-top: 16px;
  font-size: 18px;
  line-height: 1.8;
}

.dialogue-line {
  margin: 0;
}

.dialogue-line strong {
  color: #6d2f1d;
}

.dialogue-window[hidden] {
  display: none;
}

.speaker-label {
  position: absolute;
  top: -20px;
  left: 22px;
  z-index: 2;
  max-width: min(44%, 260px);
  overflow: hidden;
  padding: 3px 14px;
  color: #9b2f1f;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(232, 204, 139, 0.98);
  border: 2px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 5px 12px rgba(42, 22, 9, 0.22);
}

.history-button {
  position: absolute;
  top: -18px;
  right: 18px;
  z-index: 2;
  height: 30px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 244, 203, 0.9);
  border: 2px solid var(--line);
  border-radius: 4px;
}

.dialogue-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(126px, 21%);
  gap: 18px;
  align-items: stretch;
}

.dialogue-body .dialogue-lines {
  min-height: 138px;
  margin: 0;
  padding: 10px 0 4px;
}

.dialogue-body .dialogue-line {
  min-height: 104px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.85;
}

.dialogue-line.is-typing::after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.16em;
  background: rgba(109, 47, 29, 0.58);
}

.dialogue-portrait {
  position: relative;
  aspect-ratio: 1;
  min-width: 0;
  align-self: center;
  overflow: hidden;
  border: 2px solid rgba(91, 48, 19, 0.44);
  border-radius: 3px;
  background:
    radial-gradient(circle at 50% 48%, rgba(52, 39, 26, 0.28), transparent 54%),
    rgba(255, 244, 203, 0.48);
  box-shadow: inset 0 0 0 1px rgba(255, 248, 223, 0.36);
}

.dialogue-portrait img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.dialogue-portrait.has-image img {
  display: block;
}

.dialogue-portrait span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(91, 48, 19, 0.76);
  font-size: clamp(34px, 5vw, 68px);
  font-weight: 700;
}

.dialogue-portrait.has-image span {
  display: none;
}

.dialogue-portrait.is-creator {
  background:
    radial-gradient(circle at 50% 45%, rgba(0, 0, 0, 0.98) 0 34%, transparent 36%),
    conic-gradient(from 40deg, rgba(255, 248, 223, 0.04), rgba(140, 122, 84, 0.28), rgba(35, 63, 61, 0.24), rgba(255, 248, 223, 0.05)),
    #020202;
}

.dialogue-portrait.is-creator span {
  color: rgba(255, 248, 223, 0.35);
  text-shadow: 0 0 18px rgba(255, 248, 223, 0.25);
}

.dialogue-portrait.is-player {
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 248, 223, 0.48), transparent 22%),
    radial-gradient(circle at 50% 70%, rgba(101, 64, 38, 0.28), transparent 42%),
    rgba(255, 244, 203, 0.52);
}

.bottom-menu {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 7;
  display: flex;
  transform: translateX(-50%);
  gap: clamp(22px, 5vw, 58px);
  align-items: center;
  white-space: nowrap;
}

.bottom-menu button {
  border: 0;
  background: transparent;
  color: rgba(255, 248, 223, 0.86);
  font-size: 15px;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85);
}

.bottom-menu button.is-active,
.bottom-menu button:hover {
  color: #ffffff;
}

.content-view {
  position: absolute;
  top: clamp(74px, 9vh, 104px);
  left: clamp(24px, 7vw, 110px);
  right: clamp(24px, 7vw, 110px);
  bottom: 72px;
  z-index: 6;
  display: none;
  overflow: auto;
  padding: 22px;
  color: var(--ink);
  background: rgba(229, 199, 130, 0.92);
  border: 4px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 20px 54px var(--shadow);
}

.content-view.is-active {
  display: block;
}

.book-overlay.content-view {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 64px 32px 96px;
  color: var(--book-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.985);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.book-overlay.content-view::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(246, 241, 220, 0.14);
  backdrop-filter: blur(5px);
  pointer-events: none;
}

.book-overlay.content-view::after {
  content: none;
}

.book-overlay.content-view.is-active {
  display: grid;
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.book-frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(690px, calc(100dvh - 132px));
  max-height: min(690px, calc(100dvh - 132px));
  min-height: min(420px, calc(100dvh - 132px));
  overflow: hidden;
  border: 1px solid var(--book-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(116, 82, 39, 0.12), transparent 7%, transparent 93%, rgba(116, 82, 39, 0.12)),
    linear-gradient(180deg, rgba(255, 252, 235, 0.62), transparent 38%),
    var(--book-paper);
  box-shadow:
    inset 0 0 0 1px rgba(255, 249, 223, 0.48),
    0 22px 48px rgba(32, 25, 15, 0.36);
}

.book-frame::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  z-index: 2;
  width: 1px;
  background:
    linear-gradient(to bottom, transparent, rgba(92, 65, 32, 0.34) 12%, rgba(92, 65, 32, 0.2) 88%, transparent);
  box-shadow:
    -10px 0 18px rgba(92, 65, 32, 0.08),
    10px 0 18px rgba(255, 249, 223, 0.2);
  pointer-events: none;
}

.book-frame--map {
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
}

.book-frame--character {
  grid-template-columns: minmax(250px, 0.62fr) minmax(0, 1.38fr);
}

.book-frame--character::before {
  left: 31%;
}

.book-page {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 34px 34px 36px;
  color: var(--book-ink);
  background:
    linear-gradient(135deg, rgba(255, 252, 235, 0.46), transparent 36%),
    linear-gradient(0deg, rgba(124, 91, 43, 0.06), transparent 18%, transparent 82%, rgba(124, 91, 43, 0.06)),
    var(--book-paper-soft);
  line-height: 1.68;
}

.book-page--left {
  padding-right: 42px;
}

.book-page--right {
  padding-left: 42px;
}

.book-page--identity {
  padding: 32px 28px 34px;
}

.book-page--identity .identity-list {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 18px;
}

.book-page h2,
.book-page h3 {
  margin: 0 0 14px;
  color: var(--book-ink);
  letter-spacing: 0;
}

.book-page h2 {
  font-size: 26px;
  line-height: 1.18;
}

.book-page h3 {
  font-size: 17px;
  line-height: 1.25;
}

.book-close.close-view {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  min-width: 54px;
  height: 32px;
  border: 1px solid rgba(124, 91, 43, 0.42);
  border-radius: 4px;
  background: rgba(255, 249, 223, 0.72);
  color: var(--book-ink);
  box-shadow: 0 4px 12px rgba(52, 40, 23, 0.1);
}

.book-close.close-view:hover,
.book-close.close-view:focus-visible {
  border-color: var(--book-gold);
  outline: 0;
}

.identity-sheet {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.identity-list,
.item-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
  color: rgba(52, 40, 23, 0.86);
}

.identity-list dt,
.item-meta dt {
  color: rgba(99, 70, 32, 0.82);
  font-weight: 700;
}

.identity-list dd,
.item-meta dd {
  min-width: 0;
  margin: 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.book-page--status {
  overflow: hidden;
  padding: 28px 30px 30px;
}

.book-page--status .status-grid {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) minmax(116px, auto);
  gap: 12px;
}

.book-page--status .status-grid > section {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.book-page--status .stat-list {
  gap: 8px;
}

.status-grid > section,
.task-section,
.world-map-detail {
  min-width: 0;
  border: 1px solid var(--book-line);
  border-radius: 6px;
  background: rgba(255, 249, 223, 0.34);
}

.status-grid > section {
  padding: 14px;
}

.inventory-detail-copy,
.inventory-detail-visual {
  padding-bottom: calc(20% + 34px);
}

.inventory-strip-shell {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  height: 20%;
  min-height: 104px;
  padding: 12px 18px;
  border-top: 1px solid var(--book-line);
  background:
    linear-gradient(180deg, rgba(246, 234, 198, 0.82), rgba(238, 220, 171, 0.96)),
    var(--book-paper);
}

.inventory-page-zone {
  width: 100%;
  height: 100%;
  min-height: 72px;
  border: 1px solid rgba(124, 91, 43, 0.34);
  border-radius: 4px;
  background: rgba(255, 249, 223, 0.42);
}

.inventory-page-zone:hover,
.inventory-page-zone:focus-visible {
  border-color: var(--book-gold);
  outline: 0;
}

.inventory-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(68px, 1fr));
  gap: 10px;
  min-width: 0;
  height: 100%;
}

.inventory-slot,
.inventory-slot--empty {
  display: grid;
  min-width: 0;
  min-height: 72px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(124, 91, 43, 0.32);
  border-radius: 6px;
  background: rgba(255, 249, 223, 0.44);
  color: rgba(52, 40, 23, 0.82);
  transform: scale(1);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.inventory-slot:hover,
.inventory-slot:focus-visible,
.inventory-slot.is-selected {
  border-color: var(--book-gold);
  box-shadow: inset 0 0 0 1px rgba(180, 138, 66, 0.28);
  outline: 0;
  transform: scale(1.02);
}

.inventory-slot--empty {
  opacity: 0.48;
}

.item-context-menu {
  position: fixed;
  z-index: 12;
  min-width: 148px;
  max-width: min(260px, calc(100vw - 24px));
  overflow: hidden;
  border: 1px solid rgba(124, 91, 43, 0.46);
  border-radius: 6px;
  padding: 6px;
  background: var(--book-paper-soft);
  color: var(--book-ink);
  box-shadow: 0 16px 34px rgba(32, 25, 15, 0.28);
}

.item-context-menu[hidden] {
  display: none;
}

.item-context-menu button {
  display: block;
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 4px;
  padding: 0 10px;
  background: transparent;
  color: var(--book-ink);
  text-align: left;
}

.item-context-menu button:hover,
.item-context-menu button:focus-visible {
  outline: 0;
  background: rgba(180, 138, 66, 0.16);
}

.task-section {
  display: grid;
  gap: 10px;
  align-content: start;
  margin-top: 14px;
  padding: 12px;
}

.book-page--task-list,
.book-page--task-detail {
  display: grid;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.book-page--task-detail {
  grid-template-rows: minmax(0, 1fr);
}

.task-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}

.task-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 36px;
  border: 1px solid rgba(124, 91, 43, 0.3);
  border-radius: 4px;
  padding: 0 10px;
  background: rgba(255, 249, 223, 0.34);
  color: rgba(52, 40, 23, 0.78);
}

.task-tab.is-active {
  border-color: rgba(180, 138, 66, 0.72);
  background: rgba(180, 138, 66, 0.18);
  color: var(--book-ink);
}

.task-tab span {
  color: rgba(91, 48, 19, 0.62);
  font-size: 12px;
}

.task-list-panel,
.task-detail-panel {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--book-line);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 249, 223, 0.34);
}

.task-row-group {
  display: grid;
  gap: 6px;
}

.task-row-group + .task-row-group {
  margin-top: 8px;
}

.task-row,
.task-ring-row {
  display: grid;
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(124, 91, 43, 0.22);
  border-radius: 4px;
  padding: 10px 12px;
  background: rgba(255, 249, 223, 0.4);
  color: rgba(52, 40, 23, 0.86);
  text-align: left;
}

.task-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(80px, 0.5fr);
  gap: 4px 10px;
}

.task-row strong,
.task-row span,
.task-row em,
.task-ring-row span,
.task-ring-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row em {
  grid-column: 1 / -1;
  color: rgba(91, 48, 19, 0.72);
  font-style: normal;
}

.task-row.is-selected,
.task-ring-row.is-selected {
  border-color: rgba(180, 138, 66, 0.8);
  background: rgba(180, 138, 66, 0.16);
  box-shadow: inset 3px 0 0 var(--book-gold);
}

.task-ring-list {
  display: grid;
  gap: 4px;
  padding-left: 16px;
}

.task-ring-row {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.task-ring-row.is-completed {
  color: rgba(52, 40, 23, 0.46);
  text-decoration: line-through;
}

.task-detail-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  color: rgba(52, 40, 23, 0.9);
  line-height: 1.65;
}

.task-detail-card h3 {
  margin: 0;
  font-size: 26px;
}

.task-detail-card p,
.task-detail-card em {
  margin: 0;
}

.task-detail-card em {
  color: rgba(91, 48, 19, 0.72);
  font-style: normal;
}

.task-card {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(124, 91, 43, 0.28);
  border-radius: 6px;
  padding: 12px;
  background: rgba(255, 249, 223, 0.42);
  color: rgba(52, 40, 23, 0.88);
  line-height: 1.55;
}

.task-card summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.task-card summary::-webkit-details-marker {
  display: none;
}

.task-card summary::after {
  color: rgba(91, 48, 19, 0.72);
  content: "展开";
  font-size: 12px;
}

.task-card[open] summary::after {
  content: "收起";
}

.task-card summary span {
  color: rgba(91, 48, 19, 0.68);
  font-size: 13px;
}

.generated-task-inline {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(124, 91, 43, 0.22);
  padding-top: 10px;
}

.generated-task-meta {
  color: rgba(91, 48, 19, 0.72);
  font-size: 13px;
}

.generated-step-target {
  margin: 0;
  color: rgba(91, 48, 19, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.generated-task-inline button {
  justify-self: start;
  min-height: 32px;
  border: 1px solid rgba(91, 48, 19, 0.42);
  border-radius: 4px;
  padding: 0 12px;
  background: rgba(91, 48, 19, 0.12);
  color: var(--ink);
}

.generated-task-inline button:disabled {
  cursor: default;
  opacity: 0.52;
}

.task-card--main {
  border-color: rgba(180, 138, 66, 0.72);
  background:
    linear-gradient(90deg, rgba(180, 138, 66, 0.16), transparent 42%),
    rgba(255, 249, 223, 0.58);
  box-shadow: inset 3px 0 0 var(--book-gold);
}

.world-map-surface {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(124, 91, 43, 0.38);
  border-radius: 6px;
  background:
    radial-gradient(circle at 28% 32%, rgba(137, 171, 145, 0.34), transparent 24%),
    radial-gradient(circle at 70% 62%, rgba(180, 138, 66, 0.2), transparent 22%),
    linear-gradient(145deg, rgba(231, 238, 225, 0.82), rgba(241, 226, 184, 0.92));
  background-position: center;
  background-size: cover;
}

.world-node {
  position: absolute;
  max-width: 132px;
  border: 1px solid rgba(124, 91, 43, 0.46);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(246, 234, 198, 0.88);
  color: var(--book-ink);
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  transform: translate(-50%, -50%);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.world-node:hover,
.world-node:focus-visible,
.world-node.is-selected {
  border-color: var(--book-gold);
  outline: 0;
  box-shadow: 0 0 0 2px rgba(180, 138, 66, 0.18);
  transform: translate(-50%, -50%) scale(1.04);
}

.world-node.is-current {
  background: rgba(255, 249, 223, 0.96);
  box-shadow:
    0 0 0 2px rgba(180, 138, 66, 0.24),
    0 6px 14px rgba(52, 40, 23, 0.18);
}

.world-map-detail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 100%;
  padding: 14px;
}

.world-node-thumb,
.item-art,
.item-art-fallback {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(124, 91, 43, 0.34);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 38%, var(--book-mist), transparent 46%),
    rgba(255, 249, 223, 0.42);
  color: rgba(91, 65, 30, 0.72);
}

.world-node-thumb img,
.item-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-art-fallback {
  min-height: 240px;
  font-size: 42px;
  font-weight: 700;
}

.empty-state {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed rgba(124, 91, 43, 0.34);
  border-radius: 6px;
  padding: 18px;
  background: rgba(255, 249, 223, 0.28);
  color: rgba(52, 40, 23, 0.72);
  text-align: center;
  line-height: 1.6;
}

.content-view__head {
  margin-bottom: 18px;
}

.content-view__head span {
  display: block;
  margin-top: 8px;
  color: rgba(49, 38, 23, 0.72);
}

.close-view {
  color: var(--ink);
  background: rgba(255, 244, 203, 0.46);
  border-color: rgba(91, 48, 19, 0.38);
}

.trajectory-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trajectory-actions button {
  min-height: 34px;
  border: 1px solid rgba(91, 48, 19, 0.38);
  border-radius: 4px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 244, 203, 0.46);
}

.trajectory-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-height: min(520px, calc(100dvh - 220px));
  place-items: center;
  overflow: auto;
  border: 1px solid rgba(91, 48, 19, 0.32);
  background: rgba(255, 239, 190, 0.28);
}

.trajectory-canvas {
  position: relative;
  display: grid;
  width: min(100%, 1120px);
  aspect-ratio: 16 / 9;
  place-items: center;
  padding: 18px;
  color: rgba(49, 38, 23, 0.78);
  background:
    linear-gradient(135deg, rgba(255, 248, 223, 0.36), transparent 34%),
    rgba(255, 244, 203, 0.36);
}

.trajectory-empty,
.trajectory-placeholder {
  width: min(420px, 100%);
  border: 1px solid rgba(91, 48, 19, 0.3);
  border-radius: 6px;
  padding: 18px;
  background: rgba(255, 244, 203, 0.42);
  text-align: center;
}

.trajectory-placeholder {
  display: grid;
  gap: 8px;
}

.trajectory-placeholder strong {
  color: var(--ink);
  font-size: 20px;
}

.trajectory-placeholder span {
  color: rgba(49, 38, 23, 0.72);
}

.trajectory-placeholder em {
  color: rgba(91, 48, 19, 0.78);
  font-style: normal;
}

.trajectory-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.trajectory-bg {
  fill: rgba(12, 15, 13, 0.92);
  stroke: rgba(239, 208, 141, 0.44);
  stroke-width: 2;
}

.trajectory-title {
  fill: #fff8df;
  font-size: 32px;
  font-weight: 700;
}

.trajectory-subtitle,
.trajectory-lane-label,
.trajectory-node-time,
.trajectory-node-subtitle,
.trajectory-node-entities {
  fill: rgba(255, 248, 223, 0.68);
}

.trajectory-lane-label {
  font-size: 18px;
  letter-spacing: 0;
}

.trajectory-edge {
  fill: none;
  stroke-linecap: round;
  stroke-width: 4;
  opacity: 0.86;
}

.trajectory-edge--cultivation {
  stroke: #d8b45f;
  stroke-width: 6;
}

.trajectory-edge--revenge {
  stroke: #9e453d;
  stroke-width: 6;
}

.trajectory-edge--side {
  stroke: rgba(217, 202, 166, 0.42);
  stroke-width: 3;
}

.trajectory-node rect {
  stroke-width: 2;
}

.trajectory-node--cultivation rect {
  fill: rgba(49, 38, 23, 0.94);
  stroke: #d8b45f;
}

.trajectory-node--revenge rect {
  fill: rgba(42, 19, 17, 0.94);
  stroke: #b85449;
}

.trajectory-node--side rect {
  fill: rgba(20, 22, 20, 0.92);
  stroke: rgba(217, 202, 166, 0.52);
}

.trajectory-node--completed rect {
  stroke-opacity: 0.76;
}

.trajectory-node--available rect {
  stroke-dasharray: 8 7;
}

.trajectory-node--active rect {
  filter: url(#trajectoryGlow);
  stroke-width: 3;
}

.trajectory-node--blocked rect {
  fill-opacity: 0.72;
  stroke: #8b3f38;
}

.trajectory-node--locked {
  opacity: 0.44;
}

.trajectory-node-title {
  fill: #fff8df;
  font-size: 20px;
  font-weight: 700;
}

.trajectory-node-time,
.trajectory-node-subtitle,
.trajectory-node-entities {
  font-size: 13px;
}

.trajectory-node-entities {
  fill: rgba(239, 208, 141, 0.78);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.panel {
  position: relative;
  padding: 16px;
  border: 1px solid rgba(91, 48, 19, 0.3);
  background: rgba(255, 239, 190, 0.38);
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.stat-list,
.history-list,
.journal-list,
.quest-list,
.scene-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  display: grid;
  gap: 5px;
}

.stat-row__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(49, 38, 23, 0.82);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(116, 68, 30, 0.22);
}

.meter span {
  display: block;
  height: 100%;
  background: #78502c;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pill {
  border: 1px solid rgba(91, 48, 19, 0.32);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 244, 203, 0.42);
}

.history-item,
.quest-item,
.journal-item,
.scene-item,
.inventory-item,
.compact-item {
  border-left: 3px solid #78502c;
  padding: 10px 12px;
  background: rgba(255, 244, 203, 0.36);
  line-height: 1.65;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.inventory-item {
  min-height: 112px;
}

.inventory-item__count {
  margin-top: 8px;
  color: #7e2f23;
  font-size: 24px;
}

.quest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.npc-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr);
  gap: 14px;
}

.npc-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.npc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px;
  border-left: 3px solid #78502c;
  background: rgba(255, 244, 203, 0.36);
  color: var(--ink);
  line-height: 1.6;
}

.npc-item strong {
  display: block;
}

.npc-item button,
.generated-task button {
  flex: 0 0 auto;
  min-height: 32px;
  border: 1px solid rgba(91, 48, 19, 0.42);
  border-radius: 4px;
  padding: 0 10px;
  background: rgba(91, 48, 19, 0.12);
  color: var(--ink);
}

.npc-item button:disabled,
.generated-task button:disabled {
  cursor: default;
  opacity: 0.58;
}

.generated-dialogue {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.generated-dialogue p,
.generated-world-message {
  margin: 0;
}

.generated-wait-time {
  margin: 8px 0 0;
  color: #7e2f23;
  font-size: 13px;
  line-height: 1.45;
}

.requirement-text {
  color: #b31924;
  font-weight: 700;
}

.world-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
}

.region-map-shell {
  position: relative;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.region-map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.region-map-toolbar h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.travel-status {
  max-width: 260px;
  color: #7e2f23;
  font-size: 14px;
  line-height: 1.45;
  text-align: right;
}

.region-map {
  min-height: 460px;
}

.region-map-art {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid rgba(91, 48, 19, 0.3);
  background:
    radial-gradient(circle at 35% 30%, rgba(95, 137, 105, 0.55), transparent 28%),
    radial-gradient(circle at 70% 64%, rgba(205, 190, 126, 0.28), transparent 24%),
    linear-gradient(145deg, #223c31, #10201b);
  background-position: center;
  background-size: cover;
}

.region-map-empty {
  display: grid;
  min-height: 460px;
  place-items: center;
  border: 1px solid rgba(91, 48, 19, 0.3);
  background: rgba(255, 244, 203, 0.36);
  color: rgba(49, 38, 23, 0.72);
}

.npc-map-marker {
  position: absolute;
  display: grid;
  width: 72px;
  gap: 4px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff4cb;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.npc-map-marker img,
.npc-map-marker span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 3px solid #d8b461;
  border-radius: 50%;
  background: #6f4b31;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
  object-fit: cover;
}

.npc-map-marker em {
  max-width: 82px;
  padding: 3px 6px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(36, 24, 15, 0.72);
  font-size: 12px;
  font-style: normal;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subarea-exit {
  position: absolute;
  padding: 7px 12px;
  border: 1px solid rgba(216, 180, 97, 0.72);
  border-radius: 999px;
  background: rgba(36, 24, 15, 0.76);
  color: #fff4cb;
  pointer-events: auto;
}

.subarea-exit--anchored {
  transform: translate(-50%, -50%);
}

.subarea-exit--path-sign {
  border-color: rgba(235, 207, 136, 0.82);
  background: rgba(50, 35, 18, 0.72);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.24);
}

.subarea-exit--top {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.subarea-exit--right {
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
}

.subarea-exit--bottom {
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.subarea-exit--left {
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
}

.region-map-prompt {
  position: absolute;
  right: 12px;
  bottom: 12px;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(36, 24, 15, 0.68);
  color: rgba(255, 244, 203, 0.78);
  font-size: 12px;
  line-height: 1.45;
}

.region-travel-list {
  display: grid;
  gap: 10px;
}

.region-travel-list .compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-action {
  min-width: 72px;
  padding: 6px 10px;
  border: 1px solid rgba(91, 48, 19, 0.3);
  background: rgba(255, 244, 203, 0.5);
  color: var(--ink);
}

.mini-action:disabled {
  cursor: default;
  opacity: 0.55;
}

.map-panel {
  grid-row: span 2;
  overflow: hidden;
  min-height: 420px;
  border: 1px solid rgba(91, 48, 19, 0.38);
  background: rgba(255, 239, 190, 0.3);
}

.map-panel img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
}

.history-drawer {
  position: absolute;
  top: clamp(74px, 9vh, 104px);
  right: clamp(18px, 5vw, 72px);
  z-index: 8;
  width: min(380px, calc(100vw - 36px));
  max-height: calc(100dvh - 156px);
  overflow: auto;
  padding: 18px;
  color: var(--ink);
  background: rgba(229, 199, 130, 0.95);
  border: 4px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 20px 54px var(--shadow);
}

.history-drawer[hidden] {
  display: none;
}

.history-drawer__head {
  margin-bottom: 14px;
}

.clear-history {
  color: var(--ink);
  background: rgba(255, 244, 203, 0.46);
  border-color: rgba(91, 48, 19, 0.38);
}

.choice-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.26);
}

.choice-overlay[hidden] {
  display: none;
}

.choice-box {
  position: relative;
  width: min(620px, calc(100vw - 42px));
  padding: 18px;
  color: var(--ink);
  background: rgba(229, 199, 130, 0.96);
  border: 4px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 22px 58px var(--shadow);
}

.choice-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.choice-grid button {
  min-height: 46px;
  border: 1px solid rgba(91, 48, 19, 0.36);
  border-radius: 3px;
  padding: 0 16px;
  background: rgba(255, 244, 203, 0.58);
  color: var(--ink);
  text-align: left;
}

.choice-grid button span {
  margin-left: 12px;
  color: rgba(49, 38, 23, 0.64);
  font-size: 13px;
}

.choice-summary {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.choice-summary h2,
.choice-summary p {
  margin: 0;
}

.summary-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-token {
  border: 1px solid rgba(91, 48, 19, 0.34);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 244, 203, 0.5);
}

.choice-summary button {
  min-height: 44px;
  border: 1px solid rgba(91, 48, 19, 0.46);
  border-radius: 3px;
  background: #6d3d1e;
  color: var(--white);
}

.proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.proposal-actions button {
  min-width: 120px;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  min-width: 320px;
  overflow: hidden;
  color: #f6ecd0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 248, 221, 0.96), rgba(226, 231, 225, 0.62) 28%, transparent 58%),
    linear-gradient(180deg, #eef3f0 0%, #dbe6e4 48%, #9eb1b3 100%);
}

.welcome-screen[hidden],
.game-frame[hidden] {
  display: none;
}

.welcome-screen__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.welcome-screen__bg::before,
.welcome-screen__bg::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: -2vh;
  width: min(56vw, 720px);
  background-repeat: no-repeat;
  background-size: auto 100%;
  opacity: 0.96;
  filter: saturate(0.92) contrast(1.02);
}

.welcome-screen__bg::before {
  left: 0;
  background-image: url("/assets/art/brand/login-realm-left.png");
  background-position: left center;
}

.welcome-screen__bg::after {
  right: 0;
  background-image: url("/assets/art/brand/login-realm-right.png");
  background-position: right center;
}

.welcome-screen__mist {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 38%, rgba(246, 250, 244, 0.82), rgba(246, 250, 244, 0.24) 22%, transparent 44%),
    radial-gradient(circle at 16% 82%, rgba(255, 255, 255, 0.42), transparent 28%),
    radial-gradient(circle at 80% 76%, rgba(255, 255, 255, 0.38), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 44%, rgba(20, 34, 34, 0.22));
}

.welcome-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(58, 62, 55, 0.026) 0, rgba(58, 62, 55, 0.026) 1px, transparent 1px, transparent 10px),
    repeating-linear-gradient(90deg, rgba(58, 62, 55, 0.018) 0, rgba(58, 62, 55, 0.018) 1px, transparent 1px, transparent 14px),
    radial-gradient(circle at center, transparent 0, transparent 46%, rgba(8, 14, 14, 0.38) 100%);
}

.welcome-card {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: clamp(340px, 28vw, 460px);
  min-height: 560px;
  transform: translate(-50%, -48%);
  padding: 34px 34px 30px;
  border: 1px solid rgba(234, 213, 164, 0.74);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(50, 68, 68, 0.88), rgba(22, 34, 33, 0.92)),
    rgba(24, 36, 35, 0.9);
  box-shadow:
    0 24px 90px rgba(7, 14, 14, 0.42),
    inset 0 0 0 1px rgba(255, 249, 220, 0.16),
    inset 0 0 42px rgba(6, 14, 14, 0.28);
}

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

.welcome-card::before {
  inset: 10px;
  border: 1px solid rgba(221, 203, 155, 0.38);
  border-radius: 8px;
}

.welcome-card::after {
  left: 26px;
  right: 26px;
  top: 152px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229, 207, 154, 0.72), transparent);
}

.welcome-card__crest {
  position: absolute;
  inset: 16px 18px auto;
  height: 108px;
  border-radius: 8px 8px 0 0;
  background:
    radial-gradient(circle at 50% 62%, rgba(239, 229, 195, 0.16), transparent 58%),
    linear-gradient(90deg, transparent, rgba(238, 218, 164, 0.12), transparent);
  opacity: 0.8;
}

.welcome-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(330px, 82%);
  margin: 6px auto 18px;
  filter:
    drop-shadow(0 5px 14px rgba(0, 0, 0, 0.48))
    drop-shadow(0 0 8px rgba(236, 215, 157, 0.18));
}

.welcome-card__body {
  position: relative;
  z-index: 1;
  padding-top: 14px;
}

.welcome-kicker,
.welcome-error {
  margin: 0;
  text-align: center;
}

.welcome-kicker {
  color: rgba(237, 223, 184, 0.78);
  font-size: 15px;
  letter-spacing: 0.18em;
}

.welcome-card label {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 22px;
}

.welcome-card label span {
  display: block;
  margin: 0 0 8px 4px;
  color: rgba(240, 224, 180, 0.84);
  font-size: 14px;
  letter-spacing: 0.18em;
}

.welcome-card label::before {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 15px;
  width: 18px;
  height: 18px;
  opacity: 0.78;
  background:
    radial-gradient(circle at center, rgba(235, 214, 160, 0.9) 0 3px, transparent 4px),
    linear-gradient(rgba(235, 214, 160, 0.9), rgba(235, 214, 160, 0.9)) center 12px / 14px 2px no-repeat;
}

.welcome-card label:nth-of-type(2)::before {
  border: 2px solid rgba(235, 214, 160, 0.9);
  border-radius: 2px;
  background:
    linear-gradient(rgba(235, 214, 160, 0.9), rgba(235, 214, 160, 0.9)) center 6px / 2px 7px no-repeat,
    linear-gradient(rgba(235, 214, 160, 0.9), rgba(235, 214, 160, 0.9)) center 12px / 8px 2px no-repeat;
}

.welcome-card input {
  width: 100%;
  height: 54px;
  border: 1px solid rgba(225, 207, 159, 0.48);
  border-radius: 4px;
  outline: 0;
  padding: 0 16px 0 48px;
  background:
    linear-gradient(180deg, rgba(13, 22, 22, 0.36), rgba(4, 9, 9, 0.24)),
    rgba(255, 249, 223, 0.05);
  color: rgba(255, 248, 223, 0.94);
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.82);
  caret-color: #f0d897;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.08);
}

.welcome-card input::placeholder {
  color: transparent;
}

.welcome-card input:focus-visible {
  background:
    linear-gradient(180deg, rgba(36, 51, 49, 0.68), rgba(13, 22, 21, 0.46)),
    rgba(244, 228, 183, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(238, 219, 164, 0.56),
    0 0 20px rgba(238, 219, 164, 0.18);
}

.welcome-submit {
  width: 100%;
  min-height: 54px;
  margin-top: 28px;
  border: 1px solid rgba(103, 66, 36, 0.66);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(251, 241, 210, 0.94), rgba(198, 169, 111, 0.92)),
    #e5cc8e;
  color: #3c2515;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.36);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.welcome-submit:hover,
.welcome-submit:focus-visible {
  outline: 2px solid rgba(242, 220, 159, 0.36);
  outline-offset: 3px;
  background:
    linear-gradient(180deg, rgba(255, 248, 224, 0.98), rgba(219, 188, 123, 0.96)),
    #e7ce91;
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.24),
    0 0 22px rgba(238, 219, 164, 0.18);
}

.welcome-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 18px;
}

.welcome-links button {
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(255, 248, 223, 0.76);
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.08em;
}

.welcome-links button:hover,
.welcome-links button:focus-visible {
  outline: 1px solid rgba(238, 219, 164, 0.52);
  outline-offset: 4px;
  color: rgba(255, 248, 223, 0.94);
  text-shadow: 0 0 14px rgba(238, 219, 164, 0.34);
}

.welcome-links #forgotSecret {
  color: rgba(255, 248, 223, 0.62);
}

.welcome-error {
  min-height: 20px;
  margin-top: 18px;
  color: #ffd7a2;
  font-size: 14px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.82);
}

@media (max-width: 700px) {
  .welcome-screen__bg::before {
    display: none;
  }

  .welcome-screen__bg::after {
    right: 0;
    width: 100vw;
    background-size: cover;
    background-position: center center;
    opacity: 0.82;
  }

  .welcome-card {
    width: min(86vw, 420px);
    min-height: 0;
    padding: 28px 24px 24px;
    transform: translate(-50%, -45%);
  }

  .welcome-logo {
    width: min(310px, 88%);
  }

  .welcome-card input,
  .welcome-submit {
    height: 52px;
  }
}

@media (max-width: 900px) {
  .dialogue-window {
    left: 18px;
    right: 18px;
    width: auto;
  }

  .standing-portrait {
    right: 8px;
    width: min(44vw, 300px);
    min-width: 190px;
  }

  .bottom-menu {
    gap: clamp(10px, 3vw, 28px);
  }

  .bottom-menu button {
    font-size: 13px;
  }

  .panel-grid,
  .quest-layout,
  .npc-layout,
  .world-layout {
    grid-template-columns: 1fr;
  }

  .inventory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-panel {
    grid-row: auto;
  }

  .region-map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .travel-status {
    max-width: none;
    text-align: left;
  }

  .region-map,
  .region-map-art,
  .region-map-empty {
    min-height: 360px;
  }

  .npc-map-marker {
    width: 62px;
  }

  .npc-map-marker img,
  .npc-map-marker span {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 760px) {
  .book-overlay.content-view {
    padding: 52px 12px 76px;
  }

  .book-frame,
  .book-frame--map {
    display: block;
    height: auto;
    max-height: calc(100dvh - 128px);
    min-height: min(420px, calc(100dvh - 128px));
    overflow: auto;
  }

  .book-frame::before {
    display: none;
  }

  .book-page,
  .book-page--left,
  .book-page--right {
    overflow: visible;
    padding: 26px 18px;
  }

  .book-page--task-list,
  .book-page--task-detail {
    height: min(420px, calc(100dvh - 184px));
    overflow: hidden;
  }

  .book-page + .book-page {
    border-top: 1px solid var(--book-line);
  }

  .book-close.close-view {
    top: 10px;
    right: 10px;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .inventory-detail-copy,
  .inventory-detail-visual {
    padding-bottom: 22px;
  }

  .inventory-strip-shell {
    position: sticky;
    bottom: 0;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    height: 120px;
    min-height: 120px;
    padding: 10px;
  }

  .inventory-strip {
    grid-template-columns: repeat(4, minmax(54px, 1fr));
    grid-auto-rows: minmax(42px, 1fr);
    gap: 8px;
  }

  .inventory-slot,
  .inventory-slot--empty {
    min-height: 42px;
  }

  .inventory-page-zone {
    min-height: 84px;
  }

  .world-map-surface {
    min-height: 220px;
  }

  .item-art-fallback {
    min-height: 180px;
  }
}

@media (max-width: 620px) {
  .hud-top {
    left: 14px;
    right: 14px;
    gap: 8px;
  }

  .world-time-chip {
    min-width: 132px;
    padding: 6px 8px;
  }

  .world-time-chip small {
    display: none;
  }

  .dialogue-window {
    top: 72px;
    padding: 14px;
  }

  .dialogue-lines {
    font-size: 16px;
  }

  .standing-portrait {
    width: 230px;
    min-width: 0;
    opacity: 0.88;
  }

  .bottom-menu {
    width: calc(100vw - 24px);
    justify-content: space-between;
    gap: 0;
  }

  .bottom-menu button {
    font-size: 12px;
  }

  .content-view {
    left: 12px;
    right: 12px;
    bottom: 62px;
    padding: 16px;
  }

  .inventory-grid {
    grid-template-columns: 1fr;
  }
}
