@import url("https://fonts.googleapis.com/css2?family=ZCOOL+XiaoWei&family=Noto+Sans+SC:wght@400;500;700;900&family=JetBrains+Mono:wght@600;700&display=swap");

:root {
  --ink: #3a2a1c;
  --ink-soft: #5a4330;
  --frost: #f0a04b;
  --frost-bright: #ffc56d;
  --frost-mist: rgba(240, 160, 75, 0.16);
  --seal: #d46a4c;
  --paper: #fff8ee;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-solid: #fffaf2;
  --line: rgba(90, 60, 30, 0.12);
  --mute: #8a7360;
  --ok: #2f9d6a;
  --warn: #c47a12;
  --danger: #c0392b;
  --sky: #7ec8e3;
  --peach: #ffd7a8;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 24px rgba(90, 50, 20, 0.07);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "ZCOOL XiaoWei", "Noto Serif SC", serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --shell-max: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html, body { min-height: 100%; }
body {
  color: var(--ink);
  font: 400 14px/1.55 var(--font);
  background:
    radial-gradient(780px 420px at 12% -10%, rgba(255, 197, 109, 0.42), transparent 58%),
    radial-gradient(720px 380px at 100% 0%, rgba(126, 200, 227, 0.28), transparent 52%),
    radial-gradient(560px 320px at 70% 100%, rgba(255, 180, 140, 0.18), transparent 55%),
    linear-gradient(165deg, #fff9f0 0%, #fff3e4 46%, #f4f8fb 100%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 215, 120, 0.16), transparent 18%),
    radial-gradient(circle at 86% 18%, rgba(126, 200, 227, 0.14), transparent 16%);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 22px 16px 56px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  animation: rise .45s ease both;
}
.brand-title {
  font-family: var(--display);
  font-size: 30px;
  letter-spacing: 0.06em;
  font-weight: 400;
}
.top p { color: var(--mute); margin-top: 4px; font-size: 13px; }

.runner {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--mute);
  flex-shrink: 0;
}
.runner.on {
  color: var(--ok);
  border-color: rgba(31, 157, 99, 0.35);
  background: rgba(31, 157, 99, 0.1);
  box-shadow: 0 0 0 4px rgba(31, 157, 99, 0.08);
}

.grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  animation: rise .45s ease both;
}
.panel h2 {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
  font-weight: 400;
}

.room-stage {
  background:
    radial-gradient(520px 240px at 12% 0%, rgba(255, 197, 109, 0.35), transparent 58%),
    radial-gradient(420px 200px at 100% 8%, rgba(126, 200, 227, 0.22), transparent 55%),
    linear-gradient(165deg, #fff8ee 0%, #fff1df 48%, #f7fbff 100%);
  color: var(--ink);
  border: 1px solid rgba(240, 160, 75, 0.2);
  box-shadow: 0 10px 24px rgba(120, 70, 20, 0.06);
  padding: 10px 10px 12px;
  margin-bottom: 0;
}
.room-stage h2,
.room-stage .section-title strong { color: var(--ink); }
.room-stage .hint { color: var(--mute); }
.room-stage .runner {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(240, 160, 75, 0.28);
  color: #8a4a12;
}
.hero-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: #a07855;
  margin-bottom: 6px;
}
.room-input {
  width: 100%;
  border: 1px solid rgba(240, 160, 75, 0.28);
  background: #fff !important;
  color: var(--ink) !important;
  caret-color: #f0a04b;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  outline: none;
  -webkit-text-fill-color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
.room-input::placeholder {
  color: rgba(138, 115, 96, 0.45);
  -webkit-text-fill-color: rgba(138, 115, 96, 0.45);
  letter-spacing: 0.08em;
  font-size: 15px;
}
.room-input:focus,
.room-input:hover,
.room-input:active {
  border-color: rgba(240, 160, 75, 0.7);
  box-shadow: 0 0 0 4px rgba(240, 160, 75, 0.16);
  background: #fff !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
}
.room-input:-webkit-autofill,
.room-input:-webkit-autofill:hover,
.room-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  caret-color: #f0a04b;
  box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 99999s ease-out;
}
.save-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--mute);
}
.save-hint.ok { color: var(--ok); }

.status-box {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(240, 160, 75, 0.18);
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.status-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--mute);
}
.status-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}
.status-value.gold {
  font-family: var(--mono);
  color: #c47a12;
}
.status-value.busy { color: #1f7ea0; }
.status-value.fail { color: var(--danger); }
.status-value.ok { color: var(--ok); }
.status-accounts {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  max-height: 140px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.status-account {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(240, 160, 75, 0.08);
  font-size: 12px;
  color: var(--ink-soft);
}
.status-account .acc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status-account .bal {
  font-family: var(--mono);
  color: #c47a12;
  flex-shrink: 0;
}
.status-actions {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.status-actions > button,
.status-run-actions button {
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  touch-action: manipulation;
  font-size: 13px;
}
.status-run-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.status-run-actions #btnReset {
  grid-column: 1 / -1;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 8px;
}
.quota-tip {
  margin: 6px 0 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(232, 145, 42, 0.12);
  border: 1px solid rgba(232, 145, 42, 0.35);
  color: #8a4b12;
  font-size: 12px;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.slot-editor {
  margin-top: 2px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(240, 160, 75, 0.18);
}
.preset-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.preset-tab {
  min-height: 34px;
  border-radius: 10px;
  border: 2px solid rgba(240, 160, 75, 0.35);
  background: #fff8ef;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-tab.active {
  border-color: #e8912a;
  background: #ffc56d;
  color: #5a3208;
  box-shadow: 0 0 0 3px rgba(232, 145, 42, 0.22);
}
.preset-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--mute);
}
.preset-name-row input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(240, 160, 75, 0.35);
  background: #fff;
  padding: 0 8px;
  font-size: 13px;
  color: var(--ink);
}
.preset-active-tip {
  margin-top: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(47, 157, 106, 0.1);
  border: 1px solid rgba(47, 157, 106, 0.28);
  color: #1f6b45;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}
.slot-fixed-tip {
  margin-top: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--mute);
}
.slot-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}
.slot-tiles.bag {
  margin-top: 4px;
}
.slot-tile {
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(240, 160, 75, 0.22);
  background: #fff;
  color: var(--ink);
  padding: 6px 7px;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(120, 70, 20, 0.04);
}
.slot-tile:active,
.slot-tile.active {
  border-color: rgba(240, 160, 75, 0.75);
  background: rgba(255, 197, 109, 0.22);
  box-shadow: 0 0 0 3px rgba(240, 160, 75, 0.16);
}
.slot-tile .idx {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--mute);
}
.slot-tile .name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  word-break: break-word;
}
.slot-tile.empty .name {
  color: rgba(138, 115, 96, 0.5);
  font-weight: 500;
}
.slot-tile.waist {
  border-color: rgba(192, 57, 43, 0.45);
  background: rgba(192, 57, 43, 0.06);
}
.slot-tile.waist.cfg-ok {
  border-color: rgba(47, 157, 106, 0.55);
  background: rgba(47, 157, 106, 0.1);
  box-shadow: 0 0 0 2px rgba(47, 157, 106, 0.12);
}
.slot-tile.waist.cfg-busy {
  border-color: rgba(192, 57, 43, 0.75);
  background: rgba(192, 57, 43, 0.14);
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.16);
  animation: waist-pulse 1.1s ease-in-out infinite;
}
.slot-tile.bag-filled {
  border-color: rgba(47, 157, 106, 0.5);
  background: rgba(47, 157, 106, 0.1);
}
.slot-tile.bag-empty {
  border-color: rgba(192, 57, 43, 0.42);
  background: rgba(192, 57, 43, 0.05);
}
.waist-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(240, 160, 75, 0.28);
}
.waist-panel.cfg-busy {
  border-top-color: rgba(192, 57, 43, 0.55);
}
.waist-panel.cfg-ok {
  border-top-color: rgba(47, 157, 106, 0.55);
}
.waist-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.waist-cfg-badge {
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 22px;
  color: var(--danger);
  background: rgba(192, 57, 43, 0.1);
}
.waist-cfg-badge.ok {
  color: var(--ok);
  background: rgba(47, 157, 106, 0.12);
}
.waist-cfg-badge.busy {
  color: #fff;
  background: var(--danger);
}
@keyframes waist-pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  .slot-tile.waist.cfg-busy { animation: none; }
}
.slot-summary {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--mute);
  word-break: break-word;
}
.slot-actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.slot-actions button {
  min-height: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(240, 160, 75, 0.28);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  touch-action: manipulation;
}
.slot-actions button:hover {
  border-color: rgba(240, 160, 75, 0.55);
  background: rgba(255, 197, 109, 0.18);
}

.picker-mask {
  position: fixed;
  inset: 0;
  background: rgba(70, 45, 25, 0.35);
  z-index: 40;
  display: none;
}
.picker-mask.is-open { display: block; }
.picker-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-height: min(78vh, 640px);
  display: none;
  flex-direction: column;
  background: #fffaf2;
  color: var(--ink);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(90, 50, 20, 0.18);
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px));
}
.picker-sheet.is-open { display: flex; }
.picker-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: rgba(90, 60, 30, 0.18);
  margin: 4px auto 10px;
}
.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}
.picker-title {
  font-size: 16px;
  font-weight: 700;
}
.picker-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--mute);
}
.picker-close {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(240, 160, 75, 0.28);
  background: #fff;
  color: var(--ink-soft);
  touch-action: manipulation;
}
.picker-search {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(240, 160, 75, 0.28);
  background: #fff !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.picker-clear-row {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px dashed rgba(240, 160, 75, 0.35);
  background: transparent;
  color: var(--mute);
  touch-action: manipulation;
}
.picker-list {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: grid;
  gap: 6px;
  padding-bottom: 4px;
}
.picker-item-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.picker-item-row .picker-item {
  flex: 1;
}
.picker-price-btn {
  min-width: 52px;
  border-radius: 12px;
  border: 1px solid rgba(240, 160, 75, 0.22);
  background: #fff;
  color: #8a4a12;
  font-size: 12px;
  touch-action: manipulation;
}
.picker-item {
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(240, 160, 75, 0.18);
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.picker-item:active,
.picker-item.selected {
  border-color: rgba(240, 160, 75, 0.7);
  background: rgba(255, 197, 109, 0.22);
}
.picker-item .meta {
  font-size: 12px;
  color: var(--mute);
  font-family: var(--mono);
}
body.picker-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .slot-tiles { grid-template-columns: 1fr 1fr; }
  .top { align-items: start; }
  .brand-title { font-size: 26px; }
  .room-input {
    font-size: 28px;
    letter-spacing: 0.12em;
    padding: 16px 12px;
  }
}
@media (min-width: 900px) {
  .picker-sheet {
    left: 50%;
    right: auto;
    width: min(420px, 100%);
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--mute);
}
.room-stage label { color: var(--mute); }
label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink);
}
.room-stage label.check { color: var(--ink); }

input, textarea, select, button {
  font: inherit;
  color: inherit;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.room-stage input:not(.room-input),
.room-stage select {
  background: #fff;
  border-color: rgba(240, 160, 75, 0.24);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(240, 160, 75, 0.7);
  box-shadow: 0 0 0 4px rgba(240, 160, 75, 0.14);
  background: #fff;
}
.room-stage input:not(.room-input):focus,
.room-stage select:focus {
  background: #fff !important;
  color: var(--ink) !important;
  -webkit-text-fill-color: var(--ink);
}
input.room-input:focus {
  background: #fff !important;
  color: var(--ink) !important;
}

.actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  background: rgba(240, 160, 75, 0.08);
  border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
button:hover { transform: translateY(-1px); }
button.primary {
  background: linear-gradient(135deg, #ffc56d, #f0a04b);
  border-color: transparent;
  color: #5a3208;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(240, 160, 75, 0.28);
}
button.danger {
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.22);
  color: var(--seal);
}
button.linkish {
  padding: 4px 8px;
  font-size: 12px;
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.22);
  color: var(--seal);
}

.stats, .hint, #progressText { color: var(--mute); font-size: 13px; }
.hint { margin: 0 0 8px; }
.stats {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 197, 109, 0.14);
  border: 1px solid rgba(240, 160, 75, 0.18);
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.row-actions { display: flex; align-items: center; gap: 10px; }

.table-wrap {
  overflow: auto;
  max-height: 420px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--mute);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: #eef4f8;
}
.status { font-weight: 700; }
.status.ok { color: var(--ok); }
.status.fail { color: var(--danger); }
.status.running { color: var(--warn); }
.status.pending,
.status.ready { color: var(--mute); }
.status.ready { color: var(--frost); }
td.ops { white-space: nowrap; }

.log {
  margin: 0;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  background: #0f1a22;
  color: #d7ebf5;
  border: 1px solid rgba(20, 40, 60, 0.18);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .grid, .form { grid-template-columns: 1fr; }
  .room-input { font-size: 28px; }
}



/* ===== auth shell + bottom nav ===== */
.hidden { display: none !important; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 248, 238, 0.88);
  border-bottom: 1px solid rgba(90, 60, 30, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.topbar-inner {
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand-mark {
  display: block;
  height: 32px;
  width: auto;
  max-width: min(140px, 42vw);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 4px 10px rgba(90, 50, 20, 0.08));
}
.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.topbar-user {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}
.quota-chip {
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(126, 200, 227, 0.2);
  color: #1f5f78;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  padding: 6px 8px;
}

body.login-only .app-topbar,
body.login-only .bottom-nav { display: none; }
body.login-only .shell {
  min-height: 100svh;
  display: grid;
  align-content: center;
  padding: 24px 16px 40px;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 8px 12px calc(68px + env(safe-area-inset-bottom, 0px));
}

.page-panel {
  animation: page-in .28s ease both;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.page-kicker {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #9a7a58;
  margin-bottom: 1px;
}
.page-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 10px calc(6px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  animation: dock-up .35s ease both;
}
@keyframes dock-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.bottom-nav-inner {
  pointer-events: auto;
  width: min(440px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 4px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(255, 244, 230, 0.94));
  border: 1px solid rgba(200, 140, 70, 0.22);
  box-shadow: 0 8px 20px rgba(90, 50, 20, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.bottom-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font: 600 10px/1 var(--font);
  letter-spacing: 0.04em;
  transition: color .2s ease, background .2s ease, transform .2s ease;
}
.bottom-nav-item .nav-ico {
  width: 18px;
  height: 18px;
  display: block;
}
.bottom-nav-item.active {
  color: #8a4a12;
  background: rgba(240, 160, 75, 0.16);
}
.bottom-nav-item.active::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #f0a04b, #ffc56d);
  animation: nav-mark .28s ease both;
}
@keyframes nav-mark {
  from { transform: scaleX(0.4); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}
.bottom-nav-item:active { transform: scale(0.96); }

.login-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 18px 28px;
  align-items: center;
  animation: rise .5s ease both;
}
.login-hero {
  text-align: center;
  padding: 8px 8px 0;
}
.login-mascot {
  width: min(360px, 88%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 12px 20px rgba(90, 50, 20, 0.1));
  animation: mascot-float 4.8s ease-in-out infinite;
  content-visibility: auto;
}
@keyframes mascot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.login-brand-title {
  margin-top: 8px;
  font-family: var(--display);
  font-size: clamp(36px, 8vw, 52px);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--ink);
  line-height: 1;
}
.login-tagline {
  margin-top: 6px;
  color: var(--mute);
  font-size: 15px;
  letter-spacing: 0.18em;
}
.login-panel {
  margin-bottom: 0;
  padding: 22px 18px 18px;
  border-radius: var(--radius);
  background: rgba(255, 252, 246, 0.96);
  border: 1px solid rgba(240, 160, 75, 0.22);
  box-shadow: 0 16px 36px rgba(120, 70, 20, 0.08);
}
.login-panel h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 4px;
}

.sub, .muted { color: var(--mute); font-size: 13px; }
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 14px 0 12px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}
.tabs button {
  padding: 9px 6px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--mute);
  font-size: 13px;
  cursor: pointer;
}
.tabs button.active {
  background: linear-gradient(135deg, #f0a04b, #ffb35c);
  color: #5a3208;
  font-weight: 700;
}
.field { margin-bottom: 10px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit;
}
.field input:focus {
  outline: none;
  border-color: rgba(240, 160, 75, 0.55);
  box-shadow: 0 0 0 4px rgba(240, 160, 75, 0.14);
}
.btn-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; font-weight: 600;
}
.btn-primary {
  background: linear-gradient(135deg, #f0a04b, #ffc56d);
  border-color: transparent;
  color: #5a3208;
  box-shadow: 0 10px 22px rgba(240, 160, 75, 0.25);
}
.btn-secondary { background: #fff; }
.btn-danger { background: #3a1d22; border-color: #6b3038; color: #ffd0d4; }
.btn-block { width: 100%; }

.mine-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat {
  padding: 14px 12px;
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.9);
  border: 1px solid var(--line);
}
.stat strong {
  display: block;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 4px;
}
.stat span { color: var(--mute); font-size: 12px; }
.mine-activate {
  padding: 16px;
  border-radius: 18px;
  background:
    radial-gradient(280px 120px at 0% 0%, rgba(255, 197, 109, 0.22), transparent 70%),
    rgba(255, 252, 246, 0.92);
  border: 1px solid rgba(240, 160, 75, 0.2);
}
.mine-activate-title {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 12px;
}
.tier-list { padding-left: 18px; color: var(--mute); margin-top: 14px; }
.empty-home {
  text-align: center;
  padding: 48px 16px;
  border-radius: 20px;
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid var(--line);
}
.empty-mascot {
  width: 140px; height: auto; margin: 0 auto 10px; display: block;
  filter: drop-shadow(0 10px 18px rgba(90, 50, 20, 0.1));
}
.empty-home .btn { margin-top: 14px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(62px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  padding: 8px 14px;
  border-radius: 12px;
  background: #4a3220;
  color: #fff;
  font-size: 12px;
  max-width: min(90vw, 360px);
  text-align: center;
}
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--danger); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }

@media (max-width: 820px) {
  .login-stage { grid-template-columns: 1fr; gap: 8px; }
  .login-mascot { width: min(300px, 78vw); }
  .login-panel { order: 2; }
  .login-hero { order: 1; }
}
@media (max-width: 520px) {
  .brand-mark { height: 28px; }
  .login-mascot { width: min(220px, 64vw); }
  .topbar-user { display: none; }
  .page-title { font-size: 18px; }
  .room-input { font-size: 20px; padding: 8px 10px; }
  .run-preset-card { padding: 8px 8px; }
}

/* ensure picker always above auth chrome; beat [hidden] UA rule */
.picker-mask {
  z-index: 90 !important;
  pointer-events: auto;
}
.picker-sheet {
  z-index: 100 !important;
  pointer-events: auto;
}
.picker-mask[hidden],
.picker-sheet[hidden] { display: none !important; }
.picker-mask.is-open { display: block !important; }
.picker-sheet.is-open { display: flex !important; }
.slot-tile,
.picker-item,
.picker-close,
.picker-clear-row {
  pointer-events: auto !important;
  cursor: pointer;
}

.run-block { margin-bottom: 10px; }
.run-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.run-preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 9px;
  border-radius: 12px;
  border: 1px solid rgba(200, 140, 70, 0.22);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.run-preset-card:active { transform: scale(0.98); }
.run-preset-card.active {
  border-color: rgba(240, 160, 75, 0.7);
  background: linear-gradient(160deg, rgba(255, 214, 150, 0.45), rgba(255, 248, 236, 0.95));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.run-preset-index {
  font-family: var(--display);
  font-size: 15px;
  color: #a07855;
  line-height: 1;
}
.run-preset-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.run-preset-hint {
  font-size: 10px;
  color: var(--mute);
}
.run-preset-card.active .run-preset-hint { color: #8a4a12; }
.run-edit-link {
  margin-top: 2px;
  padding-left: 0;
  color: #8a4a12;
  font-size: 12px;
  min-height: 28px;
}
.loadout-goto {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.loadout-goto .btn { min-height: 34px; font-size: 13px; }
