/* ==================================================================
   积木综合 · 图形化编程闯关平台   全局样式
   ================================================================== */

:root {
  --bg-0: #0d0722;
  --bg-1: #170d38;
  --bg-2: #221247;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-2: rgba(255, 255, 255, 0.09);
  --stroke: rgba(255, 255, 255, 0.12);
  --stroke-2: rgba(255, 255, 255, 0.22);
  --text: #ece9ff;
  --text-dim: #a49dc9;
  --text-mute: #7a739e;
  --accent: #4c97ff;
  --accent-2: #b06cff;
  --accent-3: #35e0c0;
  --warn: #ffab19;
  --danger: #ff5f6d;
  --ok: #3ddc97;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 12% -10%, #3a1f6e 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #1b3a7a 0%, transparent 55%),
    radial-gradient(800px 800px at 50% 120%, #2a1150 0%, transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0) 60%);
  background-attachment: fixed;
}

.app-root { flex: 1; display: flex; flex-direction: column; min-height: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.mono { font-family: var(--mono); }

/* ---------------- 启动占位 ---------------- */
.boot { margin: auto; text-align: center; color: var(--text-dim); }
.boot-logo { font-size: 54px; animation: float 2.4s ease-in-out infinite; }
.boot-text { margin-top: 10px; letter-spacing: 2px; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(13, 7, 34, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: 0.5px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 19px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(76, 151, 255, 0.45);
}
.brand small { display: block; font-size: 11px; font-weight: 400; color: var(--text-mute); letter-spacing: 1px; }

.nav { display: flex; gap: 4px; margin-left: 12px; flex-wrap: wrap; }
.nav-item {
  padding: 8px 14px; border-radius: 10px; color: var(--text-dim);
  cursor: pointer; border: 1px solid transparent; transition: all 0.16s;
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(76, 151, 255, 0.28), rgba(176, 108, 255, 0.28));
  border-color: rgba(140, 160, 255, 0.5); color: #fff;
}
.topbar .spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 40px;
  background: var(--panel); border: 1px solid var(--stroke); cursor: pointer;
}
.user-chip:hover { background: var(--panel-2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #4c97ff, #b06cff);
}
.user-chip .uname { line-height: 1.15; }
.user-chip .uname b { font-size: 13px; font-weight: 600; }
.user-chip .uname span { display: block; font-size: 11px; color: var(--text-mute); }

/* ---------------- 通用控件 ---------------- */
.btn {
  padding: 9px 16px; border-radius: 10px; cursor: pointer; border: 1px solid var(--stroke);
  background: var(--panel); color: var(--text); transition: all 0.15s; font-weight: 500;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--panel-2); border-color: var(--stroke-2); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6f7bff); border-color: transparent; color: #fff; box-shadow: 0 8px 22px rgba(76, 151, 255, 0.35); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 26px rgba(76, 151, 255, 0.5); }
.btn.purple { background: linear-gradient(135deg, var(--accent-2), #ff7ac4); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 95, 109, 0.16); border-color: rgba(255, 95, 109, 0.45); color: #ffb8be; }
.btn.danger:hover:not(:disabled) { background: rgba(255, 95, 109, 0.28); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; }

.inp, .sel, .txa {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid var(--stroke);
  color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.inp:focus, .sel:focus, .txa:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76, 151, 255, 0.18); }
.sel { appearance: none; 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; padding-right: 34px; }
.sel option { background: #1c1140; color: var(--text); }
.txa { min-height: 76px; resize: vertical; line-height: 1.6; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row > * { min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--stroke);
  border-radius: var(--radius); padding: 18px; backdrop-filter: blur(8px);
}
.card.pad-sm { padding: 12px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--stroke);
}
.badge.ok { background: rgba(61, 220, 151, 0.16); border-color: rgba(61, 220, 151, 0.4); color: #8ff2c8; }
.badge.warn { background: rgba(255, 171, 25, 0.16); border-color: rgba(255, 171, 25, 0.4); color: #ffd286; }
.badge.danger { background: rgba(255, 95, 109, 0.16); border-color: rgba(255, 95, 109, 0.4); color: #ffb8be; }
.badge.info { background: rgba(76, 151, 255, 0.18); border-color: rgba(76, 151, 255, 0.42); color: #b3d3ff; }
.stars { color: var(--warn); letter-spacing: 1px; font-size: 12px; }

/* ---------------- 布局 ---------------- */
.page { flex: 1; padding: 22px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page.narrow { max-width: 900px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.page-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.page-head .spacer { flex: 1; }

/* ---------------- 登录页 ---------------- */
.auth-wrap { min-height: 100%; display: grid; grid-template-columns: 1.15fr 0.85fr; }
.auth-hero { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 60px; }
.auth-hero h1 { font-size: 42px; margin: 0 0 14px; line-height: 1.25; }
.auth-hero h1 span { background: linear-gradient(120deg, #7cc0ff, #c58cff, #62f0d0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: var(--text-dim); font-size: 15px; max-width: 520px; line-height: 1.9; }
.auth-hero .feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 28px; max-width: 560px; }
.feat { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--stroke); }
.feat i { font-style: normal; font-size: 19px; }
.feat b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.feat small { color: var(--text-mute); font-size: 11.5px; line-height: 1.5; }
.auth-hero .glow { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; pointer-events: none; }
.auth-hero .glow.g1 { width: 380px; height: 380px; background: #4c97ff; top: -80px; left: -60px; }
.auth-hero .glow.g2 { width: 340px; height: 340px; background: #b06cff; bottom: -100px; left: 180px; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: rgba(0, 0, 0, 0.25); border-left: 1px solid var(--stroke); }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { margin: 0 0 6px; font-size: 22px; }
.auth-box .sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.auth-tabs { display: flex; padding: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; margin-bottom: 20px; border: 1px solid var(--stroke); }
.auth-tabs div { flex: 1; text-align: center; padding: 8px; border-radius: 9px; cursor: pointer; color: var(--text-dim); transition: all 0.15s; font-size: 13.5px; }
.auth-tabs div.active { background: linear-gradient(135deg, var(--accent), #6f7bff); color: #fff; }
.err-msg { color: #ff9aa4; font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }

/* ---------------- 关卡大厅 ---------------- */
.cat-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.cat-chip {
  display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--stroke); cursor: pointer; transition: all 0.16s;
}
.cat-chip:hover { transform: translateY(-2px); border-color: var(--stroke-2); }
.cat-chip.active { border-color: currentColor; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); background: rgba(255, 255, 255, 0.1); }
.cat-chip .ic { font-size: 17px; }
.cat-chip .cn { font-weight: 600; }
.cat-chip .cc { font-size: 11.5px; color: var(--text-mute); }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.map-card {
  border-radius: 16px; overflow: hidden; background: var(--panel); border: 1px solid var(--stroke);
  display: flex; flex-direction: column; transition: all 0.2s; position: relative;
}
.map-card:hover { transform: translateY(-4px); border-color: rgba(140, 160, 255, 0.5); box-shadow: var(--shadow); }
.map-thumb { height: 168px; background: radial-gradient(circle at 50% 40%, #2b1a55, #150c31); position: relative; overflow: hidden; }
.map-thumb canvas { display: block; width: 100%; height: 100%; }
.map-thumb .tag-abs { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.map-thumb .id-abs { position: absolute; top: 10px; right: 10px; font-size: 11px; font-family: var(--mono); color: #b9b2dd; background: rgba(0, 0, 0, 0.45); padding: 2px 8px; border-radius: 20px; }
.map-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.map-body h3 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.map-body .desc { color: var(--text-dim); font-size: 12.5px; line-height: 1.65; flex: 1; }
.map-meta { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-mute); }
.map-meta .spacer { flex: 1; }
.empty-state { text-align: center; padding: 70px 20px; color: var(--text-mute); }
.empty-state .ic { font-size: 46px; margin-bottom: 12px; }

/* ---------------- 工具条 ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .search .inp { padding-left: 34px; }
.toolbar .search::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: 0.6; }

/* ---------------- 工作台 (编辑器 / 关卡) ---------------- */
.studio { flex: 1; display: grid; grid-template-columns: 1fr 340px; grid-template-rows: minmax(0, 1fr); gap: 14px; padding: 14px; min-height: 0; }
.panel {
  background: rgba(15, 9, 38, 0.72); border: 1px solid var(--stroke);
  border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  flex: none; padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.03); font-size: 13px; font-weight: 600;
}
.panel-head .spacer { flex: 1; }
.panel-body { flex: 1; overflow: auto; padding: 14px; min-height: 0; }
.panel-body.nopad { padding: 0; }

/* ---------------- 关卡游玩界面 ---------------- */
.play-layout {
  flex: 1; display: grid; gap: 10px; padding: 10px; min-height: 0;
  grid-template-columns: minmax(0, 1.32fr) 300px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "stage palette script" "hint hint hint";
}
.play-grid-3 { grid-template-columns: minmax(0, 1.32fr) 300px minmax(0, 1fr); }

.stage-wrap { grid-area: stage; position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--stroke); background: #150c31; display: flex; flex-direction: column; min-height: 0; }
.stage-top {
  position: absolute; inset: 0 0 auto 0; z-index: 6; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; pointer-events: none;
}
.stage-top > * { pointer-events: auto; }
.id-chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.42); border: 1px solid var(--stroke); font-size: 12px; }
.id-chip b { font-family: var(--mono); color: #8ff2c8; }
.progress-wrap { flex: 1; max-width: 260px; }
.progress-bar { height: 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--stroke); overflow: hidden; position: relative; }
.progress-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #35e0c0, #4c97ff); transition: width 0.28s ease; }
.progress-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-family: var(--mono); letter-spacing: 0.5px; }
.stage-canvas-holder { flex: 1; position: relative; min-height: 0; }
.stage-canvas-holder canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-overlay {
  position: absolute; inset: 0; z-index: 8; display: grid; place-items: center;
  background: rgba(8, 4, 22, 0.78); backdrop-filter: blur(6px); text-align: center; padding: 22px;
}
.stage-overlay .ov-card { max-width: 380px; }
.stage-overlay .ov-icon { font-size: 58px; margin-bottom: 10px; animation: pop 0.4s ease; }
.stage-overlay h2 { margin: 0 0 10px; font-size: 26px; }
.stage-overlay p { color: var(--text-dim); margin: 0 0 18px; line-height: 1.8; }
.stage-overlay .stats { display: flex; gap: 18px; justify-content: center; margin-bottom: 20px; }
.stage-overlay .stats div { text-align: center; }
.stage-overlay .stats b { display: block; font-size: 22px; font-family: var(--mono); color: #8ff2c8; }
.stage-overlay .stats span { font-size: 11.5px; color: var(--text-mute); }
@keyframes pop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.say-bubble {
  position: absolute; z-index: 7; transform: translate(-50%, -100%);
  background: #fff; color: #1b1240; padding: 7px 12px; border-radius: 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  pointer-events: none; transition: opacity 0.2s;
}
.say-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-top-color: #fff; border-bottom: 0; }

.palette-panel { grid-area: palette; }
.script-panel { grid-area: script; }
.hint-bar { grid-area: hint; }

.cat-tabs { display: flex; gap: 6px; padding: 8px 10px; flex-wrap: wrap; border-bottom: 1px solid var(--stroke); background: rgba(0,0,0,0.18); }
.cat-tab {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  border: 2px solid transparent; background: rgba(255, 255, 255, 0.07); font-size: 15px; transition: all 0.15s;
}
.cat-tab:hover { background: rgba(255, 255, 255, 0.16); transform: scale(1.07); }
.cat-tab.active { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,0.12); }
.palette-group-title { font-size: 11.5px; color: var(--text-mute); padding: 8px 12px 4px; letter-spacing: 1px; }
.palette-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 20px; }
.palette-item { cursor: grab; user-select: none; }
.palette-item:active { cursor: grabbing; }

/* 拖动积木到左侧积木面板 = 删除区（Scratch 风格）：高亮提示松手即删除 */
.drop-delete { outline: 2px dashed #ff5470; outline-offset: -3px; background: rgba(255, 84, 112, 0.14) !important; }
.drop-delete .cat-tabs, .drop-delete .palette-list { filter: grayscale(0.5); opacity: 0.85; }
.drop-deleting { cursor: no-drop !important; }

/* ---------------- 积木（Scratch 风格：顶部凸起 + 底部凹槽，可咬合） ---------------- */
.blk {
  position: relative; color: #fff; font-size: 13px; min-width: 40px;
  background: var(--c, #4c97ff);
  border: 1px solid var(--c-deep, rgba(0, 0, 0, 0.28));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26), 0 2px 0 rgba(0, 0, 0, 0.22);
}
.blk.stack, .blk.cap {
  --notch-w: 18px;
  --notch-h: 5px;
  --notch-x: 14px;
  border-radius: 5px;
}
.blk.stack::before, .blk.cap::before {
  content: ''; position: absolute; left: var(--notch-x); top: calc(-1 * var(--notch-h));
  width: var(--notch-w); height: var(--notch-h);
  background: inherit; border-radius: 3px 3px 0 0;
}
.blk.stack::after, .blk.cap::after {
  content: ''; position: absolute; left: var(--notch-x); bottom: 0;
  width: var(--notch-w); height: var(--notch-h);
  background: var(--blk-void, #150c31);
  border-radius: 0 0 3px 3px;
}
.blk.cap { border-radius: 5px 5px 14px 14px; }
.blk.selected { outline: 2px solid #fff; outline-offset: 2px; z-index: 5; }
.blk.executing { filter: brightness(1.4); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 22px rgba(255, 255, 255, 0.6); }
.blk-head { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 7px 11px; min-height: 34px; }
.blk-txt { white-space: pre; }
.blk.reporter, .blk.boolean { display: inline-flex; align-items: center; padding: 4px 10px; min-height: 27px; border-radius: 20px; }
.blk.boolean { border-radius: 5px 17px 17px 5px / 5px 17px 17px 5px; }

.blk-input {
  background: rgba(255, 255, 255, 0.96); color: #1b1240; border: none; border-radius: 13px;
  padding: 3px 8px; font-size: 12.5px; font-family: var(--mono); font-weight: 700;
  width: 46px; text-align: center; outline: none; min-width: 28px;
}
.blk-input.text { width: 84px; text-align: left; font-family: var(--font); font-weight: 500; }
.blk-input:focus { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9); }

.blk-slot {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 26px; min-width: 46px; padding: 0 7px; border-radius: 13px;
  background: rgba(0, 0, 0, 0.32); border: 1.5px dashed rgba(255, 255, 255, 0.5);
  font-size: 11px; color: rgba(255, 255, 255, 0.75);
  transition: box-shadow 0.14s, background 0.14s;
}
.blk-slot.filled { padding: 0; border: none; background: transparent; min-width: 0; }
.blk-slot.num { border: none; background: transparent; padding: 0; min-width: 0; }
.blk-slot.accept { border-color: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.14); }
.blk-slot.accept.guide { background: rgba(127, 242, 255, 0.42); box-shadow: 0 0 0 3px rgba(127, 242, 255, 0.55); }
.blk-slot .slot-del {
  position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%;
  background: #ff5f6d; color: #fff; font-size: 11px; line-height: 16px; text-align: center;
  cursor: pointer; display: none; border: 1.5px solid #fff; z-index: 7;
}
.blk-slot.filled:hover .slot-del { display: block; }
.blk-slot-holder { position: relative; display: inline-flex; }

/* C 型积木：左臂 + 底唇，内部挖空
   框体使用深色(--c-dark)，与内部同色积木形成对比，便于看清嵌套层级 */
.blk-cbody { position: relative; padding: 6px 0 7px 16px; background: inherit; }
.blk-cbody::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 7px; width: 16px;
  background: inherit;
}
.blk-cbody.is-mid { padding-bottom: 0; }
.blk-cbody.is-mid::before { bottom: 0; }
.blk-cbody-inner {
  position: relative; min-height: 18px; background: var(--blk-void, #150c31);
  border-radius: 0 4px 4px 0; padding: 0;
  box-shadow: inset 0 3px 7px rgba(0, 0, 0, 0.35), inset 0 -2px 6px rgba(0, 0, 0, 0.22);
}
.blk-cbody-label {
  position: relative; padding: 4px 10px 4px 16px; font-size: 12.5px; color: #fff;
  background: var(--c-deep, var(--c-dark, var(--c))); min-height: 28px; display: flex; align-items: center;
}
.blk-del {
  position: absolute; right: -9px; top: -9px; width: 19px; height: 19px; border-radius: 50%;
  background: #ff5f6d; color: #fff; border: 1.5px solid #fff; font-size: 11px; line-height: 16px;
  text-align: center; cursor: pointer; display: none; z-index: 8;
}
.blk:hover > .blk-del { display: block; }

/* 脚本画布 */
.script-canvas {
  --blk-void: #150c31;
  position: relative; min-height: 100%; padding: 16px 14px 60px;
  transform-origin: 0 0;
  cursor: grab;
  background-color: #150c31;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 1.4px, transparent 1.4px);
  background-size: 24px 24px;
}
.script-canvas.panning { cursor: grabbing; }
.script-empty { color: var(--text-mute); font-size: 13px; text-align: center; padding: 40px 18px; line-height: 2; border: 2px dashed var(--stroke); border-radius: 12px; }
.script-empty b { color: var(--accent); }
.stack-list { display: flex; flex-direction: column; align-items: flex-start; }
.stack-block { margin-bottom: 0; }
.stack-item { display: block; }
.gap { position: relative; height: 0; width: 100%; min-width: 100px; }
.gap.guide::before {
  content: ''; position: absolute; left: 0; right: 0; top: -3px; height: 6px;
  background: rgba(127, 242, 255, 0.9); border-radius: 3px;
  box-shadow: 0 0 12px rgba(127, 242, 255, 0.85);
}
.gap-big { height: 140px; }
.gap-body-empty { height: 30px; }
.blk-cbody-inner > .gap-big { height: 40px; }

/* 拖拽中的积木与幽灵 */
.blk.drag-src { opacity: 0.28; }
.blk-ghost {
  position: fixed; z-index: 9999; pointer-events: none; opacity: 0.94;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.55));
  transform: scale(1.02);
}
.blk-ghost .blk-del, .blk-ghost .slot-del { display: none !important; }
.blk-ghost.multi { display: flex; flex-direction: column; align-items: flex-start; }

/* 积木右键菜单 */
.blk-menu {
  position: fixed; z-index: 10000; min-width: 128px;
  background: #1f1442; border: 1px solid var(--stroke-2); border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55); padding: 4px;
}
.blk-menu-item {
  padding: 9px 13px; font-size: 13px; cursor: pointer; border-radius: 7px; color: var(--text);
  white-space: nowrap;
}
.blk-menu-item:hover { background: rgba(127, 242, 255, 0.16); }
body.is-dragging { user-select: none; cursor: grabbing; }
body.is-dragging .script-canvas { cursor: grabbing; }

/* 缩放工具条 */
.zoom-bar { display: flex; align-items: center; gap: 2px; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--stroke); border-radius: 9px; padding: 2px; }
.zoom-bar .icon-btn.xs { width: 22px; height: 22px; font-size: 13px; line-height: 1; display: grid; place-items: center; }
.zoom-pct { font-size: 11px; font-family: var(--mono); min-width: 38px; text-align: center; color: var(--text-dim); }

/* 地图工坊：缩放控件 + 平移光标 */
.map-zoom-bar {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  background: rgba(0, 0, 0, 0.42); border: 1px solid var(--stroke); border-radius: 9px; padding: 3px;
}
.map-zoom-bar .icon-btn.xs {
  width: 24px; height: 24px; font-size: 14px; line-height: 1; display: grid; place-items: center;
  background: transparent; border: none;
}
.map-zoom-bar .icon-btn.xs:hover { background: rgba(255, 255, 255, 0.16); }
.editor-canvas-holder.panning, .editor-canvas-holder.panning canvas { cursor: grabbing; }

/* 调色板分组 */
.palette-sub { font-size: 11.5px; color: var(--text-dim); margin: 6px 0 -2px; letter-spacing: 0.4px; font-weight: 600; }

/* 底部运行栏 */
.hint-bar {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-radius: var(--radius); border: 1px solid var(--stroke);
  background: linear-gradient(90deg, rgba(76, 151, 255, 0.18), rgba(53, 224, 192, 0.14));
}
.hint-bar .hint-ic { font-size: 22px; }
.hint-bar .hint-text { flex: 1; font-size: 14px; letter-spacing: 0.3px; }
.hint-bar .hint-text small { display: block; color: var(--text-dim); font-size: 11.5px; margin-top: 2px; letter-spacing: 0; }
.run-btn {
  padding: 12px 30px; border-radius: 12px; border: none; cursor: pointer; font-weight: 800; letter-spacing: 1px;
  background: linear-gradient(135deg, #4c97ff, #35e0c0); color: #06182e; font-size: 15px;
  box-shadow: 0 10px 26px rgba(53, 224, 192, 0.32); display: inline-flex; align-items: center; gap: 8px;
}
.run-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(53, 224, 192, 0.45); }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); cursor: pointer; font-size: 16px; color: var(--text); }
.icon-btn:hover { background: rgba(255, 255, 255, 0.14); }

/* ---------------- 地图编辑器 ---------------- */
.editor-grid { display: grid; grid-template-columns: 1fr 300px; grid-template-rows: minmax(0, 1fr); gap: 14px; flex: 1; min-height: 0; }
.editor-canvas-holder { flex: 1; position: relative; min-height: 0; background: #150c31; }
.editor-canvas-holder canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tool-list { display: flex; flex-direction: column; gap: 8px; }
.tool-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px;
  background: var(--panel); border: 1px solid var(--stroke); cursor: pointer; transition: all 0.15s;
}
.tool-item:hover { background: var(--panel-2); }
.tool-item.active { border-color: var(--accent); background: rgba(76, 151, 255, 0.18); }
.tool-item .ti-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 14px; background: rgba(255,255,255,0.1); }
.tool-item .ti-tx b { display: block; font-size: 13px; }
.tool-item .ti-tx small { color: var(--text-mute); font-size: 11px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--stroke); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 11px 14px; background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim); font-weight: 600; font-size: 12px; position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--stroke); white-space: nowrap;
}
table.tbl td { padding: 10px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
table.tbl tr:hover td { background: rgba(255, 255, 255, 0.03); }
table.tbl tr:last-child td { border-bottom: none; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- 权限勾选 ---------------- */
.perm-groups { display: flex; flex-direction: column; gap: 16px; }
.perm-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-dim); font-weight: 600; letter-spacing: 0.5px; }
.perm-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.perm-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: 10px; background: var(--panel); border: 1px solid var(--stroke); cursor: pointer; transition: all 0.14s; }
.perm-item:hover { background: var(--panel-2); }
.perm-item.on { border-color: rgba(53, 224, 192, 0.55); background: rgba(53, 224, 192, 0.12); }
.perm-item .box { width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--stroke-2); display: grid; place-items: center; font-size: 11px; flex: none; }
.perm-item.on .box { background: var(--ok); border-color: var(--ok); color: #06251a; }
.perm-item span { font-size: 12.5px; }
.perm-item code { font-size: 10.5px; color: var(--text-mute); display: block; font-family: var(--mono); }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.3); border-radius: 12px; border: 1px solid var(--stroke); width: fit-content; margin-bottom: 18px; }
.tabs .tab { padding: 8px 18px; border-radius: 9px; cursor: pointer; color: var(--text-dim); font-size: 13.5px; transition: all 0.15s; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active { background: linear-gradient(135deg, var(--accent), #6f7bff); color: #fff; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 16px 18px; border-radius: 14px; background: var(--panel); border: 1px solid var(--stroke); position: relative; overflow: hidden; }
.stat-card .v { font-size: 28px; font-family: var(--mono); font-weight: 700; }
.stat-card .k { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat-card .ic { position: absolute; right: 12px; top: 12px; font-size: 22px; opacity: 0.5; }
.stat-card.a .v { color: #7cc0ff; } .stat-card.b .v { color: #c58cff; }
.stat-card.c .v { color: #62f0d0; } .stat-card.d .v { color: #ffc861; }

/* ---------------- 模态框 / 提示 ---------------- */
.modal-mask { position: fixed; inset: 0; z-index: 200; background: rgba(6, 3, 18, 0.72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 24px; animation: fade 0.16s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  background: linear-gradient(160deg, #1c1140, #150c31); border: 1px solid var(--stroke-2);
  border-radius: 18px; box-shadow: var(--shadow); animation: modal-in 0.2s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.modal.wide { max-width: 760px; }
@keyframes modal-in { from { transform: translateY(18px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--stroke); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--stroke); display: flex; gap: 10px; justify-content: flex-end; }
.modal .close { cursor: pointer; color: var(--text-dim); font-size: 20px; line-height: 1; }
.modal .close:hover { color: #fff; }

.toast-root { position: fixed; top: 74px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  padding: 11px 16px; border-radius: 12px; background: rgba(28, 17, 64, 0.96);
  border: 1px solid var(--stroke-2); box-shadow: var(--shadow); font-size: 13px;
  animation: toast-in 0.22s ease; max-width: 320px; display: flex; gap: 9px; align-items: flex-start;
}
.toast.ok { border-color: rgba(61, 220, 151, 0.6); }
.toast.err { border-color: rgba(255, 95, 109, 0.65); }
.toast.warn { border-color: rgba(255, 171, 25, 0.65); }
@keyframes toast-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading-mask { position: fixed; inset: 0; z-index: 400; background: rgba(6, 3, 18, 0.5); display: grid; place-items: center; }
.loading-spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.15); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 积木补充样式 ---------------- */
select.blk-input {
  width: auto; min-width: 44px; padding: 2px 4px; border-radius: 10px;
  font-family: var(--font); font-weight: 700; text-align: center;
  background: rgba(255, 255, 255, 0.95); color: #1b1240;
}
.blk-input::-webkit-outer-spin-button,
.blk-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.palette-preview, .palette-preview * { pointer-events: none; user-select: none; }
.palette-list { --blk-void: #1a1036; }
.palette-item { touch-action: none; }
.blk-live { touch-action: none; }

/* ---------------- 关卡 HUD：体力 / 星级 ---------------- */
.stage-sub {
  position: absolute; left: 0; right: 0; top: 42px; z-index: 6;
  display: flex; align-items: center; gap: 8px; padding: 0 12px; flex-wrap: wrap;
  pointer-events: none;
}
.star-track { display: flex; gap: 3px; padding: 3px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.42); border: 1px solid var(--stroke); }
.star-track .st { font-size: 15px; color: rgba(255, 255, 255, 0.22); line-height: 1; }
.star-track .st.on { color: #ffd257; text-shadow: 0 0 8px rgba(255, 210, 87, 0.7); }
.star-track .st.pending { color: rgba(255, 210, 87, 0.72); }
.target-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 9px; font-family: var(--mono);
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--stroke); color: var(--text-dim);
}
.stamina-chip {
  display: flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.42); border: 1px solid var(--stroke); font-size: 12px;
}
.stamina-bar { width: 62px; height: 8px; border-radius: 5px; background: rgba(0, 0, 0, 0.5); overflow: hidden; border: 1px solid var(--stroke); }
.stamina-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #35e0c0, #7ff2ff); transition: width 0.25s ease; }
.stamina-bar i.low { background: linear-gradient(90deg, #ff6b6b, #ffab19); }
.stamina-bar i.inf { background: linear-gradient(90deg, #4c97ff, #b06cff); }
.stamina-chip b { font-family: var(--mono); font-size: 11.5px; color: #8ff2c8; }

/* 三星结算 */
.star-result { margin: 0 0 18px; }
.star-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.big-star { font-size: 40px; line-height: 1; color: rgba(255, 255, 255, 0.2); animation: starPop 0.5s ease backwards; }
.big-star.on { color: #ffd257; text-shadow: 0 0 18px rgba(255, 210, 87, 0.75); }
.big-star:nth-child(2) { animation-delay: 0.14s; }
.big-star:nth-child(3) { animation-delay: 0.28s; }
@keyframes starPop { from { transform: scale(0.3) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
.star-notes { display: flex; flex-direction: column; gap: 5px; }
.star-note {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px;
  padding: 6px 10px; border-radius: 9px; background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke); color: var(--text-mute);
}
.star-note.got { color: #8ff2c8; border-color: rgba(143, 242, 200, 0.45); background: rgba(53, 224, 192, 0.1); }
.star-note small { font-size: 11px; opacity: 0.85; }

/* 大厅卡片上的要求标签 */
.req-chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 7px; }
.req-chip {
  font-size: 10.5px; padding: 2px 7px; border-radius: 8px; font-family: var(--mono);
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--stroke); color: var(--text-dim);
}
.req-chip.ship { color: #9fd8ff; border-color: rgba(120, 200, 255, 0.45); }
.req-chip.crack { color: #ffbf8a; border-color: rgba(255, 170, 120, 0.45); }
.req-chip.solar { color: #9fe6b4; border-color: rgba(120, 230, 160, 0.45); }
.target-chip.solar { color: #9fe6b4; border-color: rgba(120, 230, 160, 0.4); }

/* 舞台上的即时飘字（+1 体力 之类） */
.float-layer { position: absolute; inset: 0; z-index: 7; pointer-events: none; overflow: hidden; }
.float-tip {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 800; font-family: var(--mono); color: #8ff2c8;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85), 0 0 18px rgba(127, 242, 255, 0.5);
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  22% { opacity: 1; transform: translate(-50%, -80%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
.best-stars { font-size: 12px; color: #ffd257; letter-spacing: 1px; }
.badge.warning { color: #ffd257; }

/* ---------------- 桌面端面板滚动 ---------------- */
.scroll-y { overflow-y: auto; min-height: 0; }

/* ---------------- 底部备案信息 ---------------- */
.site-footer {
  flex: none; text-align: center; color: var(--text-mute); font-size: 12px;
  border-top: 1px solid var(--stroke); background: rgba(0, 0, 0, 0.18);
  padding: 14px 18px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}
.site-footer .foot-inner { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--text); }
.site-footer .foot-sep { opacity: 0.5; }

/* ---------------- 开关控件 ---------------- */
.switch {
  position: relative; width: 46px; height: 26px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid var(--stroke);
  cursor: pointer; transition: all 0.18s; flex: none;
}
.switch.on { background: linear-gradient(135deg, var(--accent), var(--accent-3)); border-color: transparent; }
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: all 0.18s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.switch.on .knob { left: 22px; }

/* ---------------- 班级 ---------------- */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.class-card { cursor: pointer; display: flex; flex-direction: column; gap: 9px; transition: all 0.18s; }
.class-card:hover { transform: translateY(-3px); border-color: rgba(140, 160, 255, 0.5); }
.class-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.class-detail > .card:nth-child(3) { grid-column: 1 / -1; }
.member-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.member-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 5px;
  border-radius: 30px; background: var(--panel); border: 1px solid var(--stroke); font-size: 12.5px;
}
.member-chip .x { cursor: pointer; color: var(--text-mute); margin-left: 2px; font-size: 11px; }
.member-chip .x:hover { color: #ff9aa4; }
.hw-list { display: flex; flex-direction: column; gap: 10px; }
.hw-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  border-radius: 11px; background: var(--panel); border: 1px solid var(--stroke);
}
.pick-list {
  max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--stroke); border-radius: 12px; padding: 10px; background: rgba(0, 0, 0, 0.14);
}
.pick-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--stroke); cursor: pointer; transition: all 0.14s;
}
.pick-item:hover { background: var(--panel-2); }
.pick-item.on { border-color: rgba(53, 224, 192, 0.55); background: rgba(53, 224, 192, 0.12); }
.pick-item .box {
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--stroke-2);
  display: grid; place-items: center; font-size: 11px; flex: none;
}
.pick-item.on .box { background: var(--ok, #35e0c0); border-color: var(--ok, #35e0c0); color: #06251a; }
.pick-item span { font-size: 13px; }
.pick-item code { font-size: 11px; color: var(--text-mute); display: block; font-family: var(--mono); }

@media (max-width: 900px) {
  .class-detail { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .play-layout { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "stage palette" "script script" "hint hint"; grid-template-rows: minmax(280px, 1fr) auto auto; }
  .studio { grid-template-columns: 1fr 300px; }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .play-layout { grid-template-columns: 1fr; grid-template-areas: "stage" "palette" "script" "hint"; }
  .studio, .editor-grid { grid-template-columns: 1fr; }
  .page { padding: 14px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand small { display: none; }
}

/* 平板 / 小平板：顶栏导航横向滚动，避免拥挤 */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .brand > div:last-child { display: none; }
  .nav { margin-left: 0; width: 100%; order: 3; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; }
  .user-chip .uname { display: none; }
}

/* 手机：单列、紧凑间距、更大触控区 */
@media (max-width: 600px) {
  .page { padding: 12px; }
  .studio, .editor-grid { grid-template-rows: minmax(46vh, auto) auto; }
  .play-layout { grid-template-rows: minmax(46vh, auto) auto auto auto; }
  .modal { max-width: 100%; margin: 8px; border-radius: 14px; }
  .modal.wide { max-width: 100%; }
  .map-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .perm-items { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .toolbar .search { min-width: 120px; max-width: none; }
  .btn.sm { padding: 7px 12px; }
  .btn { padding: 9px 14px; }
  .page-head h1 { font-size: 19px; }
}

/* 小屏手机：隐藏品牌文字与退出登录文字，仅留图标 */
@media (max-width: 520px) {
  .brand > div { display: none; }
  .logout-tx { display: none; }
  .topbar .btn.sm.ghost { padding: 6px 9px; }
}
