/* [claude code] 2026-07-10 手機優先(v0.1 拍板):相對尺寸 + flex,觸控友善 */
:root {
  --bg: #12101c;
  --surface: #1c1930;
  --surface-2: #262242;
  --border: #35305a;
  --text: #e8e6f2;
  --mute: #9a94b8;
  --accent: #8b7cf6;
  --gold: #e8c46a;
  --hp: #e06a6a;
  --exp: #6ab4e0;
  --danger: #e05a5a;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font: 15px/1.5 "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  height: 100dvh;
}
.hidden { display: none !important; }

/* ---- 登入 / 創角 ---- */
.screen { display: flex; align-items: center; justify-content: center; height: 100dvh; padding: 20px; }
.panel {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px 22px; text-align: center;
}
.panel h1 { font-size: 30px; letter-spacing: 4px; background: linear-gradient(90deg, #a99bff, #e8c46a);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { color: var(--mute); font-size: 13px; margin: 8px 0 22px; }
input, button, select { font: inherit; }
input[type=text], input[type=password], input:not([type]), input[type=number] {
  width: 100%; padding: 13px 14px; margin-bottom: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
button {
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; transition: .15s;
}
button:active { transform: scale(.97); }
button.primary { background: linear-gradient(135deg, #7c6cf0, #a08bff); border-color: transparent; font-weight: 700; }
.row { display: flex; gap: 10px; }
.row button { flex: 1; }
.msg { margin-top: 14px; font-size: 13px; color: var(--gold); min-height: 20px; }
.msg.err { color: var(--danger); }
.ver { margin-top: 18px; font-size: 11px; color: var(--mute); }
.roll-result { margin: 10px 0 20px; font-size: 14px; line-height: 2; }
.roll-result .kind { font-size: 22px; font-weight: 700; color: var(--gold); }

/* ---- HUD ---- */
#game { display: flex; flex-direction: column; height: 100dvh; }
#hud {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.hud-left { flex: 1; min-width: 0; }
.line1 { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--gold); font-weight: 400; }
.bar { position: relative; height: 14px; margin-top: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar i { position: absolute; inset: 0; width: 0; display: block; transition: width .2s; }
.bar.exp i { background: var(--exp); }
.bar.hp i { background: var(--hp); }
.bar span { position: relative; display: block; text-align: center; font-size: 10px; line-height: 14px; }
.hud-right { text-align: right; font-size: 12px; color: var(--mute); white-space: nowrap; }
.hud-right .ico { margin-right: 4px; }
#hud-lingshi { color: var(--gold); font-weight: 700; }

/* ---- 地圖 ---- */
#stage { flex: 1; width: 100%; display: block; touch-action: none; background:
  radial-gradient(circle at 50% 40%, #1e1b32 0%, #12101c 70%); }

#toast {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 12px; background: rgba(20,17,35,.94);
  border: 1px solid var(--border); font-size: 13px; opacity: 0; transition: opacity .25s;
  pointer-events: none; max-width: 88vw; text-align: center; z-index: 20;
}
#toast.show { opacity: 1; }
#toast.warn { border-color: var(--danger); color: #ffb4b4; }

/* ---- 底部工具列 ---- */
#dock { display: flex; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); }
#dock button { flex: 1; font-size: 12px; padding: 12px 4px; }
#dock button.on { background: linear-gradient(135deg, #7c6cf0, #a08bff); border-color: transparent; }

/* ---- 面板 ---- */
.sheet {
  position: fixed; inset: auto 0 0 0; max-height: 74dvh; overflow-y: auto; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet h2 { display: flex; justify-content: space-between; align-items: center; font-size: 17px; margin-bottom: 10px; }
.sheet h3 { font-size: 13px; color: var(--mute); margin: 16px 0 8px; }
.sheet .close { padding: 4px 12px; }
.hint { font-size: 12px; color: var(--mute); background: var(--surface-2);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.sheet label { display: block; font-size: 13px; color: var(--mute); margin: 12px 0 4px; }
.sheet label.chk { display: flex; align-items: center; gap: 8px; color: var(--text); }
.sheet input[type=checkbox] { width: 18px; height: 18px; }

.card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.card .icon { font-size: 22px; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 700; font-size: 14px; }
.card .desc { font-size: 11.5px; color: var(--mute); }
.card .actions { display: flex; gap: 6px; }
.card button { padding: 7px 10px; font-size: 12px; }
.card.locked { opacity: .45; }
.slot-no { width: 22px; height: 22px; border-radius: 6px; background: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }

#log-list div { font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); color: var(--mute); }
#log-list .hi { color: var(--gold); }
#log-list .bad { color: #ff9a9a; }
