/* Kairos Canvas: controls and component states. Generated from the validated visual baseline. */

/* Opening controls and custom pointer */
.kairos-lockup {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  user-select: none;
}

.intro-logo {
  filter: drop-shadow(0 1px 0 rgba(255,255,255,.95)) drop-shadow(0 3px 9px rgba(255,255,255,.72));
}

.kairos-flare {
  width: 11px;
  height: 31px;
  flex: 0 0 auto;
  background: linear-gradient(165deg, #ff755f 0 42%, #7468ee 43% 100%);
  clip-path: polygon(58% 0, 100% 0, 61% 42%, 92% 42%, 0 100%, 27% 53%, 4% 53%);
  filter: drop-shadow(0 2px 3px rgba(116,104,238,.16));
}

.kairos-type {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}

.kairos-word {
  font-family: var(--font-sans);
  font-size: 23px;
  font-style: italic;
  font-weight: 850;
  letter-spacing: 0;
  line-height: .82;
  color: #5f56dc;
  background: linear-gradient(100deg, #ff755f 0%, #8d64e7 48%, #3f72ed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: .25px rgba(255,255,255,.48);
}

.kairos-label {
  margin-top: 4px;
  color: #6f61b8;
  font-family: var(--font-mono);
  font-size: 6px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.brand-logo .kairos-flare { width: 9px; height: 25px; }
.brand-logo .kairos-word { font-size: 19px; }
.brand-logo .kairos-label { font-size: 5px; margin-top: 3px; }

.intro-guide {
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(17,18,22,.18);
  border-radius: 7px;
  background: rgba(255,255,255,.72);
  color: #17191d;
  font-size: 11px;
  font-weight: 550;
  box-shadow: 0 3px 12px rgba(31,35,40,.05);
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.intro-guide:hover {
  background: #fff;
  border-color: rgba(17,18,22,.34);
  transform: translateY(-1px);
}

.intro-start {
  position: relative;
  width: 208px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 8px;
  background: #111216;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  box-shadow: 0 14px 30px rgba(17,18,22,.18);
  overflow: hidden;
  will-change: transform;
  transition: color .2s ease, box-shadow .2s ease, transform .28s cubic-bezier(.2,.75,.25,1);
}

.intro-start::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--warm), var(--lime));
}

.intro-start span, .intro-start svg { position: relative; z-index: 1; }
.intro-start svg { width: 18px; height: 18px; transition: transform .2s ease; }
.intro-start:hover { color: var(--lime); box-shadow: 0 18px 38px rgba(17,18,22,.25); }
.intro-start:hover svg { transform: translateX(4px); }
.intro-start:focus-visible, .intro-guide:focus-visible { outline: 3px solid rgba(111,97,242,.25); outline-offset: 4px; }

.intro-screen,
.intro-screen * {
  cursor: url('/assets/kairos-cursor.svg') 4 4, auto !important;
}

.canvas-size-select {
    min-width: 124px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-2);
    color: var(--text-1);
  }

.icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-2);
    transition: background 0.12s, color 0.12s;
  }

.icon-btn:hover { background: var(--bg-3); color: var(--text-0); }

.icon-btn svg { width: 16px; height: 16px; }

.key-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-2);
    background: var(--bg-2);
    cursor: pointer;
    transition: background 0.12s;
  }

.key-status:hover { background: var(--bg-3); }

.key-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-3);
  }

.key-dot.active { background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.panel-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 14px;
    color: var(--text-1);
    letter-spacing: 0.02em;
  }

.panel-title-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
  }

.gen-tabs {
    display: flex;
    gap: 2px;
    padding: 4px;
    margin: 4px 16px 12px;
    background: var(--bg-2);
    border-radius: 8px;
  }

.gen-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-2);
    border-radius: 5px;
    text-align: center;
    transition: all 0.15s;
  }

.gen-tab.active {
    background: var(--bg-4);
    color: var(--text-0);
  }

.gen-tab:hover:not(.active) { color: var(--text-1); }

.field {
    margin-bottom: 14px;
  }

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
    margin-bottom: 6px;
  }

.field-label .hint {
    color: var(--text-3);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-sans);
    font-size: 11px;
  }

.input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-0);
    transition: border-color 0.12s, background 0.12s;
  }

.input:focus { border-color: var(--text-3); background: var(--bg-3); }

textarea.input {
    min-height: 90px;
    line-height: 1.5;
  }

.select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-0);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23888578' d='M5 6L0 0h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
  }

.select:focus { border-color: var(--text-3); }

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

.ratio-chip {
    padding: 6px 4px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-2);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    text-align: center;
    transition: all 0.12s;
  }

.ratio-chip.active {
    background: var(--accent);
    color: var(--bg-0);
    border-color: var(--accent);
  }

.ratio-chip:hover:not(.active) { background: var(--bg-3); color: var(--text-0); }
.ratio-chip.disabled { opacity: .38; cursor: not-allowed; }

.upload-slot {
    width: 100%;
    min-height: 90px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    background: var(--bg-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-3);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.12s;
    position: relative;
    overflow: hidden;
  }

.upload-slot:hover { border-color: var(--text-3); color: var(--text-1); background: var(--bg-3); }

.upload-slot.has-image { border-style: solid; padding: 0; }

.upload-slot img { width: 100%; height: 90px; object-fit: cover; display: block; }

.upload-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.7);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
  }

.primary-btn {
    width: 100%;
    padding: 11px 16px;
    background: var(--accent);
    color: var(--bg-0);
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
  }

.primary-btn:hover:not(:disabled) {
    background: #e1ff5c;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212,255,58,0.25);
  }

.primary-btn:disabled {
    background: var(--bg-3);
    color: var(--text-3);
    cursor: not-allowed;
  }

.primary-btn .spinner {
    width: 12px; height: 12px;
    border: 1.5px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
  }

@keyframes spin { to { transform: rotate(360deg); } }

.ghost-btn {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-2);
    color: var(--text-1);
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.12s;
  }

.ghost-btn:hover { background: var(--bg-3); color: var(--text-0); border-color: var(--text-3); }

.tool-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--text-2);
    transition: all 0.12s;
  }

.tool-btn:hover { background: var(--bg-3); color: var(--text-0); }

.tool-btn.active { background: var(--bg-4); color: var(--accent); }

.tool-btn svg { width: 15px; height: 15px; }

.tool-divider { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.zoom-display {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-1);
    padding: 0 8px;
    min-width: 50px;
    text-align: center;
  }

.ruler-line {
    position: absolute;
    background: rgba(255,255,255,0.18);
  }

.marquee-box {
    position: absolute;
    border: 1px dashed rgba(212,255,58,0.95);
    background: rgba(212,255,58,0.12);
    pointer-events: none;
    z-index: 6;
  }

.canvas-layer {
    position: absolute;
    transform-origin: center;
    will-change: transform;
  }

.canvas-layer img {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }

.canvas-layer.text-layer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px dashed rgba(212,255,58,0.35);
    background: rgba(17,17,20,0.12);
  }

.canvas-layer.text-layer .text-content {
    width: 100%;
    color: inherit;
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.3;
    pointer-events: none;
  }

.canvas-layer.selected {
    outline: 2px solid var(--accent);
    outline-offset: 0;
  }

.canvas-connector-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

.canvas-connector-layer line {
    stroke: rgba(212,255,58,0.9);
    stroke-width: 2.5;
    stroke-linecap: round;
  }

.canvas-connector-layer circle {
    fill: rgba(212,255,58,0.95);
  }

.selection-handles {
    position: absolute;
    pointer-events: none;
    --handle-scale: 1;
  }

.handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border: 1.5px solid var(--bg-0);
    border-radius: 2px;
    pointer-events: auto;
    z-index: 100;
  }

.handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }

.handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }

.handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }

.handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }

.handle:not(.rot) { transform: scale(var(--handle-scale)); }

.handle.rot {
    top: -30px; left: 50%; transform: translateX(-50%) scale(var(--handle-scale));
    border-radius: 50%; cursor: grab;
  }

.canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    text-align: center;
    gap: 12px;
    pointer-events: none;
  }

.canvas-empty .big {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 36px;
    color: var(--text-2);
    line-height: 1;
  }

.canvas-empty .small {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-3);
  }

.right-tab {
    flex: 1;
    padding: 12px 8px;
    font-size: 11px;
    color: var(--text-2);
    text-align: center;
    border-bottom: 2px solid transparent;
    transition: all 0.12s;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
  }

.right-tab.active {
    color: var(--text-0);
    border-bottom-color: var(--accent);
  }

.right-tab:hover:not(.active) { color: var(--text-1); }

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 2px;
    transition: all 0.1s;
  }

.layer-item:hover { background: var(--bg-2); }

.layer-item.selected { background: var(--bg-3); border-color: var(--line); }

.layer-thumb {
    width: 36px; height: 36px;
    background: var(--bg-3);
    border-radius: 4px;
    flex-shrink: 0;
    overflow: hidden;
    background-image:
      linear-gradient(45deg, #2a2b33 25%, transparent 25%),
      linear-gradient(-45deg, #2a2b33 25%, transparent 25%),
      linear-gradient(45deg, transparent 75%, #2a2b33 75%),
      linear-gradient(-45deg, transparent 75%, #2a2b33 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    background-color: #1a1b21;
  }

.layer-thumb img { width: 100%; height: 100%; object-fit: contain; }

.layer-info {
    flex: 1;
    min-width: 0;
  }

.layer-name {
    font-size: 12px;
    color: var(--text-0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

.layer-name input {
    width: 100%;
    background: var(--bg-0);
    border: 1px solid var(--accent);
    padding: 1px 4px;
    border-radius: 3px;
  }

.layer-meta {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-3);
    margin-top: 2px;
  }

.layer-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.1s;
  }

.layer-item:hover .layer-actions, .layer-item.selected .layer-actions { opacity: 1; }

.layer-actions .icon-btn { width: 22px; height: 22px; }

.layer-actions .icon-btn svg { width: 12px; height: 12px; }

.layer-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-3);
    font-size: 11px;
  }

.layer-empty .icon { font-size: 28px; margin-bottom: 10px; opacity: 0.3; }

.properties-panel {
    border-top: 1px solid var(--line);
    padding: 12px 14px;
    background: var(--bg-2);
  }

.props-row {
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
  }

.props-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

.props-input {
    background: var(--bg-3);
    border: 1px solid var(--line);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-0);
    font-family: var(--font-mono);
    width: 100%;
  }

.props-slider {
    grid-column: 2 / 4;
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-3);
    height: 4px;
    border-radius: 2px;
    outline: none;
  }

.props-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
  }

.props-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
  }

.history-item {
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-3);
    cursor: pointer;
    position: relative;
    border: 1px solid var(--line);
    transition: all 0.12s;
  }

.history-item:hover { border-color: var(--accent); transform: scale(1.02); }

.history-item.selected { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(212,255,58,0.4) inset; }

.history-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

.history-item .badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.75);
    color: white;
    font-family: var(--font-mono);
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
  }

.history-actions {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-2);
  }

.history-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.72);
    color: var(--text-1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    font-size: 12px;
  }

.history-item.selected .history-check {
    color: var(--bg-0);
    background: var(--accent);
    border-color: var(--accent);
  }

.help-text {
    font-size: 11px;
    color: var(--text-3);
    line-height: 1.6;
    padding: 10px 12px;
    background: var(--bg-2);
    border-radius: 6px;
    border-left: 2px solid var(--accent-dim);
  }

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

.help-text code {
    font-family: var(--font-mono);
    background: var(--bg-3);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
  }

.toast {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-0);
    box-shadow: var(--shadow-sm);
    min-width: 220px;
    max-width: 360px;
    animation: toastIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
  }

.toast.error { border-left-color: var(--danger); }

.toast.warn { border-left-color: var(--warm); }

.toast .toast-title {
    font-weight: 500;
    margin-bottom: 2px;
  }

.toast .toast-msg {
    color: var(--text-2);
    font-size: 11px;
  }

@keyframes toastIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

.progress-title {
    font-size: 12px;
    color: var(--text-0);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-3);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
  }

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    animation: progSlide 1.4s ease-in-out infinite;
  }

@keyframes progSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }

.progress-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-3);
    margin-top: 6px;
  }

.panel-toggle {
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    color: var(--text-2);
    transition: background .18s ease, color .18s ease, transform .18s ease;
  }

.panel-toggle:hover { background: var(--bg-3); color: var(--text-0); transform: translateY(-1px); }

.panel-toggle svg { width: 15px; height: 15px; }

.key-status {
    background: #f4f5f6;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    padding: 5px 9px;
    font-family: var(--font-sans);
    font-size: 10px;
  }

.key-status:hover { background: #eceef0; }

.key-dot.active { background: var(--lime); box-shadow: 0 0 0 3px rgba(130,217,31,.14); }

.canvas-size-select {
    min-width: 132px;
    padding: 7px 10px;
    border-color: #e1e4e8;
    border-radius: 8px;
    background: #f7f8f9;
    color: var(--text-1);
    font-size: 11px;
  }

#exportBtn {
    width: 36px;
    background: linear-gradient(135deg, #6f61f2, #5b4de5);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 5px 14px rgba(89,74,224,.22);
  }

#exportBtn:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 7px 17px rgba(89,74,224,.28); }

.panel-title {
    font-family: var(--font-sans);
    font-style: normal;
    font-weight: 650;
    font-size: 13px;
    color: var(--text-0);
  }

.panel-title-num {
    font-family: var(--font-sans);
    font-size: 9px;
    color: var(--text-3);
    background: var(--bg-2);
    padding: 3px 6px;
    border-radius: 4px;
  }

.gen-tabs {
    gap: 3px;
    margin: 2px 12px 14px;
    padding: 3px;
    border-radius: 7px;
    background: #f0f1f3;
  }

.gen-tab {
    min-width: 0;
    padding: 7px 3px;
    border-radius: 5px;
    font-size: 10px;
    color: var(--text-2);
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
  }

.gen-tab.active {
    background: #fff;
    color: var(--text-0);
    box-shadow: 0 1px 5px rgba(29,33,40,.1);
  }

.gen-tab:hover:not(.active) { color: var(--text-0); background: rgba(255,255,255,.48); }

.field { margin-bottom: 15px; }

.field-label {
    margin-bottom: 7px;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #686e78;
  }

.input, .select {
    background: #f5f6f7;
    border-color: transparent;
    border-radius: 7px;
    color: var(--text-0);
    font-size: 11px;
    box-shadow: inset 0 0 0 1px rgba(31,35,40,.035);
  }

.input:hover, .select:hover { background-color: #f0f1f3; }

.input:focus, .select:focus {
    background-color: #fff;
    border-color: #aeb4bd;
    box-shadow: 0 0 0 3px rgba(116,104,238,.09);
  }

textarea.input { min-height: 104px; }

.ratio-grid { gap: 5px; }

.ratio-chip {
    padding: 7px 3px;
    border-color: #e4e6e9;
    border-radius: 6px;
    background: #fff;
    color: var(--text-2);
    font-family: var(--font-sans);
    font-size: 9px;
  }

.ratio-chip.active {
    background: #eeeafe;
    border-color: rgba(111,97,242,.25);
    color: var(--accent-dim);
    box-shadow: inset 0 0 0 1px rgba(111,97,242,.08);
  }

.ratio-chip:hover:not(.active) { background: #f1f3f4; color: var(--text-0); }

.upload-slot {
    min-height: 98px;
    border-color: #ccd1d7;
    border-radius: 8px;
    background: #f8f9fa;
    color: var(--text-2);
  }

.upload-slot:hover { border-color: var(--violet); background: #f7f6ff; color: var(--violet); transform: translateY(-1px); }

.primary-btn {
    min-height: 40px;
    border-radius: 8px;
    background: linear-gradient(100deg, #6558e9 0%, #8b57e8 48%, #ff755f 100%);
    background-size: 125% 100%;
    color: #fff;
    font-weight: 550;
    box-shadow: 0 8px 20px rgba(102,82,223,.2);
  }

.primary-btn:hover:not(:disabled) {
    background-position: 100% 0;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 11px 27px rgba(102,82,223,.27);
  }

.primary-btn:disabled { background: #e4e6e9; color: #9da2aa; }

.ghost-btn {
    border-color: #e1e4e8;
    border-radius: 7px;
    background: #fff;
    color: var(--text-1);
  }

.ghost-btn:hover { background: #f3f4f5; border-color: #cfd3d8; color: var(--text-0); }

.help-text { background: #f6f7f8; border-left-color: var(--violet); color: var(--text-2); }

@keyframes toolbarEnter {
    from { opacity: 0; transform: translate(-50%, -8px) scale(.98); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
  }

.tool-btn {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    border-radius: 7px;
    color: #656b75;
    transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
  }

.tool-btn:hover { background: #eff1f3; color: #17191d; transform: translateY(-1px); }

.tool-btn.active {
    background: #efedff;
    color: var(--accent-dim);
    box-shadow: inset 0 0 0 1px rgba(111,97,242,.08), 0 3px 9px rgba(89,73,223,.1);
  }

.tool-divider { background: #e1e4e8; }

.canvas-layer.selected { outline-color: var(--violet); }

.selection-handles { border-color: var(--violet); }

.handle { border-color: var(--violet); background: #fff; box-shadow: 0 1px 3px rgba(34,38,45,.16); }

.handle.rot { background: var(--violet); }

.canvas-empty {
    width: min(380px, calc(100% - 48px));
    height: auto;
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -46%);
    align-items: center;
    gap: 10px;
    padding: 30px 26px;
    border: 1px solid rgba(31,35,40,.07);
    border-radius: 12px;
    background: rgba(255,255,255,.82);
    box-shadow: 0 18px 50px rgba(36,40,47,.1);
    backdrop-filter: blur(10px);
    pointer-events: auto;
    animation: emptyEnter .55s cubic-bezier(.2,.8,.25,1) both;
  }

@keyframes emptyEnter {
    from { opacity: 0; transform: translate(-50%, -42%) scale(.98); }
    to { opacity: 1; transform: translate(-50%, -46%) scale(1); }
  }

.empty-mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff755f, #7468ee);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    transform: skewX(-7deg);
    margin-bottom: 4px;
  }

.canvas-empty .big {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 650;
    color: var(--text-0);
  }

.canvas-empty .small {
    max-width: 280px;
    font-family: var(--font-sans);
    font-size: 11px;
    line-height: 1.65;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-2);
    text-align: center;
  }

.empty-actions { display: flex; gap: 8px; margin-top: 8px; }

.empty-action {
    min-width: 104px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #dfe2e6;
    border-radius: 7px;
    background: #fff;
    color: var(--text-1);
    font-size: 11px;
    font-weight: 550;
    transition: transform .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease;
  }

.empty-action:hover { transform: translateY(-1px); background: #f3f4f5; color: var(--text-0); }

.empty-action.primary { background: linear-gradient(100deg, #6558e9, #ff755f); border-color: transparent; color: #fff; box-shadow: 0 7px 17px rgba(102,82,223,.2); }

.empty-action.primary:hover { color: #fff; box-shadow: 0 9px 22px rgba(102,82,223,.27); }

.zoom-display { font-family: var(--font-sans); color: var(--text-1); }

.right-tab {
    padding: 8px 6px 9px;
    border: 0;
    border-radius: 6px 6px 0 0;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-2);
  }

.right-tab.active { background: #f2f0ff; color: var(--accent-dim); border-bottom-color: transparent; }

.right-tab:hover:not(.active) { background: #f7f8f9; color: var(--text-0); }

.layer-item {
    padding: 7px;
    border-radius: 7px;
    margin-bottom: 3px;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
  }

.layer-item:hover { background: #f4f5f6; transform: translateX(-1px); }

.layer-item.selected { background: #f0efff; border-color: rgba(116,104,238,.25); }

.layer-thumb { border-radius: 5px; background-color: #f0f1f3; }

.layer-name { color: var(--text-0); }

.properties-panel {
    padding: 14px;
    background: #f8f9fa;
    border-top-color: #e3e5e8;
  }

.properties-panel::before {
    content: '属性';
    display: block;
    margin-bottom: 10px;
    color: var(--text-0);
    font-size: 11px;
    font-weight: 650;
  }

.props-label { font-family: var(--font-sans); letter-spacing: 0; color: var(--text-2); }

.props-input { background: #fff; border-color: #e1e4e8; color: var(--text-0); font-family: var(--font-sans); }

.props-slider { background: #dfe2e6; }

.props-slider::-webkit-slider-thumb { background: var(--violet); }

.props-slider::-moz-range-thumb { background: var(--violet); }

.history-item { border-color: #e1e4e8; background: #f1f2f3; }

.history-item:hover { border-color: var(--violet); }

.history-item.selected { border-color: var(--violet); box-shadow: 0 0 0 1px rgba(116,104,238,.26) inset; }

.history-item.selected .history-check { background: var(--violet); border-color: var(--violet); color: #fff; }
.history-item-actions { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.history-item:hover .history-item-actions { opacity: 1; }
.history-copy, .history-delete, .material-delete { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: rgba(24,25,31,.76); color: #fff; font-size: 15px; cursor: pointer; }
.history-copy:hover { background: var(--violet); }
.history-delete:hover, .material-delete:hover { background: #c8465c; }

@keyframes contextualEnter {
    from { opacity: 0; transform: translate(-50%, 7px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }

.toast {
    background: rgba(255,255,255,.97);
    border-color: rgba(31,35,40,.09);
    color: var(--text-0);
    box-shadow: var(--shadow-sm);
  }

.progress-title { color: var(--text-0); }

.progress-bar { background: #e7e9ec; }

.progress-bar::after { background: linear-gradient(90deg, transparent, var(--violet), var(--accent), transparent); }

/* Screenshot-aligned generation, tools and layers */
.internal-tool { display: none !important; }

.panel-header { height: 52px; padding: 0 16px; }
.panel-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.panel-spark { color: #6357ef; font-size: 16px; }
.panel-add {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #30343b;
  font-size: 20px;
  line-height: 1;
}

/* The editing controls live beside the selected object, not in a second global toolbar. */
.canvas-toolbar { display: none; }
.canvas-layer.text-layer { background: transparent; border-color: transparent; }

.canvas-layer.shape-layer svg, .canvas-layer.brush-layer svg { width: 100%; height: 100%; display: block; overflow: visible; }
.canvas-layer.artboard-layer { background: #fff; box-shadow: 0 12px 28px rgba(15, 16, 25, .16); border: 1px solid rgba(31, 31, 40, .24); }
.artboard-label { position: absolute; top: -23px; left: 0; color: #4f4a63; font: 11px var(--font-mono); white-space: nowrap; }
.brush-preview { position: absolute; inset: 0; pointer-events: none; z-index: 90; }
.tool-popover { position: fixed; z-index: 1000; width: 222px; padding: 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-md); color: var(--text-1); font-size: 12px; }
.tool-popover-title { font-weight: 600; margin-bottom: 9px; color: var(--text-0); }
.tool-popover label { display: grid; grid-template-columns: 48px 1fr 20px; align-items: center; gap: 8px; margin-top: 8px; }
.tool-popover input[type="color"] { width: 100%; height: 28px; border: 0; background: none; padding: 0; cursor: pointer; }
.tool-popover select { width: 100%; min-width: 0; height: 28px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-3); color: var(--text-1); font-size: 11px; }
.fill-toggle { width: 26px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-3); color: var(--text-2); font-size: 10px; }
.fill-toggle.active { border-color: var(--accent); color: var(--accent); }
.canvas-text-input { position: absolute; z-index: 120; min-width: 240px; min-height: 64px; padding: 5px 8px; resize: both; border: 1px solid var(--violet); border-radius: 3px; outline: none; background: rgba(255,255,255,.96); line-height: 1.3; box-shadow: 0 6px 18px rgba(44, 38, 110, .14); }
.text-frame-preview { position: absolute; z-index: 105; min-width: 2px; min-height: 2px; border: 1px dashed var(--violet); background: rgba(116,104,238,.08); pointer-events: none; }
.photopea-modal { position: fixed; z-index: 2000; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(11,12,16,.46); backdrop-filter: blur(5px); }
.photopea-modal[hidden] { display: none; }
.photopea-shell { display: flex; flex-direction: column; width: min(1280px, 96vw); height: min(820px, 92vh); overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: #1d1e23; box-shadow: 0 28px 80px rgba(0,0,0,.42); }
.photopea-head { display: flex; align-items: center; justify-content: space-between; height: 42px; padding: 0 10px 0 15px; background: #282a30; color: #f4f5f7; font: 12px var(--font-sans); }
.photopea-head button { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: #d8dbe1; font-size: 20px; cursor: pointer; }
.photopea-head button:hover { background: #3a3d45; color: #fff; }
.photopea-actions { display: flex; gap: 3px; }
.photopea-actions button { display: grid; place-items: center; }
.photopea-actions svg { width: 16px; height: 16px; }
.photopea-shell iframe { width: 100%; flex: 1; border: 0; background: #1d1e23; }
.element-toolbar { position: absolute; z-index: 110; display: inline-flex; flex-wrap: nowrap; align-items: center; gap: 5px; min-height: 34px; padding: 4px 6px; border: 1px solid rgba(31,35,40,.12); border-radius: 8px; background: rgba(255,255,255,.98); box-shadow: 0 7px 22px rgba(34,38,45,.16); white-space: nowrap; transform: scale(var(--ui-scale, 1)); transform-origin: top center; }
.element-toolbar label { display: flex; align-items: center; gap: 3px; color: #666d77; font: 10px var(--font-sans); }
.element-toolbar input[type="color"] { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.element-toolbar input[type="number"] { width: 38px; height: 24px; padding: 0 3px; border: 0; border-radius: 4px; background: #f3f4f6; color: #3c4149; font-size: 10px; text-align: center; }
.element-toolbar select { max-width: 84px; height: 24px; border: 0; border-radius: 4px; background: #f3f4f6; color: #3c4149; font-size: 10px; }
.element-number span { color: #9399a2; font-weight: 600; }
.element-sep { width: 1px; height: 19px; margin: 0 1px; background: #e3e5e8; }
.element-icon { width: 25px; height: 25px; border: 0; border-radius: 4px; background: transparent; color: #5f6570; cursor: pointer; font-size: 15px; }
.element-icon:hover, .element-icon.active { background: #efedff; color: #5a4ce6; }
.element-icon.danger:hover { background: #fff0f0; color: #d84a4a; }
.selection-toolbar { position: fixed; z-index: 1000; top: 78px; left: 50%; display: flex; gap: 3px; padding: 5px; border: 1px solid rgba(31,35,40,.1); border-radius: 8px; background: rgba(255,255,255,.97); box-shadow: 0 8px 22px rgba(34,38,45,.14); transform: translateX(-50%); }
.selection-toolbar { display: none !important; }
#startGroup, #ungroupLayer { display: none !important; }
.selection-toolbar button { width: 31px; height: 29px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-1); cursor: pointer; }
.selection-toolbar button svg { width: 16px; height: 16px; }
.selection-toolbar button:hover { background: #efedff; color: var(--accent-dim); }
.shape-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.shape-options button { height: 28px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-3); color: var(--text-2); font-size: 11px; }
.shape-options button.active { border-color: var(--accent); color: var(--accent); }
.materials-panel { padding: 12px; overflow: auto; }
.materials-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 12px; color: var(--text-1); }
.materials-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.material-card { position: relative; aspect-ratio: 1.25; }
.material-item { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 0; overflow: hidden; background: var(--bg-3); color: var(--text-2); cursor: grab; }
.material-item:hover { border-color: var(--accent); }
.material-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.material-delete { position: absolute; top: 5px; right: 5px; opacity: 0; }
.material-card:hover .material-delete { opacity: 1; }
.materials-empty { grid-column: 1 / -1; color: var(--text-3); font-size: 12px; line-height: 1.6; padding: 10px 2px; }
.projects-panel { padding: 12px; overflow: auto; }
.projects-list { display: flex; flex-direction: column; gap: 5px; }
.project-row { display: flex; align-items: center; gap: 3px; min-height: 38px; padding: 3px; border: 1px solid transparent; border-radius: 7px; }
.project-row:hover { background: #f6f6f8; }
.project-row.active { border-color: rgba(93,85,243,.22); background: #efedff; }
.project-open { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; height: 30px; padding: 0 7px; border: 0; background: transparent; color: var(--text-1); font-size: 12px; text-align: left; cursor: pointer; }
.project-open span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-dot { width: 8px; height: 8px; border-radius: 2px; background: #6a5eea; }
.project-rename { width: 28px; height: 28px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); cursor: pointer; }
.project-rename:hover { background: rgba(255,255,255,.75); color: var(--accent-dim); }
.shape-thumb { width: 30px; height: 24px; margin: 7px auto; border-radius: 2px; }
.project-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-2); color: var(--text-1); font: 12px var(--font-sans); cursor: pointer; }
.project-btn:hover { color: var(--text-0); border-color: var(--accent); }
.project-btn svg { width: 15px; height: 15px; }
.topbar-history { display: flex; gap: 2px; margin-left: 6px; }
.panel-add:hover { background: #f0f1f3; }
.platform-panel { height: calc(100vh - 148px); min-height: 480px; padding: 0 !important; overflow: hidden; }
.platform-panel-head { display: flex; justify-content: space-between; align-items: center; height: 38px; padding: 0 12px; border-bottom: 1px solid #e7e9ec; color: var(--text-1); font-size: 12px; }
.platform-panel-head a { color: #6255e7; font-size: 10px; text-decoration: none; }
.platform-frame { width: 100%; height: calc(100% - 38px); border: 0; background: #fff; }

.gen-tabs {
  margin: 0 15px 16px;
  padding: 0;
  gap: 22px;
  border-bottom: 1px solid #e7e9ec;
  border-radius: 0;
  background: transparent;
}

.gen-tab {
  flex: 1;
  padding: 10px 2px 9px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #666d77;
  font-size: 11px;
  box-shadow: none;
}

.gen-tab.active {
  border-bottom-color: #5d55f3;
  background: transparent;
  color: #5147e8;
  box-shadow: none;
}

.gen-tab:hover:not(.active) { background: transparent; color: #24272d; }

.side-tool {
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 6px;
  color: #343941;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.side-tool + .side-tool { margin-top: 2px; }
.side-tool:hover { background: #f1f2f4; transform: translateY(-1px); }
.side-tool.active { background: #efedff; color: #5a4ce6; }
.side-tool svg { width: 18px; height: 18px; }
.side-tool span { font-size: 9px; }

.canvas-toolbar .tool-btn { width: 32px; height: 32px; flex-basis: 32px; }
.canvas-toolbar .tool-btn svg { width: 17px; height: 17px; }

.right-tabs {
  padding: 8px 14px 0;
  gap: 24px;
  background: #fff;
}
.right-tab {
  padding: 10px 0 9px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #737983;
}
.right-tab.active {
  border-bottom-color: #5d55f3;
  background: transparent;
  color: #5147e8;
}
.right-tab:hover:not(.active) { background: transparent; color: #282c32; }

.layer-list { padding: 10px 12px; }
.layer-item {
  min-height: 46px;
  gap: 7px;
  padding: 5px 6px;
  border: 0;
  border-radius: 6px;
}
.layer-item:hover { transform: none; background: #f6f6f8; }
.layer-item.selected { background: #efedff; border-color: transparent; }
.layer-thumb { width: 32px; height: 32px; border: 1px solid #d9dce1; border-radius: 3px; }
.layer-name { font-size: 11px; font-weight: 500; }
.layer-meta { display: none; }
.layer-actions { opacity: 1; gap: 0; }
.layer-actions .icon-btn { width: 25px; height: 25px; border: 0; background: transparent; color: #5f6570; }
.layer-actions .icon-btn:hover { background: rgba(255,255,255,.72); color: #272b31; }
.layer-actions .icon-btn.active { color: #5b4de5; }

.properties-empty {
  padding: 46px 18px;
  color: #9a9fa8;
  font-size: 11px;
  text-align: center;
}
.properties-panel { border-top: 0; background: #fff; padding: 16px 14px; }
.properties-panel::before { display: none; }
