:root {
  --bg: #f4f4f1;
  --card: #ffffff;
  --text: #1d1e20;
  --muted: #62656b;
  --line: rgba(0, 0, 0, 0.1);
  --accent: #1b8fb8;
  --accent-ink: #ffffff;
  --warn-bg: #fff4e0;
  --warn-ink: #7a4b00;
  --bad: #c0392b;
  --good: #1e8a4c;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --card: #1b1c1f;
    --text: #ececec;
    --muted: #9a9ea6;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #4cc9f0;
    --accent-ink: #062633;
    --warn-bg: #2d2412;
    --warn-ink: #f1c27a;
    --bad: #ff8a80;
    --good: #6fd39b;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --card: #1b1c1f; --text: #ececec; --muted: #9a9ea6; --line: rgba(255, 255, 255, 0.1);
  --accent: #4cc9f0; --accent-ink: #062633; --warn-bg: #2d2412; --warn-ink: #f1c27a; --bad: #ff8a80; --good: #6fd39b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* even on things styled as flex */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 480px; margin: 0 auto; padding: 20px 16px 48px; }
h1, h2 { font-family: "Varela Round", system-ui, sans-serif; font-weight: 400; margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 19px; margin-bottom: 6px; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; margin: 8px 0 0; }

header { display: flex; align-items: center; gap: 14px; margin: 4px 0 18px; }
.mark {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: #000; box-shadow: inset 0 0 0 3px #8d939c;
  position: relative;
}
.mark::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 9px; height: 12px;
  border-radius: 0 0 14px 14px; background: #4cc9f0; opacity: 0.85;
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 14px; }
.card.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.card.warn h2 { color: var(--warn-ink); }
.card.warn ol { padding-left: 20px; margin: 8px 0; }
.cardHead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tag { font-size: 13px; color: var(--muted); }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 14px; }

.steps { margin: 6px 0 14px; padding-left: 20px; color: var(--muted); }
.steps li { margin: 4px 0; }
.steps strong { color: var(--text); font-weight: 600; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; margin-top: 14px; }
input#code {
  font: 500 24px/1 Orbitron, ui-monospace, monospace; letter-spacing: 0.25em;
  width: 9.2em; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); text-align: center;
}
input#code:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input#nameInput {
  font: inherit; font-size: 17px; flex: 1 1 12em; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); min-height: 44px;
}
input#nameInput:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#nameForm { margin-top: 12px; }

button, .button {
  font: inherit; font-size: 16px; cursor: pointer; border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.quiet { background: transparent; color: var(--muted); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible, .button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.msg { min-height: 1.5em; margin: 10px 0 0; font-size: 15px; }
.msg.bad { color: var(--bad); }
.msg.good { color: var(--good); }

.crop {
  position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 14px auto 6px;
  border-radius: 50%; overflow: hidden; background: #000; touch-action: none;
  box-shadow: 0 0 0 5px #8d939c, 0 0 0 6px var(--line);
}
.crop.small { width: 160px; }
.crop canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.crop canvas:active { cursor: grabbing; }
.clockOver {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; color: #fff; font-family: Orbitron, system-ui, sans-serif; font-weight: 500;
  text-shadow: 2px 3px 0 rgba(48, 51, 58, 0.9); padding-top: 4%;
}
.clockOver span { font-size: clamp(30px, 16vw, 62px); line-height: 1; }
.crop.small .clockOver span { font-size: 32px; }
.clockOver small { font-size: 0.95em; margin-top: 10%; }
.cropEmpty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #8a8f99; background: #000; }

.zoomRow { display: flex; align-items: center; gap: 10px; max-width: 300px; margin: 10px auto 0; color: var(--muted); }
.zoomRow input { flex: 1; accent-color: var(--accent); }

.progress { height: 6px; border-radius: 3px; background: var(--line); margin-top: 14px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width 0.15s; }

.fake { text-align: center; margin: 0 0 14px; }
details { margin-top: 18px; color: var(--muted); font-size: 14px; }
details pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; max-height: 240px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
