:root {
  --bg: #0b0d10;
  --panel: #14181e;
  --panel-2: #1c222b;
  --line: #2a323d;
  --text: #e8edf4;
  --muted: #94a3b5;
  --accent: #3b9dff;
  --ok: #35c47a;
  --warn: #f0b429;
  --err: #f2555a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 50% 0%, #16202c, var(--bg));
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}

h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.5px; }
.sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

.state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 13px;
  color: var(--muted);
}
.state .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.state[data-state="open"] .dot { background: var(--ok); }
.state[data-state="closed"] .dot { background: var(--err); }
.state[data-state="paired"] .dot { background: var(--ok); }
.state[data-state="checking"] .dot { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

input[type="text"] {
  width: 100%;
  height: 60px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  /* Monospace + brede mellomrom: koden leses av fra en annen skjerm */
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 26px;
  letter-spacing: 6px;
  text-align: center;
  text-transform: uppercase;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.primary {
  width: 100%;
  height: 54px;
  margin-top: 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #051020;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.primary:disabled { opacity: .45; cursor: default; }
.primary:active:not(:disabled) { filter: brightness(.9); }

.msg { min-height: 22px; margin: 14px 0 0; font-size: 13px; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

.help { margin-top: 22px; color: var(--muted); font-size: 13px; }
.help summary { cursor: pointer; padding: 6px 0; }
.help p { line-height: 1.6; }
.help pre {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12px;
  overflow-x: auto;
}
