:root {
  --ink: #0d1218;
  --paper: #1a2330;
  --gold: #d4b06a;
  --jade: #7ec8b0;
  --blush: #c97b7b;
  --mist: #8aa0b8;
  --text: #e8dcc8;
  --dim: #9aa6b4;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}
html {
  width: var(--app-w, 100%);
  height: var(--app-h, 100%);
}
body {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--app-w, 100%);
  height: var(--app-h, 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Serif SC", serif;
  background: radial-gradient(1200px 600px at 20% -10%, #24344a 0%, var(--ink) 55%);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
button { touch-action: manipulation; }
.mist {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  background:
    radial-gradient(circle at 80% 10%, rgba(126, 200, 176, 0.08), transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(212, 176, 106, 0.07), transparent 35%);
}

.hidden { display: none !important; }

.create {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  padding: calc(12px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 10px calc(16px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}
.create-card {
  width: 100%;
  max-width: none;
  min-height: 100%;
  background: #18202b;
  border: 1px solid var(--gold);
  padding: 0 0 22px;
}
.create-banner { width: 100%; height: 22%; min-height: 80px; max-height: 160px; object-fit: cover; display: block; }
.create-card h1 { margin: 16px 22px 6px; letter-spacing: 0.28em; color: var(--gold); font-size: 22px; }
.create-card h2 { margin: 16px 22px 8px; font-size: 15px; color: var(--gold); letter-spacing: 0.16em; }
.lead { margin: 0 22px 14px; color: var(--dim); line-height: 1.7; font-size: 13px; }
.create-card label {
  display: flex; align-items: center; gap: 10px;
  margin: 8px 22px; color: var(--dim); font-size: 14px;
}
.create-card input {
  flex: 1; background: #0f1620; border: 1px solid rgba(212,176,106,0.3);
  color: var(--text); font-family: inherit; padding: 7px 10px;
}
.root-picks { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 0 22px; }
.root-card {
  border: 1px solid rgba(212,176,106,0.25); padding: 10px; cursor: pointer; min-height: 120px;
}
.root-card.on { border-color: var(--gold); background: rgba(212,176,106,0.12); }
.root-card b { display: block; color: var(--gold); margin-bottom: 6px; }
.root-card span { font-size: 12px; color: var(--dim); line-height: 1.5; }
button.act.big {
  display: block; margin: 18px 22px 0; width: calc(100% - 44px);
  padding: 10px; font-family: inherit; cursor: pointer;
  background: var(--gold); border: 0; color: var(--ink); letter-spacing: 0.2em;
}

.app {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-gap: 8px;
  gap: 8px;
  padding: calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px))) 8px calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
  overflow: hidden;
}
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  border-bottom: 1px solid rgba(212, 176, 106, 0.28); padding-bottom: 10px;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.brand-art { width: 148px; height: 56px; object-fit: cover; border: 1px solid rgba(212,176,106,0.35); flex-shrink: 0; }
h1 { margin: 0; font-size: 24px; letter-spacing: 0.28em; font-weight: 600; color: var(--gold); }
.subtitle { margin: 4px 0 0; color: var(--dim); font-size: 13px; letter-spacing: 0.08em; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stats .stat, .views .view-btn, .pots .pot, .modal-actions button, .batch-row .act, .realm-tabs .view-btn {
  margin-right: 6px; margin-bottom: 6px;
}
.stat {
  min-width: 68px; background: rgba(26,35,48,0.8);
  border: 1px solid rgba(212,176,106,0.22); padding: 6px 10px;
  display: flex; gap: 5px; align-items: baseline; justify-content: center;
}
.stat span { color: var(--dim); font-size: 12px; }
.stat b { font-size: 18px; color: var(--jade); }
.clock b, .clock span { color: var(--gold); }

.views { display: flex; gap: 6px; flex-wrap: wrap; }
.view-btn {
  flex: 1 1 72px; font-family: inherit; cursor: pointer; letter-spacing: 0.12em;
  background: transparent; color: var(--dim); border: 1px solid rgba(212,176,106,0.2); padding: 7px;
}
.view-btn.on { color: var(--ink); background: var(--gold); }
.view-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.layout { display: grid; grid-template-columns: 1.45fr 1fr; grid-gap: 12px; gap: 12px; min-height: 0; height: 100%; }
.stage, .panel {
  background: linear-gradient(180deg, rgba(26,35,48,0.92), rgba(13,18,24,0.92));
  border: 1px solid rgba(212,176,106,0.2); padding: 12px; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.tab-body { overflow: auto; flex: 1; min-height: 0; -webkit-overflow-scrolling: touch; }
.stage { overflow: auto; -webkit-overflow-scrolling: touch; }

.map-wrap { position: relative; flex: 1; min-height: 0; height: 100%; overflow: hidden; border: 1px solid rgba(212,176,106,0.2); }
.map-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  font-family: inherit; cursor: pointer; white-space: nowrap;
  background: rgba(13,18,24,0.82); color: var(--gold);
  border: 1px solid var(--gold); padding: 4px 8px; font-size: 12px;
}
.pin.lock { color: var(--dim); border-color: rgba(154,166,180,0.4); }
.pin.on { background: var(--gold); color: var(--ink); }

.stage-shop {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.pots { flex-shrink: 0; max-height: 36%; overflow: auto; -webkit-overflow-scrolling: touch; }
.hall {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  grid-gap: 10px; gap: 10px; align-content: start; overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.queue-row { flex-shrink: 0; }
.seat {
  border: 1px dashed rgba(138,160,184,0.28); min-height: 108px; padding: 10px;
  background: rgba(8,12,18,0.55); display: grid; grid-template-columns: 58px 1fr; grid-gap: 8px; gap: 8px;
}
.seat.busy { border-style: solid; border-color: rgba(126,200,176,0.45); }
.seat.empty { display: block; }
.guest-pic { width: 58px; height: 78px; object-fit: cover; border: 1px solid rgba(212,176,106,0.35); }
.guest-name { font-size: 14px; color: var(--gold); }
.guest-realm { font-size: 12px; color: var(--jade); margin: 2px 0 6px; }
.guest-want { font-size: 12px; color: var(--text); }
.patience { margin-top: 8px; height: 6px; background: #2a3544; }
.patience > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blush), var(--gold)); }
.empty-seat { color: var(--dim); font-size: 13px; letter-spacing: 0.2em; padding-top: 28px; text-align: center; }
.queue-row { margin-top: 10px; color: var(--dim); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.queue { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid rgba(212,176,106,0.3); padding: 2px 8px 2px 4px; font-size: 12px;
  display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.25);
}
.chip img { width: 22px; height: 22px; object-fit: cover; }

.card {
  border: 1px solid rgba(138,160,184,0.18); padding: 10px; margin-bottom: 8px;
  display: grid; grid-template-columns: 56px 1fr auto; gap: 6px 10px; align-items: center;
  background: rgba(0,0,0,0.18);
}
.card.plain { grid-template-columns: 1fr auto; }
.card h3 { margin: 0; font-size: 15px; }
.card p { margin: 0; grid-column: 2 / -1; color: var(--dim); font-size: 12px; }
.card.plain p { grid-column: 1 / -1; }
.thumb { width: 56px; height: 56px; object-fit: cover; border: 1px solid rgba(212,176,106,0.25); grid-row: span 3; }
.ready { color: var(--gold); font-size: 12px; grid-column: 2 / -1; }
.scene-art {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border: 1px solid rgba(212,176,106,0.2);
  margin-bottom: 10px;
  flex-shrink: 0;
}
#stage > .scene-art {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
}
.bar { height: 8px; background: #2a3544; margin: 8px 0 12px; }
.bar i { display: block; height: 100%; background: var(--jade); }
.plots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plot { border: 1px dashed rgba(212,176,106,0.3); padding: 10px; min-height: 88px; }
.lock-note { color: var(--blush); font-size: 13px; line-height: 1.6; }

button.act {
  background: rgba(126,200,176,0.12); color: var(--jade);
  border: 1px solid rgba(126,200,176,0.4); padding: 6px 10px;
  cursor: pointer; font-family: inherit;
}
button.act:disabled { opacity: 0.4; cursor: not-allowed; }
button.act.on { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.batch-row {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin: 8px 0 12px; font-size: 13px; color: var(--dim);
}
.batch-row input {
  width: 72px; background: #0f1620; color: var(--text);
  border: 1px solid rgba(212,176,106,0.35); padding: 6px 8px; font-family: inherit;
}

.bond { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.bond img { width: 42px; height: 54px; object-fit: cover; }
.bond .name { color: var(--gold); }
.bond .st { color: var(--jade); font-size: 12px; }
.journal { font-size: 12px; color: var(--mist); line-height: 1.6; }
.journal h4 { margin: 10px 0 4px; color: var(--gold); font-size: 13px; font-weight: 500; }

.bottom { display: grid; grid-template-columns: 1.2fr 1.4fr auto; gap: 10px; }
.stock, .log, .controls {
  background: rgba(26,35,48,0.85); border: 1px solid rgba(212,176,106,0.18); padding: 8px 10px;
}
.stock { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.stock b { color: var(--jade); }
.log { height: 72px; overflow: auto; font-size: 12px; color: var(--mist); line-height: 1.5; }
.log .good { color: var(--jade); }
.log .bad { color: var(--blush); }
.controls { display: flex; flex-direction: column; gap: 6px; }
.controls button {
  font-family: inherit; background: transparent; color: var(--gold);
  border: 1px solid rgba(212,176,106,0.4); padding: 6px 14px; cursor: pointer;
}

.modal {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,0.62);
  display: grid; place-items: center; z-index: 5; padding: 8px;
  width: 100%; height: 100%;
}
.modal-card {
  width: 94%; max-width: none; background: #18202b; border: 1px solid var(--gold);
  padding: 0 0 18px; max-height: 92%; overflow: auto; -webkit-overflow-scrolling: touch;
}
.modal-art { display: block; width: 100%; height: 28%; min-height: 80px; max-height: 180px; object-fit: cover; border-bottom: 1px solid rgba(212,176,106,0.25); }
.modal-card h3 { margin: 14px 18px 8px; color: var(--gold); letter-spacing: 0.2em; }
.modal-card p { margin: 0 18px 16px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px; }
.modal-actions button {
  font-family: inherit; cursor: pointer; padding: 7px 12px;
  background: var(--gold); border: 0; color: var(--ink);
}
.modal-actions button.ghost { background: transparent; color: var(--gold); border: 1px solid var(--gold); }

.pots { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.pot {
  width: 92px; min-height: 88px; border: 1px solid rgba(212,176,106,0.3);
  padding: 8px; font-size: 12px; text-align: center; background: rgba(0,0,0,0.2);
}
.pot b { display: block; color: var(--gold); margin-bottom: 4px; }
.prog { height: 10px; background: #2a3544; margin: 6px 0 12px; }
.prog i { display: block; height: 100%; background: linear-gradient(90deg, var(--jade), var(--gold)); }
.cards { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 8px; gap: 8px; padding: 0 18px 12px; }
.card-btn {
  font-family: inherit; cursor: pointer; text-align: left;
  background: #121820; color: var(--text); border: 1px solid var(--gold); padding: 10px;
}
.card-btn b { display: block; color: var(--gold); margin-bottom: 4px; }
.hp-row { display: flex; justify-content: space-between; font-size: 13px; margin: 0 18px 8px; color: var(--jade); }
.sum-list { margin: 0 18px 12px; font-size: 13px; line-height: 1.7; color: var(--mist); }
.sum-list b { color: var(--jade); }
.gender-row { margin: 8px 22px; display: flex; gap: 18px; color: var(--dim); }
.realm-tabs, .subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fish-wrap { padding: 0 18px 12px; }
.fish-col { position: relative; height: 180px; width: 44px; background: #0f1620; border: 1px solid var(--gold); margin-bottom: 8px; }
#fish-bar { position: absolute; left: 6px; width: 32px; height: 40px; background: var(--jade); }
#fish-dot { position: absolute; left: 10px; width: 24px; height: 14px; background: var(--blush); border-radius: 4px; }
.fish-meter { height: 8px; background: #2a3544; margin: 8px 0; }
.fish-meter i { display: block; height: 100%; background: var(--gold); }
#fish-start {
  display: block; width: 100%; margin: 8px 0 0; padding: 10px;
  background: var(--gold); color: var(--ink); border: 0; letter-spacing: 0.16em;
}
.puzzle { display: grid; grid-template-columns: repeat(3, 64px); gap: 4px; padding: 0 18px 12px; }
.pz { width: 64px; height: 64px; font-family: inherit; font-size: 18px; cursor: pointer; background: #121820; color: var(--gold); border: 1px solid var(--gold); }
.pz.empty { background: transparent; border-style: dashed; color: transparent; }
#modal-extra input, #modal-extra select { margin: 0 18px 10px; background: #0f1620; color: var(--text); border: 1px solid var(--gold); padding: 6px; font-family: inherit; }

html.portrait .layout {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr);
}
@media (orientation: portrait) {
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr); }
}
html.portrait .topbar { flex-direction: column; align-items: stretch; gap: 6px; padding-bottom: 6px; }
html.portrait .brand { flex-direction: row; align-items: center; }
html.portrait .brand-art { width: 72px; height: 36px; flex-shrink: 0; }
html.portrait h1 { font-size: 16px; letter-spacing: 0.08em; }
html.portrait .subtitle { margin: 0; font-size: 11px; }
html.portrait .stat { min-width: 42px; padding: 3px 5px; }
html.portrait .stat b { font-size: 13px; }
html.portrait .views,
html.portrait .realm-tabs,
html.portrait .subnav {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.portrait .view-btn { flex: 0 0 auto; padding: 6px 10px; font-size: 12px; min-height: 34px; }
html.portrait .bottom { grid-template-columns: 1fr auto; }
html.portrait .stock { display: none; }
html.portrait .log { height: 40px; }
html.portrait .root-picks { grid-template-columns: 1fr; }
html.portrait .create-banner { height: 160px; max-height: 160px; }
html.portrait .scene-art { height: 160px; }
html.portrait #stage > .scene-art { height: 100%; max-height: none; }
html.portrait #panel-body > .scene-art:first-child { display: none; }
html.portrait .stage { min-height: 0; }

html.landscape .brand-art { width: 72px; height: 32px; }
html.landscape h1 { font-size: 16px; letter-spacing: 0.1em; }
html.landscape .subtitle { margin: 2px 0 0; font-size: 11px; }
html.landscape .topbar { align-items: center; padding-bottom: 6px; }
html.landscape .stats { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
html.landscape .views,
html.landscape .realm-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.landscape .view-btn { flex: 0 0 auto; padding: 5px 8px; font-size: 12px; min-height: 32px; }
html.landscape .layout { grid-template-columns: 1.25fr 1fr; min-height: 0; }
html.landscape .create-banner { height: 160px; max-height: 160px; }
html.landscape .log { height: 40px; }
html.landscape .scene-art { height: 180px; }
html.landscape #stage > .scene-art { height: 100%; max-height: none; }

@media (max-width: 900px) {
  .bottom { grid-template-columns: 1fr auto; }
  .root-picks { grid-template-columns: 1fr; }
  .stock { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .create-banner, .brand-art { display: none; }
  .stock { display: none; }
  .log { height: 32px; font-size: 11px; }
  .topbar { padding-bottom: 4px; }
}

.fold { border: 1px solid rgba(212,176,106,0.22); margin: 0 0 8px; background: rgba(0,0,0,0.18); }
.fold > button.fold-h {
  width: 100%; text-align: left; font-family: inherit; cursor: pointer;
  background: transparent; color: var(--gold); border: 0; padding: 8px 10px; letter-spacing: 0.08em;
}
.fold-b { padding: 0 10px 10px; }
.fold-b.hidden { display: none; }
.people { display: grid; grid-template-columns: 1fr 1fr; grid-gap: 6px; gap: 6px; }
.person { border: 1px solid rgba(212,176,106,0.25); padding: 8px; font-size: 12px; }
.person b { display: block; color: var(--gold); }
.person.off { opacity: 0.45; }
.lot { border: 1px solid rgba(212,176,106,0.28); padding: 8px; margin-bottom: 8px; }
.lot.on { border-color: var(--gold); }
.snake-wrap { padding: 0 18px 10px; }
.snake-grid { display: grid; grid-template-columns: repeat(8, 22px); grid-gap: 2px; gap: 2px; }
.sn { width: 22px; height: 22px; background: #121820; }
.sn.body { background: var(--jade); }
.sn.head { background: var(--gold); }
.sn.food { background: var(--blush); }
.snake-pad { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attr { font-size: 12px; color: var(--mist); line-height: 1.6; margin: 0 0 8px; }
.modal-art, #modal-title, #modal-text { pointer-events: none; }
.card-btn.on { box-shadow: 0 0 0 1px var(--jade); }
.danqi-list { display: grid; grid-template-columns: 1fr; grid-gap: 6px; gap: 6px; }
.feed-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

