/* ============================================================
   VTOPIA · 失眠的理想乡 — v2 design
   一周目 UTOPIA  = 童话自然（森林夜 + 萤火金）
   二周目 MECHANOMANIA = 机械工业（炭黑 + 铜橙蒸汽）
   场景由 features.js 切换 body[data-scene] 驱动，本文件只做表现。
   ============================================================ */

:root {
  /* default scene（未选择周目）*/
  --bg-0: #0a0d16;
  --bg-1: #0e1320;
  --panel: rgba(17, 23, 38, 0.78);
  --panel-solid: #131a2b;
  --line: rgba(173, 191, 220, 0.14);
  --line-strong: rgba(173, 191, 220, 0.26);

  --accent: #9ad27f;
  --accent-strong: #e8d28a;
  --accent-soft: rgba(154, 210, 127, 0.12);
  --accent-ink: #14210f;

  --text: #eef2ea;
  --text-secondary: rgba(238, 242, 234, 0.62);
  --faint: rgba(238, 242, 234, 0.38);

  --ok: #8fd18a;
  --bad: #e07a5f;

  --px: "Press Start 2P", monospace;
  --zh: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", Consolas, monospace;

  --r: 16px;
  --r-sm: 10px;
}

body[data-scene="utopia"] {
  --bg-0: #08120c;
  --bg-1: #0c1a12;
  --panel: rgba(13, 26, 18, 0.80);
  --panel-solid: #11241a;
  --line: rgba(143, 209, 138, 0.16);
  --line-strong: rgba(143, 209, 138, 0.32);
  --accent: #8fd18a;
  --accent-strong: #f0d28b;
  --accent-soft: rgba(143, 209, 138, 0.12);
  --accent-ink: #11240f;
}

body[data-scene="mechanomania"] {
  --bg-0: #100d0b;
  --bg-1: #181210;
  --panel: rgba(26, 19, 15, 0.82);
  --panel-solid: #221a14;
  --line: rgba(224, 145, 90, 0.16);
  --line-strong: rgba(224, 145, 90, 0.34);
  --accent: #e0915a;
  --accent-strong: #8fb7cc;
  --accent-soft: rgba(224, 145, 90, 0.12);
  --accent-ink: #241407;
}

/* 二周目 VanillaEra — 魔幻 · 农艺 · 养老：暮色麦田 + 微光紫 */
body[data-scene="vanillaera"] {
  --bg-0: #0e0b13;
  --bg-1: #16101f;
  --panel: rgba(26, 20, 36, 0.82);
  --panel-solid: #1d1528;
  --line: rgba(200, 170, 230, 0.16);
  --line-strong: rgba(200, 170, 230, 0.32);
  --accent: #dcc079;
  --accent-strong: #c0a3e0;
  --accent-soft: rgba(220, 192, 121, 0.13);
  --accent-ink: #2a1f0a;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--zh);
  color: var(--text);
  background: var(--bg-0);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 0.9s ease;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; }

audio { display: none; }

/* ---------- scene backdrop ---------- */
.scene-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1200px 700px at 50% -16%, var(--accent-soft), transparent 62%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
  transition: background 0.9s ease;
}

#sceneCanvas {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* pixel horizon silhouette */
.horizon {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 90px;
  z-index: -1;
  opacity: 0.5;
  background-repeat: repeat-x;
  background-position: bottom;
  background-size: auto 100%;
  transition: opacity 0.9s;
  image-rendering: pixelated;
}
body[data-scene="default"] .horizon { opacity: 0.22; }
body[data-scene="utopia"] .horizon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='90'%3E%3Cg fill='%23123420'%3E%3Crect x='0' y='60' width='180' height='30'/%3E%3Crect x='10' y='30' width='12' height='30'/%3E%3Crect x='4' y='42' width='24' height='18'/%3E%3Crect x='60' y='18' width='14' height='42'/%3E%3Crect x='52' y='34' width='30' height='26'/%3E%3Crect x='120' y='38' width='12' height='22'/%3E%3Crect x='112' y='48' width='28' height='12'/%3E%3Crect x='154' y='50' width='10' height='10'/%3E%3C/g%3E%3C/svg%3E");
}
body[data-scene="mechanomania"] .horizon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='90'%3E%3Cg fill='%232a1c10'%3E%3Crect x='0' y='62' width='200' height='28'/%3E%3Crect x='14' y='26' width='10' height='36'/%3E%3Crect x='12' y='20' width='14' height='8'/%3E%3Crect x='48' y='40' width='26' height='22'/%3E%3Crect x='56' y='30' width='8' height='12'/%3E%3Crect x='104' y='18' width='8' height='44'/%3E%3Crect x='100' y='12' width='16' height='8'/%3E%3Crect x='140' y='44' width='34' height='18'/%3E%3Crect x='148' y='32' width='10' height='14'/%3E%3C/g%3E%3C/svg%3E");
}
/* 暮色麦田与农舍剪影 */
body[data-scene="vanillaera"] .horizon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='90'%3E%3Cg fill='%23221634'%3E%3Crect x='0' y='66' width='190' height='24'/%3E%3Cpath d='M20 66 L34 50 L48 66 Z'/%3E%3Crect x='26' y='58' width='16' height='8'/%3E%3Cg stroke='%23221634' stroke-width='2'%3E%3Cline x1='72' y1='66' x2='72' y2='48'/%3E%3Cline x1='78' y1='66' x2='78' y2='46'/%3E%3Cline x1='84' y1='66' x2='84' y2='50'/%3E%3Cline x1='112' y1='66' x2='112' y2='47'/%3E%3Cline x1='118' y1='66' x2='118' y2='45'/%3E%3Cline x1='124' y1='66' x2='124' y2='49'/%3E%3C/g%3E%3Cpath d='M150 66 L164 52 L178 66 Z'/%3E%3Crect x='156' y='59' width='16' height='7'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- music ---------- */
.music-control {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 60;
  width: 46px; height: 46px;
  border-radius: 12px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  backdrop-filter: blur(10px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.25s;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
}
.music-control:hover { border-color: var(--accent); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.35); }
.music-control:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.35); }
.music-control svg { width: 22px; height: 22px; fill: var(--accent); }
.music-control.playing svg { animation: vt-bob 1.2s ease-in-out infinite; }
@keyframes vt-bob { 50% { transform: translateY(-2px); } }

/* ---------- shell / hero ---------- */
.page-shell {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(26px, 5vh, 60px) clamp(16px, 4vw, 44px) 140px;
}

.hero { text-align: center; }

.hero-card { display: inline-block; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 20px;
}

.hero-logo img {
  width: clamp(84px, 12vw, 120px);
  height: auto;
  image-rendering: auto;
  filter: drop-shadow(0 8px 30px var(--accent-soft));
  animation: vt-float 5s ease-in-out infinite;
}
@keyframes vt-float { 50% { transform: translateY(-8px); } }

.hero-title {
  font-family: var(--px);
  font-size: clamp(1.6rem, 5.2vw, 3rem);
  letter-spacing: 0.12em;
  margin-top: 22px;
  color: var(--text);
  text-shadow:
    0 0 24px var(--accent-soft),
    3px 3px 0 rgba(0, 0, 0, 0.45);
}
.hero-title::after {
  content: "";
  display: block;
  width: 90px; height: 4px;
  margin: 18px auto 0;
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 12px);
}

.hero-subtitle {
  margin-top: 16px;
  font-size: 1rem;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--text-secondary);
}

/* ---------- 周目切换器（planet-grid 重塑）---------- */
.server-stage { margin-top: clamp(34px, 6vh, 60px); }

.stage-label {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.4em;
  color: var(--faint);
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ---------- 周目切换标签 ---------- */
.season-tabs {
  display: flex;
  gap: 10px;
  max-width: 520px;
  margin: 0 auto 22px;
}

.season-tab {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--zh);
  text-align: left;
  transition: border-color 0.3s, transform 0.22s, color 0.3s, background 0.3s, box-shadow 0.3s;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
}
.season-tab:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.28); border-color: var(--line-strong); color: var(--text); }
.season-tab:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.28); }
.season-tab.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: linear-gradient(150deg, var(--accent-soft), var(--panel));
  box-shadow: 3px 3px 0 rgba(0,0,0,.28), 0 0 30px -10px var(--accent-soft);
}

.season-rune {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  font-family: var(--px);
  font-size: 0.78rem;
  border: 2px solid var(--line-strong);
  border-radius: 9px;
  color: var(--accent);
  transition: 0.3s;
}
.season-tab.is-active .season-rune { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }

.season-name { font-weight: 700; letter-spacing: 0.18em; font-size: 0.95rem; }
.season-sub { margin-left: auto; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--faint); }

.season-group { display: none; animation: vt-in 0.5s cubic-bezier(.2,.8,.25,1) both; }
.season-group.is-active { display: block; }

.planet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  max-width: 760px;
  margin: 0 auto;
}
.planet-grid.single { grid-template-columns: 1fr; max-width: 420px; }

.planet-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  backdrop-filter: blur(10px);
  cursor: pointer;
  font-family: var(--zh);
  color: var(--text);
  text-align: left;
  transition: border-color 0.3s, transform 0.25s, box-shadow 0.3s, background 0.3s;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.planet-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 rgba(0,0,0,.3); border-color: var(--line-strong); }
.planet-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(0,0,0,.3); }

.planet-card.is-selected {
  border-color: var(--accent);
  background: linear-gradient(150deg, var(--accent-soft), var(--panel));
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3), 0 0 36px -8px var(--accent-soft);
}

.planet-card.is-selected::after {
  content: "▶ 当前周目";
  position: absolute;
  top: -11px; right: 14px;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 3px 10px;
  border-radius: 6px;
  font-weight: 700;
}

.planet-visual {
  position: relative;
  width: 52px; height: 52px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.planet-core {
  width: 34px; height: 34px;
  border-radius: 8px;
  transform: rotate(45deg);
  transition: 0.4s;
}
#planet-utopia .planet-core { background: linear-gradient(135deg, #8fd18a, #3e7d4e); box-shadow: 0 0 22px rgba(143, 209, 138, .4); }
#planet-mechanomania .planet-core { background: linear-gradient(135deg, #e0915a, #7d4a2a); box-shadow: 0 0 22px rgba(224, 145, 90, .4); }
#planet-vanillaera .planet-core { background: linear-gradient(135deg, #dcc079, #9a6fc0); box-shadow: 0 0 22px rgba(192, 163, 224, .4); }
.planet-card.is-selected .planet-core { transform: rotate(225deg) scale(1.08); }
.planet-halo, .planet-ring {
  position: absolute;
  inset: 0;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  transition: 0.4s;
}
.planet-ring { inset: -6px; opacity: 0.5; }
.planet-card.is-selected .planet-halo { transform: rotate(45deg); border-color: var(--accent); }

.planet-copy { min-width: 0; }
.planet-season {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--accent);
  margin-bottom: 5px;
}
.planet-name {
  display: block;
  font-family: var(--px);
  font-size: clamp(0.62rem, 1.5vw, 0.85rem);
  letter-spacing: 0.06em;
  line-height: 1.5;
}
.planet-type {
  margin-top: 6px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

/* ---------- selection panel ---------- */
.selection-panel { margin-top: clamp(28px, 5vh, 46px); position: relative; }

.server-placeholder {
  display: none;
  text-align: center;
  padding: 64px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--r);
  color: var(--faint);
}
.server-placeholder.is-active { display: block; animation: vt-in 0.5s ease both; }
.placeholder-title { font-size: 1rem; font-weight: 400; letter-spacing: 0.3em; }

.server-detail { display: none; }
.server-detail.is-active { display: block; animation: vt-in 0.55s cubic-bezier(.2,.8,.25,1) both; }
@keyframes vt-in { from { opacity: 0; transform: translateY(22px); } }

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.detail-title {
  font-family: var(--px);
  font-size: clamp(0.95rem, 2.6vw, 1.4rem);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.info-card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  transition: border-color 0.3s;
}
.info-card:hover { border-color: var(--line-strong); }
.info-card.wide { grid-column: 1 / -1; }

.info-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}

.info-value { font-size: 0.95rem; line-height: 1.8; color: var(--text); overflow-wrap: anywhere; }

.server-ip {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: 0.25s;
}
.server-ip:hover { border-color: var(--accent); color: var(--accent); }

.copy-hint { margin-left: 10px; font-size: 0.78rem; color: var(--ok); }

.status-online { color: var(--ok); font-weight: 500; }
.status-offline { color: var(--bad); font-weight: 500; }

.map-warning {
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-strong);
  padding-left: 12px;
}

/* ---------- nav dock ---------- */
.nav-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  gap: 6px;
  padding: 9px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 2px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.8), 4px 4px 0 rgba(0, 0, 0, 0.25);
}

.nav-bubble {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: 0.22s;
}
.nav-bubble svg { width: 21px; height: 21px; fill: var(--text-secondary); transition: 0.22s; }
.nav-bubble:hover { background: var(--accent-soft); transform: translateY(-4px); }
.nav-bubble:hover svg { fill: var(--accent); }

.nav-bubble .tooltip {
  position: absolute;
  bottom: 54px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  white-space: nowrap;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
}
.nav-bubble:hover .tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- footer ---------- */
.footer {
  position: relative;
  text-align: center;
  padding: 30px 16px 110px;
  font-size: 0.78rem;
  color: var(--faint);
}
.footer-help { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.footer-refresh {
  font-size: 0.74rem;
  color: var(--accent);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  padding: 5px 14px;
  cursor: pointer;
  transition: 0.25s;
}
.footer-refresh:hover { border-color: var(--accent); }
.beian { color: var(--faint); text-decoration: none; }
.beian:hover { color: var(--text-secondary); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--zh);
  font-size: 0.86rem;
  letter-spacing: 0.05em;
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  background: var(--panel-solid);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s, box-shadow 0.18s, background 0.25s, border-color 0.25s;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.btn:hover { border-color: var(--accent); }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.3); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(0,0,0,.3); }

.btn-primary { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-color: transparent; }
.btn-primary:hover { border-color: transparent; }
.btn-secondary { background: var(--panel-solid); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: var(--bad); color: #2a0f08; font-weight: 700; }
.btn-sm { padding: 7px 14px; font-size: 0.78rem; border-radius: 8px; }

.action-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.86rem;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  border: 2px solid var(--line-strong);
  color: var(--text);
  transition: 0.25s;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}
.action-link.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 700; }
.action-link:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 rgba(0,0,0,.3); }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px 40px;
  overflow-y: auto;
  background: rgba(4, 6, 11, 0.74);
  backdrop-filter: blur(8px);
}
.modal.active { display: flex; animation: vt-fade 0.25s ease; }
@keyframes vt-fade { from { opacity: 0; } }

.modal-content {
  position: relative;
  width: min(640px, 100%);
  background: var(--panel-solid);
  border: 2px solid var(--line-strong);
  border-radius: var(--r);
  padding: clamp(22px, 3.5vw, 34px);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.35), 0 40px 90px -30px rgba(0, 0, 0, 0.9);
  animation: vt-pop 0.32s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes vt-pop { from { opacity: 0; transform: translateY(20px) scale(0.97); } }

.modal-content.modal-lg { width: min(880px, 100%); }

.close-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: 0.22s;
}
.close-btn:hover { color: var(--bad); border-color: var(--bad); transform: rotate(90deg); }

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.modal-subtitle {
  margin: 8px 0 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* ---------- forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.32);
  border: 2px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-family: var(--zh);
  font-size: 0.9rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.25s;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--faint); }
select.form-input { appearance: none; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* inline form rows generated by features.js keep their inline styles;
   inputs inside flex rows shouldn't stretch full width */
form[id="chat-form"] { display: flex; gap: 10px; flex-wrap: wrap; }
form[id="chat-form"] .form-input { width: auto; }

/* ---------- chat ---------- */
.chat-messages {
  height: 340px;
  overflow-y: auto;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.28);
  padding: 14px;
  margin-bottom: 14px;
  scrollbar-width: thin;
}
.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.chat-message {
  padding: 7px 4px;
  font-size: 0.9rem;
  line-height: 1.75;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.chat-message:last-child { border-bottom: none; }
.chat-username { color: var(--accent); font-weight: 500; }
.chat-text { color: var(--text); overflow-wrap: anywhere; }
.chat-input-area { display: block; }

/* ---------- news ---------- */
.news-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.news-item {
  background: var(--panel);
  border: 2px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: border-color 0.25s, transform 0.25s;
}
.news-item:hover { border-color: var(--line-strong); transform: translateX(4px); }
.news-title { font-size: 1rem; font-weight: 700; letter-spacing: 0.04em; }
.news-meta { font-family: var(--mono); font-size: 0.68rem; color: var(--faint); margin: 7px 0 10px; }
.news-content-text { font-size: 0.88rem; line-height: 1.95; color: var(--text-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- gallery ---------- */
#gallery-content {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
#gallery-content > p { grid-column: 1 / -1; }

.gallery-item {
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 6px 10px;
  transition: 0.25s;
}
.gallery-item:hover { border-color: var(--accent); transform: translateY(-4px); }
.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  display: block;
  image-rendering: auto;
}

.upload-section {
  margin-top: 22px;
  padding: 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-sm);
}
.upload-section h3 { font-size: 0.95rem; letter-spacing: 0.1em; margin-bottom: 12px; color: var(--accent); }
.upload-section .form-input { margin-bottom: 10px; }

/* ---------- links ---------- */
.link-item, #links-content > div {
  margin-bottom: 12px;
}
.link-title { font-size: 0.96rem; font-weight: 700; color: var(--accent); }
.link-url { font-family: var(--mono); font-size: 0.74rem; color: var(--text-secondary); word-break: break-all; }
.link-url a { color: var(--accent-strong); text-decoration: none; }
.link-description { font-size: 0.84rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.8; }

/* ---------- user / admin ---------- */
.user-info {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  margin-bottom: 16px;
  line-height: 2.1;
  font-size: 0.92rem;
}
.user-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.login-register { margin-top: 8px; }
.login-register .form-input { margin-bottom: 12px; }

.admin-panel { min-height: 320px; }
.admin-menu { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.admin-action-btn {
  font-size: 0.76rem;
  padding: 6px 13px;
  border-radius: 7px;
  border: 2px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: 0.22s;
}
.admin-action-btn:hover { border-color: var(--accent); color: var(--accent); }
.admin-action-btn.delete:hover { border-color: var(--bad); color: var(--bad); }

/* ---------- markdown body (guide preview etc.) ---------- */
.markdown-body { line-height: 2; font-size: 0.92rem; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.2em 0 0.6em; color: var(--accent); }
.markdown-body p { margin-bottom: 0.8em; }
.markdown-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  padding: 2px 7px;
}
.markdown-body a { color: var(--accent-strong); }

/* ---------- misc ---------- */
.loading {
  display: inline-block;
  color: var(--faint);
  font-size: 0.86rem;
  letter-spacing: 0.14em;
  animation: vt-pulse 1.3s ease-in-out infinite;
}
@keyframes vt-pulse { 50% { opacity: 0.35; } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .planet-grid { grid-template-columns: 1fr; max-width: 420px; }
  .detail-grid { grid-template-columns: 1fr; }
  .nav-dock { gap: 2px; padding: 7px; max-width: 94vw; }
  .nav-bubble { width: 40px; height: 40px; }
  .modal { padding: 3vh 10px 30px; }
  form[id="chat-form"] .form-input { width: 100% !important; }
  .hero-subtitle { letter-spacing: 0.3em; }
}

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