/* Bidadari Seal - system fonts, no external assets. Change the brand via the variables below. */
:root {
  --accent: #6d4fd8;          /* violet from the Bidadari logo */
  --accent-hover: #5a3dc2;
  --accent-contrast: #ffffff;
  --accent-grad: linear-gradient(135deg, #7c5ce6, #6240d0);
  --accent-soft: #f0ecff;
  --bg: #faf9ff;
  --surface: #ffffff;
  --text: #1d1830;
  --muted: #5f5a75;
  --border: #e3defa;
  --danger: #b42318;
  --warn-bg: #fff6e5;
  --warn-border: #f0d9a8;
  --err-bg: #fdecec;
  --err-border: #f1c0c0;
  --focus: #3b2fb8;
  --glow: radial-gradient(60rem 30rem at 50% -10%, rgb(167 139 250 / 18%), transparent 70%);
  --radius: 16px;
  --shadow: 0 1px 2px rgb(29 24 48 / 6%), 0 12px 32px rgb(109 79 216 / 10%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #b79cff;
    --accent-hover: #cbb8ff;
    --accent-contrast: #14102a;
    --accent-grad: linear-gradient(135deg, #c4b5fd, #a78bfa);
    --accent-soft: #231c3d;
    --bg: #09070f;
    --surface: #14111f;
    --text: #f1eefc;
    --muted: #aaa4c4;
    --border: #2b2542;
    --danger: #ff8d8d;
    --warn-bg: #2e2514;
    --warn-border: #5a4824;
    --err-bg: #331b1d;
    --err-border: #6b3236;
    --focus: #c4b5fd;
    --glow: radial-gradient(60rem 30rem at 50% -10%, rgb(167 139 250 / 22%), transparent 70%);
    --shadow: 0 1px 2px rgb(0 0 0 / 50%), 0 12px 32px rgb(0 0 0 / 45%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--glow) no-repeat top center, var(--bg); background-color: var(--bg); color: var(--text); font: 1rem/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }
[hidden] { display: none !important; }

.site-header, .site-footer { width: 100%; max-width: 780px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-height: 44px; }
.brand .wordmark { height: 15px; width: auto; color: var(--text); flex: none; }
.brand-sub { font-size: .72rem; font-weight: 700; letter-spacing: .32em; text-transform: uppercase; color: var(--accent); padding-left: 10px; border-left: 1.5px solid var(--border); line-height: 1; margin-left: 2px; }
.site-header nav, .site-footer nav { display: flex; gap: 6px; }
.site-header { flex-wrap: nowrap; }
.site-header nav { margin-left: auto; }
.site-header nav a, .site-footer nav a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.site-header nav a:hover, .site-footer nav a:hover { color: var(--text); background: var(--accent-soft); }
.site-footer { margin-top: auto; padding-top: 32px; padding-bottom: 32px; border-top: 1px solid var(--border); font-size: .9rem; }
.site-footer p { margin: 0; }
.site-footer .copyright { font-size: .85rem; }
.muted { color: var(--muted); }

.container { width: 100%; max-width: 780px; margin: 0 auto; padding: 8px 16px 40px; }
.hero { text-align: center; padding: 24px 0 20px; }
.hero h1 { font-size: clamp(1.45rem, 6.4vw, 2.8rem); white-space: nowrap; line-height: 1.15; margin: 12px 0; letter-spacing: -.02em; }
.lede { color: var(--muted); font-size: 1.1rem; max-width: 56ch; margin: 0 auto 8px; }
.hero-mark { display: block; margin: 0 auto; }
h1, h2 { text-wrap: balance; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h1:focus, h2:focus { outline: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin: 16px 0; animation: rise .35s ease both; }
.card.center { text-align: center; }
.card.center .left { text-align: left; }
.card h1 { font-size: 1.7rem; margin: 8px 0; }

.field-label { display: block; font-weight: 600; margin: 16px 0 6px; }
textarea, input[type="password"], input[type="text"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9' fill='none'%3E%3Cpath d='M1.5 1.75 7 7.25l5.5-5.5' stroke='%237a7498' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 14px 9px;
}
textarea { resize: vertical; min-height: 140px; }
textarea.mono, .mono { font-family: var(--mono); font-size: .92rem; word-break: break-all; }
textarea, input[type="password"], input[type="text"], select { transition: border-color .15s, box-shadow .15s; }
/* One soft highlight: the border turns violet and a faint halo appears; no second outline ring. */
textarea:focus-visible, input[type="password"]:focus-visible, input[type="text"]:focus-visible, select:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
[aria-invalid="true"] { border-color: var(--danger); }
.meter-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.meter { margin: 6px 0 0; font-size: .85rem; color: var(--muted); margin-left: auto; white-space: nowrap; }
.meter.over { color: var(--danger); font-weight: 600; }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.field-error { color: var(--danger); font-size: .92rem; margin: 6px 0 0; font-weight: 500; }

.extra { border: 1px solid var(--border); border-radius: 12px; padding: 8px 16px 16px; margin: 20px 0; }
.extra legend { padding: 0 8px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 28px; background: var(--border); position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / 30%); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 650; min-height: 48px; padding: 12px 22px; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s, transform .1s; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: .92rem; }
.pass-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.trail { margin: 18px 0 4px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; }
.trail h3 { margin: 0 0 10px; font-size: 1rem; }
.trail-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.trail-list li { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.trail-list .when { color: var(--muted); font-size: .9rem; }
.trail-list li.done { font-weight: 650; }
.trail-list li.pending { color: var(--muted); }
.radio-group { display: grid; gap: 8px; margin-bottom: 8px; }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; min-height: 44px; }
.radio input { margin: 3px 0 0; accent-color: var(--accent); flex: none; width: 18px; height: 18px; }
.radio small { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.recipient-list, .rlinks { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.recipient-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }
.recipient-row select { width: auto; min-width: 130px; }
.rec-remove { min-width: 44px; padding: 8px 12px; font-size: 1.2rem; line-height: 1; }
.rlink { padding: 14px 16px; border: 1.5px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; }
.rlink h3 { margin: 0 0 2px; font-size: 1.05rem; overflow-wrap: anywhere; }
.rlink .actions { margin: 10px 0 6px; }
.rlink-status { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.icon { width: 18px; height: 18px; flex: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.chip-select { position: relative; display: inline-flex; align-items: center; }
.chip-select .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.chip-select select { width: auto; min-height: 44px; border-radius: 999px; padding: 8px 40px 8px 38px; font-size: .95rem; background-position: right 14px center; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text); cursor: pointer; font-size: .95rem; position: relative; }
.chip .icon { color: var(--muted); }
.chip-input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip:has(.chip-input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip:has(.chip-input:checked) .icon { color: var(--accent); }
.chip:has(.chip-input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); }
.advanced { margin: 14px 0 6px; border: 1.5px solid var(--border); border-radius: 12px; padding: 0 14px; }
.advanced summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; font-size: .95rem; }
.advanced[open] summary { margin-bottom: 8px; }
.advanced[open] { padding-bottom: 12px; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-primary { background: var(--accent-grad); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--err-bg); }
.btn-quiet { background: transparent; color: var(--text); border-color: var(--border); }
.btn-quiet:hover { background: var(--accent-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.actions .btn { flex: 1 1 180px; }

.notice { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: .95rem; }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-border); }
.notice-error { background: var(--err-bg); border-color: var(--err-border); }

.trust { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 0; margin: 18px 0 0; color: var(--muted); font-size: .88rem; }
.trust li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: middle; }

.how { margin-top: 32px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.step-icon { width: 40px; height: 40px; padding: 9px; box-sizing: border-box; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.steps strong { font-size: 1.05rem; }
.steps span { color: var(--muted); font-size: .92rem; }

.secret-out { margin: 0; padding: 16px; background: var(--bg); border: 1.5px solid var(--border); border-radius: 12px; font: .98rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow: auto; user-select: all; }

.prose { padding-top: 16px; }
.prose h1 { font-size: 2rem; margin: 0 0 8px; }
.prose h2 { margin-top: 32px; }
.prose .lede { margin: 0 0 8px; }
.prose ul { padding-left: 1.2em; }
.prose li { margin: 8px 0; }
code { font-family: var(--mono); background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.flow { margin: 24px 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.flow-path { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.flow-title { margin: 0 0 10px; font-weight: 650; color: var(--muted); font-size: .9rem; }
.flow ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.flow li { position: relative; margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); text-align: center; }
.flow li:not(:last-child)::after { content: "\2193"; position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%); color: var(--accent); font-weight: 700; line-height: 22px; }
.flow li.accent { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* Subtle seal animations */
.is-sealing { animation: stamp .6s ease-in-out infinite; }
.is-breaking { animation: crack .5s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes stamp { 0%, 100% { transform: scale(1); } 50% { transform: scale(.92) rotate(-3deg); } }
@keyframes crack { 0% { transform: none; } 40% { transform: scale(1.06) rotate(4deg); } 100% { transform: scale(.96); opacity: .7; filter: saturate(.4); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 480px) {
  .site-header { padding-left: 12px; padding-right: 12px; gap: 4px; }
  .site-header nav { gap: 0; }
  .site-header nav a { padding: 10px 5px; font-size: .82rem; }
  .site-header { flex-wrap: wrap; }
  .brand { gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  .brand .wordmark { height: 12px; }
  .brand-sub { font-size: .62rem; letter-spacing: .22em; padding-left: 8px; }
  .recipient-row { grid-template-columns: 1fr auto; }
  .recipient-row .rec-name { grid-column: 1 / -1; }
  .card { padding: 18px; }
  .meter-row { flex-direction: column-reverse; gap: 0; }
  .meter { margin-left: 0; }
}
