/* ------------------------------ 通用运行框架 /run/<game> ------------------------------ */
body.is-runtime { overflow: hidden; }
body.is-runtime .site-header,
body.is-runtime .site-footer { display: none; }
body.is-runtime main { flex: 1 1 auto; min-height: 0; }
html.runtime-embed, body.runtime-embed { height: 100%; }
.rt-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 560px;
  background: #070b16;
}
.rt-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  background: rgba(10, 15, 30, 0.95);
  backdrop-filter: blur(10px);
  flex: 0 0 auto;
  z-index: 5;
}
.rt-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  color: var(--text-soft, #c3cbe9);
  text-decoration: none;
  font-size: 13px;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.rt-back:hover { border-color: var(--accent, #5b7cff); color: var(--text, #e9edff); }
.rt-back .icon { width: 14px; height: 14px; transform: rotate(180deg); }
.rt-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rt-title strong { font-size: 15px; letter-spacing: 0.01em; }
.rt-title span {
  font-size: 12.5px;
  color: var(--muted, #9aa6d4);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rt-spacer { flex: 1 1 auto; }
.rt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft, #c3cbe9);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.rt-chip:hover { border-color: rgba(91, 124, 255, 0.55); background: rgba(91, 124, 255, 0.12); }
.rt-chip .icon { width: 15px; height: 15px; }
.rt-chip b { color: var(--text, #e9edff); font-weight: 600; }
.rt-chip span { color: var(--muted, #9aa6d4); }
.rt-account { padding-left: 9px; }
.rt-account .avatar { width: 22px; height: 22px; font-size: 11px; }
.rt-main { position: relative; flex: 1 1 auto; min-height: 0; background: #050811; }
.rt-frame { width: 100%; height: 100%; border: 0; display: block; background: #050811; }
.rt-boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #050811;
  color: var(--muted, #9aa6d4);
  font-size: 14px;
  z-index: 4;
  transition: opacity 0.25s ease;
}
.rt-boot.is-hidden { opacity: 0; pointer-events: none; }
.rt-boot .spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(91, 124, 255, 0.2);
  border-top-color: #5b7cff;
  animation: rt-spin 0.9s linear infinite;
}
@keyframes rt-spin { to { transform: rotate(360deg); } }
.rt-restore {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(12, 18, 36, 0.92);
  border: 1px solid rgba(91, 124, 255, 0.45);
  color: var(--text-soft, #c3cbe9);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 6;
}
.rt-restore.is-visible { opacity: 1; }

/* 弹层 */
.rt-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 16, 0.72);
  backdrop-filter: blur(4px);
}
.rt-modal-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  border-radius: 18px;
  border: 1px solid var(--border-strong, rgba(124, 145, 214, 0.32));
  background: var(--surface-solid, #0d1428);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.rt-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--border, rgba(124, 145, 214, 0.18));
}
.rt-modal-head h2 { margin: 0; font-size: 17px; }
.rt-modal-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted, #9aa6d4); }
.rt-icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #9aa6d4);
  cursor: pointer;
}
.rt-icon-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text, #e9edff); }
.rt-modal-body { padding: 16px 20px; overflow: auto; }
.rt-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border, rgba(124, 145, 214, 0.18));
}
.rt-empty { color: var(--muted, #9aa6d4); font-size: 13px; line-height: 1.7; margin: 8px 0; }
.rt-hint { color: var(--dim, #7480ab); font-size: 12.5px; line-height: 1.7; margin: 12px 0 0; }
.rt-field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.rt-field > span { font-size: 13px; color: var(--muted, #9aa6d4); }
.rt-field select { width: 100%; }
.rt-danger { color: #ff9b9b; }

/* 积分面板 */
.rt-points-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.rt-points-main {
  flex: 1 1 240px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(91, 124, 255, 0.18), rgba(192, 132, 252, 0.12));
  border: 1px solid rgba(91, 124, 255, 0.35);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rt-points-main span { font-size: 12.5px; color: var(--muted, #9aa6d4); }
.rt-points-main strong { font-size: 30px; letter-spacing: -0.01em; }
.rt-points-main small { font-size: 12px; color: var(--dim, #7480ab); margin-top: 4px; }
.rt-points-side { flex: 0 0 200px; display: flex; flex-direction: column; gap: 10px; }
.rt-points-side > div {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rt-points-side span { font-size: 12px; color: var(--muted, #9aa6d4); }
.rt-points-side b { font-size: 18px; }
.rt-ledger { margin-top: 16px; }
.rt-ledger-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted, #9aa6d4);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border, rgba(124, 145, 214, 0.18));
}
.rt-ledger-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 76px 70px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  font-size: 12.5px;
  border-bottom: 1px dashed rgba(124, 145, 214, 0.12);
}
.rt-ledger-time { color: var(--muted, #9aa6d4); font-variant-numeric: tabular-nums; }
.rt-ledger-model { color: var(--text-soft, #c3cbe9); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-ledger-delta { text-align: right; color: #ff9b9b; font-variant-numeric: tabular-nums; }
.rt-ledger-tokens { text-align: right; color: var(--muted, #9aa6d4); font-variant-numeric: tabular-nums; }

/* 存档面板 */
.rt-saves-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted, #9aa6d4);
}
.rt-saves-total strong { color: var(--text, #e9edff); font-size: 16px; }
.rt-saves-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rt-autosave { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.rt-saves-search { margin-top: 12px; }
.rt-saves-search .ws-input { width: 100%; box-sizing: border-box; }
.rt-save-current-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed rgba(91, 124, 255, 0.42);
  background: rgba(91, 124, 255, 0.08);
}
.rt-save-current-empty > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-save-current-empty span { font-size: 11.5px; color: var(--muted, #9aa6d4); }
.rt-save-current-empty strong { font-size: 14px; }
.rt-save-current-empty p { margin: 0; font-size: 12.5px; color: var(--muted, #9aa6d4); }
.rt-save-groups { display: grid; gap: 12px; margin-top: 14px; }
.rt-save-world {
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}
.rt-save-world-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.03);
}
.rt-save-world-head::-webkit-details-marker { display: none; }
.rt-save-world-head::before {
  content: '▸';
  color: var(--muted, #9aa6d4);
  font-size: 11px;
  flex: 0 0 auto;
  transition: transform 0.15s ease;
}
.rt-save-world[open] > .rt-save-world-head::before { transform: rotate(90deg); }
.rt-save-world-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.rt-save-world-title em {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: #9fc0ff;
  border: 1px solid rgba(91, 124, 255, 0.42);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.rt-save-world-meta { margin-left: auto; font-size: 12px; color: var(--muted, #9aa6d4); text-align: right; white-space: nowrap; }
.rt-save-world .rt-save-list { padding: 10px 12px 12px; margin-top: 0; }
.rt-save-list { display: grid; gap: 10px; }
.rt-save-card {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rt-save-card.is-hidden, .rt-save-world.is-hidden, .rt-save-no-match.is-hidden { display: none; }
.rt-save-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.rt-save-head strong { font-size: 14px; }
.rt-save-kind {
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 8px;
  border: 1px solid var(--border, rgba(124, 145, 214, 0.24));
  white-space: nowrap;
}
.rt-save-kind--auto { color: #93d7b0; border-color: rgba(86, 190, 126, 0.42); background: rgba(86, 190, 126, 0.1); }
.rt-save-kind--manual { color: #aebcf0; background: rgba(124, 145, 214, 0.08); }
.rt-save-meta { font-size: 12.5px; color: var(--text-soft, #c3cbe9); }
.rt-save-actions { display: flex; gap: 8px; justify-content: flex-end; }
.rt-save-target {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(91, 124, 255, 0.35);
  background: linear-gradient(135deg, rgba(91, 124, 255, 0.16), rgba(192, 132, 252, 0.1));
}
.rt-save-target span { font-size: 12px; color: var(--muted, #9aa6d4); }
.rt-save-target strong { font-size: 16px; }
.rt-save-target small { font-size: 11.5px; color: var(--dim, #7480ab); word-break: break-all; }
.rt-field input { width: 100%; box-sizing: border-box; }
.rt-account-rows { display: grid; gap: 10px; }
.rt-account-rows > div {
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(124, 145, 214, 0.18));
  font-size: 13px;
}
.rt-account-rows span { color: var(--muted, #9aa6d4); }

@media (max-width: 760px) {
  .rt-bar { flex-wrap: wrap; padding: 8px 10px; gap: 8px; }
  .rt-title span { max-width: 130px; }
  .rt-chip span { display: none; }
  .rt-shell { height: 100dvh; min-height: 0; }
  .rt-modal { padding: 12px; }
  .rt-modal-card { max-height: 92dvh; }
  .rt-save-world-head { flex-wrap: wrap; align-items: flex-start; }
  .rt-save-world-meta { margin-left: 0; width: 100%; text-align: left; white-space: normal; }
  .rt-save-actions { flex-wrap: wrap; }
  .rt-saves-actions { width: 100%; justify-content: space-between; }
  .rt-ledger-row { grid-template-columns: 96px minmax(0, 1fr) 64px; }
  .rt-ledger-tokens { display: none; }
}

/* 运行外壳：启动失败 / 会话过期（/run/<game> 启动阶段） */
.rt-boot.is-error { padding: 28px 20px; text-align: center; }
.rt-boot-error { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 460px; }
.rt-boot-msg { margin: 0; color: var(--text-soft, #c3cbe9); font-size: 15px; line-height: 1.75; }
.rt-boot-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* 模型选择 */
.rt-model-list { display: grid; gap: 8px; max-height: 42vh; overflow: auto; padding-right: 2px; }
.rt-model-add { display: grid; gap: 10px; margin-top: 12px; }
.rt-model-add form { display: grid; gap: 10px; }
.rt-model-add form.is-hidden { display: none; }
.rt-model-add-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rt-model-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid rgba(120, 140, 200, 0.22); border-radius: 12px; cursor: pointer; background: rgba(255, 255, 255, 0.02); }
.rt-model-option:hover { border-color: rgba(91, 124, 255, 0.5); background: rgba(91, 124, 255, 0.08); }
.rt-model-option input { margin-top: 3px; accent-color: #5b7cff; }
.rt-model-option > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-model-option strong { font-size: 13.5px; color: var(--text, #e9edff); }
.rt-model-option small { font-size: 11.5px; color: var(--muted, #9aa6d4); word-break: break-all; }
.rt-model-price { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; line-height: 1.45; }
.rt-model-option:has(input:checked) { border-color: rgba(91, 124, 255, 0.8); background: rgba(91, 124, 255, 0.14); }

.rt-model-auto { padding: 2px; }
.rt-model-group { border: 1px solid rgba(120, 140, 200, 0.22); border-radius: 12px; overflow: hidden; background: rgba(255, 255, 255, 0.02); }
.rt-model-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.rt-model-group > summary::-webkit-details-marker { display: none; }
.rt-model-group > summary span { font-size: 13.5px; font-weight: 600; color: var(--text, #e9edff); }
.rt-model-group > summary small { font-size: 11.5px; color: var(--muted, #9aa6d4); }
.rt-model-group[open] > summary { border-bottom: 1px solid rgba(120, 140, 200, 0.18); }
.rt-model-group-body { display: grid; gap: 6px; padding: 8px; }
.rt-model-group-body .rt-model-option { border-color: rgba(120, 140, 200, 0.16); }
.rt-model-auto .rt-model-option { border-color: rgba(91, 124, 255, 0.28); }

.rt-model-tabs { display: flex; gap: 6px; padding: 3px; margin-bottom: 12px; border: 1px solid rgba(120, 140, 200, 0.2); border-radius: 12px; background: rgba(255, 255, 255, 0.02); }
.rt-model-tab { flex: 1; border: 0; border-radius: 9px; padding: 9px 12px; background: transparent; color: var(--muted, #9aa6d4); font-size: 13px; font-weight: 600; cursor: pointer; }
.rt-model-tab small { font-size: 10.5px; font-weight: 500; opacity: 0.75; }
.rt-model-tab.is-active { background: rgba(91, 124, 255, 0.18); color: var(--text, #e9edff); }
.rt-model-pane.is-hidden { display: none; }
/* 生成参数已从「选择模型」面板剥离为独立入口：这里只保留字段网格样式。 */
.rt-params-pane { padding-top: 4px; padding-bottom: 8px; }
.rt-gen-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.rt-gen-grid > .rt-gen-tip { grid-column: 1 / -1; font-size: 11.5px; line-height: 1.6; color: var(--dim, #7480ab); }
.rt-gen-grid .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rt-gen-grid .field > span { font-size: 12px; color: var(--muted, #b1aa9e); }
.rt-gen-grid .field > .rt-gen-tip { font-size: 11.5px; line-height: 1.6; color: var(--dim, #7480ab); }
.rt-gen-grid .field.rt-gen-wide { grid-column: 1 / -1; }
.rt-gen-check { display: flex; align-items: center; gap: 10px; min-height: 44px; grid-column: 1 / -1; cursor: pointer; }
.rt-gen-check input { width: 18px; height: 18px; accent-color: var(--accent, #e7b15a); }
/* 生成参数面板：世界内部开关分组 */
.rt-gen-group { border-top: 1px dashed rgba(120, 140, 200, 0.28); padding-top: 12px; margin-top: 4px; }
.rt-gen-group-title { display: block; font-size: 12.5px; font-weight: 650; letter-spacing: 0.06em; color: var(--text, #f3ede3); }
@media (max-width: 640px) { .rt-gen-grid { grid-template-columns: minmax(0, 1fr); } }
.rt-model-placeholder { border: 1px dashed rgba(120, 140, 200, 0.38); border-radius: 14px; padding: 28px 22px; text-align: center; background: rgba(255, 255, 255, 0.02); }
.rt-model-placeholder-badge { display: inline-block; margin-bottom: 10px; padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(120, 140, 200, 0.4); color: var(--muted, #9aa6d4); font-size: 11px; }
.rt-model-placeholder strong { display: block; font-size: 15px; color: var(--text, #e9edff); margin-bottom: 8px; }
.rt-model-placeholder p { margin: 0 0 8px; color: var(--muted, #9aa6d4); font-size: 12.5px; line-height: 1.7; }
.rt-model-placeholder code { padding: 1px 6px; border-radius: 6px; background: rgba(91, 124, 255, 0.14); color: var(--text, #e9edff); }
.rt-modal-foot button:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== 选择模型：基础价 + 折扣徽章 + 折后价（2026-11-02） ===== */
.rt-model-price-rich { gap: 7px; margin-top: 6px; }
.rt-price-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.rt-price-base-label,
.rt-price-final-label {
  flex: 0 0 auto;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(154, 166, 212, 0.14);
  color: var(--muted, #9aa6d4);
}
.rt-price-base {
  font-size: 11.5px;
  color: rgba(154, 166, 212, 0.8);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(255, 150, 120, 0.65);
}
.rt-price-after .rt-price-final-label {
  background: linear-gradient(135deg, rgba(91, 124, 255, 0.34), rgba(140, 90, 255, 0.34));
  color: #d6ddff;
  box-shadow: inset 0 0 0 1px rgba(150, 170, 255, 0.25);
}
.rt-price-final { font-size: 11.8px; font-weight: 650; color: #eef2ff; }

/* 折扣徽章：金色渐变 + 流光 + 微光晕 */
.rt-discount-badge {
  flex: 0 0 auto;
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  overflow: hidden;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #3a1d00;
  white-space: nowrap;
  background: linear-gradient(135deg, #fff2bf 0%, #ffcf5c 32%, #ff9d3f 62%, #ffd977 100%);
  box-shadow:
    0 0 0 1px rgba(255, 206, 92, 0.6),
    0 3px 12px rgba(255, 152, 63, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.rt-discount-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.9) 47%, transparent 63%);
  transform: translateX(-130%);
  animation: rt-discount-shine 4.2s ease-in-out infinite;
  pointer-events: none;
}
.rt-discount-badge i { font-style: normal; font-size: 9px; opacity: 0.85; }
.rt-discount-badge em {
  font-style: normal;
  margin-left: 1px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 800;
  color: #4a2200;
  background: rgba(74, 34, 0, 0.16);
}
.rt-model-option:hover .rt-discount-badge {
  transform: translateY(-1px) scale(1.05);
  box-shadow:
    0 0 0 1px rgba(255, 214, 120, 0.75),
    0 5px 16px rgba(255, 152, 63, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
@keyframes rt-discount-shine {
  0%, 52% { transform: translateX(-130%); }
  78%, 100% { transform: translateX(130%); }
}
@media (prefers-reduced-motion: reduce) {
  .rt-discount-badge::after { animation: none; }
  .rt-discount-badge { transition: none; }
}

/* 文案型折扣标签（没有数字折扣时） */
.rt-discount-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  color: #ffe2a8;
  background: linear-gradient(135deg, rgba(255, 193, 77, 0.18), rgba(255, 139, 61, 0.12));
  box-shadow: inset 0 0 0 1px rgba(255, 193, 77, 0.45);
}
.rt-price-extra { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.rt-price-extra span { font-size: 11px; color: var(--muted, #9aa6d4); }
