:root {
  color-scheme: light;
  --ink: #13233f;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #059669;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --line: #dce4ef;
  --surface: rgba(255, 255, 255, 0.9);
  --shadow: 0 20px 50px rgba(37, 99, 235, 0.1);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 5%, #dbeafe 0, transparent 30rem),
    radial-gradient(circle at 95% 90%, #e0e7ff 0, transparent 28rem),
    #f7f9fc;
}

button,
select,
input,
textarea {
  font: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.subtitle {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.status-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 126px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-chip[data-state="listening"] {
  color: var(--green);
}

.status-chip[data-state="listening"] .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.12);
}

.status-chip[data-state="error"] {
  color: var(--red);
}

.status-chip[data-state="error"] .status-dot {
  background: var(--red);
}

.status-chip[data-state="speaking"] {
  color: var(--blue);
}

.status-chip[data-state="speaking"] .status-dot {
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.45fr);
  gap: 24px;
}

.control-panel,
.transcript-panel,
.parser-panel,
.canvas-panel,
.help-panel,
.quality-panel {
  border: 1px solid rgba(220, 228, 239, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.quality-panel {
  margin-top: 24px;
  padding: 28px 32px;
}

.quality-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.quality-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 22px;
  gap: 12px;
}

.quality-metrics div {
  display: grid;
  padding: 14px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #f8fafc;
  gap: 5px;
}

.quality-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.quality-metrics strong {
  color: var(--blue-dark);
  font-size: 1.05rem;
}

.quality-results {
  display: grid;
  max-height: 310px;
  margin: 16px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  gap: 7px;
}

.quality-results li {
  padding: 10px 12px;
  border-left: 4px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.78rem;
}

.quality-results li[data-state="passed"] {
  border-left-color: #22c55e;
}

.quality-results li[data-state="failed"] {
  border-left-color: #ef4444;
  background: #fef2f2;
  color: #991b1b;
}

.control-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 32px 30px;
  text-align: center;
}

.control-panel > p {
  color: var(--muted);
  line-height: 1.65;
}

.microphone-visual {
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  margin-bottom: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-radius: inherit;
  opacity: 0;
}

.microphone-visual.is-listening .pulse-ring {
  animation: pulse 1.8s ease-out infinite;
}

.microphone-icon {
  position: relative;
  width: 56px;
  height: 70px;
}

.microphone-capsule {
  position: absolute;
  top: 0;
  left: 16px;
  width: 24px;
  height: 43px;
  border-radius: 14px;
  background: var(--blue);
}

.microphone-capsule::after {
  position: absolute;
  right: -8px;
  bottom: -9px;
  width: 36px;
  height: 31px;
  border: 4px solid var(--blue);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  content: "";
}

.microphone-stem {
  position: absolute;
  bottom: 0;
  left: 26px;
  width: 4px;
  height: 17px;
  border-radius: 4px;
  background: var(--blue);
}

.microphone-stem::after {
  position: absolute;
  right: -9px;
  bottom: 0;
  width: 22px;
  height: 4px;
  border-radius: 4px;
  background: var(--blue);
  content: "";
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 260px);
  min-height: 52px;
  margin: 8px 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-button:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-button.is-listening {
  background: var(--red);
  box-shadow: 0 12px 24px rgba(220, 38, 38, 0.2);
}

.primary-button:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.button-icon {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
}

.primary-button.is-listening .button-icon {
  border-radius: 2px;
}

.language-field {
  display: grid;
  width: min(100%, 260px);
  gap: 8px;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  text-align: left;
}

.language-field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.browser-note {
  margin: 20px 0 0;
  font-size: 0.78rem;
}

.transcript-panel {
  min-height: 540px;
  padding: 30px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.text-button {
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.parser-panel {
  margin-top: 24px;
  padding: 30px;
}

.canvas-panel {
  margin-top: 24px;
  padding: 30px;
}

.canvas-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.canvas-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.canvas-toolbar .text-button:disabled {
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.6;
}

.object-count {
  margin-right: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.selection-status {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 0.78rem;
  font-weight: 800;
}

.drawing-toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 14px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  box-shadow: inset 0 1px 0 #fff;
  gap: 12px;
}

.tool-group {
  display: flex;
  align-items: center;
  padding-right: 12px;
  border-right: 1px solid #cbd5e1;
  gap: 7px;
}

.tool-group-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.voice-tool {
  display: inline-flex;
  min-height: 38px;
  padding: 6px 10px;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.06);
  color: #64748b;
  cursor: pointer;
  font-size: 0.73rem;
  font-weight: 850;
  gap: 6px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.project-tool {
  min-width: auto;
}

.project-tool-group {
  border-right: 0;
}

.voice-tool:not(:disabled):hover {
  transform: translateY(-1px);
}

.voice-tool.is-active {
  border-color: #60a5fa;
  background: #eff6ff;
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.11),
    0 5px 14px rgba(37, 99, 235, 0.14);
  color: var(--blue-dark);
}

.tool-icon {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.67rem;
  place-items: center;
}

.voice-tool.is-active .tool-icon {
  background: var(--blue);
  color: #fff;
}

.voice-tool.is-future {
  cursor: not-allowed;
  opacity: 0.46;
}

.voice-picker {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  gap: 5px;
}

.voice-picker select {
  max-width: 190px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 0.7rem;
}

.voice-preview {
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 850;
}

.voice-preview:disabled,
.voice-picker select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.toolbox-hint {
  flex: 1 1 220px;
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
  text-align: right;
}

.toolbox-hint span {
  display: block;
}

.import-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 2px dashed #60a5fa;
  border-radius: 14px;
  background: #eff6ff;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.1);
  color: #334155;
  gap: 16px;
}

.import-panel[hidden] {
  display: none;
}

.import-panel.is-dragging {
  border-color: var(--blue);
  background: #dbeafe;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.import-panel h3,
.import-panel p {
  margin: 0;
}

.import-panel h3 {
  margin-top: 2px;
  font-size: 0.95rem;
}

.import-panel p:not(.panel-kicker) {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
}

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

.ai-assistant {
  margin: 18px 0 14px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background:
    radial-gradient(circle at 95% 0, rgba(99, 102, 241, 0.14), transparent 16rem),
    linear-gradient(145deg, #f8fbff, #f5f3ff);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.1);
}

.ai-assistant[hidden] {
  display: none;
}

.ai-assistant-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-assistant-heading h3,
.ai-assistant-heading p {
  margin: 0;
}

.ai-assistant-heading h3 {
  font-size: 1.05rem;
}

.ai-assistant-heading p:not(.panel-kicker) {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.ai-connection {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 850;
}

.ai-connection[data-state="loading"] {
  background: #dbeafe;
  color: var(--blue-dark);
}

.ai-connection[data-state="ready"] {
  background: #dcfce7;
  color: #047857;
}

.ai-connection[data-state="error"] {
  background: #fee2e2;
  color: #b91c1c;
}

.ai-key-setup {
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(0, 1fr) auto auto;
  align-items: end;
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  gap: 8px;
}

.ai-key-setup label {
  display: grid;
  min-width: 0;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  gap: 6px;
}

.ai-key-setup input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
}

.ai-key-setup select,
.ai-custom-config input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.72rem;
}

.ai-custom-config {
  display: grid;
  grid-template-columns: 1fr 0.7fr;
  margin-top: 9px;
  gap: 8px;
}

.ai-custom-config[hidden] {
  display: none;
}

.ai-custom-config label {
  display: grid;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 850;
  gap: 6px;
}

.ai-provider-note {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.45;
}

.ai-key-setup input:disabled {
  background: #f1f5f9;
}

.ai-prompt-field {
  display: grid;
  margin-top: 14px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  gap: 7px;
}

.ai-prompt-field textarea {
  width: 100%;
  min-height: 82px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.55;
}

.ai-actions {
  display: flex;
  align-items: center;
  margin-top: 11px;
  gap: 9px;
}

.ai-response {
  min-height: 48px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  color: #475569;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.ai-response[data-state="loading"] {
  background: #eff6ff;
  color: var(--blue-dark);
}

.ai-response[data-state="success"] {
  background: #ecfdf5;
  color: #047857;
}

.ai-response[data-state="error"] {
  background: #fef2f2;
  color: #b91c1c;
}

.ai-security-note {
  margin: 9px 0 0;
  color: #64748b;
  font-size: 0.68rem;
  line-height: 1.45;
}

.drawing-surface {
  position: relative;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background: #fff;
  aspect-ratio: 900 / 560;
}

#drawingCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-shape {
  filter: drop-shadow(0 7px 7px rgba(15, 23, 42, 0.15));
}

.canvas-object.is-new .filled-shape {
  animation: filled-shape-draw 760ms ease-out both;
}

.canvas-object.is-new .path-shape {
  animation: path-draw 760ms ease-out both;
}

.canvas-object.is-selected .canvas-shape {
  stroke: #f59e0b;
  stroke-width: 6;
  stroke-dasharray: 12 7;
}

.image-selection-outline {
  pointer-events: none;
  stroke: transparent;
}

.canvas-object.is-selected .image-selection-outline {
  stroke: #f59e0b;
  stroke-width: 6;
  stroke-dasharray: 12 7;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.canvas-empty[hidden] {
  display: none;
}

.canvas-empty strong {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 1.1rem;
}

.canvas-empty span {
  font-size: 0.86rem;
}

.execution-feedback {
  margin-top: 14px;
  padding: 13px 16px;
  border-radius: 12px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.execution-feedback[data-state="success"] {
  background: #ecfdf5;
  color: #047857;
}

.execution-feedback[data-state="warning"] {
  background: #fffbeb;
  color: #92400e;
}

.parser-heading {
  align-items: center;
}

.panel-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.parse-status {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.parse-status[data-state="ready"] {
  background: #ecfdf5;
  color: var(--green);
}

.parse-status[data-state="needs_clarification"] {
  background: #fffbeb;
  color: #b45309;
}

.parse-status[data-state="unsupported"] {
  background: var(--red-soft);
  color: var(--red);
}

.test-command-form {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.test-command-form label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.test-command-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.test-command-row input {
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
}

.test-command-form > p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.secondary-button {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.command-flow {
  margin: 18px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fbff, #f8fafc);
}

.command-flow-heading,
.flow-step-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.command-flow-heading h3 {
  margin: 0;
  font-size: 0.98rem;
}

.command-flow-heading .panel-kicker {
  margin-bottom: 3px;
  font-size: 0.65rem;
}

.flow-summary,
.flow-status {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
}

.flow-summary[data-state="completed"],
.flow-step[data-state="completed"] .flow-status {
  background: #dcfce7;
  color: #047857;
}

.flow-summary[data-state="failed"],
.flow-step[data-state="failed"] .flow-status {
  background: #fee2e2;
  color: #b91c1c;
}

.flow-summary[data-state="clarification"],
.flow-step[data-state="clarification"] .flow-status {
  background: #fef3c7;
  color: #a16207;
}

.flow-list {
  display: flex;
  margin: 12px 0 0;
  padding: 0;
  gap: 8px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: thin;
}

.flow-step {
  position: relative;
  display: flex;
  flex: 1 0 180px;
  min-width: 180px;
  max-width: 260px;
  gap: 8px;
}

.flow-step:not(:last-child)::after {
  position: absolute;
  top: 17px;
  right: -8px;
  width: 8px;
  height: 2px;
  background: #cbd5e1;
  content: "";
}

.flow-marker {
  position: relative;
  z-index: 1;
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 2px solid #dbeafe;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  font-size: 0.74rem;
  font-weight: 900;
  place-items: center;
}

.flow-step[data-state="completed"] .flow-marker {
  border-color: #bbf7d0;
  color: #047857;
}

.flow-step[data-state="failed"] .flow-marker {
  border-color: #fecaca;
  color: #b91c1c;
}

.flow-step[data-state="clarification"] .flow-marker {
  border-color: #fde68a;
  color: #a16207;
}

.flow-step[data-state="skipped"] {
  opacity: 0.55;
}

.flow-step-body {
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #dbe5f1;
  border-radius: 13px;
  background: #fff;
}

.flow-step-heading strong {
  color: var(--ink);
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-original,
.flow-detail {
  margin: 5px 0 0;
  line-height: 1.35;
}

.flow-original {
  display: -webkit-box;
  overflow: hidden;
  color: #334155;
  font-size: 0.74rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.flow-detail {
  color: var(--muted);
  font-size: 0.68rem;
}

.flow-empty {
  width: 100%;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
  gap: 22px;
}

.analysis-summary,
.json-section {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.entity-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  gap: 10px;
}

.entity-list div {
  padding: 12px;
  border-radius: 11px;
  background: #f8fafc;
}

.entity-list dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.entity-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.parser-message {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.86rem;
  line-height: 1.55;
}

.parser-message[data-state="needs_clarification"] {
  background: #fffbeb;
  color: #92400e;
}

.parser-message[data-state="unsupported"] {
  background: var(--red-soft);
  color: #991b1b;
}

.json-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.json-output {
  min-height: 260px;
  max-height: 360px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 12px;
  background: #0f172a;
  color: #dbeafe;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.current-transcript {
  min-height: 130px;
  margin-top: 24px;
  padding: 22px;
  border: 1px dashed #bfdbfe;
  border-radius: 16px;
  background: #f8fbff;
}

.transcript-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.interim-text {
  margin-bottom: 0;
  color: #7c8ca3;
  font-size: 1.15rem;
  line-height: 1.65;
}

.interim-text.has-content {
  color: var(--ink);
}

.history-section {
  margin-top: 26px;
}

.transcript-list {
  display: grid;
  max-height: 235px;
  margin: 0;
  padding: 0;
  gap: 10px;
  overflow-y: auto;
  list-style: none;
}

.transcript-list li:not(.empty-state) {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f1f5f9;
  line-height: 1.55;
}

.transcript-index {
  color: var(--blue);
  font-weight: 800;
}

.empty-state {
  padding: 22px;
  border-radius: 12px;
  background: #f8fafc;
  color: #94a3b8;
  text-align: center;
}

.help-panel {
  display: grid;
  grid-template-columns: 0.6fr 1.4fr;
  gap: 36px;
  margin-top: 24px;
  padding: 28px 32px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding-left: 24px;
  gap: 12px 30px;
  color: var(--muted);
  line-height: 1.55;
}

.steps li::marker {
  color: var(--blue);
  font-weight: 800;
}

.error-banner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  max-width: 430px;
  padding: 16px 20px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: var(--red-soft);
  box-shadow: 0 16px 36px rgba(127, 29, 29, 0.16);
  color: #991b1b;
  gap: 5px;
}

.error-banner[hidden] {
  display: none;
}

@keyframes pulse {
  0% {
    opacity: 0.7;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes shape-appear {
  from {
    opacity: 0;
    transform: scale(0.85);
    transform-origin: center;
  }
  to {
    opacity: 1;
    transform: scale(1);
    transform-origin: center;
  }
}

@keyframes filled-shape-draw {
  0% {
    fill-opacity: 0;
    opacity: 0.65;
    stroke-dasharray: 0 1000;
  }
  55% {
    fill-opacity: 0;
    opacity: 1;
    stroke-dasharray: 1000 0;
  }
  100% {
    fill-opacity: 1;
    opacity: 1;
    stroke-dasharray: 1000 0;
  }
}

@keyframes path-draw {
  from {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }
  to {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 680px);
    padding: 28px 0;
  }

  .hero,
  .panel-heading {
    align-items: flex-start;
  }

  .workspace,
  .analysis-grid,
  .help-panel,
  .quality-metrics {
    grid-template-columns: 1fr;
  }

  .transcript-panel {
    min-height: 460px;
  }

  .canvas-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .quality-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .ai-assistant-heading {
    display: grid;
  }

  .ai-connection {
    justify-self: start;
  }

  .ai-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-key-setup {
    grid-template-columns: 1fr;
  }

  .ai-custom-config {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .control-panel,
  .transcript-panel,
  .help-panel {
    padding: 24px 20px;
    border-radius: 18px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .test-command-row {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    width: 100%;
  }

  .import-panel-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .import-panel-actions button {
    justify-content: center;
    width: 100%;
  }

  .entity-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
