/* 觉醒的侠客 · 东方武侠沉浸终端 */
:root {
  --bg: #07090e;
  --terminal-bg: rgba(11, 15, 25, 0.92);
  --line: rgba(56, 189, 248, 0.15);
  --fg: #e2e8f0;
  --dim: #94a3b8;
  --gold: #f5b72e;
  --gold-glow: #ffd36a;
  --cyan: #38bdf8;
  --green: #4ade80;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background-color: var(--bg);
  /* 全屏铺底武侠大画卷背景 + 柔和暗角 */
  background-image: 
    radial-gradient(circle at 50% 30%, rgba(7, 9, 14, 0.75) 0%, rgba(7, 9, 14, 0.96) 80%),
    url('./bg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Serif SC", serif;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 居中黄金比例武侠终端容器（最大宽度 780px，不再被宽屏拉伸扯散） */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 820px;
  height: 100vh;
  background: var(--terminal-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid rgba(245, 183, 46, 0.2);
  border-right: 1px solid rgba(245, 183, 46, 0.2);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.9), 0 0 30px rgba(245, 183, 46, 0.05);
  position: relative;
  overflow: hidden;
}

/* ---- 顶部信息头 ---- */
header {
  background: rgba(15, 21, 35, 0.95);
  border-bottom: 1px solid rgba(245, 183, 46, 0.25);
  padding: 12px 18px;
  flex-shrink: 0;
  z-index: 20;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hrow1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--dim);
}

.hright {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bgm-toggle-btn {
  background: rgba(245, 183, 46, 0.12);
  border: 1px solid rgba(245, 183, 46, 0.35);
  color: #ffd36a;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  user-select: none;
}

.bgm-toggle-btn:hover {
  background: rgba(245, 183, 46, 0.25);
  border-color: rgba(245, 183, 46, 0.6);
  transform: translateY(-1px);
}

.bgm-toggle-btn.muted {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #94a3b8;
}

#hTitle {
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 2px;
  text-shadow: 0 0 12px rgba(245, 183, 46, 0.3);
}

.hrow2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 13px;
}

#hRoom {
  color: var(--cyan);
  font-weight: 700;
}

#hAct {
  color: var(--green);
  font-weight: 600;
}

/* ---- 中部文本流 ---- */
#stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  font-size: 16px;
  line-height: 1.9;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.line {
  animation: fadein 0.25s ease;
  margin-bottom: 6px;
}

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

.para {
  margin: 6px 0;
  letter-spacing: 0.2px;
}

/* 定宽美术：标题横幅、框线、地图居中且严格等宽对齐 */
.mud-banner-card {
  margin: 18px auto 14px;
  width: 320px;
  max-width: 90%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.75);
  border: 2px solid #38bdf8;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25), inset 0 0 15px rgba(56, 189, 248, 0.08);
  text-align: center;
  position: relative;
  display: block;
}

.mud-banner-inner {
  border: 1px dashed rgba(56, 189, 248, 0.45);
  border-radius: 4px;
  padding: 10px 14px;
}

.mud-banner-title {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 6px;
  text-shadow: 0 0 12px rgba(245, 183, 46, 0.4);
}

.mud-banner-sub {
  font-size: 0.84rem;
  color: #94a3b8;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.5px;
}

.c-red { color: #f87171; }
.c-yellow { color: #facc15; }
.c-green { color: #4ade80; }
.c-cyan { color: #38bdf8; }
.c-magenta { color: #e879f9; }

.art {
  margin: 16px auto;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.35;
  font-family: Consolas, "Courier New", "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  font-size: 14px;
  color: #93c5fd;
  background: rgba(15, 23, 42, 0.65);
  padding: 12px 24px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: table;
  text-align: left;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.panelcard {
  border: 1px solid rgba(245, 183, 46, 0.35);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 14px 0;
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation: fadein 0.3s ease;
}

.ptitle {
  text-align: center;
  color: var(--gold);
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.prow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0;
  font-size: 14px;
}

.plab {
  color: var(--cyan);
  flex: 0 0 3.2em;
  font-weight: 600;
}

.pbar {
  flex: 1;
  height: 8px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
}

.pfill {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.pval {
  font-size: 13px;
  font-family: monospace;
}

.green { color: #4ade80; }
.yellow { color: #facc15; }
.red { color: #f87171; }
.cyan { color: #38bdf8; }
.magenta { color: #e879f9; }
.brown { color: #fbbf24; }
.dcyan { color: #38bdf8; }
.gray { color: #94a3b8; }
.white { color: #f8fafc; }
.blue { color: #60a5fa; }
.b { font-weight: 800; }
.band { background: rgba(245, 183, 46, 0.2); padding: 2px 6px; border-radius: 4px; }

/* ---- 底部交互控件区 ---- */
#controls {
  background: rgba(15, 21, 35, 0.96);
  border-top: 1px solid rgba(245, 183, 46, 0.25);
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  z-index: 20;
}

#chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }

#exits, #actions {
  display: flex;
  gap: 8px;
  padding: 4px 0 8px;
}

#exits { flex-wrap: wrap; }

button {
  min-height: 40px;
  border-radius: 8px;
  background: #1e293b;
  color: var(--fg);
  border: 1px solid #334155;
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
  transition: all 0.15s;
}

button:hover {
  background: #334155;
  border-color: #64748b;
}

button:active {
  transform: scale(0.98);
}

#chips button {
  min-height: 34px;
  font-size: 13px;
  color: #e879f9;
  border-color: rgba(232, 121, 249, 0.35);
  background: rgba(232, 121, 249, 0.12);
}

.exitbtn {
  flex: 1;
  min-width: 80px;
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

#actions button { flex: 1; }

#actions .gold {
  color: #fef08a;
  border-color: rgba(245, 183, 46, 0.5);
  background: rgba(245, 183, 46, 0.18);
}

#inputrow {
  display: flex;
  gap: 10px;
  padding-top: 4px;
}

#inp {
  flex: 1;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: var(--fg);
  font-size: 15px;
  padding: 0 14px;
  outline: none;
}

#inp:focus {
  border-color: var(--gold);
}

#send {
  flex: 0 0 80px;
  background: #062B55;
  border: 1px solid #f5b72e;
  color: #f5b72e;
  font-weight: 700;
}

/* 抽屉浮层 */
#jump {
  position: absolute;
  right: 20px;
  bottom: 220px;
  z-index: 25;
  min-height: 36px;
  background: #0284c7;
  border: 1px solid #38bdf8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

#sheet {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  z-index: 50;
  backdrop-filter: blur(6px);
  max-width: 100%;
}

#sheet.open { display: block; }

#sheetContent {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  background: #111827;
  border-top: 1px solid rgba(245, 183, 46, 0.35);
  border-radius: 16px 16px 0 0;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 75vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
}

.shead {
  color: var(--gold);
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 12px;
}

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.sheetbtn {
  background: #1f2937;
  border-color: #374151;
}

.sheetbtn.gold {
  color: #fef08a;
  border-color: #ca8a04;
  background: rgba(202, 138, 4, 0.25);
}

.sheetbtn.big {
  flex: 1;
  min-height: 48px;
  font-size: 15px;
}

/* 启动屏 */
#splash {
  position: absolute;
  inset: 0;
  background: #0a0e17;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: opacity 0.4s;
}

#splash.hide {
  opacity: 0;
  pointer-events: none;
}

.stitle {
  font-size: 28px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 6px;
  margin-bottom: 12px;
}

#status {
  color: var(--dim);
  font-size: 14px;
}
