/* ============================================================
   无人岛的墙 · 深夜蓝紫主题
   布局：fixed 导航 + 三视图（首页/墙/地图）+ 提交抽屉 + 详情弹窗
   ============================================================ */

:root {
  --bg-deep: #04060f;
  --panel-solid: #0b1029;
  --panel: rgba(13, 18, 46, 0.72);
  --line: rgba(148, 163, 255, 0.14);
  --line-strong: rgba(148, 163, 255, 0.28);
  --ink: #eef1ff;
  --ink-dim: #9aa3c7;
  --ink-faint: #6b7499;
  --cyan: #5eead4;
  --cyan-strong: #2dd4bf;
  --violet: #a78bfa;
  --amber: #fcd34d;
  --rose: #fb7185;
  --grad-primary: linear-gradient(135deg, #5eead4 0%, #818cf8 100%);
  --shadow-glow: 0 0 24px rgba(94, 234, 212, 0.22);
  --radius: 16px;
  --nav-h: 62px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scrollbar-width: thin; scrollbar-color: #2a3160 transparent; }

body {
  background: var(--bg-deep);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(94, 234, 212, 0.3); }

button { font-family: inherit; }
a { color: inherit; }

#bg-canvas { position: fixed; inset: 0; z-index: 0; display: block; }
.bg-fallback {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse at 50% 110%, #16224f 0%, transparent 55%),
    radial-gradient(ellipse at 80% 10%, #1a1440 0%, transparent 45%),
    var(--bg-deep);
}

/* ---------- 通用 ---------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.btn { border: none; cursor: pointer; border-radius: 12px; transition: all 0.2s ease; font-size: 15px; }
.btn-primary {
  background: var(--grad-primary);
  color: #04241f;
  font-weight: 700;
  padding: 12px 28px;
  box-shadow: var(--shadow-glow);
  letter-spacing: 1px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(94, 234, 212, 0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 11px 24px;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-sm { padding: 8px 16px; font-size: 13.5px; border-radius: 10px; }
.btn-danger { background: rgba(251, 113, 133, 0.14); color: var(--rose); border: 1px solid rgba(251, 113, 133, 0.35); }
.btn-danger:hover { background: rgba(251, 113, 133, 0.24); }
.btn-safe { background: rgba(94, 234, 212, 0.12); color: var(--cyan); border: 1px solid rgba(94, 234, 212, 0.35); }
.btn-safe:hover { background: rgba(94, 234, 212, 0.22); }

/* ---------- 导航 ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 50;
  display: flex; align-items: center; gap: 22px; padding: 0 26px;
  background: rgba(4, 6, 15, 0.6);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav .logo {
  font-size: 17.5px; font-weight: 800; letter-spacing: 1.5px;
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav .logo .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.nav nav { display: flex; gap: 2px; }
.nav nav a {
  color: var(--ink-dim); text-decoration: none; font-size: 14.5px;
  padding: 8px 14px; border-radius: 10px; transition: 0.2s; cursor: pointer; user-select: none;
}
.nav nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.nav nav a.active { color: var(--cyan); background: rgba(94, 234, 212, 0.09); }
.nav .spacer { flex: 1; }

/* ---------- 视图容器 ---------- */
.view { display: none; position: relative; z-index: 10; padding-top: var(--nav-h); min-height: 100vh; }
.view.active { display: block; animation: viewIn 0.45s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 landing ---------- */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 20px 30px; position: relative;
}
.hero .badge {
  font-size: 12.5px; color: var(--cyan); letter-spacing: 3px;
  border: 1px solid rgba(94, 234, 212, 0.3); padding: 7px 16px; border-radius: 999px;
  background: rgba(94, 234, 212, 0.06); margin-bottom: 30px;
}
.hero h1 {
  font-size: clamp(46px, 8vw, 88px); font-weight: 800; letter-spacing: 6px; line-height: 1.15;
  background: linear-gradient(180deg, #ffffff 18%, #9fd8ff 58%, #5eead4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 34px rgba(129, 230, 217, 0.28));
  margin-bottom: 20px;
}
.hero .slogan { font-size: clamp(15px, 2.3vw, 20px); color: var(--ink-dim); letter-spacing: 1.5px; margin-bottom: 42px; }
.hero .cta { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.hero .stats { display: flex; gap: 14px; margin-top: 58px; flex-wrap: wrap; justify-content: center; }
.stat-pill { padding: 14px 24px; text-align: left; min-width: 128px; }
.stat-pill .num { font-size: 27px; font-weight: 800; color: var(--cyan); font-variant-numeric: tabular-nums; }
.stat-pill .label { font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }

.features {
  max-width: 1080px; margin: 0 auto; padding: 24px 22px 90px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.feature-card { padding: 26px 26px 24px; transition: 0.25s; }
.feature-card:hover { transform: translateY(-4px); border-color: rgba(94, 234, 212, 0.3); }
.feature-card .icon { font-size: 28px; margin-bottom: 14px; }
.feature-card h3 { font-size: 16.5px; margin-bottom: 10px; letter-spacing: 0.5px; }
.feature-card p { font-size: 13.5px; color: var(--ink-dim); line-height: 1.75; }

.footer-note { text-align: center; padding: 0 20px 44px; font-size: 12.5px; color: var(--ink-faint); line-height: 1.8; }

/* ---------- 贴纸墙视图 ---------- */
.wall-stage {
  position: relative; height: min(62vh, 540px); margin: 18px 18px 0;
  border-radius: 20px; overflow: hidden; border: 1px solid var(--line);
  background: rgba(5, 8, 24, 0.4);
}
#wall-3d { position: absolute; inset: 0; cursor: grab; }
#wall-3d:active { cursor: grabbing; }
.wall-stage .hint {
  position: absolute; left: 16px; bottom: 12px; font-size: 12.5px;
  color: var(--ink-faint); pointer-events: none; letter-spacing: 0.5px;
}
.wall-stage .loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: 14px; pointer-events: none;
}
.wall-toolbar { display: flex; gap: 12px; align-items: center; padding: 14px 18px 0; flex-wrap: wrap; }
.seg { display: flex; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { background: none; border: none; color: var(--ink-dim); padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 13.5px; transition: 0.2s; }
.seg button.on { background: rgba(94, 234, 212, 0.14); color: var(--cyan); }
.wall-toolbar .count { font-size: 13px; color: var(--ink-faint); }

.wall-list {
  max-width: 1100px; margin: 16px auto 40px; padding: 0 18px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px;
}
.post-card { padding: 18px 18px 14px; cursor: pointer; transition: 0.22s; position: relative; }
.post-card:hover { transform: translateY(-3px); border-color: rgba(94, 234, 212, 0.35); }
.post-card .content { font-size: 14.5px; line-height: 1.78; white-space: pre-wrap; word-break: break-word; }
.post-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12.5px; color: var(--ink-faint); }
.post-card .geo { color: var(--cyan); }
.post-card .actions { display: flex; gap: 6px; margin-top: 8px; }
.act-btn {
  background: none; border: none; color: var(--ink-faint); font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 9px; transition: 0.18s;
}
.act-btn:hover { color: var(--cyan); background: rgba(94, 234, 212, 0.08); }
.act-btn.liked { color: var(--rose); }
.act-btn.liked:hover { color: var(--rose); background: rgba(251, 113, 133, 0.1); }

.empty-tip { text-align: center; color: var(--ink-faint); font-size: 14px; padding: 60px 20px; grid-column: 1 / -1; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 6px 0 56px; }
.pagination .page-info { font-size: 13px; color: var(--ink-faint); min-width: 80px; text-align: center; }

/* ---------- 地图视图 ---------- */
.map-layout {
  display: grid; grid-template-columns: 1fr 340px; gap: 16px;
  padding: 18px; height: calc(100vh - var(--nav-h));
}
#map-chart { border-radius: 20px; border: 1px solid var(--line); background: rgba(5, 8, 24, 0.4); min-height: 420px; }
.map-side { padding: 20px; overflow-y: auto; }
.map-side h3 { font-size: 16px; margin-bottom: 4px; }
.map-side .sub { font-size: 12.5px; color: var(--ink-faint); margin-bottom: 16px; }
.map-side .placeholder { color: var(--ink-faint); font-size: 13.5px; line-height: 1.9; padding: 30px 0; text-align: center; }
.prov-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed rgba(148, 163, 255, 0.1); font-size: 13.5px; cursor: pointer; }
.prov-row:hover { color: var(--cyan); }
.prov-row .name { flex: 1; }
.prov-row .bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--cyan), var(--violet)); min-width: 4px; }
.prov-row .n { color: var(--ink-faint); font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.city-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(94, 234, 212, 0.08); border: 1px solid rgba(94, 234, 212, 0.22); color: var(--cyan); font-size: 12.5px; padding: 5px 11px; border-radius: 999px; margin: 0 8px 8px 0; }
.city-chip .n { color: var(--ink-dim); font-size: 11.5px; }
.side-posts { margin-top: 14px; }
.side-post { padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); font-size: 13px; line-height: 1.7; margin-bottom: 10px; cursor: pointer; }
.side-post:hover { border-color: rgba(94, 234, 212, 0.3); }
.side-post .t { color: var(--ink-faint); font-size: 11.5px; margin-top: 6px; }

/* ---------- 提交抽屉 ---------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(2, 4, 12, 0.62);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 90; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw);
  background: var(--panel-solid); border-left: 1px solid var(--line); z-index: 95;
  transform: translateX(106%); transition: transform 0.38s cubic-bezier(0.32, 0.72, 0.35, 1);
  display: flex; flex-direction: column;
}
.drawer.show { transform: none; }
.drawer > header { padding: 22px 24px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer > header h2 { font-size: 18px; letter-spacing: 1px; }
.drawer .close-x { background: none; border: none; color: var(--ink-faint); font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.drawer .close-x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.drawer .body { padding: 20px 24px 28px; overflow-y: auto; flex: 1; }
.drawer .notice { font-size: 12.5px; color: var(--ink-faint); line-height: 1.8; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; }

textarea#post-content {
  width: 100%; min-height: 150px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  padding: 14px; font-size: 15px; line-height: 1.75; resize: vertical; transition: border-color 0.2s;
}
textarea#post-content:focus { outline: none; border-color: rgba(94, 234, 212, 0.5); }
textarea#post-content::placeholder { color: var(--ink-faint); }
.char-count { text-align: right; font-size: 12px; color: var(--ink-faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--rose); }

.geo-box { margin: 18px 0 20px; }
.geo-box .geo-title { font-size: 13px; color: var(--ink-dim); margin-bottom: 8px; }
.geo-status { font-size: 13px; color: var(--ink-dim); display: flex; align-items: center; gap: 8px; min-height: 22px; }
.geo-status .spinner { width: 13px; height: 13px; border: 2px solid rgba(94, 234, 212, 0.25); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.geo-status.ok { color: var(--cyan); }
.geo-status.manual-tip { color: var(--amber); }
.geo-selectors { display: none; gap: 10px; margin-top: 12px; }
.geo-selectors.show { display: flex; }
select {
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font-size: 14px; flex: 1; min-width: 0; transition: border-color 0.2s;
}
select:focus { outline: none; border-color: rgba(94, 234, 212, 0.5); }
select option { background: var(--panel-solid); color: var(--ink); }

.feedback { margin-top: 16px; border-radius: 12px; padding: 13px 15px; font-size: 14px; display: none; line-height: 1.65; }
.feedback.show { display: block; animation: viewIn 0.3s ease; }
.feedback.ok { background: rgba(94, 234, 212, 0.1); border: 1px solid rgba(94, 234, 212, 0.35); color: var(--cyan); }
.feedback.err { background: rgba(251, 113, 133, 0.1); border: 1px solid rgba(251, 113, 133, 0.35); color: var(--rose); }
.feedback.info { background: rgba(167, 139, 250, 0.1); border: 1px solid rgba(167, 139, 250, 0.35); color: var(--violet); }

/* ---------- 详情弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(2, 4, 12, 0.66);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 22px; opacity: 0; pointer-events: none; transition: opacity 0.28s;
}
.modal-mask.show { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 100%); max-height: min(84vh, 760px); overflow-y: auto;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 20px;
  padding: 26px 28px; transform: translateY(16px) scale(0.98); transition: transform 0.28s;
}
.modal-mask.show .modal { transform: none; }
.modal .post-content { font-size: 15.5px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; margin: 14px 0 18px; }
.modal .post-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-faint); }
.modal .post-actions { display: flex; gap: 10px; margin: 18px 0 22px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.comments h4 { font-size: 14.5px; margin-bottom: 12px; color: var(--ink-dim); }
.comment-item { padding: 11px 14px; background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line); border-radius: 12px; font-size: 13.5px; line-height: 1.7; margin-bottom: 10px; }
.comment-item .t { font-size: 11.5px; color: var(--ink-faint); margin-top: 5px; }
.comment-form { display: flex; gap: 10px; margin-top: 12px; }
.comment-form input {
  flex: 1; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); padding: 10px 13px; font-size: 13.5px; font-family: inherit;
}
.comment-form input:focus { outline: none; border-color: rgba(94, 234, 212, 0.5); }

/* ---------- Toast / 纸飞机 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 38px; transform: translateX(-50%) translateY(16px);
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  padding: 12px 24px; border-radius: 12px; font-size: 14px; z-index: 140;
  opacity: 0; transition: all 0.3s; pointer-events: none; max-width: 82vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.plane {
  position: fixed; z-index: 150; pointer-events: none; font-size: 42px;
  filter: drop-shadow(0 0 18px rgba(94, 234, 212, 0.8));
}
@keyframes planeFly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(46vw, -62vh) rotate(18deg) scale(0.4); opacity: 0; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .nav { padding: 0 14px; gap: 10px; }
  .nav nav a { padding: 8px 9px; font-size: 13px; }
  .nav .logo { font-size: 15.5px; }
  .features { grid-template-columns: 1fr; padding-bottom: 60px; }
  .wall-stage { height: 54vh; margin: 12px 12px 0; }
  .map-layout { grid-template-columns: 1fr; height: auto; padding: 12px; }
  #map-chart { height: 58vh; }
  .drawer { top: auto; height: 90vh; width: 100%; border-left: none; border-top: 1px solid var(--line-strong); border-radius: 22px 22px 0 0; transform: translateY(106%); }
  .drawer.show { transform: none; }
  .hero .stats { gap: 10px; }
  .stat-pill { min-width: 104px; padding: 12px 16px; }
  .stat-pill .num { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
