
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #1a1a2e; color: #e0e0e0;
  display: flex; flex-direction: column; height: 100vh; overflow: hidden; user-select: none;
}
.topbar-container {
  flex-shrink: 0;
  border-bottom: 1px solid #0f3460;
}
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px; background: #16213e; flex-shrink: 0;
  flex-wrap: wrap; overflow: hidden; min-width: 0;
}
.topbar-primary { padding: 7px 16px; }
.topbar-secondary { padding: 4px 16px; background: #131b30; border-top: 1px solid #0f3460; gap: 8px; }
.topbar h1 { font-size: 18px; font-weight: 700; color: #e94560; white-space: nowrap; }
.topbar .sep { width: 1px; height: 24px; background: #0f3460; flex-shrink: 0; }
.topbar button, .topbar select {
  padding: 5px 10px; border: 1px solid #0f3460; background: #1a1a2e; color: #e0e0e0;
  border-radius: 6px; cursor: pointer; font-size: 13px; font-family: inherit;
  white-space: nowrap; transition: all .15s; min-width: 0;
}
.topbar button:hover, .topbar select:hover { background: #0f3460; border-color: #e94560; }
.topbar button.active { background: #e94560; border-color: #e94560; color: #fff; }
.topbar .spacer { flex: 1; min-width: 8px; }
.topbar label { font-size: 12px; color: #aaa; display: flex; align-items: center; gap: 4px; min-width: 0; }
.topbar input[type=range] { width: 80px; accent-color: #e94560; }
.topbar input[type=color] { width: 32px; height: 28px; border: 1px solid #0f3460; border-radius: 4px; cursor: pointer; background: none; padding: 1px; }
.topbar input[type=number] { width: 40px; padding: 4px 6px; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 4px; font-size: 12px; text-align: center; }
.topbar select { padding: 6px 8px; font-size: 12px; }
.topbar-secondary button, .topbar-secondary select { padding: 4px 8px; font-size: 12px; }
.btn-group { display: flex; gap: 2px; }
.btn-group button { padding: 5px 8px !important; font-size: 14px !important; min-width: 28px; text-align: center; }
.main { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.panel { background: #16213e; border-right: 1px solid #0f3460; padding: 10px; overflow-y: auto; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 8px; }
.tool-panel { width: 80px; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tool-btn {
  width: 48px; height: 48px; border: 2px solid transparent; background: #1a1a2e; color: #ccc;
  border-radius: 10px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.tool-btn:hover { background: #0f3460; }
.tool-btn.active { border-color: #e94560; background: #0f3460; color: #e94560; }
.tool-btn .icon { font-size: 22px; line-height: 1; }
.canvas-area {
  flex: 1; background: #1a1a2e; min-width: 0;
  background-image: radial-gradient(circle, #222 1px, transparent 1px);
  background-size: 20px 20px; position: relative; overflow: hidden; min-height: 200px;
}
.canvas-area canvas { position: absolute; cursor: crosshair; image-rendering: pixelated; box-shadow: 0 0 30px rgba(233,69,96,0.2); }
.selection-toolbar {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: #16213e;
  border: 1px solid #0f3460; border-radius: 8px; z-index: 10; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.selection-toolbar button { padding: 4px 8px; border: 1px solid #0f3460; background: #1a1a2e; color: #ccc; border-radius: 4px; cursor: pointer; font-size: 13px; transition: all .15s; }
.selection-toolbar button:hover { background: #0f3460; border-color: #e94560; color: #e94560; }
.selection-toolbar .sep { width: 1px; height: 20px; background: #0f3460; margin: 0 2px; }
.selection-toolbar button.confirm-btn { background: #e94560; color: #fff; border-color: #e94560; }
.selection-toolbar button.confirm-btn:hover { background: #c73854; }
.selection-toolbar button.cancel-btn { color: #e94560; }
.right-panel { width: 220px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px; overflow-y: auto; background: #16213e; border-left: 1px solid #0f3460; }
.right-panel > div { flex-shrink: 0; }
.palette-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: all .1s; }
.swatch:hover { transform: scale(1.2); z-index: 2; }
.swatch.active { border-color: #e94560; box-shadow: 0 0 8px #e94560; }
.swatch.custom-color { border-style: dashed; border-color: #e94560; }
.current-colors { display: flex; gap: 8px; align-items: center; }
.current-colors .cc { width: 36px; height: 36px; border-radius: 6px; border: 2px solid #0f3460; }
.current-colors .cc.primary { border-color: #e94560; box-shadow: 0 0 6px rgba(233,69,96,0.5); }
.palette-actions { display: flex; gap: 4px; margin-top: 4px; }
.palette-actions button { flex: 1; padding: 4px; border-radius: 4px; border: 1px solid #0f3460; background: #1a1a2e; color: #ccc; cursor: pointer; font-size: 13px; }
.palette-actions button:hover { background: #0f3460; border-color: #e94560; }
.frame-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.frame-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: #1a1a2e; border-radius: 6px; cursor: pointer; border: 2px solid transparent; font-size: 12px; }
.frame-item:hover { background: #0f3460; }
.frame-item.active { border-color: #e94560; }
.frame-item .thumb { width: 32px; height: 32px; border-radius: 3px; image-rendering: pixelated; background: #111; }
.frame-item .num { color: #888; font-size: 11px; }
.frame-item .duration-badge { font-size: 10px; color: #e94560; background: rgba(233,69,96,0.15); padding: 1px 4px; border-radius: 3px; cursor: pointer; user-select: none; transition: all .15s; }
.frame-item .duration-badge:hover { background: rgba(233,69,96,0.3); }
.frame-item .del-btn { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; background: none; border: none; color: #888; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.frame-item .del-btn:hover { color: #e94560; background: #333; }
.frame-actions { display: flex; gap: 6px; }
.frame-actions button { flex: 1; padding: 6px; border-radius: 6px; border: 1px solid #0f3460; background: #1a1a2e; color: #ccc; cursor: pointer; font-size: 16px; }
.frame-actions button:hover { background: #0f3460; border-color: #e94560; }
.layer-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.layer-item { display: flex; align-items: center; gap: 4px; padding: 4px 6px; background: #1a1a2e; border-radius: 6px; cursor: pointer; border: 2px solid transparent; font-size: 11px; transition: all .1s; }
.layer-item:hover { background: #0f3460; }
.layer-item.active { border-color: #e94560; }
.layer-item .layer-vis { width: 20px; height: 20px; border-radius: 4px; border: 1px solid #0f3460; background: #1a1a2e; color: #ccc; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.layer-item .layer-vis:hover { border-color: #e94560; }
.layer-item .layer-vis.hidden { color: #555; }
.layer-item .layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: none; color: #e0e0e0; font-size: 11px; font-family: inherit; cursor: pointer; padding: 0; }
.layer-item .layer-name:focus { outline: 1px solid #e94560; border-radius: 2px; }
.layer-item .layer-opacity-slider { width: 36px; accent-color: #e94560; }
.layer-actions { display: flex; gap: 4px; margin-top: 4px; }
.layer-actions button { flex: 1; padding: 4px; border-radius: 4px; border: 1px solid #0f3460; background: #1a1a2e; color: #ccc; cursor: pointer; font-size: 13px; }
.layer-actions button:hover { background: #0f3460; border-color: #e94560; }
.preview-container {
  display: flex; justify-content: center; align-items: center;
  background: linear-gradient(45deg, #2a2a3e 25%, transparent 25%), linear-gradient(-45deg, #2a2a3e 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a3e 75%), linear-gradient(-45deg, transparent 75%, #2a2a3e 75%);
  background-size: 8px 8px; background-position: 0 0, 0 4px, 4px -4px, -4px 0px; background-color: #1e1e30;
  border-radius: 6px; padding: 6px; min-height: 60px;
}
.preview-container canvas { image-rendering: pixelated; max-width: 100px; max-height: 100px; width: 100px; height: 100px; }
.shortcuts-section { cursor: pointer; }
.shortcuts-section h3 { display: flex; align-items: center; gap: 4px; }
.shortcuts-section h3::after { content: '▾'; font-size: 10px; color: #666; transition: transform .2s; }
.shortcuts-section.collapsed h3::after { transform: rotate(-90deg); }
.shortcuts-section.collapsed .shortcuts-content { display: none; }
.anim-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #16213e; border-top: 1px solid #0f3460; flex-shrink: 0; flex-wrap: wrap; }
.anim-bar button { padding: 6px 12px; }
.anim-bar .fps-label { font-size: 12px; color: #aaa; }
.anim-bar input[type=range] { accent-color: #e94560; width: 100px; }
.dialog-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 999; }
.dialog { background: #16213e; border: 1px solid #0f3460; border-radius: 12px; padding: 20px; max-width: 400px; width: 90%; }
.dialog h3 { margin-bottom: 12px; }
.dialog input, .dialog select { width: 100%; padding: 8px 12px; margin-bottom: 10px; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 6px; font-family: inherit; font-size: 14px; }
.dialog .btn-row { display: flex; gap: 8px; justify-content: flex-end; }
.dialog button { padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; }
.dialog .btn-primary { background: #e94560; color: #fff; }
.dialog .btn-secondary { background: #1a1a2e; color: #ccc; border: 1px solid #0f3460; }
.dialog .preview-row { display: flex; gap: 12px; align-items: center; margin: 10px 0; }
.dialog .preview-row canvas { border: 1px solid #0f3460; border-radius: 6px; image-rendering: pixelated; }
.dialog .preview-row span { color: #888; font-size: 20px; }
.dialog .option-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.dialog .option-row select { width: auto; padding: 6px 10px; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 6px; }
.dialog .option-row input[type=range] { accent-color: #e94560; width: 100px; }
.dialog .file-drop { border: 2px dashed #0f3460; border-radius: 8px; padding: 20px; text-align: center; color: #888; cursor: pointer; margin-bottom: 10px; transition: all .2s; }
.dialog .file-drop:hover { border-color: #e94560; color: #e94560; }
.dialog .file-drop.has-file { border-color: #44891a; color: #a3ce27; }
.dialog .import-file-item { width: 48px; height: 48px; border-radius: 4px; border: 2px solid #0f3460; overflow: hidden; cursor: pointer; position: relative; flex-shrink: 0; transition: all .15s; }
.dialog .import-file-item:hover { border-color: #e94560; }
.dialog .import-file-item.active { border-color: #e94560; box-shadow: 0 0 6px rgba(233,69,96,0.5); }
.dialog .import-file-item canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.dialog .import-file-item .file-index { position: absolute; bottom: 1px; right: 2px; font-size: 9px; color: #aaa; background: rgba(0,0,0,0.6); padding: 0 3px; border-radius: 2px; line-height: 1.3; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #e94560; color: #fff; padding: 10px 24px; border-radius: 20px; font-size: 13px; z-index: 1000; animation: toastIn .3s ease, toastOut .3s 1.7s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
.progress-bar { width: 100%; height: 8px; background: #1a1a2e; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-bar .progress-fill { height: 100%; background: #e94560; border-radius: 4px; transition: width .2s; }
.dialog .field-group { margin: 8px 0; }
.dialog .field-group label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #ccc; margin-bottom: 4px; }
.dialog .field-group input[type=number] { width: 60px; padding: 4px 8px; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 4px; font-size: 13px; text-align: center; }
.dialog .field-group input[type=checkbox] { accent-color: #e94560; width: 16px; height: 16px; }
.dialog .field-group select { width: auto; padding: 4px 8px; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 4px; font-size: 13px; }
.dialog .field-group input[type=range] { accent-color: #e94560; width: 100px; }
.dialog .status-text { font-size: 12px; color: #888; margin-top: 4px; }
.dialog textarea { width: 100%; height: 120px; padding: 8px; margin: 8px 0; background: #1a1a2e; border: 1px solid #0f3460; color: #e0e0e0; border-radius: 6px; font-family: 'Consolas', 'Courier New', monospace; font-size: 11px; resize: vertical; word-break: break-all; }
.dialog .btn-row .btn-copy { background: #0f3460; color: #e0e0e0; border: 1px solid #0f3460; }
.dialog .btn-row .btn-copy:hover { background: #1a4a8a; }

/* === Footer & compliance === */
.site-footer {
  flex-shrink: 0;
  padding: 10px 16px;
  background: #131b30;
  border-top: 1px solid #0f3460;
  text-align: center;
  font-size: 12px;
  color: #888;
  line-height: 1.7;
}
.site-footer a {
  color: #aaa;
  text-decoration: none;
  margin: 0 4px;
  transition: color .15s;
}
.site-footer a:hover { color: #e94560; text-decoration: underline; }
.site-footer-mini {
  padding: 4px 12px;
  font-size: 11px;
  line-height: 1;
  background: #0d1424;
  border-top: 1px solid #1a2340;
}
.site-footer .beian-icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.site-footer .police-icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.site-footer .mainsite-link { color: #e94560; font-weight: 500; }
.mainsite-btn {
  padding: 4px 10px;
  background: #0f3460;
  color: #e0e0e0 !important;
  border: 1px solid #0f3460;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.mainsite-btn:hover { background: #e94560; border-color: #e94560; color: #fff !important; text-decoration: none; }

/* 右栏备案信息模块 - 始终展开,小字 */
.beian-section { cursor: default; }
.beian-section h3 { font-size: 12px !important; padding: 8px 12px !important; }
.beian-section .shortcuts-content {
  max-height: none !important;
  padding: 0 12px 10px !important;
}
.beian-section a:hover { color: #e94560 !important; }

/* === 新手引导覆盖层 === */
.tutorial-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  animation: tut-fade-in 0.3s ease;
}
@keyframes tut-fade-in { from {opacity:0} to {opacity:1} }
.tutorial-card {
  background: linear-gradient(180deg, #1a1f3a 0%, #131830 100%);
  border: 2px solid #e94560;
  border-radius: 14px;
  padding: 32px 36px;
  max-width: 520px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 30px rgba(233,69,96,0.2);
  color: #e0e0e0;
  text-align: center;
}
.tutorial-step-num {
  display: inline-block;
  background: #e94560;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.tutorial-icon { font-size: 64px; margin: 12px 0; line-height: 1; }
.tutorial-title { font-size: 22px; font-weight: 600; margin-bottom: 12px; color: #fff; }
.tutorial-desc { font-size: 14px; line-height: 1.7; color: #b8b8c8; margin-bottom: 8px; }
.tutorial-hint { font-size: 12px; color: #888; margin-top: 16px; padding: 8px 12px; background: rgba(233,69,96,0.1); border-radius: 6px; display: inline-block; }
.tutorial-progress { display: flex; gap: 6px; justify-content: center; margin: 20px 0 8px; }
.tutorial-dot { width: 8px; height: 8px; border-radius: 50%; background: #2a2f4a; transition: all 0.2s; }
.tutorial-dot.active { background: #e94560; transform: scale(1.4); }
.tutorial-dot.done { background: #5a3a5a; }
.tutorial-btns { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.tutorial-btn {
  padding: 8px 18px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all 0.15s;
}
.tutorial-btn-primary { background: #e94560; color: #fff; }
.tutorial-btn-primary:hover { background: #ff5577; }
.tutorial-btn-secondary { background: #2a2f4a; color: #e0e0e0; }
.tutorial-btn-secondary:hover { background: #3a3f5a; }
.tutorial-btn-skip { background: transparent; color: #888; }
.tutorial-btn-skip:hover { color: #aaa; }

/* === 示例作品卡片 === */
.demo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 12px 0;
}
.demo-card {
  background: #1a1f3a;
  border: 2px solid #2a2f4a;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.demo-card:hover {
  border-color: #e94560;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233,69,96,0.2);
}
.demo-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  image-rendering: pixelated;
  background: #2a2a3e;
  border-radius: 4px;
  margin-bottom: 8px;
}
.demo-card-name { font-size: 13px; font-weight: 500; color: #fff; margin-bottom: 4px; }
.demo-card-desc { font-size: 11px; color: #888; }
.demo-card-info { font-size: 10px; color: #666; margin-top: 4px; }
