:root {
  --glass: rgba(24, 34, 38, 0.52);
  --glass-strong: rgba(24, 34, 38, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f6f3ec;
  --muted: rgba(246, 243, 236, 0.66);
  --accent: #3fd1bd;
  --warm: #f2a65a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1628; color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.5; }

.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20;
  background: radial-gradient(ellipse at 50% 40%, rgba(30, 70, 90, 0.55), rgba(8, 18, 30, 0.85)); }
#start { background: rgba(8, 18, 30, 0.35); }
.card { width: min(380px, calc(100vw - 32px)); padding: 28px 26px; border-radius: 22px; text-align: center;
  background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.brand { font-size: 26px; font-weight: 700; letter-spacing: 0.12em; margin-bottom: 14px; }
.card p { margin: 10px 0; line-height: 1.7; font-size: 14px; }
.card .bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; margin: 18px 0 12px; }
#load-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s; }
.primary { margin-top: 14px; padding: 12px 42px; border-radius: 999px; background: var(--accent); color: #0d2a2a; font-weight: 700; font-size: 16px; letter-spacing: 0.2em; }
.primary:hover { filter: brightness(1.08); }

.pill { position: fixed; top: 14px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.pill.tl { left: 14px; padding-right: 18px; }
.pill.tr { right: 14px; }
.icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--text); }
.icon:hover { background: rgba(255,255,255,0.1); }
.icon svg { width: 21px; height: 21px; }
#btn-sound:not(.on) .wave { opacity: 0.15; }
#btn-sound:not(.on) { color: var(--muted); }
.where #loc { font-weight: 700; font-size: 15px; }
.where #clock { font-size: 12px; margin-top: 1px; }

#hint { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); font-size: 13px; color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 6px rgba(0,0,0,0.45); pointer-events: none; white-space: nowrap; z-index: 4; }

.dock { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 2px; padding: 6px;
  border-radius: 20px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.dock button { width: 72px; padding: 8px 4px 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; }
.dock button:hover { background: rgba(255,255,255,0.09); }
.dock button.on { background: rgba(63, 209, 189, 0.22); color: #c9fff5; }
.dock svg { width: 23px; height: 23px; }

#context { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; }
#context button { padding: 11px 22px; border-radius: 999px; background: var(--glass-strong); border: 1px solid rgba(255,255,255,0.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 14px; font-weight: 600; animation: pop 0.2s ease-out; }
#context button:first-child { border-color: rgba(63, 209, 189, 0.7); }
#context button:hover { background: rgba(40, 60, 64, 0.85); }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

.panel { position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 7; width: min(400px, calc(100vw - 32px));
  padding: 16px; border-radius: 18px; background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.panel.right { left: auto; right: 14px; top: 70px; bottom: auto; transform: none; width: min(320px, calc(100vw - 28px)); }
.ptitle { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; margin: 4px 0 8px; }
.ptitle:not(:first-child) { margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 13px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid transparent; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: rgba(255,255,255,0.14); }
.chip.on { border-color: var(--accent); background: rgba(63, 209, 189, 0.16); }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.4); }
.swatches { margin-top: 12px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 4px 0 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0; }
.check input { accent-color: var(--accent); }

#map { position: fixed; top: 70px; left: 14px; z-index: 7; padding: 10px; border-radius: 18px; background: var(--glass-strong);
  border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-align: center; }
#mapc { width: min(360px, calc(100vw - 48px)); height: auto; aspect-ratio: 1; border-radius: 12px; display: block; margin-bottom: 6px; cursor: pointer; }

#stats { position: fixed; left: 14px; bottom: 14px; z-index: 3; font-size: 11px; color: rgba(255,255,255,0.8); text-shadow: 0 1px 4px rgba(0,0,0,0.6); pointer-events: none; }
#toast { position: fixed; top: 108px; left: 50%; transform: translate(-50%, -6px); z-index: 8; padding: 9px 18px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--line); font-size: 13px; opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  #hint { display: none; }
  .dock button { width: 62px; }
  #stats { bottom: 92px; }
}

.row.center { justify-content: center; margin: 6px 0 2px; }
#hint { max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }

#btn-mic .slash { opacity: 1; }
#btn-mic.on .slash { opacity: 0; }
#btn-mic.on { background: rgba(63, 209, 189, 0.22); color: #c9fff5; box-shadow: 0 0 0 calc(var(--lvl, 0) * 6px) rgba(63, 209, 189, 0.35); }
#btn-mic.quiet { background: rgba(242, 166, 90, 0.22); color: #ffe2c2; }

input.text { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text); font: inherit; font-size: 14px; outline: none; }
input.text:focus { border-color: var(--accent); }
