:root {
  --bg: #0b0d12;
  --panel: #12151d;
  --panel-2: #181c26;
  --line: #242a37;
  --text: #e8ebf2;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent-2: #7c5bff;
  --good: #3ecf8e;
  --warn: #f5b84b;
  --bad: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1a2140 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 24px rgba(91, 140, 255, 0.45);
}

.tagline {
  color: var(--muted);
  font-size: 13px;
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 24px 64px;
}

h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 24px 0 12px;
}

h2 {
  font-size: 18px;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

.lead {
  color: var(--muted);
  font-size: 17px;
  max-width: 680px;
  margin: 0 0 28px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.choice {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.choice:hover,
.choice:focus-visible {
  border-color: var(--accent);
  background: var(--panel-2);
  transform: translateY(-1px);
  outline: none;
}

.choice.unsupported {
  opacity: 0.5;
  cursor: not-allowed;
}

.choice-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  position: relative;
}

.choice-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border-top: 2.5px solid var(--accent);
  border-right: 2.5px solid var(--accent);
}

.choice-icon.send::after {
  transform: translateY(3px) rotate(-45deg);
}

.choice-icon.receive::after {
  transform: translateY(-3px) rotate(135deg);
}

.choice-title {
  font-size: 18px;
  font-weight: 600;
}

.choice-sub {
  color: var(--muted);
}

.choice-badge {
  margin-top: 6px;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.15);
  color: #a9c1ff;
}

.note {
  color: var(--muted);
  margin-top: 20px;
}

code {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.back {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 8px 0;
  margin: 8px 0 12px;
}

.back:hover {
  color: var(--text);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 8px;
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}

.dropzone p {
  margin: 0 0 14px;
}

.dropzone.over {
  border-color: var(--accent);
  background: rgba(91, 140, 255, 0.06);
}

.dropzone.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 14px 0;
}

.row.end {
  justify-content: flex-end;
}

.btn {
  font: inherit;
  font-weight: 550;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
  border-color: #3a4256;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}

.btn.danger {
  color: var(--bad);
}

.link {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

.selection {
  margin-top: 16px;
}

.selection-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.code-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.code-input {
  flex: 1 1 220px;
  font: 600 28px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}

.code-input:focus {
  outline: none;
  border-color: var(--accent);
}

.code-form .btn {
  min-width: 140px;
  font-size: 16px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

.code-card {
  text-align: center;
  padding: 32px 22px;
}

.code-card .steps {
  text-align: left;
  max-width: 460px;
  margin: 22px auto 0;
  color: var(--muted);
  padding-left: 20px;
}

.code-card .steps li {
  margin: 6px 0;
}

.code-card.compact {
  padding: 16px 22px;
}

.code-card.compact .steps {
  display: none;
}

.code-card.compact .code-display {
  font-size: 28px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

.code-display {
  font: 700 64px/1.1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  margin: 8px 0;
  background: linear-gradient(135deg, #fff, #a9c1ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-line {
  color: var(--muted);
  margin: 4px 0 0;
}

.status-line.error {
  color: var(--warn);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.phase {
  margin: 0;
}

.phase.done {
  color: var(--good);
}

.phase.error,
.phase.declined,
.phase.cancelled {
  color: var(--bad);
}

.phase.reconnecting,
.phase.waiting-reconnect {
  color: var(--warn);
}

.route {
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(62, 207, 142, 0.35);
  color: var(--good);
  background: rgba(62, 207, 142, 0.08);
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.bar-fill.done {
  background: var(--good);
}

.bar-fill.reconnecting,
.bar-fill.waiting-reconnect {
  background: var(--warn);
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 16px 0 4px;
}

.stats div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.stats dt {
  font-size: 12px;
  color: var(--muted);
}

.stats dd {
  margin: 2px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.bad {
  color: var(--bad);
}

.tip {
  background: rgba(245, 184, 75, 0.08);
  border: 1px solid rgba(245, 184, 75, 0.3);
  color: #f3d79e;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.file-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.file-list:empty {
  display: none;
}

.file-list.compact {
  max-height: 220px;
}

.file {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.file:last-child {
  border-bottom: none;
}

.file-icon {
  text-align: center;
  color: var(--muted);
}

.file.done .file-icon,
.file.skipped .file-icon {
  color: var(--good);
}

.file.failed .file-icon {
  color: var(--bad);
}

.file.sending .file-icon,
.file.receiving .file-icon {
  color: var(--accent);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.file-error {
  grid-column: 2 / -1;
  color: var(--bad);
  font-size: 12px;
}

.file.more {
  display: block;
  color: var(--muted);
  text-align: center;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(5, 7, 12, 0.7);
  backdrop-filter: blur(3px);
}

.dialog-body {
  padding: 24px;
}

.error {
  color: var(--bad);
  font-size: 13px;
}

@media (max-width: 560px) {
  .tagline {
    display: none;
  }
  .code-display {
    font-size: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
