/* ==========================================================================
   沙盒世界模式
   与恋爱对话使用不同的信息结构：世界大厅、年份、世界书、状态栏与回合。
   ========================================================================== */

.page-sandbox-home,
.page-sandbox-worldbooks,
.page-sandbox-worldbook-create,
.page-sandbox-create {
  padding-bottom: 56px;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 28px 0 12px;
}

.section-heading {
  margin: 26px 0 12px;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.03em;
}

.section-heading-row .section-heading {
  margin: 0;
}

/* ---------------------------------- 大厅 --------------------------------- */

.sandbox-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 26px;
  overflow: hidden;
  margin-top: 8px;
  padding: 28px 30px;
  border: 1px solid rgba(111, 148, 127, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 12%, rgba(224, 234, 225, 0.9), transparent 38%),
    linear-gradient(135deg, #fffaf1, #f4f1e7 58%, #eef3ec);
  box-shadow: var(--shadow-sm);
}

.sandbox-hero::after {
  content: "九洲 · 长安 · 白港";
  position: absolute;
  right: 24px;
  bottom: 13px;
  color: rgba(101, 121, 101, 0.32);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.38em;
}

.sandbox-hero-copy h2 {
  max-width: 560px;
  margin: 5px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(25px, 3.4vw, 42px);
  line-height: 1.24;
  letter-spacing: 0.01em;
}

.sandbox-hero-copy > p:not(.eyebrow) {
  max-width: 660px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.sandbox-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 19px;
}

.sandbox-hero-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 11px;
  align-self: center;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.6);
  backdrop-filter: blur(12px);
}

.sandbox-hero-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 9px;
  border-bottom: 1px dashed rgba(214, 202, 184, 0.64);
}

.sandbox-hero-stats div:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.sandbox-hero-stats strong {
  font-family: var(--font-display);
  font-size: 25px;
  color: var(--sage-deep);
}

.sandbox-hero-stats span {
  color: var(--muted);
  font-size: 11px;
}

.sandbox-category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.sandbox-category-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 205px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(224, 211, 193, 0.85);
  border-radius: 20px;
  background:
    linear-gradient(160deg, rgba(255, 253, 247, 0.94), rgba(250, 246, 238, 0.8)),
    var(--surface);
  box-shadow: 0 12px 28px -26px rgba(83, 58, 42, 0.42);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.sandbox-category-card::before {
  content: "";
  position: absolute;
  top: -34px;
  right: -28px;
  width: 115px;
  height: 115px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sandbox-accent) 14%, transparent);
}

.sandbox-category-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sandbox-accent) 30%, #e5d7c4);
  box-shadow: 0 18px 36px -28px rgba(70, 55, 43, 0.5);
}

.sandbox-category-card-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sandbox-category-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: color-mix(in srgb, var(--sandbox-accent) 15%, #fffaf2);
  color: color-mix(in srgb, var(--sandbox-accent) 78%, #40483f);
}

.sandbox-category-card-icon .icon {
  width: 21px;
  height: 21px;
}

.sandbox-category-arrow {
  color: var(--muted-light);
}

.sandbox-category-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
}

.sandbox-category-card p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.8;
}

.sandbox-category-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: color-mix(in srgb, var(--sandbox-accent) 64%, #6d6f66);
  font-size: 10px;
}

.sandbox-category-card-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sandbox-accent) 9%, #f9f4ea);
}

.sandbox-save-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 13px;
}

.sandbox-save-card {
  display: flex;
  flex-direction: column;
  padding: 18px;
  border: 1px solid rgba(228, 215, 197, 0.86);
  border-radius: 19px;
  background:
    linear-gradient(155deg, rgba(255, 253, 247, 0.95), rgba(250, 245, 236, 0.83)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.sandbox-save-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sandbox-save-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--sandbox-accent) 17%, #fffaf3);
  color: color-mix(in srgb, var(--sandbox-accent) 78%, #39453d);
}

.sandbox-save-icon .icon {
  width: 17px;
  height: 17px;
}

.sandbox-save-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.sandbox-save-title-line h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
}

.sandbox-save-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
}

.sandbox-save-location {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 12px;
  color: color-mix(in srgb, var(--sandbox-accent) 58%, #6b7068);
  font-size: 10.5px;
}

.sandbox-save-location .icon {
  width: 12px;
  height: 12px;
}

.sandbox-save-summary {
  flex: 1;
  min-height: 48px;
  margin: 10px 0 12px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.75;
}

.sandbox-save-bars {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.sandbox-save-bars span {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f8f2e8;
}

.sandbox-save-bars small {
  color: var(--muted);
  font-size: 9px;
}

.sandbox-save-bars strong {
  font-size: 11px;
}

.sandbox-save-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 11px;
  border-top: 1px dashed rgba(222, 207, 187, 0.7);
}

.sandbox-save-actions .btn-primary {
  margin-right: auto;
}

.sandbox-empty {
  margin-top: 8px;
}

.sandbox-quick-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 28px;
}

.sandbox-quick-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border: 1px solid rgba(228, 215, 197, 0.82);
  border-radius: 16px;
  background: rgba(255, 251, 244, 0.7);
  text-align: left;
  color: var(--ink);
  transition: background 0.2s ease, border-color 0.2s ease;
}

button.sandbox-quick-link {
  cursor: pointer;
}

.sandbox-quick-link:hover {
  border-color: rgba(111, 148, 127, 0.38);
  background: #fffdf8;
}

.sandbox-quick-link > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.sandbox-quick-link strong {
  font-size: 12.5px;
}

.sandbox-quick-link small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.quick-link-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: rgba(223, 234, 227, 0.72);
  color: var(--sage-deep);
}

.quick-link-icon .icon {
  width: 16px;
  height: 16px;
}

/* ------------------------------ 世界书管理 ------------------------------ */

.sandbox-mode-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 9px 0 19px;
  padding: 14px 17px;
  border: 1px solid rgba(111, 148, 127, 0.2);
  border-radius: 15px;
  background: rgba(237, 244, 237, 0.72);
  color: #4d6858;
}

.sandbox-mode-note .icon {
  margin-top: 2px;
  flex: 0 0 18px;
}

.sandbox-mode-note strong {
  display: block;
  font-size: 12.5px;
}

.sandbox-mode-note p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.7;
}

.sandbox-category-tabs,
.sandbox-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-category-tabs {
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.sandbox-filter {
  padding: 6px 11px;
  border: 1px solid rgba(226, 213, 195, 0.9);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.7);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.sandbox-filter.is-active {
  border-color: rgba(111, 148, 127, 0.42);
  background: #eaf2ea;
  color: var(--sage-deep);
}

.filter-count {
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 9px;
}

.sandbox-worldbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 13px;
}

.sandbox-worldbook-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 19px;
  border: 1px solid rgba(228, 215, 197, 0.88);
  border-radius: 19px;
  background:
    linear-gradient(155deg, rgba(255, 253, 248, 0.96), rgba(250, 245, 236, 0.82)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.sandbox-worldbook-head {
  display: flex;
  min-width: 0;
  gap: 11px;
  align-items: flex-start;
}

.sandbox-worldbook-emblem,
.sandbox-book-emblem {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--sandbox-accent) 15%, #fffaf3);
  color: color-mix(in srgb, var(--sandbox-accent) 78%, #3f4940);
}

.sandbox-worldbook-emblem .icon,
.sandbox-book-emblem .icon {
  width: 19px;
  height: 19px;
}

.sandbox-worldbook-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.sandbox-worldbook-title-line h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: 18px;
}

.sandbox-worldbook-head p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.sandbox-worldbook-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 10px;
}

.sandbox-worldbook-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sandbox-worldbook-meta .icon {
  width: 12px;
  height: 12px;
  color: color-mix(in srgb, var(--sandbox-accent) 60%, #81867d);
}

.sandbox-worldbook-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  align-content: flex-start;
}

.sandbox-worldbook-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px dashed rgba(222, 207, 187, 0.7);
}

.sandbox-worldbook-foot .btn-primary {
  margin-right: auto;
}

.sandbox-worldbook-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 180px;
  padding: 20px;
  border: 1px dashed rgba(178, 163, 142, 0.55);
  border-radius: 19px;
  background: rgba(255, 251, 245, 0.35);
  text-align: center;
  color: var(--muted);
}

.sandbox-worldbook-new:hover {
  border-color: rgba(111, 148, 127, 0.45);
  background: rgba(255, 253, 248, 0.7);
}

.sandbox-worldbook-new strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
}

.sandbox-worldbook-new span:last-child {
  font-size: 10.5px;
}

.new-card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #eef4ed;
  color: var(--sage-deep);
}

/* 世界书详情 */

.sandbox-worldbook-detail {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sandbox-era-overview {
  padding: 13px 15px;
  border-radius: 13px;
  background: #f6f0e5;
}

.sandbox-era-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8e613d;
  font-size: 12px;
  font-weight: 700;
}

.sandbox-era-badge .icon {
  width: 14px;
  height: 14px;
}

.sandbox-era-overview p {
  margin: 6px 0 9px;
  color: var(--muted);
  font-size: 11px;
}

.sandbox-era-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sandbox-period-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.8);
  font-size: 10px;
}

.sandbox-period-chip small {
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-detail-title {
  margin: 12px 0 3px;
  font-family: var(--font-display);
  font-size: 16px;
}

.sandbox-detail-rule {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.8;
}

.sandbox-entry-detail,
.sandbox-scenario-detail,
.sandbox-event-detail {
  padding: 11px 13px;
  border: 1px solid rgba(231, 219, 202, 0.72);
  border-radius: 11px;
  background: #fffdf8;
}

.sandbox-entry-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-entry-head strong {
  font-size: 12px;
}

.entry-priority {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 9px;
}

.sandbox-entry-detail p,
.sandbox-scenario-detail p,
.sandbox-event-detail p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.sandbox-scenario-detail small {
  display: block;
  margin-top: 2px;
  color: var(--muted-light);
  font-size: 9px;
}

.sandbox-event-detail {
  display: flex;
  gap: 10px;
}

.sandbox-event-detail .entry-index {
  flex: 0 0 42px;
  color: #a77952;
  font-size: 10px;
  font-weight: 700;
}

.sandbox-event-detail strong {
  font-size: 11.5px;
}

/* ------------------------------ 世界书创建 ------------------------------ */

.sandbox-worldbook-form,
.sandbox-create-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.step-number.step-word {
  font-size: 9px;
  letter-spacing: 0.04em;
}

.sandbox-create-layout {
  align-items: start;
}

.sandbox-category-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.sandbox-category-choice,
.sandbox-scenario-choice {
  position: relative;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 13px;
  border: 1px solid rgba(229, 216, 198, 0.9);
  border-radius: 13px;
  background: #fffdf8;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.sandbox-category-choice input,
.sandbox-scenario-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sandbox-category-choice.is-selected,
.sandbox-scenario-choice.is-selected {
  border-color: color-mix(in srgb, var(--sandbox-accent, var(--sage)) 55%, #dfd4c4);
  background: color-mix(in srgb, var(--sandbox-accent, var(--sage)) 7%, #fffdf8);
}

.sandbox-category-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--sandbox-accent) 14%, #fffaf3);
  color: color-mix(in srgb, var(--sandbox-accent) 78%, #3f4940);
}

.sandbox-category-icon .icon {
  width: 16px;
  height: 16px;
}

.sandbox-category-choice > span:nth-child(3),
.sandbox-scenario-choice > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.sandbox-category-choice strong,
.sandbox-scenario-choice strong {
  font-size: 11.5px;
}

.sandbox-category-choice small,
.sandbox-scenario-choice small {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.sandbox-scenario-choice p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.choice-check {
  display: none;
  color: var(--sage-deep);
}

.sandbox-category-choice.is-selected .choice-check,
.sandbox-scenario-choice.is-selected .choice-check {
  display: block;
}

.choice-check .icon {
  width: 14px;
  height: 14px;
}

.sandbox-field-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
}

.field-label {
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.sandbox-book-detail {
  min-width: 0;
  margin-top: 10px;
  padding: 14px;
  border-radius: 13px;
  background: #f8f3e9;
}

.sandbox-book-detail-head {
  display: flex;
  min-width: 0;
  gap: 9px;
}

.sandbox-book-detail-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
}

.sandbox-book-detail-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.sandbox-book-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 9.5px;
}

.sandbox-book-facts span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sandbox-book-facts .icon {
  width: 11px;
  height: 11px;
}

.sandbox-year-panel,
.sandbox-year-head,
.sandbox-year-controls,
.sandbox-year-quick,
.sandbox-year-readout {
  display: flex;
  flex-direction: column;
}

.sandbox-year-panel {
  gap: 11px;
  padding: 15px;
  border: 1px solid rgba(193, 158, 120, 0.28);
  border-radius: 15px;
  background: linear-gradient(150deg, #fbf3e5, #f7efe2);
}

.sandbox-year-head {
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sandbox-year-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
}

.sandbox-year-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.sandbox-year-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.75);
  color: #9a6d45;
  font-size: 9.5px;
}

.sandbox-year-badge .icon {
  width: 12px;
  height: 12px;
}

.sandbox-year-controls {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.sandbox-year-input {
  width: 100px;
  flex: 0 0 100px;
  text-align: center;
  font-weight: 700;
}

.sandbox-month-select {
  width: 82px;
  flex: 0 0 82px;
  padding-right: 5px;
  text-align: center;
  font-weight: 700;
}

.sandbox-year-range {
  flex: 1;
  accent-color: #b47c4f;
}

.sandbox-year-quick {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 5px;
}

.sandbox-year-chip {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid rgba(190, 159, 126, 0.34);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.66);
  color: #8e6847;
  font-size: 9.5px;
  cursor: pointer;
}

.sandbox-year-chip strong {
  font-size: 10px;
}

.sandbox-year-readout {
  gap: 3px;
  padding-top: 10px;
  border-top: 1px dashed rgba(190, 159, 126, 0.3);
}

.sandbox-year-number {
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1;
  color: #9a6d45;
}

.sandbox-year-readout strong {
  font-size: 11px;
}

.sandbox-year-readout p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.sandbox-year-events {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.sandbox-year-events small {
  width: 100%;
  color: var(--muted-light);
  font-size: 9px;
}

.sandbox-year-events span {
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 253, 247, 0.7);
  color: #8b735d;
  font-size: 9px;
}

.sandbox-era-free {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 13px 14px;
  border-radius: 12px;
  background: #f6f1e7;
  color: var(--muted);
}

.sandbox-era-free strong {
  display: block;
  color: var(--ink);
  font-size: 11.5px;
}

.sandbox-era-free p {
  margin: 3px 0 0;
  font-size: 10px;
}

.sandbox-scenario-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.sandbox-scenario-note {
  margin: 7px 0 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.sandbox-custom-choice {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 20px;
  align-items: start;
  gap: 9px;
  border-style: dashed;
  background:
    linear-gradient(120deg, rgba(244, 237, 224, 0.72), rgba(255, 253, 248, 0.92));
}

.sandbox-custom-choice.is-selected {
  border-style: solid;
}

.sandbox-custom-choice > span:nth-child(2) {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  border-radius: 9px;
  background: rgba(197, 107, 87, 0.11);
  color: var(--terracotta-deep);
}

.sandbox-custom-choice > span:nth-child(2) .icon {
  width: 15px;
  height: 15px;
}

.sandbox-custom-choice > span:nth-child(3) {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sandbox-custom-choice > span:nth-child(3) strong {
  font-size: 11.5px;
}

.sandbox-custom-choice > span:nth-child(3) small {
  color: var(--terracotta-deep);
  font-size: 9.5px;
}

.sandbox-custom-choice > span:nth-child(3) p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.sandbox-custom-choice .choice-check {
  align-self: center;
}

.sandbox-custom-opening {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 15px;
  border: 1px solid rgba(197, 107, 87, 0.28);
  border-radius: 15px;
  background:
    linear-gradient(150deg, rgba(255, 249, 240, 0.95), rgba(246, 239, 228, 0.9));
}

.sandbox-custom-opening[hidden] {
  display: none;
}

.sandbox-custom-opening-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.sandbox-custom-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  background: rgba(197, 107, 87, 0.12);
  color: var(--terracotta-deep);
}

.sandbox-custom-icon .icon {
  width: 16px;
  height: 16px;
}

.sandbox-custom-opening-head strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
}

.sandbox-custom-opening-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.sandbox-custom-opening .form-grid {
  gap: 8px;
}

.sandbox-opening-review-note {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(111, 148, 127, 0.08);
  color: #587162;
  font-size: 9.5px;
  line-height: 1.6;
}

.sandbox-opening-review-note .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin-top: 1px;
}

.sandbox-template-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(197, 107, 87, 0.22);
  border-radius: 12px;
  background: rgba(255, 250, 242, 0.72);
}

.sandbox-template-panel[hidden] {
  display: none;
}

.sandbox-template-help {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.sandbox-point-hint {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(189, 154, 104, 0.1);
  color: #806446;
  font-size: 9.5px;
  line-height: 1.6;
}

.sandbox-point-hint .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin-top: 1px;
}

.sandbox-fixed-banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(111, 148, 127, 0.12);
  color: #4f6f5f;
  font-size: 10px;
  line-height: 1.55;
}

.sandbox-fixed-banner[hidden] {
  display: none;
}

.sandbox-fixed-banner strong {
  font-size: 10.5px;
}

.is-locked {
  opacity: 0.62;
  cursor: not-allowed;
}

.sandbox-preview-points {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(197, 107, 87, 0.07);
  color: var(--ink-soft);
  font-size: 9px;
}

.sandbox-opening-verdict {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(228, 215, 197, 0.9);
  border-radius: 10px;
  background: #fffdf8;
}

.sandbox-opening-verdict[hidden] {
  display: none;
}

.sandbox-opening-verdict-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sandbox-opening-verdict-head .icon {
  width: 15px;
  height: 15px;
}

.sandbox-opening-verdict-head strong {
  font-size: 10.5px;
}

.sandbox-opening-verdict p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
}

.sandbox-opening-verdict small {
  color: var(--muted-light);
  font-size: 8.5px;
}

.sandbox-opening-verdict.is-pending {
  border-color: rgba(189, 154, 104, 0.36);
  background: #fbf5e8;
  color: #967044;
}

.sandbox-opening-verdict.is-approved {
  border-color: rgba(111, 148, 127, 0.38);
  background: #f0f7ef;
  color: #547563;
}

.sandbox-opening-verdict.is-rejected {
  border-color: rgba(177, 92, 74, 0.36);
  background: #fcf1ec;
  color: #9b5748;
}

.form-subhead {
  margin: 15px 0 0;
  font-family: var(--font-display);
  font-size: 15px;
}

.sandbox-difficulty-row,
.sandbox-attribute-head-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sandbox-difficulty-row .select {
  flex: 1;
  min-width: 220px;
}

.sandbox-attribute-budget {
  color: var(--muted);
  font-size: 10px;
}

.sandbox-attribute-budget.is-over {
  color: #b64f43;
  font-weight: 700;
}

.sandbox-attribute-head-row .btn {
  margin-left: auto;
}

.sandbox-attribute-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sandbox-attribute {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid rgba(228, 215, 197, 0.8);
  border-radius: 11px;
  background: #fffdf8;
}

.sandbox-attribute-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sandbox-attribute-head span {
  font-size: 11.5px;
  font-weight: 600;
}

.sandbox-attribute-head small {
  color: var(--muted-light);
  font-size: 8.5px;
}

.attribute-number {
  width: 55px;
  flex: 0 0 55px;
  padding: 6px 7px;
  text-align: center;
  font-weight: 700;
}

.sandbox-check-row {
  margin-top: 13px;
}

.sandbox-check-row strong {
  display: block;
  font-size: 11.5px;
}

.sandbox-check-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

/* 预览 */

.sandbox-create-preview-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 17px;
  border: 1px solid rgba(226, 211, 191, 0.8);
  border-radius: 16px;
  background: linear-gradient(155deg, #fffdf8, #f7f1e6);
}

.sandbox-preview-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 21px;
}

.sandbox-preview-meta {
  margin: 0;
  color: #8d745d;
  font-size: 9.5px;
  line-height: 1.6;
}

.sandbox-preview-desc {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.sandbox-preview-attributes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 8px 0;
  border-top: 1px dashed rgba(215, 198, 177, 0.65);
  border-bottom: 1px dashed rgba(215, 198, 177, 0.65);
}

.sandbox-preview-attributes span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: center;
}

.sandbox-preview-attributes small {
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-preview-attributes strong {
  font-family: var(--font-display);
  font-size: 17px;
}

.sandbox-preview-scenario {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(238, 244, 237, 0.75);
}

.sandbox-preview-label {
  display: block;
  color: #6b7d6d;
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.sandbox-preview-scenario strong {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}

.sandbox-preview-scenario p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.sandbox-preview-note {
  display: block;
  margin-top: 4px;
  color: #6d8a76;
  font-size: 8.5px;
  line-height: 1.5;
}

.sandbox-preview-resources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sandbox-preview-resources span {
  padding: 3px 7px;
  border-radius: 6px;
  background: #f6efe3;
  color: #7e6a57;
  font-size: 8.5px;
}

.sandbox-preview-note {
  display: flex;
  gap: 5px;
  margin: 0;
  color: var(--muted-light);
  font-size: 8.5px;
  line-height: 1.6;
}

.sandbox-preview-note .icon {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  margin-top: 1px;
}

.sandbox-preview-footnote {
  margin: 10px 2px 0;
  color: var(--muted-light);
  font-size: 9px;
  line-height: 1.65;
}

.sandbox-create-preview .btn-lg {
  width: 100%;
  margin-top: 12px;
}

/* 世界书创建 */

.sandbox-worldbook-preview .preview-sticky {
  max-height: calc(100vh - 150px);
}

.sandbox-live-card {
  margin-bottom: 10px;
}

.sandbox-live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.sandbox-scenario-editor-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sandbox-scenario-editor {
  padding: 13px;
  border: 1px solid rgba(229, 216, 198, 0.86);
  border-radius: 13px;
  background: #fffdf8;
}

.sandbox-scenario-editor-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.sandbox-scenario-editor-head strong {
  font-family: var(--font-display);
  font-size: 14px;
}

.sandbox-scenario-editor-head .icon-btn {
  margin-left: auto;
}

.sandbox-timeline-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.8fr) minmax(70px, 0.8fr) minmax(70px, 0.8fr) minmax(0, 2fr) 28px;
  gap: 5px;
  align-items: center;
  margin-bottom: 5px;
}

.sandbox-timeline-row .input {
  min-width: 0;
  padding: 7px 8px;
  font-size: 10px;
}

.sandbox-scenario-editor .form-grid,
.sandbox-worldbook-form .form-grid {
  gap: 8px;
}

.sandbox-worldbook-form .form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.sandbox-worldbook-form .form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* -------------------------------- 游戏页 -------------------------------- */

.page-sandbox-play {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 2px 8px 10px;
  overflow: hidden;
}

.sandbox-play-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 3px 3px 4px;
}

.sandbox-play-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.sandbox-back {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  margin-top: 2px;
  border: 1px solid rgba(226, 213, 195, 0.85);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.7);
  color: var(--muted);
}

.sandbox-back:hover {
  color: var(--ink);
  border-color: rgba(160, 140, 113, 0.45);
}

.sandbox-play-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.sandbox-category-pill,
.sandbox-rule-chip,
.sandbox-demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 8.5px;
  line-height: 1.35;
}

.sandbox-category-pill {
  background: color-mix(in srgb, var(--sage) 16%, #fffaf2);
  color: #4e6c59;
}

.sandbox-category-pill .icon,
.sandbox-rule-chip .icon {
  width: 11px;
  height: 11px;
}

.sandbox-rule-chip {
  background: rgba(243, 235, 221, 0.9);
  color: #85694d;
}

.sandbox-rule-chip.is-empty {
  opacity: 0.58;
}

.sandbox-demo-pill {
  background: rgba(226, 234, 226, 0.7);
  color: #617568;
}

.sandbox-play-title {
  margin: 5px 0 3px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.sandbox-play-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 11px;
  color: var(--muted);
  font-size: 9.5px;
}

.sandbox-play-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sandbox-play-meta .icon {
  width: 11px;
  height: 11px;
}

.sandbox-play-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.sandbox-play-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 0.95fr);
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.sandbox-story-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(229, 216, 198, 0.88);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(251, 246, 238, 0.9)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.sandbox-story-feed {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 24px 8px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.sandbox-action-message {
  max-width: 78%;
  margin: 0 0 18px auto;
  padding: 10px 13px;
  border: 1px solid rgba(213, 190, 164, 0.7);
  border-radius: 15px 4px 15px 15px;
  background: linear-gradient(145deg, #f8ecdc, #f4e4d2);
  box-shadow: 0 7px 18px -16px rgba(94, 61, 40, 0.5);
}

.sandbox-action-label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #98765b;
  font-size: 9px;
  letter-spacing: 0.04em;
}

.sandbox-action-label .icon {
  width: 12px;
  height: 12px;
}

.sandbox-action-label time {
  margin-left: auto;
  color: #b39a83;
  font-size: 8.5px;
}

.sandbox-action-text {
  margin: 6px 0 0;
  color: #5e4738;
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.sandbox-narrative-message {
  max-width: 94%;
  margin: 0 0 22px;
}

.sandbox-narrative-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.03em;
}

.sandbox-narrative-label time {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 8.5px;
}

.sandbox-narrative-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: rgba(223, 234, 227, 0.78);
  color: #5e7d68;
}

.sandbox-narrative-mark .icon {
  width: 12px;
  height: 12px;
}

.sandbox-narrative-body {
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.95;
  letter-spacing: 0.012em;
}

.sandbox-decision-hints {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px dashed rgba(154, 124, 81, 0.45);
  border-radius: 10px;
  background: rgba(249, 244, 235, 0.6);
}

.sandbox-decision-hints-head {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  color: #8d6d4d;
  font-size: 9px;
}

.sandbox-decision-hints-head .icon {
  width: 12px;
  height: 12px;
}

.sandbox-decision-hints-head strong {
  font-size: 10px;
}

.sandbox-decision-hints-head span {
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-decision-hints ol {
  margin: 6px 0 0;
  padding-left: 18px;
  color: #5f5144;
  font-size: 10px;
  line-height: 1.7;
}

.sandbox-decision-hints li + li {
  margin-top: 3px;
}

.sandbox-narrative-body .rich-paragraph {
  margin: 0 0 0.95em;
}

.sandbox-narrative-body .rich-paragraph:last-child {
  margin-bottom: 0;
}

.sandbox-narrative-body .rich-emphasis {
  color: #8d5b43;
}

.sandbox-narrative-body blockquote {
  margin: 0.8em 0;
  padding: 8px 12px;
  border-left: 2px solid rgba(195, 145, 104, 0.5);
  background: rgba(247, 239, 227, 0.7);
  color: #6d5747;
}

.sandbox-narrative-message.is-pending .sandbox-narrative-body {
  min-height: 30px;
}

.sandbox-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 0;
}

.sandbox-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9aab9b;
  animation: sandbox-typing 1.1s infinite ease-in-out;
}

.sandbox-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.sandbox-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes sandbox-typing {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  35% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.sandbox-check-card {
  margin-top: 9px;
  border-top: 1px dashed rgba(174, 139, 105, 0.4);
  color: #7e5f48;
  font-size: 9.5px;
}

.sandbox-check-card summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-top: 7px;
  cursor: pointer;
  list-style: none;
}

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

.sandbox-check-card summary .icon {
  width: 12px;
  height: 12px;
}

.sandbox-check-card summary strong {
  font-size: 9.5px;
}

.check-formula {
  margin-left: auto;
  color: #a88e78;
  font-size: 8.5px;
}

.sandbox-check-body p {
  margin: 6px 0;
  line-height: 1.65;
}

.sandbox-check-body .sandbox-check-reason {
  padding: 6px 8px;
  border-left: 2px solid rgba(154, 124, 81, 0.45);
  background: rgba(249, 244, 235, 0.7);
  color: #6d5a47;
  font-size: 9px;
}

.sandbox-check-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  color: #a88e78;
  font-size: 8.5px;
}

.sandbox-check-card.outcome-critical-success summary strong,
.sandbox-check-card.outcome-success summary strong {
  color: #5f806b;
}

.sandbox-check-card.outcome-failure summary strong,
.sandbox-check-card.outcome-critical-failure summary strong {
  color: #ad5d4b;
}

.sandbox-check-card.outcome-partial summary strong,
.sandbox-check-card.outcome-partial-success summary strong {
  color: #a37643;
}

.sandbox-feed-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  font-size: 11px;
}

.sandbox-choices-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  padding: 9px 22px;
  border-top: 1px dashed rgba(228, 215, 197, 0.72);
  background: rgba(252, 248, 240, 0.72);
}

.sandbox-choices-label {
  flex: 0 0 auto;
  margin-right: 2px;
  color: var(--muted-light);
  font-size: 8.5px;
  letter-spacing: 0.08em;
}

.sandbox-choice {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid rgba(216, 200, 180, 0.85);
  border-radius: 999px;
  background: #fffdf8;
  color: #6b6257;
  font-size: 9.5px;
  text-align: left;
  cursor: pointer;
}

.sandbox-choice:hover {
  border-color: rgba(111, 148, 127, 0.42);
  color: #4d6a58;
  background: #f3f8f2;
}

.sandbox-choice .icon {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  opacity: 0.6;
}

.sandbox-choices-free {
  margin-left: auto;
  color: var(--muted-light);
  font-size: 8.5px;
}

.sandbox-action-bar {
  padding: 10px 18px 12px;
  border-top: 1px solid rgba(228, 215, 197, 0.72);
  background: rgba(255, 252, 246, 0.84);
}

.sandbox-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 8px 8px 8px 13px;
  border: 1px solid rgba(211, 193, 171, 0.86);
  border-radius: 15px;
  background: #fffdf8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sandbox-input-wrap:focus-within {
  border-color: rgba(111, 148, 127, 0.55);
  box-shadow: 0 0 0 3px rgba(111, 148, 127, 0.09);
}

.sandbox-action-input {
  flex: 1;
  min-height: 26px;
  max-height: 150px;
  padding: 3px 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.65;
  resize: none;
}

.sandbox-action-input:disabled {
  opacity: 0.55;
}

.sandbox-input-side {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.sandbox-send-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(111, 148, 127, 0.38);
  border-radius: 10px;
  background: linear-gradient(145deg, #759a82, #5f816c);
  color: #fffdf8;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.sandbox-send-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.sandbox-send-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.sandbox-send-btn .icon {
  width: 16px;
  height: 16px;
}

.sandbox-stop-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  border: 1px solid rgba(186, 93, 73, 0.3);
  border-radius: 9px;
  background: #fdf2ed;
  color: #a95c4b;
  font-size: 9.5px;
  cursor: pointer;
}

.sandbox-stop-btn .icon {
  width: 13px;
  height: 13px;
}

.sandbox-composer-hint {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted-light);
  font-size: 8.5px;
}

.sandbox-composer-tokens {
  white-space: nowrap;
}

.sandbox-ended-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid rgba(181, 102, 84, 0.28);
  border-radius: 13px;
  background: #fbf0eb;
  color: #8c5244;
}

.sandbox-ended-banner strong {
  display: block;
  font-size: 11.5px;
}

.sandbox-ended-banner p {
  margin: 2px 0 0;
  color: #9f7569;
  font-size: 9.5px;
}

.sandbox-ended-banner .btn {
  margin-left: auto;
}

.sandbox-ended-icon .icon {
  width: 20px;
  height: 20px;
}

.sandbox-error-card {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 10px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(181, 102, 84, 0.3);
  border-radius: 12px;
  background: #fcf3ef;
}

.sandbox-error-icon {
  color: #b66a53;
}

.sandbox-error-card > div {
  flex: 1;
}

.sandbox-error-card strong {
  font-size: 11px;
}

.sandbox-error-card p {
  margin: 3px 0 0;
  color: #9b7569;
  font-size: 9.5px;
  line-height: 1.6;
}

/* 右侧状态 */

.sandbox-status-pane {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.sandbox-character-card,
.sandbox-scene-card {
  border: 1px solid rgba(229, 216, 198, 0.88);
  border-radius: 16px;
  background:
    linear-gradient(155deg, rgba(255, 253, 247, 0.95), rgba(249, 244, 235, 0.84)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.sandbox-character-card {
  padding: 14px;
}

.sandbox-character-head {
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.sandbox-character-avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--sage) 16%, #fffaf2);
  color: #52705c;
}

.sandbox-character-avatar .icon {
  width: 18px;
  height: 18px;
}

.sandbox-character-head > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.sandbox-character-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
}

.sandbox-character-head p {
  margin: 2px 0 0;
  color: #876d58;
  font-size: 9.5px;
}

.sandbox-character-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.sandbox-vitals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px 0;
}

.sandbox-vital {
  min-width: 0;
}

.sandbox-vital-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-vital-head strong {
  color: var(--ink-soft);
  font-size: 10px;
}

.sandbox-vital-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee5d9;
}

.sandbox-vital-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8fb19a, #6d947d);
}

.sandbox-vital.energy .sandbox-vital-track span {
  background: linear-gradient(90deg, #d7b783, #b99253);
}

.sandbox-vital.danger .sandbox-vital-track span {
  background: linear-gradient(90deg, #d59a85, #b86150);
}

.sandbox-character-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-character-facts span {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  line-height: 1.5;
}

.sandbox-character-facts .icon {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  margin-top: 1px;
  color: #899a8a;
}

.sandbox-status-dead {
  margin-top: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #fbf0eb;
  color: #a55a49;
  font-size: 9px;
}

.sandbox-scene-card {
  padding: 13px 14px;
}

.sandbox-scene-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sandbox-scene-label {
  color: var(--muted-light);
  font-size: 8.5px;
  letter-spacing: 0.1em;
}

.sandbox-scene-turn {
  color: #9a8169;
  font-size: 8.5px;
}

.sandbox-scene-card h3 {
  margin: 6px 0 4px;
  font-family: var(--font-display);
  font-size: 15px;
}

.sandbox-scene-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.sandbox-scene-weather {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(222, 207, 187, 0.62);
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-scene-weather span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.sandbox-scene-weather .icon {
  width: 11px;
  height: 11px;
}

.sandbox-status-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(228, 215, 197, 0.8);
  border-radius: 11px;
  background: rgba(249, 244, 235, 0.75);
}

.sandbox-status-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 3px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 8.5px;
  cursor: pointer;
}

.sandbox-status-tab .icon {
  width: 11px;
  height: 11px;
}

.sandbox-status-tab.is-active {
  background: #fffdf8;
  color: #4e6c59;
  box-shadow: 0 2px 7px -5px rgba(74, 49, 32, 0.5);
}

.sandbox-status-tab-body {
  flex: 1;
  min-height: 100px;
  padding: 12px 13px;
  border: 1px solid rgba(229, 216, 198, 0.88);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.85);
  overflow-y: auto;
}

.sandbox-resource-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sandbox-resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 7px 9px;
  border: 1px solid rgba(228, 215, 197, 0.8);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.76);
  font-size: 10px;
}

.sandbox-resource-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
}

.sandbox-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sandbox-event-row {
  padding: 9px 10px;
  border: 1px solid rgba(228, 215, 197, 0.9);
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.82);
}

.sandbox-event-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sandbox-event-head strong {
  font-size: 10.5px;
}

.sandbox-event-status {
  color: #9a7c51;
  font-size: 9px;
}

.sandbox-event-status.is-ended {
  color: #6d8a76;
}

.sandbox-event-row p {
  margin: 4px 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.sandbox-event-row small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.sandbox-attribute-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sandbox-attribute-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 10px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(228, 215, 197, 0.58);
}

.sandbox-attribute-row:last-child {
  border-bottom: none;
}

.sandbox-attribute-row span {
  font-size: 10px;
}

.sandbox-attribute-row strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: #566e5c;
}

.sandbox-attribute-row small {
  grid-column: 1 / -1;
  color: var(--muted-light);
  font-size: 8px;
}

.sandbox-status-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(228, 215, 197, 0.62);
}

.sandbox-status-block h4 {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sandbox-status-text {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.7;
}

.sandbox-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sandbox-mini-chip {
  padding: 3px 6px;
  border-radius: 5px;
  background: #f4eee4;
  color: #746555;
  font-size: 8.5px;
}

.sandbox-mini-chip.is-warn {
  background: #fbeee8;
  color: #a45f4d;
}

.sandbox-mini-chip.is-muted {
  background: #f2f0e9;
  color: var(--muted-light);
}

.sandbox-status-empty {
  margin: 5px 0;
  color: var(--muted-light);
  font-size: 9.5px;
  line-height: 1.65;
}

.sandbox-inventory-list,
.sandbox-relationship-list,
.sandbox-quest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sandbox-inventory-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sandbox-inventory-icon {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  border-radius: 7px;
  background: #f4eee3;
  color: #9b7a59;
}

.sandbox-inventory-icon .icon {
  width: 12px;
  height: 12px;
}

.sandbox-inventory-row > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.sandbox-inventory-row strong {
  font-size: 9.5px;
}

.sandbox-inventory-row small {
  overflow: hidden;
  color: var(--muted-light);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sandbox-inventory-qty {
  color: var(--muted);
  font-size: 8.5px;
}

.sandbox-money-line {
  margin: 0;
  color: #886b50;
  font-family: var(--font-display);
  font-size: 16px;
}

.sandbox-relationship-row {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(228, 215, 197, 0.58);
}

.sandbox-relationship-row:last-child {
  border-bottom: none;
}

.sandbox-relationship-head,
.sandbox-quest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sandbox-relationship-head strong,
.sandbox-quest-head strong {
  font-size: 9.5px;
}

.sandbox-attitude {
  font-size: 8.5px;
  color: var(--muted);
}

.sandbox-attitude.is-friendly {
  color: #5d8269;
}

.sandbox-attitude.is-hostile {
  color: #b25e4c;
}

.sandbox-attitude-track {
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee4d6;
}

.sandbox-attitude-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8c9b8, #7d9e84);
}

.sandbox-relationship-row small,
.sandbox-quest-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted-light);
  font-size: 8px;
  line-height: 1.55;
}

.sandbox-quest-row {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(228, 215, 197, 0.58);
}

.sandbox-quest-row:last-child {
  border-bottom: none;
}

.sandbox-quest-status {
  padding: 2px 5px;
  border-radius: 5px;
  background: #f4eee3;
  color: #907257;
  font-size: 8px;
}

.sandbox-quest-status.is-done {
  background: #e9f1e8;
  color: #5d7d63;
}

/* 编年史 */

.sandbox-chronicle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sandbox-chronicle-entry {
  padding: 10px 12px;
  border: 1px solid rgba(228, 215, 197, 0.75);
  border-radius: 11px;
  background: #fffdf8;
}

.sandbox-chronicle-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.sandbox-chronicle-head strong {
  font-size: 10px;
  color: #7f664f;
}

.sandbox-chronicle-head time {
  color: var(--muted-light);
  font-size: 8px;
}

.sandbox-chronicle-entry p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.75;
}

@media (max-width: 1180px) {
  .sandbox-play-layout {
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  }

  .sandbox-save-grid {
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  }
}

@media (max-width: 980px) {
  .sandbox-hero {
    grid-template-columns: 1fr;
  }

  .sandbox-hero-stats {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .sandbox-hero-stats div {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    border-bottom: none;
    padding-bottom: 0;
  }

  .sandbox-hero-stats span {
    font-size: 9px;
    line-height: 1.35;
  }

  .sandbox-category-grid,
  .sandbox-category-choice-grid {
    grid-template-columns: 1fr;
  }

  .sandbox-quick-links {
    grid-template-columns: 1fr;
  }

  .sandbox-play-layout {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-height: 0;
  }

  .page-sandbox-play {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 80px;
  }

  .sandbox-story-pane {
    height: calc(100dvh - 320px);
    min-height: 320px;
    max-height: none;
  }

  .sandbox-story-feed {
    padding: 16px 16px 6px;
  }

  .sandbox-status-pane {
    flex: 0 0 auto;
    overflow: visible;
    padding-right: 0;
  }

  .sandbox-status-tab-body {
    max-height: none;
  }

  .sandbox-action-message {
    max-width: 90%;
  }

  .sandbox-choices-bar {
    padding: 8px 14px;
  }

  .sandbox-choices-free {
    width: 100%;
    margin-left: 0;
  }

  .sandbox-play-header {
    gap: 9px;
  }

  .sandbox-play-actions {
    width: 100%;
  }

  .sandbox-character-facts {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .sandbox-status-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sandbox-worldbook-grid,
  .sandbox-save-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sandbox-scenario-choice-grid {
    grid-template-columns: 1fr;
  }

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

  .sandbox-attribute {
    flex-direction: column;
    align-items: stretch;
  }

  .attribute-number {
    width: 100%;
    flex: auto;
  }

  .sandbox-play-title {
    font-size: 19px;
  }

  .sandbox-play-meta {
    font-size: 9px;
  }

  .sandbox-story-pane {
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    border-radius: 16px;
  }

  .sandbox-story-feed {
    flex: 0 0 auto;
    height: clamp(190px, 27dvh, 300px);
  }

  .sandbox-year-input {
    width: 96px;
    flex: 0 0 96px;
  }

  .sandbox-month-select {
    width: 72px;
    flex: 0 0 72px;
  }

  .sandbox-narrative-body {
    font-size: 12.5px;
  }

  .sandbox-action-message {
    max-width: 94%;
  }

  .sandbox-play-actions .btn span {
    display: none;
  }

  .sandbox-play-actions .btn {
    padding: 6px 8px;
  }

  .sandbox-input-wrap {
    padding-left: 10px;
  }

  .sandbox-timeline-row {
    grid-template-columns: 1fr 1fr;
  }

  .sandbox-timeline-row .input:nth-child(4) {
    grid-column: 1 / -1;
  }

  .sandbox-timeline-row .icon-btn {
    grid-column: 2;
    justify-self: end;
  }

  .sandbox-worldbook-form .form-grid.four,
  .sandbox-worldbook-form .form-grid.three {
    grid-template-columns: 1fr;
  }

  .sandbox-composer-hint {
    font-size: 8px;
  }

  .sandbox-status-tab {
    font-size: 8px;
  }

  .sandbox-status-tab .icon {
    width: 10px;
    height: 10px;
  }
}
