/* ==========================================================================
   INKFLOW · 在线画板
   ========================================================================== */

:root {
  --bg: #0c0b0a;
  --bg-2: #121110;
  --panel: #171514;
  --panel-2: #1e1b19;
  --panel-3: #262220;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f4eee7;
  --dim: #a79d94;
  --mute: #6c645d;
  --accent: #ff6b4a;
  --accent-soft: rgba(255, 107, 74, 0.14);
  --accent-ink: #1a0904;
  --teal: #4dd0c0;
  --gold: #ffc247;

  --font-display: 'Bricolage Grotesque', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'WenQuanYi Zen Hei', sans-serif;
  --font-ui: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'WenQuanYi Zen Hei', sans-serif;
  --font-mono: 'Space Grotesk', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-panel: 0 18px 44px -22px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 30px 70px -28px rgba(0, 0, 0, 0.85);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 8% -12%, rgba(255, 107, 74, 0.10), transparent 62%),
    radial-gradient(900px 520px at 102% -6%, rgba(77, 208, 192, 0.075), transparent 58%),
    radial-gradient(760px 620px at 50% 118%, rgba(255, 194, 71, 0.05), transparent 60%);
  z-index: 0;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sprite symbol { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ shell */

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 60px 1fr;
  height: 100vh;
  height: 100dvh;
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px 0 14px;
  background: linear-gradient(180deg, rgba(24, 21, 20, 0.96), rgba(16, 14, 13, 0.92));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: 0 0 auto;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), #ff9d5c 55%, var(--gold));
  box-shadow: 0 8px 20px -10px rgba(255, 107, 74, 0.9);
}
.brand-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.06em;
}
.brand-text em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--mute);
  letter-spacing: 0.22em;
}

.doc-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.doc-title {
  width: min(320px, 40vw);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.doc-title:hover { background: rgba(255, 255, 255, 0.07); }
.doc-title:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

.doc-size {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--mute);
  white-space: nowrap;
}

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

.segmented {
  display: flex;
  align-items: center;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.seg-btn {
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--dim);
  transition: color 0.14s ease, background 0.14s ease;
}
.seg-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.seg-btn .glyph { font-size: 16px; line-height: 1; }
.seg-btn:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.seg-btn:disabled { opacity: 0.32; cursor: not-allowed; }
.zoom .zoom-label {
  width: 52px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
}
.zoom .zoom-fit {
  width: auto;
  padding: 0 9px;
  font-size: 11.5px;
  color: var(--dim);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: var(--line-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(180deg, #ff7d5e, var(--accent));
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -14px rgba(255, 107, 74, 0.95);
}
.btn.primary:hover { background: linear-gradient(180deg, #ff8b6f, #ff7857); }
.btn.ghost { color: var(--dim); }
.btn.ghost:hover { color: var(--text); }

.icon-plain {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--mute);
  transition: color 0.14s ease, background 0.14s ease;
}
.icon-plain svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-plain:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

/* -------------------------------------------------------------- workspace */

.workspace {
  display: grid;
  grid-template-columns: 62px 1fr 296px;
  min-height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------- toolrail */

.toolrail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 0;
  background: linear-gradient(180deg, rgba(23, 21, 20, 0.9), rgba(14, 13, 12, 0.9));
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}
.toolrail::-webkit-scrollbar { display: none; }

.tool-btn {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--dim);
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  animation: rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--i) * 26ms);
}
.tool-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tool-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); transform: translateY(-1px); }
.tool-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 74, 0.28);
}
.tool-btn.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255, 107, 74, 0.9);
}
.tool-btn .key {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  color: var(--mute);
}

.rail-divider {
  width: 26px;
  height: 1px;
  margin: 7px 0;
  background: var(--line);
  flex: 0 0 auto;
}

.rail-color {
  width: 34px;
  height: 34px;
  margin-top: auto;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.9);
  transition: transform 0.16s ease;
}
.rail-color:hover { transform: scale(1.06); }

/* -------------------------------------------------------------- stage area */

.stage-area {
  display: grid;
  grid-template-rows: 1fr 30px;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.045) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg-2);
}

.stage-scroll {
  overflow: auto;
  padding: 40px;
  min-height: 0;
}

.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  min-height: 100%;
  position: relative;
}

.paper {
  position: relative;
  border-radius: 4px;
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.06);
  background: #fff;
  touch-action: none;
}
.paper canvas {
  display: block;
  border-radius: 4px;
}
#overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#board { cursor: crosshair; }

.cursor-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.remote-cursor {
  position: absolute;
  transform: translate(-2px, -2px);
  display: flex;
  align-items: flex-start;
  gap: 4px;
  animation: cursorIn 0.22s ease-out;
}
.remote-cursor svg { width: 14px; height: 14px; fill: currentColor; stroke: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.remote-cursor span {
  margin-top: 12px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 600;
  color: #16110f;
  white-space: nowrap;
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.8);
}

.text-editor {
  position: absolute;
  z-index: 5;
  transform: translate(-2px, -2px);
}
.text-editor textarea {
  min-width: 240px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: rgba(20, 18, 17, 0.96);
  box-shadow: var(--shadow-pop);
  font-size: 18px;
  resize: none;
  outline: none;
}

/* --------------------------------------------------------------- statusbar */

.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: rgba(15, 14, 13, 0.9);
  font-size: 11.5px;
  color: var(--mute);
}
.status-chip {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}
.status-spacer { flex: 1; }
.status-chip.peers { color: var(--teal); background: rgba(77, 208, 192, 0.12); }
.status-chip.dot { color: var(--mute); }
.status-chip.dot.online { color: var(--teal); background: rgba(77, 208, 192, 0.12); }
.status-chip.dot.reconnecting { color: var(--gold); background: rgba(255, 194, 71, 0.12); }

/* --------------------------------------------------------------- inspector */

.inspector {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  background: var(--line);
  border-left: 1px solid var(--line);
}

.panel {
  padding: 14px 14px 16px;
  background: linear-gradient(180deg, var(--panel), #141211);
  animation: rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.panel:nth-child(1) { animation-delay: 40ms; }
.panel:nth-child(2) { animation-delay: 90ms; }
.panel:nth-child(3) { animation-delay: 140ms; }
.panel:nth-child(4) { animation-delay: 190ms; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.panel-count {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--mute);
  letter-spacing: 0;
}

.color-head { display: flex; gap: 12px; align-items: flex-start; }
.color-preview {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 8px 18px -12px rgba(0, 0, 0, 0.9);
  cursor: pointer;
}
.color-preview input { position: absolute; inset: -6px; width: 200%; height: 200%; border: none; padding: 0; background: none; cursor: pointer; opacity: 0; }
.color-preview-chip {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: #1f1a17;
  background-image: linear-gradient(45deg, rgba(255,255,255,.12) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.12) 75%),
    linear-gradient(45deg, rgba(255,255,255,.12) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.12) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}
.color-preview-chip::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--swatch, #1f1a17);
}
.color-meta { flex: 1; min-width: 0; }
.hex-input {
  width: 100%;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: lowercase;
}
.hex-input:focus { outline: none; border-color: var(--accent); }

.swatches {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin-top: 9px;
}
.swatch {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.swatch:hover { transform: scale(1.16); }
.swatch.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }

.field {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  font-size: 12px;
  color: var(--dim);
}
.field output {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  min-width: 46px;
  text-align: right;
}
.field input[type='number'],
.field input[type='text'] {
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
}
.field input:focus { outline: none; border-color: var(--accent); }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: none;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent) var(--pct, 100%), rgba(255, 255, 255, 0.12) var(--pct, 100%));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.8);
}
input[type='range']::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); }
input[type='range']::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: #fff; }

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--dim);
  cursor: pointer;
}
.toggle input { accent-color: var(--accent); width: 14px; height: 14px; }

.bg-picker { display: flex; gap: 6px; }
.bg-chip {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.bg-chip:hover { transform: translateY(-2px); }
.bg-chip.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }
.bg-chip.transparent {
  background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.18) 75%),
    linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.18) 75%);
  background-size: 10px 10px;
  background-position: 0 0, 5px 5px;
  background-color: #2a2624;
}

.brush-preview {
  height: 62px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 6px, transparent 6px 12px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
#brushDot {
  border-radius: 50%;
  background: currentColor;
  display: block;
}

/* ----------------------------------------------------------------- layers */

.layers-panel { display: flex; flex-direction: column; }
.layer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.layer-item:hover { background: rgba(255, 255, 255, 0.07); }
.layer-item.active { border-color: rgba(255, 107, 74, 0.45); background: var(--accent-soft); }
.layer-item .eye {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--mute);
  flex: 0 0 auto;
}
.layer-item .eye:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.layer-item .eye svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.layer-item.hidden-layer .layer-name { opacity: 0.42; text-decoration: line-through; }
.layer-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-name input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12.5px;
}
.layer-thumb {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: #fff;
  background-size: cover;
  flex: 0 0 auto;
}
.layer-actions {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}
.mini-btn {
  flex: 1;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  color: var(--dim);
  transition: color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}
.mini-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mini-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.mini-btn.danger:hover { color: #ff7a5c; border-color: rgba(255, 107, 74, 0.4); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.stats div { text-align: center; padding: 8px 4px; border-radius: 9px; background: rgba(255, 255, 255, 0.035); }
.stats dt { font-size: 10.5px; color: var(--mute); }
.stats dd { margin: 3px 0 0; font-family: var(--font-mono); font-size: 15px; font-weight: 500; }

/* ----------------------------------------------------------------- sheets */

.sheet {
  border: none;
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text);
  max-width: min(92vw, 520px);
  box-shadow: var(--shadow-pop);
}
.sheet.wide { max-width: min(94vw, 880px); }
.sheet::backdrop { background: rgba(6, 5, 5, 0.62); backdrop-filter: blur(4px); }
.sheet-body {
  background: linear-gradient(180deg, #1d1a19, #141211);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  animation: sheetIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.sheet-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.head-actions { display: flex; align-items: center; gap: 8px; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.preset {
  padding: 11px 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.preset:hover { border-color: rgba(255, 107, 74, 0.5); background: var(--accent-soft); transform: translateY(-2px); }
.preset strong { display: block; font-size: 13px; }
.preset span { font-family: var(--font-mono); font-size: 10.5px; color: var(--mute); }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; grid-template-columns: 42px 1fr; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  max-height: 64vh;
  overflow-y: auto;
  padding-right: 4px;
}
.work-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.work-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 107, 74, 0.45);
  box-shadow: 0 22px 44px -26px rgba(0, 0, 0, 0.95);
}
.work-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.work-meta { padding: 10px 12px 12px; }
.work-meta h4 { margin: 0 0 3px; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-meta span { font-family: var(--font-mono); font-size: 10.5px; color: var(--mute); }
.work-actions { display: flex; gap: 6px; margin-top: 10px; }
.work-actions button {
  flex: 1;
  height: 28px;
  border-radius: 8px;
  font-size: 11.5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  transition: color 0.14s ease, background 0.14s ease;
}
.work-actions button:hover { color: var(--text); background: rgba(255, 255, 255, 0.1); }
.work-actions button.danger:hover { color: #ff7a5c; }
.sheet-empty { text-align: center; color: var(--mute); font-size: 13px; padding: 34px 0 20px; }

.collab-body { display: flex; flex-direction: column; gap: 14px; }
.collab-desc { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.6; }
.collab-body .field { grid-template-columns: 48px 1fr; margin-top: 0; }
.collab-actions { display: flex; gap: 9px; }
.room-card {
  padding: 14px;
  border-radius: 13px;
  border: 1px dashed rgba(77, 208, 192, 0.4);
  background: rgba(77, 208, 192, 0.06);
}
.room-link-row { display: flex; gap: 8px; }
.room-link-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.peer-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.peer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
}
.peer i { width: 9px; height: 9px; border-radius: 50%; display: block; }

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 11px;
  background: rgba(28, 25, 23, 0.97);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  animation: toastIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.error { border-color: rgba(255, 107, 74, 0.55); color: #ffb59f; }
.toast.ok { border-color: rgba(77, 208, 192, 0.5); color: #9fe8de; }
.toast.out { animation: toastOut 0.24s ease forwards; }

/* -------------------------------------------------------------- animation */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sheetIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.97); }
}
@keyframes cursorIn {
  from { opacity: 0; transform: translate(-2px, -2px) scale(0.7); }
  to { opacity: 1; transform: translate(-2px, -2px) scale(1); }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 58px 1fr 264px; }
  .doc-size { display: none; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 54px 1fr; }
  .inspector {
    position: fixed;
    top: 60px;
    right: 0;
    bottom: 0;
    width: 280px;
    z-index: 40;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: -20px 0 50px -30px rgba(0, 0, 0, 0.9);
  }
  .inspector.open { transform: translateX(0); }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { padding: 0 10px; }
  .doc-title { width: min(220px, 34vw); }
}

@media (max-width: 620px) {
  .brand-text { display: none; }
  .zoom { display: none; }
  .stage-scroll { padding: 18px; }
}
