/* ============================================================
   雾角 Foghorn — 原创叙事解谜游戏
   全部样式原创，无外部资源
   ============================================================ */

:root {
  --ink: #0a0f16;
  --night: #0b1520;
  --deep: #0e1b2a;
  --panel: #131f2c;
  --panel2: #182636;
  --line: #2a3b4e;
  --amber: #e8b45a;
  --amber-dim: #b9883e;
  --phos: #9fe0a8;
  --phos-dim: #5d9a66;
  --text: #cfd9e4;
  --text-dim: #7e8ea0;
  --paper-bg: #ece3cd;
  --paper-ink: #3a3226;
  --red: #c25b4e;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Songti SC", serif;
  --mono: "Sarasa Mono SC", "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ==================== 画面切换 ==================== */
.screen {
  position: fixed; inset: 0;
  display: none;
  animation: screenIn .8s ease both;
}
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ==================== 标题画面 ==================== */
#screen-title { background: linear-gradient(180deg, #05080d 0%, #0b1520 55%, #10202f 100%); }
#title-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; z-index: 3; padding-bottom: 8vh;
}
.title-sub {
  letter-spacing: .6em; text-indent: .6em;
  color: var(--text-dim); font-size: 14px; margin-bottom: 18px;
}
.title-main {
  font-size: clamp(72px, 14vw, 150px);
  font-weight: 400;
  letter-spacing: .18em;
  color: #f2e7cf;
  text-shadow: 0 0 40px rgba(232, 180, 90, .35), 0 0 8px rgba(242, 231, 207, .4);
  line-height: 1;
}
.title-gap { display: inline-block; width: .1em; }
.title-en {
  margin-top: 10px; letter-spacing: 1.2em; text-indent: 1.2em;
  color: var(--amber-dim); font-size: 13px; font-family: var(--mono);
}
.title-menu { margin-top: 7vh; display: flex; flex-direction: column; gap: 14px; }
.menu-btn {
  background: none; border: 1px solid rgba(232, 180, 90, .35);
  color: #e8dcbf; padding: 12px 58px; font-size: 17px; letter-spacing: .5em; text-indent: .5em;
  transition: all .25s;
}
.menu-btn:hover { background: rgba(232, 180, 90, .12); border-color: var(--amber); color: #fff; letter-spacing: .7em; }
.title-hint { position: absolute; bottom: 26px; width: 100%; color: var(--text-dim); font-size: 12px; letter-spacing: .2em; }
.title-waves {
  position: absolute; bottom: 0; left: 0; right: 0; height: 18vh; z-index: 2;
  background:
    radial-gradient(120% 100% at 50% 100%, rgba(16,32,47,.9) 0%, transparent 70%),
    repeating-linear-gradient(180deg, transparent 0 8px, rgba(159,224,168,.03) 8px 9px);
}

/* ==================== 关于 ==================== */
#screen-about {
  background: rgba(5, 8, 13, .82); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
#screen-about.active { display: flex; }
.about-card { max-width: 620px; width: 92%; max-height: 82vh; overflow: auto; padding: 34px 38px; position: relative; color: var(--paper-ink); }
.about-body p { margin: 10px 0; line-height: 1.9; }
.about-sign { text-align: right; color: var(--amber-dim); font-family: var(--kai); }

/* ==================== 序幕 ==================== */
#screen-intro { background: radial-gradient(ellipse at 50% 30%, #0e1b2a 0%, #05080d 75%); }
.intro-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 0 12vw;
}
.intro-text {
  max-width: 720px; font-size: 20px; line-height: 2.3; color: #d8e2ec;
  min-height: 5em; letter-spacing: .06em; white-space: pre-wrap;
}
.intro-actions { margin-top: 6vh; display: flex; gap: 18px; }
.ghost-btn {
  background: none; border: 1px solid var(--line); color: var(--text-dim);
  padding: 8px 22px; font-size: 14px; letter-spacing: .15em; transition: all .2s;
  white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--amber-dim); color: var(--amber); }
.ghost-btn.primary { border-color: rgba(232,180,90,.5); color: var(--amber); }
.ghost-btn.small { padding: 4px 12px; font-size: 12px; }

/* ==================== 值班室布局 ==================== */
#screen-room { background: #07090d; }

#window-frame {
  position: absolute; top: 3vh; left: 2.2vw;
  width: 56vw; height: 78vh;
  border: 14px solid #1b1410;
  border-radius: 6px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.7), 0 10px 50px rgba(0,0,0,.8), 0 0 0 2px #3a2c1e;
  overflow: hidden;
  background: #000;
}
#scene-canvas { width: 100%; height: 100%; display: block; }
#window-glass {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.05) 0%, transparent 18%, transparent 70%, rgba(255,255,255,.03) 100%);
  box-shadow: inset 0 0 90px rgba(0,0,0,.55);
}
#window-glass::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 10px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #241a12, #1b1410);
  box-shadow: -1px 0 2px rgba(0,0,0,.8), 1px 0 2px rgba(0,0,0,.8);
}
#window-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; padding: 8px 14px;
  font-family: var(--mono); font-size: 12px; color: rgba(207,217,228,.75);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
  letter-spacing: .1em; pointer-events: none;
}

/* ==================== 设备台 ==================== */
#console {
  position: absolute; top: 3vh; right: 2.2vw;
  width: 37vw; height: 78vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel) 0%, #101a26 100%);
  border: 1px solid #22303f;
  border-radius: 10px;
  box-shadow: 0 14px 50px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,.05);
}
#station-tabs {
  display: flex; gap: 4px; padding: 10px 10px 0;
  border-bottom: 1px solid #22303f;
  flex-wrap: wrap;
}
.tab {
  background: #0e1822; border: 1px solid #22303f; border-bottom: none;
  color: var(--text-dim); font-size: 13px; letter-spacing: .2em;
  padding: 9px 16px 11px; border-radius: 8px 8px 0 0;
  transition: all .2s; position: relative; top: 1px;
}
.tab:hover { color: var(--text); }
.tab.active { background: #16232f; color: var(--amber); border-color: #33475c; }
.tab.alert::after {
  content: ""; position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 6px var(--red); animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: .25; } }

.station { display: none; flex: 1; min-height: 0; padding: 14px; flex-direction: column; position: relative; }
.station.active { display: flex; animation: screenIn .35s ease both; }

/* ---- CRT 终端 ---- */
.crt {
  flex: 1; min-height: 0;
  background: #071410;
  border-radius: 12px;
  border: 10px solid #2c2c30;
  box-shadow: inset 0 0 40px rgba(0,0,0,.85), 0 0 30px rgba(60,180,110,.06), inset 0 0 6px rgba(120,255,160,.15);
  position: relative; overflow: hidden;
}
.crt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.crt-screen {
  height: 100%; overflow-y: auto; padding: 16px 18px;
  font-family: var(--mono); font-size: 14px; line-height: 1.85;
  color: var(--phos); text-shadow: 0 0 6px rgba(120,230,140,.45);
  scrollbar-width: thin; scrollbar-color: #2c4a38 transparent;
}
.crt-screen .dim { color: var(--phos-dim); }
.crt-screen .warn { color: #e8c07a; }
.crt-screen .err { color: #e07a6a; }
.crt-screen .usr { color: #cdebc2; }
.crt-screen .blank { height: 1em; }
.crt-input-line { display: flex; gap: 8px; margin-top: 8px; }
.crt-input-line input {
  flex: 1; background: rgba(120,230,140,.05); border: 1px solid rgba(120,230,140,.25);
  color: var(--phos); font-family: var(--mono); font-size: 14px;
  padding: 6px 10px; outline: none; letter-spacing: .2em;
}
.crt-input-line input:focus { border-color: rgba(120,230,140,.6); box-shadow: 0 0 8px rgba(120,230,140,.15); }
.crt-btn {
  background: rgba(120,230,140,.08); border: 1px solid rgba(120,230,140,.35);
  color: var(--phos); padding: 6px 16px; font-family: var(--mono); font-size: 13px;
}
.crt-btn:hover { background: rgba(120,230,140,.18); }
.crt-menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--phos); font-family: var(--mono); font-size: 14px; padding: 3px 6px;
  letter-spacing: .08em;
}
.crt-menu-item:hover { background: rgba(120,230,140,.12); color: #d6f7cc; }
.crt-hint {
  margin-top: 10px; font-size: 12px; color: var(--text-dim); letter-spacing: .1em;
  display: flex; justify-content: space-between; align-items: center;
}
.sticker {
  font-family: var(--kai); color: #caa04c; font-size: 12px;
  background: rgba(232,180,90,.08); border: 1px dashed rgba(232,180,90,.4);
  padding: 3px 8px; border-radius: 3px; transform: rotate(-1.5deg);
}

/* ---- 无线电 ---- */
.radio-face { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.radio-dial {
  position: relative; height: 54px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(180deg, #050b12, #0b1520);
  border: 1px solid #2a3b4e; flex: none;
}
.dial-scale {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(159,224,168,.25) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(232,180,90,.35) 0 1px, transparent 1px 120px);
}
.dial-needle {
  position: absolute; top: 4px; bottom: 4px; width: 2px;
  background: var(--red); box-shadow: 0 0 8px var(--red);
  transition: left .15s ease;
}
.radio-readout {
  text-align: center; font-family: var(--mono); font-size: 22px; color: var(--amber);
  background: #050b12; border: 1px solid #2a3b4e; border-radius: 6px; padding: 8px;
  letter-spacing: .2em; text-shadow: 0 0 10px rgba(232,180,90,.4); flex: none;
}
.radio-controls { display: flex; gap: 8px; flex: none; }
.knob-btn {
  flex: 1; background: linear-gradient(180deg, #1d2b3a, #14202e);
  border: 1px solid #32475d; color: var(--text);
  border-radius: 6px; padding: 10px 4px; font-size: 14px; letter-spacing: .1em;
  transition: all .15s;
}
.knob-btn:hover { border-color: var(--amber-dim); color: var(--amber); }
.knob-btn:active { transform: translateY(1px); }
.knob-btn.wide { flex: 2; }
.knob-btn.hot { border-color: var(--red); color: var(--red); box-shadow: 0 0 10px rgba(194,91,78,.3); }
.radio-log {
  flex: 1; min-height: 0; overflow-y: auto;
  background: #050b12; border: 1px solid #2a3b4e; border-radius: 6px;
  padding: 12px 14px; font-size: 14px; line-height: 1.9;
  scrollbar-width: thin; scrollbar-color: #2a3b4e transparent;
}
.radio-line { margin-bottom: 6px; animation: screenIn .3s ease both; }
.radio-line .who { color: var(--amber-dim); font-size: 12px; letter-spacing: .15em; margin-right: 8px; }
.radio-line.zhou .who { color: #7ab3d9; }
.radio-line.ghost .who { color: var(--red); }
.radio-line.sys { color: var(--text-dim); font-size: 12px; }
.radio-line.distort { color: #a8b6c4; font-family: var(--kai); }
.radio-choices { display: flex; gap: 8px; flex-wrap: wrap; flex: none; min-height: 20px; }
.radio-choices .knob-btn { font-size: 13px; }

/* ---- 手记（书页） ---- */
.journal-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.journal-page {
  flex: 1; min-height: 0; overflow-y: auto; padding: 26px 30px;
  color: var(--paper-ink); font-family: var(--kai); font-size: 17px; line-height: 2.15;
  box-shadow: inset 0 0 40px rgba(120,90,40,.18), 0 6px 24px rgba(0,0,0,.6);
  scrollbar-width: thin;
}
.journal-page .j-date { color: #8a6a3a; font-size: 14px; letter-spacing: .3em; margin-bottom: 12px; font-family: var(--mono); }
.journal-page .j-body { white-space: pre-wrap; }
.journal-page .j-new { color: var(--red); font-size: 12px; letter-spacing: .3em; margin-bottom: 8px; font-family: var(--serif); }
.journal-page.locked { display: flex; align-items: center; justify-content: center; color: #9a8a6a; }
.journal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.journal-nav span { color: var(--text-dim); font-size: 13px; letter-spacing: .2em; }

/* ---- 文件 ---- */
.file-tray { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 0; overflow-y: auto; }
.file-item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #0e1822; border: 1px solid #22303f; border-radius: 6px;
  padding: 12px 16px; color: var(--text); font-size: 15px; letter-spacing: .1em;
  transition: all .2s;
}
.file-item:hover { border-color: var(--amber-dim); background: #13202c; }
.file-item .fi-icon { color: var(--amber-dim); font-size: 18px; }
.file-item .fi-sub { color: var(--text-dim); font-size: 12px; margin-left: auto; }
.file-item.unread .fi-name::after { content: " ●"; color: var(--red); font-size: 10px; }
.paper-viewer {
  position: absolute; inset: 14px; z-index: 5; overflow-y: auto;
  padding: 30px 34px; color: var(--paper-ink); font-size: 15.5px; line-height: 2;
  box-shadow: 0 10px 40px rgba(0,0,0,.7);
}
.paper-viewer h3 { margin-bottom: 14px; font-size: 18px; letter-spacing: .3em; border-bottom: 1px solid rgba(58,50,38,.3); padding-bottom: 10px; }
.paper-viewer p { margin: 8px 0; white-space: pre-wrap; }
.paper-viewer .back-row { margin-bottom: 12px; }
.paper-viewer .stamp {
  display: inline-block; border: 2px solid #a5443a; color: #a5443a;
  padding: 2px 10px; transform: rotate(-4deg); letter-spacing: .3em; font-size: 13px;
  margin-top: 8px; opacity: .8;
}

/* ---- 潮汐钟 ---- */
#station-clock { align-items: center; justify-content: center; gap: 16px; }
.tide-clock {
  width: min(360px, 90%);
  background: radial-gradient(circle at 30% 25%, #3a3226, #201a12 70%);
  border: 3px solid #594a2e; border-radius: 16px; padding: 26px;
  box-shadow: 0 10px 40px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,235,190,.15);
}
.tide-label { text-align: center; color: #d8c79a; letter-spacing: .4em; font-size: 14px; margin-bottom: 18px; }
.tide-digits { display: flex; gap: 8px; justify-content: center; margin-bottom: 20px; }
.tide-digit {
  width: 34px; height: 48px; display: flex; align-items: center; justify-content: center;
  background: #0c0a06; color: var(--amber); font-family: var(--mono); font-size: 24px;
  border-radius: 4px; border: 1px solid #4a3c22;
  box-shadow: inset 0 0 10px rgba(0,0,0,.8); text-shadow: 0 0 8px rgba(232,180,90,.5);
}
.tide-input { display: flex; gap: 8px; justify-content: center; }
.tide-input input {
  width: 140px; background: #0c0a06; border: 1px solid #4a3c22; color: var(--amber);
  font-family: var(--mono); font-size: 18px; padding: 8px 12px; text-align: center;
  letter-spacing: .2em; outline: none;
}
.tide-input input:focus { border-color: var(--amber-dim); }
.tide-note { margin-top: 18px; color: #b8a67a; font-size: 13px; text-align: center; font-family: var(--kai); line-height: 1.9; }
.tide-extra {
  max-width: 420px; color: var(--text-dim); font-size: 13px; line-height: 2;
  text-align: center; font-family: var(--kai);
}
.tide-extra .lowtide-ok { color: #9fd0a4; }
.tide-extra .lowtide-no { color: #b09a6a; }

/* ---- 储藏室 ---- */
.storage-desc { flex: 1; overflow-y: auto; font-size: 15px; line-height: 2.2; color: var(--text); padding: 6px 4px; white-space: pre-wrap; }
.storage-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 10px; }
.storage-actions .knob-btn { flex: none; padding: 10px 20px; }

/* ---- 配电盘 & 灯质 ---- */
.power-face, .lamp-face { flex: 1; display: flex; flex-direction: column; }
.power-title { color: var(--amber); letter-spacing: .3em; font-size: 15px; margin-bottom: 12px; }
.power-timer { font-family: var(--mono); color: var(--red); font-size: 20px; margin-bottom: 12px; min-height: 26px; }
.power-switches { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; }
.pswitch {
  display: flex; align-items: center; gap: 12px;
  background: #0e1822; border: 1px solid #32475d; border-radius: 6px;
  padding: 12px 14px; color: var(--text); font-size: 14px; letter-spacing: .08em;
  transition: all .2s; text-align: left;
}
.pswitch:hover { border-color: var(--amber-dim); }
.pswitch.on { border-color: #6fae7c; background: #10231a; color: #bde3c2; }
.pswitch.on .sw-lever { background: #6fae7c; }
.pswitch .sw-lever {
  width: 10px; height: 26px; border-radius: 3px; background: #4a5866; transition: all .2s; flex: none;
}
.power-note { margin-top: 10px; color: var(--text-dim); font-size: 12.5px; font-family: var(--kai); }
.lamp-seq { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; min-height: 46px; }
.lamp-cell {
  width: 46px; height: 46px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: #0c1420; border: 1px solid #32475d; color: var(--text-dim); font-family: var(--mono); font-size: 13px;
}
.lamp-cell.short { border-color: #d9b45a; color: #f0d9a0; box-shadow: 0 0 10px rgba(232,180,90,.35); }
.lamp-cell.long { border-color: var(--amber); color: #fff; background: #2c2410; box-shadow: 0 0 16px rgba(232,180,90,.6); }

/* ==================== 底部任务栏 ==================== */
#room-bar {
  position: absolute; left: 2.2vw; right: 2.2vw; bottom: 2.2vh;
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #131f2c, #0e1822);
  border: 1px solid #22303f; border-radius: 10px; padding: 0 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 12px; }
.bar-label { font-size: 13px; letter-spacing: .3em; color: var(--amber-dim); }
.bar-mid {
  flex: 1; text-align: center; font-size: 14px; color: var(--text); font-family: var(--kai);
  letter-spacing: .1em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 0 10px;
  opacity: 0; transition: opacity .6s ease;
}
.bar-mid.flash { animation: toastIn .45s ease-out; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ==================== 纸张与弹层 ==================== */
.paper {
  background:
    radial-gradient(1200px 500px at 20% 0%, rgba(255,255,255,.35), transparent 60%),
    linear-gradient(180deg, #efe6d0, #e6dbc0);
  border-radius: 4px;
  box-shadow: 0 6px 30px rgba(0,0,0,.5);
}
.modal {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 7, 11, .78); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.modal-paper {
  max-width: 640px; width: 92%; max-height: 84vh; overflow-y: auto;
  padding: 34px 38px; color: var(--paper-ink);
  font-family: var(--kai); font-size: 16.5px; line-height: 2.2; position: relative;
}
.modal-paper h3 { letter-spacing: .3em; font-size: 18px; margin-bottom: 16px; border-bottom: 1px solid rgba(58,50,38,.3); padding-bottom: 10px; font-weight: 400; }
.modal-paper p { margin: 10px 0; white-space: pre-wrap; }
.modal-paper .p-sign { text-align: right; margin-top: 18px; }
.close-x {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; color: #8a7a5a; font-size: 24px; line-height: 1;
}
.close-x:hover { color: var(--paper-ink); }

/* ==================== 结局 ==================== */
.ending-screen { background: radial-gradient(ellipse at 50% 40%, #0e1b2a 0%, #04060a 80%); z-index: 40; }
.ending-card { max-width: 700px; margin: 0 auto; padding-top: 12vh; text-align: center; }
.ending-tag { font-family: var(--mono); color: var(--amber-dim); letter-spacing: .5em; font-size: 13px; margin-bottom: 18px; }
.ending-title { font-size: 44px; font-weight: 400; letter-spacing: .3em; color: #f2e7cf; text-shadow: 0 0 30px rgba(232,180,90,.3); margin-bottom: 30px; }
.ending-body { text-align: left; max-width: 620px; margin: 0 auto; font-size: 16.5px; line-height: 2.3; color: #cfd9e4; font-family: var(--kai); white-space: pre-wrap; }
.ending-actions { margin-top: 5vh; }

/* ==================== 触控与移动端基础 ==================== */
button, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.journal-page, .paper-viewer, .modal-paper, .radio-log, .crt-screen, .about-body {
  -webkit-user-select: text; user-select: text;
}
.tide-input input, .crt-input-line input { font-size: 16px; } /* 防止 iOS 聚焦自动放大 */

/* ==================== 自适应（平板 / 手机竖屏） ==================== */
@media (max-width: 980px) {
  html, body { overflow: hidden; height: 100%; }
  body { height: 100dvh; }

  /* —— 标题画面 —— */
  .title-sub { font-size: 12px; }
  .title-hint { font-size: 11px; padding: 0 24px; bottom: calc(16px + env(safe-area-inset-bottom)); }
  .menu-btn { padding: 13px 44px; font-size: 16px; }

  /* —— 序幕 —— */
  .intro-stage { padding: 0 8vw; padding-bottom: env(safe-area-inset-bottom); }
  .intro-text { font-size: 17px; line-height: 2.1; }

  /* —— 值班室：窗在上，设备台在下 —— */
  #screen-room.active { display: flex; flex-direction: column; overflow: hidden; }
  #window-frame {
    position: relative; top: auto; left: auto;
    width: 100%; height: 30vh; min-height: 180px; flex: none;
    border-width: 6px; border-top: none; border-left: none; border-right: none;
    margin: 0; border-radius: 0;
    padding-top: env(safe-area-inset-top);
  }
  #window-glass::before { width: 7px; }
  #window-caption { font-size: 11px; padding: 6px 10px; }
  #console {
    position: relative; top: auto; right: auto;
    flex: 1; min-height: 0; width: 100%;
    margin: 0; border-radius: 0; border-left: none; border-right: none; border-bottom: none;
  }
  #station-tabs {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    padding: 8px 8px 0;
    -webkit-overflow-scrolling: touch;
  }
  #station-tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; padding: 10px 14px 12px; font-size: 13px; }
  .station { padding: 10px; }

  /* —— 底部任务栏（含安全区） —— */
  #room-bar {
    position: relative; left: auto; right: auto; bottom: auto;
    flex: none; height: 50px;
    margin: 0; border-radius: 0; border-left: none; border-right: none; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bar-label { display: none; }
  /* 提示改为悬浮卡片：允许换行，不再截断 */
  #room-bar .bar-mid {
    position: absolute;
    left: 10px; right: 10px;
    bottom: calc(100% + 10px);
    white-space: normal;
    text-overflow: clip;
    overflow: visible;
    line-height: 1.9;
    font-size: 13.5px;
    text-align: center;
    background: rgba(8, 13, 20, .93);
    border: 1px solid #2a3b4e;
    border-radius: 10px;
    padding: 10px 16px;
    pointer-events: none;
    z-index: 30;
    box-shadow: 0 8px 30px rgba(0,0,0,.55);
  }

  /* —— 各站点触控优化 —— */
  .knob-btn { min-height: 46px; }
  .file-item { padding: 14px 16px; }
  .crt-screen { font-size: 13.5px; padding: 12px 14px; }
  .crt-btn { padding: 8px 18px; min-height: 44px; }
  .crt-input-line input { padding: 9px 12px; }
  .radio-readout { font-size: 19px; }
  .radio-log { font-size: 13.5px; }
  .journal-page { font-size: 15.5px; padding: 20px 22px; line-height: 2; }
  .journal-nav .ghost-btn { padding: 10px 12px; font-size: 12.5px; letter-spacing: .05em; }
  .journal-nav span { font-size: 12px; }
  .paper-viewer { padding: 22px 24px; font-size: 14.5px; position: relative; inset: auto; height: 100%; }
  .modal-paper { font-size: 15.5px; padding: 26px 26px; }
  .tide-clock { padding: 20px; }
  .pswitch { padding: 14px; font-size: 13.5px; }
  .lamp-cell { width: 42px; height: 42px; }
  .storage-desc { font-size: 14.5px; line-height: 2; }
  .storage-actions .knob-btn { padding: 12px 18px; }

  /* —— 结局 —— */
  .ending-card { padding-top: 8vh; padding-bottom: env(safe-area-inset-bottom); }
  .ending-title { font-size: 34px; }
  .ending-body { font-size: 15.5px; line-height: 2.1; padding: 0 6vw; }
}

/* —— 手机（更窄） —— */
@media (max-width: 540px) {
  .title-main { font-size: clamp(58px, 19vw, 90px); }
  .intro-text { font-size: 16px; }
  .tab { padding: 9px 11px 10px; font-size: 12px; letter-spacing: .1em; }
  #window-frame { height: 26vh; min-height: 150px; }
  .radio-controls { flex-wrap: wrap; }
  .radio-controls .knob-btn { min-width: 30%; }
  .tide-digit { width: 30px; height: 44px; font-size: 21px; }
  .lamp-cell { width: 36px; height: 40px; }
}

/* —— 手机横屏：恢复紧凑的并排布局 —— */
@media (max-width: 980px) and (orientation: landscape) {
  #screen-room.active { display: block; overflow: hidden; }
  #window-frame {
    position: absolute; top: 1.5vh; left: 1.5vw;
    width: 54vw; height: 88vh; border-width: 8px; border-radius: 4px;
  }
  #console {
    position: absolute; top: 1.5vh; right: 1.5vw;
    width: 41vw; height: 88vh; border-radius: 8px;
    border: 1px solid #22303f;
  }
  #room-bar {
    position: absolute; left: 1.5vw; right: 1.5vw; bottom: auto; top: 0;
    height: 0; overflow: visible; border: none; background: none; box-shadow: none;
    padding: 0;
  }
  #room-bar .bar-mid {
    position: fixed; bottom: 10px; left: 12vw; right: 12vw;
    text-align: center; z-index: 30; pointer-events: none;
    white-space: normal; overflow: visible; line-height: 1.8; font-size: 12.5px;
    background: rgba(8, 13, 20, .93);
    border: 1px solid #2a3b4e; border-radius: 8px;
    padding: 8px 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.55);
  }
  #room-bar .bar-right { position: absolute; right: 42vw; top: 1vh; }
  #window-caption { display: none; }
  .station { padding: 10px; }
  .crt-screen { font-size: 12.5px; }
}
