/* ============================================================
   studio.hopzz.top — 创作工作站
   深海军蓝 + 冰青，与 ai.hopzz.top / chat 站同一套调性。
   移动端优先断点：900px（两栏→单栏）、640px（紧凑）、380px（极窄）
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  color-scheme: dark;

  --navy-deep: #0a2e58;
  --navy: #1b477b;
  --blue-mid: #3b6194;
  --blue-bright: #4e77a9;
  --blue-light: #6fa8c6;
  --ice: #7fd8f0;
  --ice-pale: #c5e9ee;
  --muted: #b1afc9;
  --near-white: #f5fefe;

  --bg-top: var(--navy-deep);
  --bg-bottom: #071c38;
  --bg: var(--navy-deep);

  --panel: rgba(255, 255, 255, 0.06);
  --panel-glass: rgba(10, 46, 88, 0.55);
  --panel-solid: rgba(8, 34, 63, 0.94);
  --card-bg: rgba(9, 36, 66, 0.72);

  --surface: rgba(255, 255, 255, 0.08);
  --surface-2: rgba(255, 255, 255, 0.12);
  --surface-3: rgba(255, 255, 255, 0.18);

  --text: var(--near-white);
  --text-dim: var(--muted);
  --text-faint: rgba(177, 175, 201, 0.62);

  --border: rgba(197, 233, 238, 0.18);
  --border-strong: rgba(197, 233, 238, 0.34);

  --accent: var(--ice);
  --accent-2: var(--blue-bright);
  --accent-soft: rgba(127, 216, 240, 0.12);
  --accent-softer: rgba(127, 216, 240, 0.07);
  --grad-accent: linear-gradient(120deg, #7fd8f0 0%, #4e77a9 100%);
  --ink-on-accent: #06203f;

  --ok: #9fe6cf;
  --warn: #f3d29a;
  --danger: #ee9a86;
  --ok-soft: rgba(159, 230, 207, 0.12);
  --warn-soft: rgba(243, 210, 154, 0.12);
  --danger-soft: rgba(238, 154, 134, 0.14);

  --shadow-soft: 0 22px 60px rgba(2, 15, 32, 0.4);
  --shadow-pop: 0 14px 36px rgba(2, 15, 32, 0.38);
  --shadow-bubble: 0 10px 28px rgba(2, 15, 32, 0.22);

  --wash-1: rgba(127, 216, 240, 0.16);
  --wash-2: rgba(78, 119, 169, 0.16);
  --paper-line: rgba(245, 254, 254, 0.025);

  --radius-panel: 22px;
  --radius-card: 18px;
  --radius-btn: 14px;
  --radius-chip: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC",
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --topbar-h: 62px;
  --app-bg: radial-gradient(1200px 700px at 85% -10%, rgba(127, 216, 240, 0.13), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(78, 119, 169, 0.2), transparent 55%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background: var(--app-bg) fixed;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
video,
audio,
svg {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4, p {
  margin: 0;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(127, 216, 240, 0.3);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 细滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 216, 240, 0.28) transparent;
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(127, 216, 240, 0.24);
  border-radius: 99px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(127, 216, 240, 0.38);
}

*::-webkit-scrollbar-track {
  background: transparent;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background 0.16s ease, border-color 0.16s ease,
    transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--grad-accent);
  border-color: transparent;
  color: var(--ink-on-accent);
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(127, 216, 240, 0.16);
}

.btn-primary:hover {
  background: var(--grad-accent);
  box-shadow: 0 10px 28px rgba(127, 216, 240, 0.26);
  filter: brightness(1.05);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(238, 154, 134, 0.4);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(238, 154, 134, 0.22);
}

.btn-sm {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
}

.btn-xs {
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-plus {
  font-weight: 700;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: transparent;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  border-color: rgba(238, 154, 134, 0.4);
  color: var(--danger);
}

.input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(5, 22, 43, 0.55);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.16s ease, background 0.16s ease,
    box-shadow 0.16s ease;
}

.input::placeholder {
  color: var(--text-faint);
}

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  outline: none;
  border-color: rgba(127, 216, 240, 0.62);
  background: rgba(5, 22, 43, 0.75);
  box-shadow: 0 0 0 3px rgba(127, 216, 240, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.7;
}

.textarea.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}

.input-sm {
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 13px;
}

.input-number {
  max-width: 180px;
}

select.input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.field-hint {
  color: var(--text-faint);
  font-size: 12px;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.field-check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--ice);
  flex: 0 0 auto;
}

.hint {
  color: var(--text-faint);
  font-size: 13px;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ============================================================
   登录页
   ============================================================ */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login-card {
  width: min(392px, 100%);
  padding: 30px 26px 24px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(15, 55, 100, 0.82), rgba(6, 25, 48, 0.9));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--grad-accent);
  color: var(--ink-on-accent);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(127, 216, 240, 0.24);
}

.login-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.login-brand-text strong {
  font-size: 17px;
  letter-spacing: 0.02em;
}

.login-brand-sub {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.login-subtitle {
  margin-bottom: 18px;
  color: var(--text-dim);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .field {
  gap: 7px;
}

.login-error {
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--danger);
  font-size: 13px;
}

.login-foot {
  margin-top: 14px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.06em;
}

/* ============================================================
   主框架
   ============================================================ */
.main-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--border);
  background: rgba(7, 27, 52, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 17px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-sub {
  color: var(--text-dim);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.view {
  flex: 1 1 auto;
  min-width: 0;
}

/* ============================================================
   项目墙
   ============================================================ */
.wall-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  align-items: start;
  gap: 22px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px clamp(14px, 3vw, 30px) 48px;
}

.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 16px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.sidebar-title {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.type-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.type-btn:hover {
  background: var(--surface);
  color: var(--text);
}

.type-btn.is-active {
  border-color: rgba(127, 216, 240, 0.34);
  background: var(--accent-soft);
  color: var(--text);
}

.type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--accent-softer);
  color: var(--accent);
  font-size: 13px;
  line-height: 1;
}

.type-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-count {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.type-btn.is-active .type-count {
  color: var(--accent);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--accent-softer);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tag-btn {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tag-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.tag-btn.is-active {
  border-color: rgba(127, 216, 240, 0.5);
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-chip--mini {
  padding: 1px 8px;
  font-size: 11px;
}

.tag-chip--removable {
  padding-right: 4px;
}

.tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.tag-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-empty {
  color: var(--text-faint);
  font-size: 12px;
}

.tag-add-input {
  width: 92px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-chip);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
}

.tag-add-input::placeholder {
  color: var(--text-faint);
}

.tag-add-input:focus {
  outline: none;
  border-style: solid;
  border-color: rgba(127, 216, 240, 0.55);
}

.wall-main {
  min-width: 0;
}

.wall-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wall-title {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 650;
  letter-spacing: 0.01em;
}

.wall-count {
  color: var(--text-faint);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 14px;
  min-width: 0;
}

.project-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: linear-gradient(165deg, rgba(17, 57, 99, 0.62), rgba(6, 26, 50, 0.72));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease,
    box-shadow 0.16s ease, background 0.16s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: linear-gradient(165deg, rgba(23, 70, 118, 0.7), rgba(7, 30, 57, 0.8));
  box-shadow: var(--shadow-pop);
}

.project-card:active {
  transform: translateY(0);
}

.pc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.pc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.pc-type {
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.1em;
}

.pc-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.pc-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
}

.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.pc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 2px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.pc-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel);
  color: var(--text-dim);
  text-align: center;
}

.empty-icon {
  font-size: 34px;
  color: var(--accent);
  opacity: 0.7;
}

.empty-text {
  font-size: 14px;
}

/* ============================================================
   项目详情
   ============================================================ */
.detail-view {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px clamp(14px, 3vw, 30px) 56px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.back-btn {
  flex: 0 0 auto;
  margin-top: 3px;
}

.detail-title-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.title-input {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 560px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: clamp(20px, 2.8vw, 28px);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.title-input:hover {
  border-color: var(--border);
}

.title-input:focus {
  outline: none;
  border-color: rgba(127, 216, 240, 0.55);
  background: rgba(5, 22, 43, 0.6);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 3px 10px;
  border: 1px solid rgba(127, 216, 240, 0.3);
  border-radius: var(--radius-chip);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.detail-meta {
  color: var(--text-faint);
  font-size: 12px;
}

.tag-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.detail-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding-top: 4px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}

.save-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.save-status.is-saving {
  color: var(--accent);
}

.save-status.is-saved {
  color: var(--ok);
}

.save-status.is-error {
  color: var(--danger);
}

.detail-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.tab-btn {
  padding: 7px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(127, 216, 240, 0.28);
}

.detail-body {
  min-width: 0;
}

/* ---------- 编辑布局 ---------- */
.editor-layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  min-width: 0;
}

.module-panel {
  position: sticky;
  top: calc(var(--topbar-h) + 18px);
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: var(--panel-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.panel-title {
  margin-bottom: 10px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.module-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.module-check:hover {
  background: var(--surface);
  color: var(--text);
}

.module-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--ice);
  cursor: pointer;
}

.module-check-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-forms {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.module-section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: linear-gradient(170deg, rgba(14, 49, 88, 0.55), rgba(6, 26, 50, 0.6));
}

.module-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 600;
}

.module-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--grad-accent);
}

.module-section .field + .field {
  margin-top: 14px;
}

.meta-panel .field + .field {
  margin-top: 14px;
}

/* ---------- 片段编辑 ---------- */
.sections-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.7fr) minmax(0, 0.7fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sec-del {
  justify-self: end;
}

/* ============================================================
   仓库
   ============================================================ */
.repo-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.repo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-glass);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
}

.crumb {
  padding: 3px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crumb:hover {
  background: var(--surface);
  color: var(--text);
}

.crumb-sep {
  color: var(--text-faint);
  font-size: 12px;
}

.repo-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(6, 27, 51, 0.6);
  font-size: 12.5px;
}

.upload-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.upload-bar {
  flex: 0 0 120px;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface);
}

.upload-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: var(--grad-accent);
  transition: width 0.16s linear;
}

.upload-pct {
  flex: 0 0 42px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.upload-row.is-done .upload-pct {
  color: var(--ok);
}

.upload-row.is-error .upload-pct {
  color: var(--danger);
}

.repo-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: rgba(6, 27, 51, 0.45);
  min-height: 120px;
}

.repo-tree > .hint {
  padding: 26px 12px;
  text-align: center;
}

.repo-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 82px 92px auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 11px;
  transition: background 0.14s ease;
}

.repo-row:hover {
  background: var(--surface);
}

.repo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-softer);
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}

.repo-row.is-dir .repo-icon {
  background: rgba(243, 210, 154, 0.1);
  color: var(--warn);
}

.repo-thumb {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface);
}

.repo-name {
  min-width: 0;
  padding: 4px 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.repo-name:hover {
  color: var(--accent);
}

.repo-row.is-dir .repo-name {
  font-weight: 550;
}

.repo-size,
.repo-time {
  color: var(--text-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* ============================================================
   预览
   ============================================================ */
.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.preview-img {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  margin: 0 auto;
  border-radius: 14px;
  background: var(--surface);
  object-fit: contain;
}

.preview-video {
  width: 100%;
  max-height: 62vh;
  border-radius: 14px;
  background: #04152b;
}

.preview-audio {
  width: 100%;
}

.preview-text {
  width: 100%;
  max-height: 58vh;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(3, 17, 34, 0.75);
  color: var(--ice-pale);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.preview-generic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 16px;
  text-align: center;
}

.preview-generic-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 28px;
}

.preview-hint {
  margin: 0;
  text-align: center;
}

/* ============================================================
   弹窗与提示
   ============================================================ */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 20px 14px;
  background: rgba(3, 13, 27, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  max-height: min(88vh, 880px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: linear-gradient(170deg, rgba(16, 55, 96, 0.97), rgba(5, 23, 45, 0.98));
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

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

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  min-width: 0;
  font-size: 15.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  flex: 0 0 auto;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  min-height: 0;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}

.confirm-body {
  padding: 4px 2px;
}

.confirm-message {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.modal .field + .field {
  margin-top: 14px;
}

.chip-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--accent-softer);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip-check:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip-check:has(input:checked) {
  border-color: rgba(127, 216, 240, 0.5);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--ice);
  cursor: pointer;
}

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 28px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: rgba(8, 32, 60, 0.94);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: var(--shadow-bubble);
  overflow-wrap: anywhere;
  transition: opacity 0.22s ease, transform 0.22s ease;
  animation: toast-in 0.2s ease both;
}

.toast-ok {
  border-color: rgba(159, 230, 207, 0.45);
  color: var(--ok);
}

.toast-warn {
  border-color: rgba(243, 210, 154, 0.45);
  color: var(--warn);
}

.toast-error {
  border-color: rgba(238, 154, 134, 0.5);
  color: var(--danger);
}

.toast.is-out {
  opacity: 0;
  transform: translateY(6px);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .wall-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding-top: 16px;
  }

  .sidebar {
    position: static;
    gap: 14px;
  }

  .type-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .type-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 6px 12px;
    border-radius: var(--radius-chip);
  }

  .type-label {
    flex: 0 1 auto;
  }

  .tag-filter {
    flex-wrap: wrap;
  }

  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .module-panel {
    position: static;
  }

  .module-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .module-check {
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-chip);
  }

  .repo-row {
    grid-template-columns: 30px minmax(0, 1fr) auto auto;
  }

  .repo-time {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --topbar-h: 56px;
    --radius-panel: 18px;
    --radius-card: 16px;
  }

  body {
    font-size: 14px;
  }

  .topbar {
    padding: 8px 14px;
  }

  .brand .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 15px;
  }

  .brand-text strong {
    font-size: 14px;
  }

  .btn-label {
    display: none;
  }

  #new-project-btn {
    min-width: 40px;
    padding: 8px 12px;
    font-size: 17px;
  }

  .btn-plus {
    line-height: 1;
  }

  .detail-view {
    padding-top: 14px;
  }

  .detail-head {
    flex-wrap: wrap;
  }

  .detail-head-actions {
    margin-left: auto;
  }

  .save-status {
    font-size: 11.5px;
  }

  .title-input {
    flex-basis: 100%;
    max-width: none;
    font-size: 21px;
    padding-left: 4px;
  }

  .module-section {
    padding: 14px;
  }

  .section-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
  }

  .sec-name {
    grid-column: 1 / -1;
  }

  .sec-notes {
    grid-column: 1 / -1;
  }

  .sec-del {
    justify-self: end;
  }

  .repo-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .repo-actions {
    width: 100%;
  }

  .repo-row {
    grid-template-columns: 30px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .repo-size {
    display: none;
  }

  .upload-bar {
    flex-basis: 70px;
  }

  .modal-overlay {
    padding: 12px 10px;
  }

  .modal {
    max-height: 92vh;
    border-radius: 18px;
  }

  .modal-body {
    padding: 14px;
  }

  .modal-head {
    padding: 12px 14px;
  }

  .modal-actions {
    padding: 10px 14px 14px;
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 11px;
  }

  .toast-root {
    bottom: 18px;
  }
}

@media (max-width: 380px) {
  .brand-sub {
    display: none;
  }

  .wall-layout,
  .detail-view {
    padding-left: 12px;
    padding-right: 12px;
  }

  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .type-btn {
    padding: 5px 10px;
    font-size: 12.5px;
  }

  .type-count {
    display: none;
  }

  .repo-actions .btn {
    padding: 5px 9px;
  }
}

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