/* 码头 · 3D 场景外壳 */
:root {
  --ink: #2f4a4f;
  --ink-2: #4c6b6b;
  --muted: #7f9490;
  --accent: #d98a5f;
  --accent-soft: rgba(217, 138, 95, 0.18);
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-line: rgba(255, 255, 255, 0.7);
  --shadow-s: 0 1px 2px rgba(40, 62, 64, 0.07), 0 4px 14px rgba(40, 62, 64, 0.07);
  --shadow-m: 0 2px 6px rgba(40, 62, 64, 0.08), 0 16px 40px rgba(40, 62, 64, 0.12);
  --sans: "Avenir Next", -apple-system, BlinkMacSystemFont, "PingFang SC",
          "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Songti SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
}

html[data-phase="night"] {
  --ink: #e6eef0;
  --ink-2: #bccfd3;
  --muted: #90a7ac;
  --glass: rgba(20, 32, 42, 0.52);
  --glass-strong: rgba(24, 38, 48, 0.82);
  --glass-line: rgba(160, 190, 200, 0.18);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.28);
  --shadow-m: 0 2px 8px rgba(0, 0, 0, 0.3), 0 20px 48px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e9f1ef;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html[data-phase="night"], html[data-phase="night"] body { background: #22323d; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.harbor { position: fixed; inset: 0; }

#island {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

/* ---------------- HUD ---------------- */

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s var(--ease, cubic-bezier(.22,.61,.36,1)) 0.25s;
}
.harbor.ready .hud { opacity: 1; }

.hud-top {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: 24px;
  right: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 18px 7px 7px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-s);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  transition: background 0.9s ease, border-color 0.9s ease, transform 0.35s ease;
}
.brand:hover { transform: translateY(-1px); }

.brand .mark { width: 40px; height: 40px; color: var(--ink); flex: none; }

.brand-txt { display: block; line-height: 1.05; }
.brand-txt .nm {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.brand-txt .sub {
  display: block;
  margin-top: 4px;
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--muted);
}

.hud-actions { display: flex; align-items: center; gap: 8px; pointer-events: auto; }

.rooms {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-s);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  transition: background 0.9s ease, border-color 0.9s ease;
}
.rooms a {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  transition: background 0.25s ease, color 0.25s ease;
}
.rooms a:hover { background: var(--glass-strong); color: var(--ink); }

.round {
  pointer-events: auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  box-shadow: var(--shadow-s);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.3s cubic-bezier(.22,.61,.36,1), background 0.9s ease, border-color 0.9s ease;
}
.round:hover { transform: translateY(-2px); }
.round:active { transform: scale(0.95); }
.round svg { width: 19px; height: 19px; }

#btnTime .i-moon { display: none; }
html[data-phase="night"] #btnTime .i-sun { display: none; }
html[data-phase="night"] #btnTime .i-moon { display: block; }

/* ---------------- 悬停标签 ---------------- */

.tip {
  position: absolute;
  top: 0; left: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px 7px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 5px rgba(40, 62, 64, 0.1), 0 10px 24px rgba(40, 62, 64, 0.14);
  color: #2f4a4f;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
  transition: opacity 0.18s ease;
}
html[data-phase="night"] .tip {
  background: rgba(244, 250, 251, 0.94);
}
.tip.on { opacity: 1; }
.tip i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex: none;
}
.tip b { font-size: 13px; font-weight: 500; letter-spacing: 0.03em; }
.tip em { font-size: 11.5px; font-style: normal; color: #7f9490; }
.tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 1px;
  height: 13px;
  background: linear-gradient(rgba(47, 74, 79, 0.35), rgba(47, 74, 79, 0.05));
}
.tip::before {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  bottom: -19px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(47, 74, 79, 0.18);
}
.tip.flip::after { bottom: auto; top: -13px; background: linear-gradient(rgba(47, 74, 79, 0.05), rgba(47, 74, 79, 0.35)); }
.tip.flip::before { bottom: auto; top: -19px; }

/* ---------------- 底部 ---------------- */

.hud-bottom {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.mood {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 10px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-s);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  max-width: min(64vw, 420px);
  transition: background 0.9s ease, border-color 0.9s ease;
}

.mood-ic {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #c1764d;
  flex: none;
}
.mood-ic svg { width: 17px; height: 17px; }

.mood p { margin: 0; line-height: 1.35; }
.mood b { display: block; font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink); }
.mood small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }

/* ---------------- 载入 / 兜底 ---------------- */

.veil {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: linear-gradient(170deg, #e8f1ee 0%, #f1eee2 60%, #e9e2d0 100%);
  color: #7f9490;
  font-size: 12px;
  letter-spacing: 0.42em;
  transition: opacity 1s ease 0.15s, visibility 1s;
}
.veil span { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.95; } }
.harbor.ready .veil { opacity: 0; visibility: hidden; }

body.leaving .hud { opacity: 0; transition: opacity 0.4s ease; }
body.leaving .veil { opacity: 1; visibility: visible; background: #eef3ee; }

.fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  background: #eef3ee;
  padding: 30px;
}
.fb-links { display: flex; gap: 10px; justify-content: center; margin: 0; }
.fb-links a {
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-s);
  font-size: 13px;
}

body.no-webgl .veil { display: none; }

/* ---------------- 小屏 ---------------- */

@media (max-width: 700px) {
  .hud-top { top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; }
  .hud-bottom { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .brand { padding: 5px 14px 5px 5px; gap: 8px; }
  .brand .mark { width: 32px; height: 32px; }
  .brand-txt .nm { font-size: 18px; }
  .brand-txt .sub { display: none; }
  .rooms a { padding: 6px 9px; font-size: 11.5px; letter-spacing: 0.02em; }
  .round { width: 38px; height: 38px; }
  .mood { padding: 8px 14px 8px 8px; border-radius: 16px; max-width: 62vw; }
  .mood b { font-size: 11.5px; }
  .mood small { display: none; }
  .tip b { font-size: 12.5px; }
  .tip em { display: none; }
}

@media (max-height: 480px) {
  .mood small, .brand-txt .sub { display: none; }
  .mood { padding: 6px 12px 6px 6px; }
}
