/* System Edition panel — step 1 UI prototype (stub data).
   Cyberpunk / sci-fi blue theme: deep-space navy base, neon cyan-blue accents,
   neon magenta for magic, soft glows. Layers on the game-flavored pieces:
   level/exp, five-dim radar, growing forest, 「叮！」.
   Columns are equal-height: the forest fills the left column so both columns
   align at the bottom (no protruding block). */

:root {
  color-scheme: dark;
  --bg: #060a14;
  --surface: #0d1426;
  --surface-soft: #111a30;
  --text: #dbe7ff;
  --muted: #8094bf;
  --line: rgba(90, 150, 255, 0.16);
  --line-strong: rgba(90, 160, 255, 0.34);
  --ink: #0a1020;
  --accent: #34c8ff;
  --accent-2: #4f8cff;
  --accent-soft: rgba(52, 200, 255, 0.12);
  --gold: #ffb454;
  --gold-soft: rgba(255, 180, 84, 0.12);
  --magic: #c264ff;
  --magic-soft: rgba(194, 100, 255, 0.14);
  --success: #3ddc97;
  --success-soft: rgba(61, 220, 151, 0.12);
  --success-line: rgba(61, 220, 151, 0.5);
  --glow-cyan: 0 0 10px rgba(52, 200, 255, 0.45);
  --glow-magic: 0 0 10px rgba(194, 100, 255, 0.4);
  --card-shadow: 0 10px 30px rgba(4, 10, 24, 0.55), inset 0 1px 0 rgba(120, 170, 255, 0.06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 620px at 82% -12%, rgba(52, 140, 255, 0.12), transparent 60%),
    radial-gradient(960px 520px at -6% 112%, rgba(194, 100, 255, 0.08), transparent 60%),
    var(--bg);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 16px; line-height: 1.3; }
h3 { font-size: 13px; line-height: 1.3; }

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.muted { color: var(--muted); line-height: 1.55; }

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
  padding: 6px 12px;
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
button:hover { border-color: var(--accent); box-shadow: var(--glow-cyan); }
button:disabled { cursor: not-allowed; opacity: 0.45; box-shadow: none; }

/* ---------- Top bar ---------- */
.sys-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 26, 50, 0.85), rgba(8, 13, 28, 0.7));
  backdrop-filter: blur(6px);
  padding: 12px 22px;
}
.brand-wrap { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sys-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--glow-cyan);
  background: var(--ink);
}
.sys-brand { display: grid; gap: 2px; }
.sys-brand h1 { display: flex; align-items: center; gap: 10px; color: #eaf3ff; }
.sys-brand .tagline { color: var(--muted); font-size: 12.5px; }

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--ink);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(52, 200, 255, 0.7);
  box-shadow: var(--glow-cyan);
}

.sys-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}
.exp-wrap { display: grid; gap: 4px; min-width: 200px; }
.exp-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.exp-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(120, 160, 255, 0.12);
  border: 1px solid var(--line);
  overflow: hidden;
}
.exp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(52, 180, 255, 0.7);
  transition: width 520ms cubic-bezier(.22,.61,.36,1);
}
.magic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--magic);
  background: var(--magic-soft);
  color: var(--magic);
  font-weight: 800;
  font-size: 13px;
  box-shadow: var(--glow-magic);
}
.mock-badge {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d4a72c;
  background: rgba(212, 167, 44, 0.16);
  color: #e6c25a;
  font-size: 12px;
  font-weight: 700;
}
.shop-btn {
  border-color: var(--magic);
  color: var(--magic);
  background: var(--magic-soft);
  font-weight: 700;
}
.shop-btn:hover { box-shadow: var(--glow-magic); border-color: var(--magic); }
.link-classic {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
}
.link-classic:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Layout (equal-height columns) ---------- */
.sys-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  max-width: 1240px;
  margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.55), rgba(11, 18, 36, 0.65));
  box-shadow: var(--card-shadow);
  padding: 16px;
  min-width: 0;
}
.card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-title h2 { color: #e8f1ff; }
.card-title span { color: var(--muted); font-size: 12px; font-weight: 700; }

/* ---------- Forest (成长之地) — fills the left column, neon-grid terrain ---------- */
.forest-card {
  padding: 0;
  overflow: hidden;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.forest-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 10px;
  flex: 0 0 auto;
}
.forest-head h2 { color: #e8f1ff; }
.forest-stage-pill {
  border: 1px solid var(--success-line);
  background: var(--success-soft);
  color: var(--success);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}
.forest-scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #081124, #0a1730);
  overflow: hidden;
}
.forest-sky-deco {
  flex: 0 0 auto;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 12px;
  color: var(--accent);
  opacity: 0.5;
  pointer-events: none;
  border-bottom: 1px solid rgba(52, 200, 255, 0.28);
  box-shadow: 0 1px 10px rgba(52, 200, 255, 0.25);
}
.forest-ground {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
  align-items: flex-end;
  gap: 2px 6px;
  padding: 10px 14px 12px;
  background:
    repeating-linear-gradient(90deg, transparent 0 36px, rgba(52, 200, 255, 0.05) 36px 37px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(52, 200, 255, 0.05) 22px 23px),
    linear-gradient(180deg, rgba(10, 30, 52, 0.45), rgba(7, 20, 40, 0.85));
}
.tree {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 0 4px rgba(52, 200, 255, 0.3));
}
.tree.pop { animation: treePop 620ms cubic-bezier(.2,.9,.3,1.2); }
.deco { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 5px rgba(194, 120, 255, 0.45)); }
.forest-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 14px;
  color: var(--muted);
  font-size: 12.5px;
  flex: 0 0 auto;
}

@keyframes treePop {
  0% { transform: translateY(10px) scale(0.2); opacity: 0; }
  60% { transform: translateY(-3px) scale(1.12); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

/* ---------- Radar ---------- */
.radar-wrap {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.radar-svg { width: 100%; height: auto; display: block; }
.radar-grid-line { fill: none; stroke: rgba(110, 160, 255, 0.18); stroke-width: 1; }
.radar-axis { stroke: rgba(110, 160, 255, 0.22); stroke-width: 1; }
.radar-area {
  fill: rgba(52, 200, 255, 0.2);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(52, 200, 255, 0.5));
  transition: all 480ms ease;
}
.radar-dot { fill: var(--accent); }
.radar-label { font-size: 11px; fill: var(--muted); font-weight: 700; }
.attr-legend { display: grid; gap: 8px; }
.attr-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; }
.attr-name { font-size: 12.5px; font-weight: 700; }
.attr-track { height: 8px; border-radius: 999px; background: rgba(120, 160, 255, 0.12); border: 1px solid var(--line); overflow: hidden; }
.attr-fill { height: 100%; border-radius: inherit; transition: width 480ms ease, background 480ms ease; }
.attr-lv {
  font-size: 11px;
  font-weight: 800;
  border: 1px solid;
  border-radius: 999px;
  padding: 1px 8px;
  background: rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

/* ---------- Quest lines ---------- */
.quest { padding: 11px 0; border-bottom: 1px solid var(--line); }
.quest:last-child { border-bottom: none; }
.quest-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.quest-kind {
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
}
.quest-kind.main { background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(255, 180, 84, 0.45); }
.quest-kind.side { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(52, 200, 255, 0.4); }
.quest-title { font-weight: 700; }
.quest-track { height: 8px; border-radius: 999px; background: rgba(120, 160, 255, 0.12); border: 1px solid var(--line); overflow: hidden; margin-top: 9px; }
.quest-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 8px rgba(52, 180, 255, 0.5); }
.quest-pct { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- Today tasks ---------- */
.sys-task {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 11px;
  margin-bottom: 10px;
  transition: border-color 200ms ease, background 200ms ease, opacity 240ms ease, box-shadow 200ms ease;
}
.sys-task:last-child { margin-bottom: 0; }
.sys-task:hover { border-color: var(--line-strong); }
.sys-task.done { border-color: var(--success-line); background: var(--success-soft); opacity: 0.65; }
.sys-task.done .task-name { text-decoration: line-through; color: var(--muted); }
.task-main { min-width: 0; }
.task-name { font-weight: 700; overflow-wrap: anywhere; color: #e8f1ff; }
.reward-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.reward-badge {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}
.reward-badge.exp { color: var(--accent); border-color: rgba(52, 200, 255, 0.4); background: var(--accent-soft); }
.reward-badge.magic { color: var(--magic); border-color: rgba(194, 100, 255, 0.45); background: var(--magic-soft); }
.reward-badge.attr { color: var(--gold); border-color: rgba(255, 180, 84, 0.45); background: var(--gold-soft); }
.task-do { white-space: nowrap; border-color: var(--accent); color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.task-do:hover { box-shadow: var(--glow-cyan); }

/* ---------- System quest (系统生成任务) ---------- */
.title-actions { display: flex; align-items: center; gap: 10px; }
.quest-gen-btn {
  border-color: var(--magic);
  color: var(--magic);
  background: var(--magic-soft);
  font-weight: 700;
  font-size: 12.5px;
  min-height: 30px;
}
.quest-gen-btn:hover { box-shadow: var(--glow-magic); border-color: var(--magic); }

.quest-proposal {
  display: grid;
  gap: 8px;
  border: 1px solid var(--magic);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(194, 100, 255, 0.12), rgba(11, 18, 36, 0.5));
  box-shadow: var(--glow-magic);
  padding: 12px;
  margin-bottom: 12px;
}
.qp-voice { color: #e7d6ff; line-height: 1.5; }
.qp-title { font-weight: 800; color: #fff; }
.qp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.qp-accept { border-color: var(--success-line); color: var(--success); background: var(--success-soft); font-weight: 700; }
.qp-accept:hover { box-shadow: 0 0 10px rgba(61, 220, 151, 0.45); }
.qp-source { font-size: 11px; color: var(--muted); }

/* ---------- Ding feed ---------- */
.ding-feed { display: grid; gap: 8px; }
.ding-item {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  border-radius: 0 6px 6px 0;
  padding: 7px 10px;
}
.ding-item .at { color: var(--muted); font-size: 11px; white-space: nowrap; }

/* ---------- 「叮！」 overlay ---------- */
.ding-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 60;
}
.ding-burst {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 30px;
  border-radius: 14px;
  background: rgba(10, 18, 36, 0.94);
  border: 1px solid var(--accent);
  color: #fff;
  box-shadow: 0 0 28px rgba(52, 180, 255, 0.55), var(--card-shadow);
  animation: dingPop 1500ms ease forwards;
}
.ding-burst .big { font-size: 30px; font-weight: 800; letter-spacing: 0.04em; color: var(--accent); text-shadow: 0 0 14px rgba(52, 200, 255, 0.8); }
.ding-burst .sub { font-size: 14px; color: #cfe6ff; }
@keyframes dingPop {
  0% { transform: scale(0.7); opacity: 0; }
  14% { transform: scale(1.05); opacity: 1; }
  24% { transform: scale(1); }
  78% { opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

.levelup-flash { animation: levelFlash 1200ms ease; }
@keyframes levelFlash {
  0%, 100% { box-shadow: var(--glow-cyan); }
  30% { box-shadow: 0 0 0 4px rgba(255, 180, 84, 0.6), 0 0 18px rgba(255, 180, 84, 0.7); border-color: var(--gold); color: var(--gold); }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 320px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: rgba(10, 18, 36, 0.96);
  color: #fff;
  padding: 10px 12px;
  box-shadow: var(--glow-cyan), var(--card-shadow);
  z-index: 50;
}

/* ---------- Shop modal (系统外形) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 8, 18, 0.66);
  backdrop-filter: blur(3px);
}
.modal {
  width: min(560px, 100%);
  max-height: 86vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.97), rgba(10, 16, 32, 0.98));
  box-shadow: 0 0 32px rgba(52, 160, 255, 0.25), var(--card-shadow);
  padding: 18px;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h2 { color: #eaf3ff; }
.modal-close { min-height: 30px; width: 32px; border-radius: 8px; border-color: var(--line-strong); color: var(--muted); }
.modal-close:hover { color: var(--accent); border-color: var(--accent); }
.modal-sub { margin: 6px 0 14px; font-size: 12.5px; }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.avatar-tile {
  display: grid;
  gap: 8px;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
.avatar-tile.is-equipped { border-color: var(--accent); box-shadow: var(--glow-cyan); }
.av-art { width: 84px; height: 84px; border-radius: 12px; overflow: hidden; }
.av-name { font-weight: 700; font-size: 13px; color: #e8f1ff; }
.av-tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); }
.av-tag.equipped { color: var(--accent); border-color: rgba(52, 200, 255, 0.4); background: var(--accent-soft); }
.av-tag.owned { color: var(--success); border-color: var(--success-line); background: var(--success-soft); }
.av-tag.cost { color: var(--magic); border-color: rgba(194, 100, 255, 0.45); background: var(--magic-soft); }
.avatar-tile button { width: 100%; }
.av-equip { border-color: var(--magic); color: var(--magic); background: var(--magic-soft); font-weight: 700; }
.av-equip:hover { box-shadow: var(--glow-magic); }

/* ---------- Feedback button + modal textarea ---------- */
.fb-btn { border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; padding: 5px 12px; }
.fb-btn:hover { border-color: var(--accent); color: var(--accent); }
.modal textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 10px;
  font: inherit;
  margin-bottom: 12px;
}

/* ---------- Email gate (first run) ---------- */
.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(900px 500px at 50% 0%, rgba(52, 140, 255, 0.12), transparent 60%), rgba(6, 10, 20, 0.96);
  backdrop-filter: blur(4px);
}
.gate-card {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.97), rgba(10, 16, 32, 0.98));
  box-shadow: 0 0 32px rgba(52, 160, 255, 0.25), var(--card-shadow);
  padding: 24px;
}
.gate-card h2 { color: #eaf3ff; }
#gate-email {
  width: 100%;
  box-sizing: border-box;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
}
#gate-email:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow-cyan); }
.gate-start {
  min-height: 40px;
  border-color: var(--accent);
  color: #051018;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  font-weight: 800;
}
.gate-start:hover { box-shadow: var(--glow-cyan); }
.gate-err { color: #ff8a8a; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .sys-shell { grid-template-columns: 1fr; align-items: start; }
  .sys-topbar { flex-wrap: wrap; }
  .radar-wrap { grid-template-columns: 1fr; }
  .exp-wrap { min-width: 160px; }
  .forest-scene { min-height: 150px; }
}
