:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0089ff;
  --primary-dark: #006aff;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --ok-text: #166534;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --border: #334155;
    --primary: #4da8ff;
    --primary-dark: #0089ff;
    --ok-bg: rgba(22, 101, 52, 0.2);
    --ok-border: rgba(74, 222, 128, 0.3);
    --ok-text: #86efac;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 520px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 24px; text-align: center; margin: 0 0 16px; }
a { color: var(--primary); }

.notice {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok-text);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  margin: 0 0 20px;
}
.notice a { color: inherit; }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.port { width: 96px; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
input, select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.center { text-align: center; }

#qrcode {
  display: flex;
  justify-content: center;
  margin: 24px auto 8px;
  padding: 12px;
  width: fit-content;
  background: #ffffff;
  border-radius: 12px;
}
#qrcode img, #qrcode canvas { display: block; max-width: 100%; height: auto; }

.url-row { display: flex; gap: 8px; align-items: stretch; margin-top: 16px; }
#url-preview {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
button {
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: var(--primary-dark);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { background: var(--primary); }

details { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 12px; font-size: 14px; }
summary { cursor: pointer; font-weight: 600; }
code { font-size: 0.9em; }
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }

.trust {
  margin-top: 32px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
}
.trust h2 { font-size: 18px; margin: 0 0 8px; }
.trust p { margin: 0 0 10px; }
.trust ol { margin: 0 0 10px; padding-left: 20px; }
.trust li { margin-bottom: 10px; }
.trust strong { display: block; }
