:root {
  --bg: #0b1020;
  --bg-soft: #111832;
  --card: rgba(20, 28, 54, 0.86);
  --line: rgba(120, 150, 220, 0.16);
  --text: #e8eefc;
  --muted: #8ea0c8;
  --accent: #5eead4;
  --accent-soft: rgba(94, 234, 212, 0.16);
  --danger: #fb7185;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 520px at 10% -10%, rgba(94, 234, 212, 0.10), transparent 60%),
    radial-gradient(900px 480px at 100% 0%, rgba(96, 165, 250, 0.12), transparent 55%),
    var(--bg);
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 36px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(94, 234, 212, 0.9);
}

.meta {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 20px;
}

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #cdd9f5;
}

.hint { color: var(--muted); font-size: 12px; }

.status {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.status.active { color: var(--accent); border-color: rgba(94, 234, 212, 0.45); }

.canvas-wrap {
  display: flex;
  justify-content: center;
}

#pad {
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(140, 170, 240, 0.28);
  background: #000;
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(94, 234, 212, 0.5);
  background: var(--accent);
  color: #04211d;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover { box-shadow: 0 8px 24px rgba(94, 234, 212, 0.28); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn.ghost:hover { background: var(--accent-soft); box-shadow: none; }

.result {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 4px 16px;
}

.digit {
  min-width: 108px;
  text-align: center;
  font-size: 96px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 34px rgba(94, 234, 212, 0.35);
}

.conf { flex: 1; }

.conf-label { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }

.conf-value {
  font-size: 26px;
  font-weight: 600;
  margin: 2px 0 8px;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(140, 170, 240, 0.14);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4bf, #5eead4);
  transition: width 0.25s ease;
}

.probs {
  display: grid;
  gap: 6px;
  padding: 6px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.prob-row {
  display: grid;
  grid-template-columns: 18px 1fr 46px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.prob-row.top { color: var(--accent); }

.prob-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(140, 170, 240, 0.12);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: rgba(140, 170, 240, 0.55);
  transition: width 0.2s ease;
}

.prob-row.top .prob-fill { background: var(--accent); }

.prob-val { text-align: right; }

.preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.preview-head { font-size: 12px; color: var(--muted); flex: 1; }

.preview-img {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #000;
  image-rendering: pixelated;
}

.preview-img[hidden] { display: none; }

.footer {
  margin-top: 22px;
  text-align: center;
  color: rgba(142, 160, 200, 0.6);
  font-size: 12px;
  letter-spacing: 0.06em;
}
