:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #1a1d27;
  --text: #f0f1f3;
  --muted: #8b8f9a;
  --line: #2a2d3a;
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --copy-bg: #232636;
  --danger-bg: #2d1518;
  --danger-line: #5c2528;
  --danger-text: #f87171;
  --ok-bg: #065f46;
  --ok-text: #6ee7b7;
}

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

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding: 24px 16px 40px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

main {
  width: min(100%, 920px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1,
h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 16px;
}

.lede,
.note,
#line-count {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.lede {
  margin-top: 6px;
}

.panel,
.card {
  background: var(--panel);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.label-row,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.label-row {
  margin-bottom: 8px;
}

#line-count.over {
  color: var(--danger-text);
  font-weight: 700;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

textarea {
  width: 100%;
  min-height: 168px;
  resize: vertical;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 20%);
}

.primary-btn {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 8px;
  margin-top: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn:active {
  background: var(--accent-dark);
}

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

.note {
  margin-top: 12px;
}

.error {
  background: var(--danger-bg);
  border: 0.5px solid var(--danger-line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--danger-text);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 0.5px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.col-num {
  width: 36px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cell-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cell-text,
.totp-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

.cell-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.4;
}

.totp-code {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
  white-space: nowrap;
}

.totp-code.invalid {
  color: var(--danger-text);
  font-size: 14px;
  letter-spacing: 0;
}

.copy-btn {
  width: 72px;
  height: 32px;
  flex: 0 0 72px;
  border: 0;
  background: var(--copy-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.copy-btn.copied {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.countdown {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.countdown svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-track,
.countdown-fill {
  fill: none;
  stroke-width: 3;
}

.countdown-track {
  stroke: var(--line);
}

.countdown-fill {
  stroke: var(--accent);
  stroke-linecap: round;
}

.countdown-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
