:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-soft: #11182b;
  --panel: rgba(20, 29, 52, 0.86);
  --panel-strong: rgba(28, 39, 70, 0.96);
  --line: rgba(154, 174, 220, 0.18);
  --text: #eef4ff;
  --muted: #9cadc8;
  --accent: #7dd3fc;
  --accent-2: #c084fc;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.2), transparent 34rem),
    radial-gradient(circle at 80% 5%, rgba(192, 132, 252, 0.18), transparent 30rem),
    linear-gradient(135deg, #080c18 0%, #0b1020 45%, #10172a 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(125, 211, 252, 0.55);
}

.app-shell {
  width: min(1880px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 980px;
  margin-bottom: 12px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 14px;
  font-size: 17px;
}

.subtitle {
  max-width: 980px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-links {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
}

.ghost-link:hover {
  border-color: rgba(125, 211, 252, 0.58);
}

.hero-card {
  display: flex;
  min-width: 280px;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--warning);
  box-shadow: 0 0 24px var(--warning);
}

.status-dot.ready {
  background: var(--success);
  box-shadow: 0 0 24px var(--success);
}

.status-dot.busy {
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent);
  animation: pulse 0.9s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(0.8);
    opacity: 0.65;
  }
  to {
    transform: scale(1.2);
    opacity: 1;
  }
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(640px, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.workspace.dev-open {
  grid-template-columns: 300px minmax(620px, 1fr) 300px;
}

.control-panel,
.stage-panel,
.side-panel,
.api-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.control-panel,
.side-panel {
  align-self: start;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 211, 252, 0.45) rgba(8, 13, 26, 0.34);
}

.control-panel::-webkit-scrollbar,
.side-panel::-webkit-scrollbar {
  width: 8px;
}

.control-panel::-webkit-scrollbar-thumb,
.side-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.45);
}

.control-panel .panel-section:first-child {
  padding-bottom: 18px;
}

.panel-section {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

label {
  display: grid;
  gap: 9px;
  margin: 13px 0;
  color: var(--text);
  font-size: 14px;
}

select,
input[type="range"] {
  width: 100%;
}

select,
input[type="text"],
input[type="color"] {
  padding: 11px 12px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0c1324;
}

input[type="color"] {
  height: 44px;
  padding: 5px;
  cursor: pointer;
}

input[type="range"] {
  accent-color: var(--accent);
}

output {
  float: right;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.upload-box {
  min-height: 96px;
  place-items: center;
  padding: 16px;
  text-align: center;
  border: 1px dashed rgba(125, 211, 252, 0.52);
  border-radius: 22px;
  background: rgba(125, 211, 252, 0.08);
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box span {
  font-weight: 800;
}

.upload-box small {
  color: var(--muted);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.action-row button,
.toolbar-actions button {
  padding: 11px 13px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  cursor: pointer;
}

.action-row .primary-action {
  border-color: color-mix(in srgb, var(--accent) 62%, white 8%);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, transparent), rgba(192, 132, 252, 0.2));
}

.utility-row {
  margin-top: 10px;
}

.presentation-form {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.presentation-form h2 {
  margin-bottom: 10px;
}

.micro-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.control-group {
  margin: 16px 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 18px;
  background: rgba(125, 211, 252, 0.07);
}

.concept-group {
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.11), rgba(192, 132, 252, 0.07));
}

.group-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.control-group p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.stage-panel::before {
  content: none;
}

.step-list {
  display: grid;
  gap: 10px;
}

.step-button {
  width: 100%;
  padding: 12px;
  color: var(--muted);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.step-button.active {
  color: var(--text);
  border-color: rgba(125, 211, 252, 0.65);
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.18), rgba(192, 132, 252, 0.12));
}

.step-button strong {
  display: block;
  margin-bottom: 5px;
}

.state-grid {
  display: grid;
  gap: 10px;
}

.state-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.state-grid strong,
.state-grid span {
  display: block;
}

.state-grid span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.stage-panel {
  position: sticky;
  top: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100vh - 36px);
  min-height: 720px;
  overflow: hidden;
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.stage-toolbar span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

#origamiCanvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  cursor: grab;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(125, 211, 252, 0.08), transparent 45%),
    #080d1a;
  background-size: 36px 36px, 36px 36px, auto, auto;
}

#origamiCanvas:active {
  cursor: grabbing;
}

.api-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 760px;
  overflow: hidden;
}

.api-panel.collapsed {
  display: none;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.tab-button {
  padding: 15px 8px;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button.active {
  color: var(--text);
  background: rgba(125, 211, 252, 0.1);
}

.tab-content {
  display: none;
  margin: 0;
  padding: 20px;
  overflow: auto;
  color: #c9d7ef;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.tab-content.active {
  display: block;
}

@media (max-width: 1180px) {
  .workspace,
  .workspace.dev-open {
    grid-template-columns: 300px minmax(560px, 1fr);
  }

  .stage-panel {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    min-height: 720px;
  }

  .side-panel {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1.05fr 1fr 0.85fr;
    gap: 1px;
    background: var(--line);
  }

  .side-panel .panel-section {
    border-bottom: 0;
    background: var(--panel);
  }

  .api-panel {
    grid-column: 1 / -1;
    min-height: 520px;
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100vw - 20px, 760px);
    padding-top: 16px;
  }

  .hero,
  .workspace,
  .workspace.dev-open,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding-top: min(680px, calc(72vh + 26px));
  }

  .control-panel,
  .side-panel {
    position: static;
    max-height: none;
    height: auto;
    overflow: visible;
  }

  .stage-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    height: min(680px, 72vh);
    min-height: 560px;
    max-height: calc(100vh - 20px);
    overflow: hidden;
    z-index: 30;
    box-shadow: 0 28px 100px rgba(0, 0, 0, 0.58);
  }

  #origamiCanvas {
    min-height: 0;
  }
}


.output-section {
  border-top: 2px solid rgba(125, 211, 252, 0.24);
}

.timeline-section {
  border-top: 2px solid rgba(192, 132, 252, 0.22);
}

.state-section {
  border-top: 2px solid rgba(251, 191, 36, 0.22);
}



.stage-object-ui-layer {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 96px));
  height: 220px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  transition: none;
}

.object-center-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.48), transparent);
  box-shadow: 0 0 18px rgba(125, 211, 252, 0.18);
}

.object-center-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  color: rgba(238, 244, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 999px;
  background:
    radial-gradient(circle at center, rgba(125, 211, 252, 0.10), transparent 58%),
    rgba(8, 13, 26, 0.08);
  box-shadow:
    inset 0 0 28px rgba(125, 211, 252, 0.10),
    0 0 30px rgba(125, 211, 252, 0.12);
  transform: translate(-50%, -50%);
}

.object-center-ring::before,
.object-center-ring::after {
  content: "";
  position: absolute;
  background: rgba(125, 211, 252, 0.48);
}

.object-center-ring::before {
  width: 150px;
  height: 1px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.object-center-ring::after {
  width: 1px;
  height: 150px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.object-center-ring span {
  position: relative;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(8, 13, 26, 0.62);
}

.stage-help-card {
  position: absolute;
  z-index: 5;
  top: 132px;
  right: 20px;
  width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(125, 211, 252, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.11), rgba(192, 132, 252, 0.07));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(18px);
  pointer-events: none;
}

.help-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.stage-help-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.stage-help-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.stage-view-controls {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(160px, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px 16px;
  border-top: 1px solid rgba(125, 211, 252, 0.22);
  background: linear-gradient(135deg, rgba(8, 13, 26, 0.92), rgba(20, 29, 52, 0.82));
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.view-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 168px;
}

.view-control-head strong {
  color: var(--text);
  font-size: 14px;
}

.view-control-head button {
  padding: 7px 11px;
  color: var(--accent);
  border: 1px solid rgba(125, 211, 252, 0.34);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
  cursor: pointer;
}

.stage-view-controls label {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 10px;
  align-items: center;
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.stage-view-controls label input {
  grid-column: 1 / -1;
}

.stage-view-controls input[type="range"] {
  accent-color: var(--accent);
}

@media (max-width: 860px) {
  .stage-object-ui-layer {
    width: min(420px, calc(100% - 60px));
    height: 180px;
  }

  /* 状态说明卡片文字已全局放开，不再按屏幕截断 */

  .stage-view-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: auto;
    margin: 0;
    transform: none;
  }

  .stage-view-controls .view-control-head {
    grid-column: 1 / -1;
  }
}


/* 状态说明卡片在所有屏幕下保持固定样式，不额外响应 */


/* 状态说明卡片全局固定，此处无覆盖规则 */
