:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --line: #2a303c;
  --text: #e8ecf3;
  --muted: #8a93a6;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --ok: #22c55e;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px
           max(24px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.wrap {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.head h1 {
  margin: 4px 0 2px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: .5px;
}

.head .sub {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.panel-head label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .3px;
}

.count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

textarea {
  width: 100%;
  min-height: 150px;
  max-height: 46dvh;
  resize: vertical;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none;
  transition: border-color .15s;
}

textarea::placeholder { color: #5c6578; }

textarea:focus { border-color: #3d4a63; }

#output { color: #cfe3ff; }

.actions {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: #232833; border-color: #3a4354; }
.btn:active { transform: scale(.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 有内容时才高亮，这是需求里点名的一条 */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-primary:disabled {
  background: var(--panel-2);
  border-color: var(--line);
  color: #5c6578;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.copied {
  background: var(--ok);
  border-color: var(--ok);
  color: #06240f;
}

.hint {
  margin: 0;
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.hint.err { color: #f59e0b; }

@media (max-width: 420px) {
  body { padding-left: 12px; padding-right: 12px; }
  textarea { min-height: 130px; font-size: 14px; }
}
