:root {
  --brand: #1b6dc1;
  --brand-2: #2ea7e0;
  --sky: #9ed4f5;
  --ink: #123457;
  --card: rgba(255, 255, 255, 0.86);
  --shadow: 0 8px 28px rgba(18, 52, 87, 0.18);
  --radius: 18px;
}

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

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 50% 20%, #eaf6ff 0%, #b7e0f7 45%, #7fc0ec 100%);
  overflow: hidden;
}
body { position: fixed; inset: 0; touch-action: none; user-select: none; }

#app { position: absolute; inset: 0; }
#app canvas { display: block; width: 100%; height: 100%; }

/* ---------- UI 覆盖层 ---------- */
#ui {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: env(safe-area-inset-top) 16px calc(16px + env(safe-area-inset-bottom));
}

#topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; margin-top: 6px;
}
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-name { font-weight: 800; font-size: 20px; color: var(--brand); text-shadow: 0 1px 0 #fff; }
.brand-sub { font-size: 13px; color: var(--ink); opacity: .8; }
.chip {
  pointer-events: none; font-size: 12px; padding: 6px 12px; border-radius: 20px;
  background: rgba(255,255,255,.84); color: var(--brand); box-shadow: var(--shadow);
  font-weight: 600;
}

.status-card {
  align-self: center; text-align: center; max-width: 86%;
  background: var(--card); border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
  transition: opacity .3s;
}
.status-card h1 { margin: 0 0 4px; font-size: 22px; color: var(--brand); }
.status-card p { margin: 0; font-size: 15px; line-height: 1.5; }
#status.off { opacity: 0; pointer-events: none; }

.bubble {
  position: absolute; left: 50%; bottom: 108px; transform: translateX(-50%);
  width: min(88%, 560px); background: var(--card); border-radius: 16px;
  box-shadow: var(--shadow); padding: 12px 38px 12px 14px; display: flex; align-items: center; gap: 10px;
  transition: opacity .25s, transform .25s; pointer-events: auto;
}
.bubble.hidden { opacity: 0; transform: translateX(-50%) translateY(12px); pointer-events: none; }
.bubble-avatar { font-size: 30px; line-height: 1; }
.bubble-text { font-size: 16px; line-height: 1.5; }
.bubble-close {
  position: absolute; right: 8px; top: 8px; border: none; background: transparent;
  font-size: 22px; color: var(--ink); cursor: pointer; opacity: .6;
}

#controls {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; pointer-events: auto;
}
.btn {
  pointer-events: auto; border: none; cursor: pointer; padding: 12px 16px; border-radius: 24px;
  font-size: 15px; font-weight: 700; color: #fff; background: var(--brand);
  box-shadow: var(--shadow); transition: transform .12s, background .2s;
}
.btn:active { transform: scale(.94); }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); font-size: 16px; }
.btn-ghost { background: rgba(255,255,255,.9); color: var(--brand); }

.hint {
  text-align: center; font-size: 13px; line-height: 1.6; margin: 8px auto 0;
  color: var(--ink); opacity: .72; max-width: 640px; pointer-events: none;
}

.boot {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; background: radial-gradient(circle at 50% 30%, #eaf6ff, #a9d8f1);
  transition: opacity .6s; z-index: 20;
}
.boot.fade { opacity: 0; pointer-events: none; }
.boot-wave { font-size: 64px; animation: bob 1.4s ease-in-out infinite; }
.boot-title { font-size: 24px; font-weight: 800; color: var(--brand); }
.boot-note { font-size: 15px; color: var(--ink); opacity: .8; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

@media (max-width: 620px) {
  .brand-sub { display: none; }
  .hint { font-size: 12px; }
}
