:root {
  --bg: #0f1218;
  --panel: #171b24;
  --panel-2: #1d2330;
  --ink: #f5f7fb;
  --muted: #a8b0c2;
  --soft: #737d95;
  --line: #2a3242;
  --accent: #8bd3ff;
  --accent-2: #b8f5d0;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top left, rgba(139, 211, 255, 0.13), transparent 34rem), var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: var(--accent); }
.shell { max-width: 720px; margin: 0 auto; padding: 28px 20px 48px; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 8px 0 12px; font-size: clamp(28px, 5vw, 42px); letter-spacing: -0.04em; line-height: 1.05; }
.lead { color: var(--muted); line-height: 1.55; margin: 0 0 20px; }
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.step-panel { animation: fadeSlideUp 0.45s ease both; }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.assistant-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.avatar {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  background: conic-gradient(var(--accent) 0 280deg, rgba(255, 255, 255, 0.08) 0);
  display: grid; place-items: center; font-size: 22px;
}
.bubble-wrap { flex: 1; min-width: 0; }
.bubble {
  padding: 12px 14px; border-radius: 14px; line-height: 1.5;
  background: var(--panel-2); border: 1px solid var(--line);
  animation: bubbleIn 0.35s ease both;
}
.bubble + .bubble { margin-top: 8px; animation-delay: 0.08s; }
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-log {
  min-height: 200px; max-height: 360px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px;
}
.chat-bubble { padding: 10px 12px; border-radius: 12px; max-width: 88%; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.chat-bubble.user { align-self: flex-end; background: #2a4060; }
.chat-bubble.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.chat-bubble.system { align-self: center; color: var(--muted); font-size: 13px; background: transparent; max-width: 100%; text-align: center; }
.upload-stack { display: grid; gap: 16px; margin: 4px 0 8px; }
.upload-label {
  margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 800;
  letter-spacing: 0.02em;
}
.upload-label .optional-tag {
  font-weight: 600; color: var(--soft); font-size: 12px; margin-left: 6px;
}
.drop-zone {
  display: block;
  border: 2px dashed rgba(139, 211, 255, 0.35); border-radius: 14px; padding: 28px 16px;
  text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(139, 211, 255, 0.06); }
.drop-zone input { display: none; }
.drop-zone strong { display: block; font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.drop-hint { color: var(--soft); font-size: 13px; line-height: 1.4; }
.drop-zone.has-file { border-style: solid; border-color: rgba(184, 245, 208, 0.45); background: rgba(184, 245, 208, 0.05); }
.drop-zone.has-file strong { color: var(--accent-2); }
.footer-reset { margin-top: 24px; display: flex; justify-content: center; }
.icon-btn {
  width: 44px; height: 44px; padding: 0; border-radius: 12px;
  display: inline-grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer; position: relative;
}
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.danger-icon { color: #ff9b9b; border-color: rgba(255, 155, 155, 0.35); }
.icon-btn:hover, .icon-btn:focus-visible { border-color: var(--accent); color: var(--ink); outline: none; }
.icon-btn.danger-icon:hover, .icon-btn.danger-icon:focus-visible { border-color: #ff9b9b; color: #ffb8b8; }
.icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 8px 12px; border-radius: 10px; font-size: 12px; font-weight: 700;
  white-space: nowrap; color: var(--ink); background: var(--panel-3, #222938);
  border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
}
.icon-btn[data-tooltip]:hover::after, .icon-btn[data-tooltip]:focus-visible::after {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.progress-ring {
  width: 56px; height: 56px; border-radius: 50%; margin: 12px auto;
  background: conic-gradient(var(--accent) var(--pct, 0%), rgba(255, 255, 255, 0.08) 0);
  display: grid; place-items: center; position: relative;
}
.progress-ring::after {
  content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--panel);
}
.progress-ring span { position: relative; z-index: 1; font-size: 12px; font-weight: 800; }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 14px; }
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font: inherit;
}
textarea { min-height: 72px; resize: vertical; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.step-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
button, .btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font: inherit; font-weight: 800;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button.primary, .btn.primary { background: var(--accent); color: #071019; border-color: transparent; }
button.danger, .btn.danger {
  background: transparent;
  color: #ff9b9b;
  border-color: rgba(255, 155, 155, 0.45);
}
button.danger:hover, .btn.danger:hover { border-color: #ff9b9b; color: #ffb8b8; }
button.ghost { background: transparent; color: var(--muted); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03); font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
}
.summary-card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--soft); font-weight: 800; }
.summary-card .value { margin-top: 4px; font-weight: 700; word-break: break-word; }
details.section { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; }
details.section summary {
  padding: 12px 14px; cursor: pointer; font-weight: 800; background: var(--panel-2);
  list-style: none;
}
details.section summary::-webkit-details-marker { display: none; }
details.section .section-body { padding: 14px; border-top: 1px solid var(--line); }
.status-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.pill {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.pill.ok { color: #06130c; background: var(--accent-2); border-color: transparent; font-weight: 800; }
.pill.warn { color: #1d1500; background: #ffd166; border-color: transparent; font-weight: 800; }
.msg { min-height: 1.2em; color: var(--muted); font-size: 14px; margin-top: 8px; }
.msg.error { color: #ff9b9b; }
.step-dots { display: flex; gap: 6px; margin-bottom: 20px; }
.step-dots span {
  height: 6px; flex: 1; border-radius: 999px; background: rgba(255, 255, 255, 0.08);
  transition: background 0.25s;
}
.step-dots span.active { background: var(--accent); }
.step-dots span.done { background: rgba(139, 211, 255, 0.45); }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.advanced-grid .full { grid-column: 1 / -1; }
.install-steps {
  margin: 12px 0 4px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.55;
}
.install-steps li + li { margin-top: 8px; }
.install-steps code {
  font-size: 0.92em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
}
.install-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(139, 211, 255, 0.06);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.install-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.import-progress-host {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(139, 211, 255, 0.05);
}
.import-progress-host .loading-row { display: flex; width: 100%; align-items: center; }
.import-progress-host .braille-loader { flex-shrink: 0; min-width: 2.5rem; min-height: 1.25rem; }
.step-panel.is-loading .upload-stack { opacity: 0.45; pointer-events: none; }
.step-panel.is-loading .step-actions button:not(#importBtn) { pointer-events: none; opacity: 0.5; }
@media (max-width: 600px) {
  .summary-grid, .advanced-grid { grid-template-columns: 1fr; }
}
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .step-panel, .bubble, .chat-bubble { animation: none !important; }
  * { transition: none !important; }
}
