*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #181b24;
  --border: #2a2e3d;
  --accent: #4f8ef7;
  --accent-dk: #3a72d8;
  --text: #e2e6f0;
  --muted: #7a8099;
  --radius: 8px;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
}

html,
body {
  height: 100%;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 60px;
}

header {
  width: 100%;
  max-width: 820px;
  margin-bottom: 36px;
}

header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

header p {
  font-size: 0.825rem;
  color: var(--muted);
  margin-top: 4px;
}

.divider {
  width: 100%;
  max-width: 820px;
  height: 1px;
  background: var(--border);
  margin-bottom: 32px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  width: 100%;
  max-width: 820px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.label-optional {
  font-weight: 400;
  font-size: 0.72rem;
  opacity: 0.6;
}

.passkey-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.passkey-wrap input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.passkey-wrap input:focus {
  border-color: var(--accent);
}

button.toggle-pw {
  width: auto;
  padding: 8px 10px;
  font-size: 0.75rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

button.toggle-pw:hover {
  background: var(--border);
  color: var(--text);
}

textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  min-height: 110px;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus {
  border-color: var(--accent);
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

button {
  width: 100%;
  padding: 9px 14px;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
  letter-spacing: 0.01em;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-dk);
  border-color: var(--accent-dk);
}

button.secondary {
  background: transparent;
  color: var(--text);
}

button.secondary:hover {
  background: var(--border);
}

.status-bar {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 36px;
  word-break: break-word;
}

.status-bar.ok {
  color: #6fcf97;
  border-color: #2a4a38;
}

.status-bar.err {
  color: #eb5757;
  border-color: #4a2a2a;
}

.status-bar.info {
  color: var(--accent);
  border-color: #1e2d4a;
}

.capacity-info {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  margin-top: 4px;
}

.capacity-info.ok {
  color: #6fcf97;
}

.capacity-info.err {
  color: #eb5757;
}

.progress-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-wrap.hidden {
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}

.canvas-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  position: relative;
}

.canvas-placeholder {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
  user-select: none;
  line-height: 1.8;
}

canvas {
  display: block;
  max-width: 100%;
}

canvas.hidden {
  display: none;
}