/* Записки: the main site's look (ink, cream, gold) with system fonts only. */
:root {
  --ink: #0a0d13;
  --ink-2: #0e131b;
  --surface: #141a24;
  --surface-2: #19212d;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --cream: #f3eee3;
  --muted: #97a1b2;
  --muted-2: #6b7585;
  --gold: #e6b15e;
  --gold-bright: #f6d294;
  --gold-dim: rgba(230, 177, 94, .14);
  --ok: #5fd58a;
  --danger: #ff8f8f;
  --display: Georgia, "Times New Roman", serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the hidden attribute wins over any display rule below */
html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.55 var(--body);
  color: var(--cream);
  background:
    radial-gradient(760px 420px at 80% -10%, rgba(230, 177, 94, .12), transparent 60%),
    radial-gradient(600px 400px at 0% 10%, rgba(86, 120, 180, .10), transparent 60%),
    linear-gradient(180deg, var(--ink), var(--ink-2));
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right))
           max(28px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

/* ---- top bar ---- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: .95rem; letter-spacing: .02em; color: var(--cream); text-decoration: none; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px var(--gold-dim); }
.top-link { color: var(--muted); font-size: .92rem; text-decoration: none; padding: 8px 2px; }
.top-link:hover { color: var(--gold-bright); }

/* ---- panel ---- */
.panel {
  padding: 22px 20px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .8);
  animation: rise .35s ease-out;
}
h1 { margin: 0 0 8px; font: 500 1.75rem/1.15 var(--display); letter-spacing: -.01em; }
.lede { margin: 0 0 18px; color: var(--muted); font-size: 1rem; }
.hint { margin: 10px 0 0; color: var(--muted-2); font-size: .9rem; line-height: 1.45; }
.hint.center { text-align: center; margin: 0 0 14px; }

/* ---- fields ---- */
.field { display: block; margin: 0 0 14px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: .86rem; color: var(--muted); }
.counter { font-family: var(--mono); font-size: .74rem; color: var(--muted-2); }
.counter.over { color: var(--danger); }
textarea, input[type="password"], input[type="text"], .linkbox {
  width: 100%;
  font: inherit;
  font-size: 17px;             /* >= 16px: iOS does not zoom into the field */
  color: var(--cream);
  background: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus, input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
textarea { resize: none; min-height: 150px; max-height: 55vh; overflow: auto; line-height: 1.5; }
::placeholder { color: var(--muted-2); }

/* ---- options list ---- */
.options { margin: 0 0 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 8px 14px; border-top: 1px solid var(--line); }
.opt:first-child { border-top: 0; }
.opt-label { color: var(--cream); }
.opt.pw { flex-direction: column; align-items: stretch; }
#pw-field { margin-top: 6px; padding-bottom: 6px; }
#pw-field input { margin-top: 4px; }

.select-wrap { position: relative; flex: none; }
.select-wrap::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; pointer-events: none;
  border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: translateY(-70%) rotate(45deg);
}
select {
  appearance: none; -webkit-appearance: none;
  min-height: 42px; padding: 8px 34px 8px 14px;
  font: inherit; font-size: 16px; color: var(--cream);
  background: var(--ink); border: 1px solid var(--line-2); border-radius: 12px; outline: none;
}
select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }

/* toggle switch: the real checkbox lies (invisible) over the track, so it stays clickable and accessible */
.switch { position: relative; flex: none; width: 50px; height: 30px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 15px; background: #2a3342; border: 1px solid var(--line-2); transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); transition: transform .15s; }
.switch input:checked + .track { background: var(--gold); border-color: var(--gold); }
.switch input:checked + .track::after { transform: translateX(20px); background: var(--ink); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--gold-dim); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 20px;
  font: 600 1rem var(--body); text-decoration: none; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--line-2);
  color: var(--cream); background: var(--surface-2);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); border-color: transparent; color: #1a1408; box-shadow: 0 10px 24px -12px rgba(230, 177, 94, .8); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn-big { width: 100%; font-size: 1.08rem; min-height: 54px; }
.link-btn { background: none; border: 0; padding: 8px 0; font: 500 .96rem var(--body); color: var(--gold); cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--gold-bright); }
.link-btn.danger { color: var(--muted); }
.link-btn.danger:hover { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.actions .btn { flex: 1 1 160px; }
.actions.secondary { align-items: center; justify-content: space-between; margin-top: 8px; }
.actions.secondary .btn { flex: 0 1 auto; }

/* ---- messages ---- */
.msg { min-height: 1.4em; margin: 12px 0 0; font-weight: 600; }
.msg:empty { min-height: 0; margin: 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* ---- result ---- */
.done { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.done svg { width: 34px; height: 34px; color: var(--gold); flex: none; }
.done h1 { margin: 0; }
.qr { display: flex; justify-content: center; margin: 14px 0 10px; }
.qr svg { width: min(74vw, 280px); height: auto; padding: 12px; border-radius: 18px; background: #fff; box-shadow: 0 16px 40px -24px rgba(0, 0, 0, .9); }
.linkbox { font-family: var(--mono); font-size: .86rem; margin: 0; text-overflow: ellipsis; }

/* ---- reading ---- */
.note {
  white-space: pre-wrap; overflow-wrap: anywhere;
  min-height: 90px; max-height: 60vh; overflow: auto;
  margin: 4px 0 4px; padding: 14px 16px;
  font: 17px/1.55 var(--body); color: var(--cream);
  background: var(--ink); border: 1px solid var(--line-2); border-radius: 14px;
  user-select: text; -webkit-user-select: text;
}

/* ---- how it works ---- */
.how { margin-top: 18px; color: var(--muted); font-size: .92rem; }
.how summary { cursor: pointer; color: var(--gold); font-weight: 500; list-style: none; padding: 6px 0; }
.how summary::-webkit-details-marker { display: none; }
.how summary::before { content: "+ "; }
.how[open] summary::before { content: "− "; }
.how ul { margin: 6px 0 0; padding-left: 20px; }
.how li { margin: 4px 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } .btn, .switch .track, .switch .track::after { transition: none; } }
