:root { --ink: #2a1b3d; --paper: #fff8ec; --gold: #ffc531; --muted: #8a7f94; --orange: #f39a3d; --teal: #2b8fd0; --shell-2: #2a1b3d;
  font-family: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1320; color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
canvas#game { position: fixed; inset: 0; display: block; }
[hidden] { display: none !important; }
.btn { font: inherit; font-weight: 700; font-size: 16px; border: 3px solid var(--ink); border-radius: 14px; padding: 10px 16px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--ink); transition: transform .06s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 0 4px 0 var(--ink); }
.btn.primary { background: var(--orange); color: #fff; }
.btn.gold { background: var(--gold); }
.btn.ghost { background: transparent; box-shadow: none; border-color: rgba(42,27,61,.35); }
.btn.danger { color: #c0392b; }
.btn.big { font-size: 20px; padding: 14px 22px; }
.btn.sm { font-size: 14px; padding: 7px 10px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
/* HUD */
.hud { position: fixed; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 8px) 10px 0; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
.hud-row { display: flex; gap: 8px; align-items: center; }
.hud-row > * { pointer-events: auto; }
.bar { flex: 1; display: flex; align-items: center; gap: 6px; background: rgba(42,27,61,.78); border-radius: 12px; padding: 5px 8px; color: #fff; min-width: 0; }
.bar-ic { font-size: 15px; }
.bar-track { flex: 1; height: 10px; background: rgba(255,255,255,.18); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width .2s; }
.bar-fill.fuel { background: linear-gradient(90deg, #ffb347, #ffe066); }
.bar-fill.hull { background: linear-gradient(90deg, #4fd1c5, #9ff0ff); }
.bar-fill.low { background: #ff5d5d; animation: blink .6s infinite alternate; }
@keyframes blink { to { opacity: .45; } }
.bar-num { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.hud-btn { pointer-events: auto; width: 40px; height: 36px; border-radius: 12px; border: none; background: rgba(42,27,61,.78); color: #fff; font-size: 20px; cursor: pointer; }
.chips { flex-wrap: wrap; }
.chip { background: rgba(255,248,236,.94); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.chip.full { background: #ffd6cc; animation: blink .6s infinite alternate; }
.items { display: flex; gap: 6px; pointer-events: auto; align-self: flex-end; }
.item-btn { border: 2px solid var(--ink); background: #fff8ec; border-radius: 12px; padding: 3px 8px; font-size: 18px; cursor: pointer; position: relative; }
.item-btn b { font-size: 12px; margin-left: 2px; }
.toasts { position: fixed; top: calc(env(safe-area-inset-top) + 96px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 460px); z-index: 30; }
.toast { background: rgba(42,27,61,.92); color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 14px; font-weight: 700; text-align: center; animation: pop .2s ease-out; transition: opacity .4s; }
.toast.good { background: rgba(32,140,90,.95); } .toast.warn { background: rgba(200,120,10,.95); } .toast.bad { background: rgba(200,50,50,.95); }
.toast.out { opacity: 0; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.enter-btn { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 150px); transform: translateX(-50%); font: inherit; font-weight: 800; font-size: 17px; padding: 10px 20px; border-radius: 999px; border: 3px solid var(--ink); background: var(--gold); color: var(--ink); box-shadow: 0 4px 0 var(--ink); cursor: pointer; z-index: 5; animation: bob 1s infinite alternate; }
@keyframes bob { to { transform: translate(-50%, -4px); } }
/* touch pad */
.pad { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 14px calc(env(safe-area-inset-bottom) + 16px); display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; z-index: 4; }
.pad > div { display: flex; gap: 12px; pointer-events: auto; }
.pad-r { flex-direction: column-reverse; }
.pad button { width: 72px; height: 72px; border-radius: 22px; border: 3px solid rgba(255,255,255,.7); background: rgba(42,27,61,.55); color: #fff; font-size: 26px; font-weight: 800; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; cursor: pointer; }
.pad button small { font-size: 12px; margin-top: 2px; }
.pad button.on { background: rgba(243,154,61,.9); transform: scale(.95); }
@media (hover: hover) and (pointer: fine) and (min-width: 900px) { .pad { opacity: .55; } .pad button { width: 60px; height: 60px; } }
/* overlays */
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.title { background: radial-gradient(circle at 50% 30%, #ffe2b8 0%, #ff9f6e 45%, #6b3d7a 100%); }
.title-card { text-align: center; max-width: 440px; width: 100%; }
.title-card canvas { width: 230px; height: 195px; }
.title h1 { margin: 4px 0 6px; font-size: 40px; color: #fff; text-shadow: 0 3px 0 var(--ink), 0 0 18px rgba(0,0,0,.25); letter-spacing: 2px; }
.title h1 span { display: block; font-size: 28px; color: var(--gold); }
.tag { color: #fff; font-weight: 700; margin: 0 0 16px; text-shadow: 0 1px 2px rgba(0,0,0,.4); line-height: 1.5; }
.title-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 300px; margin: 0 auto; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.5; }
.title .fine { color: rgba(255,255,255,.85); }
.sheet-back { background: rgba(20,10,30,.55); align-items: flex-end; padding: 0; }
.sheet { background: var(--paper); width: 100%; max-width: 520px; max-height: 88vh; border-radius: 22px 22px 0 0; border: 3px solid var(--ink); border-bottom: none; display: flex; flex-direction: column; animation: up .2s ease-out; }
@media (min-width: 700px) { .sheet-back { align-items: center; } .sheet { border-radius: 22px; border-bottom: 3px solid var(--ink); } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.sheet-head h2 { margin: 0; font-size: 21px; }
.x { border: none; background: transparent; font-size: 22px; cursor: pointer; color: var(--ink); width: 40px; height: 40px; }
.sheet-body { padding: 4px 16px 18px; overflow: auto; font-size: 15px; line-height: 1.55; user-select: text; -webkit-user-select: text; touch-action: pan-y; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
.row .btn { flex: 1; }
.big-stat { font-size: 18px; margin: 4px 0; } .big-stat b { font-size: 24px; color: var(--orange); }
.list { list-style: none; padding: 0; margin: 8px 0; }
.list li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px dashed rgba(42,27,61,.2); }
.list li b { margin-left: auto; }
.ore-dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); transform: rotate(45deg); flex: none; }
.tabs { display: flex; gap: 6px; margin: 4px 0 8px; }
.tab { flex: 1; font: inherit; font-weight: 700; padding: 8px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; cursor: pointer; }
.tab.on { background: var(--ink); color: #fff; }
.wallet { margin: 0 0 8px; } .wallet b { color: var(--orange); font-size: 18px; }
.cards { display: flex; flex-direction: column; gap: 8px; }
.card { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; }
.card-ic { font-size: 28px; width: 40px; text-align: center; }
.card-main { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.card-main b { font-size: 16px; } .card-main small { color: var(--muted); font-weight: 400; }
.vals { color: var(--muted); } .vals em { color: #1f8f5a; font-style: normal; font-weight: 700; }
.menu { display: flex; flex-direction: column; gap: 10px; }
.howto { padding-left: 20px; margin: 4px 0; } .howto li { margin: 5px 0; }
.dex summary { cursor: pointer; font-weight: 700; margin-top: 8px; }
.noscript { position: fixed; inset: 0; background: #fff; padding: 20px; }
