/* BubuAuth — cute neobrutalism, blue × yellow. Mobile-first. */

@font-face { font-family: 'Fredoka'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/fredoka-400.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/fredoka-500.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('/vendor/fonts/fredoka-600.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/fredoka-700.woff2') format('woff2'); }
@font-face { font-family: 'Space Mono'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/space-mono-400.woff2') format('woff2'); }
@font-face { font-family: 'Space Mono'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/space-mono-700.woff2') format('woff2'); }

:root {
  --ink: #141414;
  --text: #141414;
  --muted: #545a6e;
  --bg: #fff6d6;
  --bg-dot: rgba(61, 107, 255, 0.17);
  --paper: #ffffff;
  --paper-2: #fffbea;
  --sheet: #fffdf3;
  --blue: #3d6bff;
  --blue-2: #2c55e0;
  --blue-soft: #dfe7ff;
  --blue-ink: #1d3bb8;
  --yellow: #ffd23f;
  --yellow-2: #ffc21a;
  --yellow-soft: #fff1b8;
  --pink: #ff9ebb;
  --mint: #7be0b0;
  --red: #ff5b5b;
  --red-soft: #ffe1e1;
  --green: #2fbf71;
  --code: #1d3bb8;
  --bw: 2.5px;
  --r: 18px;
  --r-sm: 12px;
  --sh: 4px 4px 0 var(--ink);
  --sh-sm: 2px 2px 0 var(--ink);
  --sh-lg: 7px 7px 0 var(--ink);
  --font: 'Fredoka', ui-rounded, 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --appbar-h: 68px;
  --tabbar-h: 70px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --ink: #05060c;
  --text: #f4f6ff;
  --muted: #aab3d9;
  --bg: #121a3d;
  --bg-dot: rgba(255, 210, 63, 0.1);
  --paper: #1e2858;
  --paper-2: #26326c;
  --sheet: #19224d;
  --blue: #5b82ff;
  --blue-2: #4a70f0;
  --blue-soft: #2b3a86;
  --blue-ink: #c7d4ff;
  --yellow-soft: #4a4120;
  --red-soft: #4a2230;
  --code: #ffd23f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.7px);
  background-size: 20px 20px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }
p { margin: 0; }
a { color: var(--blue-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--yellow); color: #141414; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- utilities ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.stack.center { align-items: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; }
.row > .field { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.tiny { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 32px 8px; }
.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.pre { white-space: pre-wrap; }
.wrap-any { overflow-wrap: anywhere; word-break: break-all; }
.error-text { color: var(--red); font-weight: 600; font-size: 14px; }
:root[data-theme='dark'] .error-text { color: #ff8a8a; }
.ico { display: inline-flex; flex: none; line-height: 0; }
.ico svg { display: block; }
.ico.fav { color: var(--yellow-2); }
.ico.fav svg { fill: var(--yellow); stroke: var(--ink); }
.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- card ---------- */
.card {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--sh);
}

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: var(--bw) solid var(--ink);
  border-radius: 14px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  box-shadow: var(--sh-sm);
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s;
  white-space: nowrap;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: var(--sh-sm); }
.btn.primary, .btn.yellow { --btn-bg: var(--yellow); --btn-fg: #141414; }
.btn.blue { --btn-bg: var(--blue); --btn-fg: #fff; }
.btn.white { --btn-bg: var(--paper); }
.btn.danger { --btn-bg: var(--red); --btn-fg: #fff; }
.btn.ghost { --btn-bg: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--yellow-soft); border-color: var(--ink); box-shadow: var(--sh-sm); }
.btn.danger-text { color: var(--red); }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: 14px; border-radius: 12px; }
.btn.lg { min-height: 54px; font-size: 17px; border-radius: 16px; box-shadow: var(--sh); }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: 44px; min-height: 44px; }
.btn.icon.sm { width: 38px; min-height: 38px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 3px solid currentColor; border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
input:not([type='checkbox']):not([type='range']):not([type='file']), select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
  transition: box-shadow 0.12s, transform 0.12s;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 80px; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus, select:focus, textarea:focus { box-shadow: 3px 3px 0 var(--blue); transform: translate(-1px, -1px); }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
:root[data-theme='dark'] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23f4f6ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.input-row { position: relative; display: flex; align-items: center; }
.input-row > input, .input-row > textarea { padding-right: 96px; }
.input-actions, .input-row > .btn { position: absolute; right: 6px; display: flex; gap: 2px; }
.input-row > .btn { right: 6px; }

input[type='checkbox'] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 24px; height: 24px;
  margin: 0;
  border: var(--bw) solid var(--ink);
  border-radius: 7px;
  background: var(--paper);
  box-shadow: var(--sh-sm);
  cursor: pointer;
  display: grid; place-content: center;
}
input[type='checkbox']:checked {
  background: var(--yellow) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23141414' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check > span { padding-top: 1px; }

input[type='range'] { width: 100%; accent-color: var(--blue); height: 28px; }

.toggle { display: flex; align-items: center; gap: 12px; justify-content: space-between; cursor: pointer; position: relative; padding: 4px 0; }
.toggle-text { display: flex; flex-direction: column; font-weight: 500; }
.toggle-text small { font-weight: 400; font-size: 13px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  flex: none; position: relative;
  width: 52px; height: 30px;
  border: var(--bw) solid var(--ink); border-radius: 99px;
  background: var(--paper-2);
  box-shadow: var(--sh-sm);
  transition: background 0.18s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  border: var(--bw) solid var(--ink); background: #fff;
  transition: transform 0.2s cubic-bezier(.5, 1.6, .5, 1);
}
.toggle input:checked + .switch { background: var(--blue); }
.toggle input:checked + .switch::after { transform: translateX(21px); background: var(--yellow); }
.toggle input:focus-visible + .switch { outline: 3px solid var(--blue); outline-offset: 2px; }

.meter { display: flex; flex-direction: column; gap: 4px; }
.meter-track { height: 10px; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; background: var(--paper-2); }
.meter-fill { height: 100%; width: 0; transition: width 0.25s, background 0.25s; background: var(--red); }
.meter-fill[data-score='1'] { background: #ff9a3d; }
.meter-fill[data-score='2'] { background: var(--yellow); }
.meter-fill[data-score='3'] { background: #8fdc6a; }
.meter-fill[data-score='4'] { background: var(--green); }
.meter-label { font-size: 12px; color: var(--muted); min-height: 16px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 6px 14px; min-height: 36px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: var(--paper); font-weight: 600; font-size: 14px;
  box-shadow: var(--sh-sm); cursor: pointer;
  transition: transform 0.08s, background 0.15s;
}
.chip:active { transform: translate(2px, 2px); box-shadow: none; }
.chip.active { background: var(--yellow); color: #141414; }
.segmented { display: flex; border: var(--bw) solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: var(--sh-sm); }
.segmented button { flex: 1; padding: 10px; border: 0; background: var(--paper); font-weight: 600; cursor: pointer; }
.segmented button + button { border-left: var(--bw) solid var(--ink); }
.segmented button.active { background: var(--yellow); color: #141414; }

/* ---------- mascot ---------- */
.mascot { flex: none; filter: drop-shadow(3px 3px 0 var(--ink)); }
.mascot.bob { animation: bob 2.6s ease-in-out infinite; }
.mascot .m-eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-7px) rotate(1.5deg); } }
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }

/* ---------- auth screens ---------- */
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: calc(28px + var(--safe-t)) 18px calc(28px + var(--safe-b)); isolation: isolate; }
.auth-card {
  position: relative;
  width: 100%; max-width: 440px;
  padding: 26px 22px 22px;
  display: flex; flex-direction: column; align-items: stretch; gap: 16px;
  box-shadow: var(--sh-lg);
}
.auth-card::before {
  content: ''; position: absolute; inset: calc(-1 * var(--bw)); z-index: -1;
  background: var(--yellow); border: var(--bw) solid var(--ink); border-radius: var(--r);
  transform: rotate(-3.2deg) translate(-4px, 6px);
}
.auth-card > .mascot { align-self: center; }
.back-btn { align-self: flex-start; margin: -8px 0 -6px -8px; }
.brand {
  text-align: center; font-size: 46px; letter-spacing: 0.5px;
  color: var(--blue);
  text-shadow:
    -2px -2px 0 var(--ink), 0 -2px 0 var(--ink), 2px -2px 0 var(--ink),
    -2px 0 0 var(--ink), 2px 0 0 var(--ink),
    -2px 2px 0 var(--ink), 0 2px 0 var(--ink), 2px 2px 0 var(--ink),
    4px 4px 0 var(--ink), 5px 5px 0 var(--ink);
}
.brand span { color: var(--yellow); }
.brand.small { font-size: 34px; }
.lead { font-size: 17px; font-weight: 500; }
.feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.feature-list li {
  display: flex; gap: 12px; align-items: flex-start; font-size: 15px;
  padding: 10px 12px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper-2);
}
.feature-list .ico { padding: 6px; border: 2px solid var(--ink); border-radius: 10px; background: var(--yellow); color: #141414; }
.feature-list li:nth-child(2) .ico { background: var(--blue); color: #fff; }
.feature-list li:nth-child(3) .ico { background: var(--pink); }

.boot { min-height: 100dvh; display: grid; place-items: center; gap: 12px; align-content: center; font-weight: 600; color: var(--muted); }
.boot .boot-bear { width: 96px; height: 96px; border-radius: 28px; border: var(--bw) solid var(--ink); background: var(--yellow) url('/icons/favicon.svg') center / 86% no-repeat; box-shadow: var(--sh); animation: bob 2.6s ease-in-out infinite; }

/* ---------- shell ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: calc(var(--appbar-h) + var(--safe-t));
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: var(--blue);
  border-bottom: var(--bw) solid var(--ink);
  color: #fff;
}
.appbar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar-brand .mascot { filter: drop-shadow(2px 2px 0 var(--ink)); }
.appbar-kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--yellow); line-height: 1; text-shadow: 1px 1px 0 var(--ink); }
.appbar-title { font-size: 23px; color: #fff; text-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
.sync-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: 2px solid var(--ink); border-radius: 99px;
  background: var(--paper); color: var(--text);
  font-weight: 600; font-size: 13px; box-shadow: var(--sh-sm); cursor: pointer;
}
.sync-badge[data-state='ok'] { background: var(--mint); color: #141414; }
.sync-badge[data-state='error'], .sync-badge[data-state='auth'] { background: var(--red); color: #fff; }
.sync-badge[data-state='offline'] { background: var(--paper-2); }
.sync-badge[data-state='local'] { background: var(--yellow-soft); }
@media (max-width: 380px) { .sync-badge span:not(.ico) { display: none; } .sync-badge { width: 36px; padding: 0; justify-content: center; } }

.content { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: 16px 16px 0; }
.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: 760px; margin: 12px auto 0; padding: 10px 14px; width: calc(100% - 32px);
  border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--yellow); color: #141414;
  box-shadow: var(--sh-sm); font-weight: 500; font-size: 14px;
}
.banner span { flex: 1; min-width: 160px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  background: var(--paper);
  border-top: var(--bw) solid var(--ink);
}
.tab {
  flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px;
}
.tab-ico { display: grid; place-items: center; width: 54px; height: 34px; border-radius: 99px; border: 2px solid transparent; transition: background 0.15s, transform 0.15s; }
.tab.active { color: var(--text); }
.tab.active .tab-ico { background: var(--yellow); border-color: var(--ink); box-shadow: var(--sh-sm); color: #141414; transform: translateY(-2px); }

.fab {
  position: fixed; z-index: 31;
  right: 18px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border: var(--bw) solid var(--ink); border-radius: 22px;
  background: var(--yellow); color: #141414;
  box-shadow: var(--sh); cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.fab:hover { transform: translate(-1px, -1px) rotate(-6deg); box-shadow: 5px 5px 0 var(--ink); }
.fab:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

@media (min-width: 900px) {
  .tabbar {
    top: calc(var(--appbar-h) + var(--safe-t)); bottom: 0; right: auto;
    width: 220px; height: auto;
    flex-direction: column; justify-content: flex-start; gap: 6px;
    padding: 20px 14px;
    border-top: 0; border-right: var(--bw) solid var(--ink);
  }
  .tab { flex: none; max-width: none; flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 16px; padding: 4px; }
  .tab-ico { width: 46px; height: 40px; }
  .content { margin-left: 220px; padding-bottom: 120px; }
  .fab { bottom: 32px; right: 32px; }
}

/* ---------- toolbar / search ---------- */
.toolbar { position: sticky; top: calc(var(--appbar-h) + var(--safe-t)); z-index: 10; padding: 6px 0 10px; margin: -6px 0 0; background: linear-gradient(var(--bg) 70%, transparent); }
.search { position: relative; display: flex; align-items: center; }
.search > .ico { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search-input { padding-left: 44px !important; border-radius: 16px !important; box-shadow: var(--sh-sm); }
.chip-row:empty, .folder-row:empty { display: none; }
.chip-row { margin: 0 -4px 6px; }
.folder-row { margin-bottom: 12px; }
.folder-select { max-width: 280px; min-height: 40px !important; padding-top: 6px !important; padding-bottom: 6px !important; font-weight: 600; box-shadow: var(--sh-sm); }

/* ---------- avatar / tags ---------- */
.avatar {
  flex: none; display: grid; place-items: center;
  border: var(--bw) solid var(--ink); border-radius: 14px;
  font-weight: 700; font-size: 20px; color: #141414;
  box-shadow: var(--sh-sm);
}
.avatar.kind-card { background: var(--mint); }
.avatar.kind-note { background: var(--yellow); }
.avatar.kind-identity { background: var(--pink); }
.avatar.kind-passkey { background: var(--blue); color: #fff; }
.avatar.kind-login { background: var(--blue-soft); }
.mini-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--yellow-soft); color: var(--text); font-size: 11.5px; font-weight: 700; line-height: 1.5; white-space: nowrap;
}
.mini-tag.blue { background: var(--blue); color: #fff; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.section-title h3 { font-size: 16px; }

/* ---------- authenticator ---------- */
.otp-list { display: grid; gap: 14px; }
@media (min-width: 700px) { .otp-list { grid-template-columns: 1fr 1fr; } }
.otp-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 14px 10px 14px 14px; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform 0.1s, box-shadow 0.1s, background 0.25s;
  touch-action: manipulation;
}
.otp-card:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.otp-card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.otp-card.copied { background: var(--yellow-soft); }
.otp-card > .avatar { align-self: start; margin-top: 2px; }
.otp-info { min-width: 0; }
.otp-issuer { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 16.5px; }
.otp-issuer span, .otp-account { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otp-account { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; min-height: 19px; }
.otp-code {
  font-family: var(--mono); font-weight: 700; font-size: 31px; letter-spacing: 1.5px; line-height: 1.15;
  color: var(--code); margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.otp-code.hidden-code { letter-spacing: 3px; color: var(--muted); }
.otp-next { font-family: var(--mono); font-size: 12px; color: var(--muted); min-height: 16px; }
.otp-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ring-wrap { position: relative; width: 42px; height: 42px; display: grid; place-items: center; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring-track { stroke: var(--paper-2); stroke-width: 7 !important; }
.ring-prog { stroke: var(--blue); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.ring-wrap::before { content: ''; position: absolute; inset: 2px; border: 2px solid var(--ink); border-radius: 50%; }
.ring-label { position: relative; font-weight: 700; font-size: 13px; }
.ring-wrap.urgent .ring-prog { stroke: var(--red); }
.ring-wrap.urgent .ring-label { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }

.add-grid { display: grid; gap: 12px; }
.add-option {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px; text-align: left; cursor: pointer; transition: transform 0.08s, box-shadow 0.08s;
}
.add-option:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.add-ico { display: grid; place-items: center; width: 50px; height: 50px; border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--paper-2); }
.add-option.yellow .add-ico { background: var(--yellow); color: #141414; }
.add-option.blue .add-ico { background: var(--blue); color: #fff; }
.add-text { display: flex; flex-direction: column; }
.add-text b { font-size: 16.5px; }
.add-text small { color: var(--muted); }

.preview-code {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border: var(--bw) dashed var(--ink); border-radius: 14px; background: var(--blue-soft);
}
.preview-code b { font-family: var(--mono); font-size: 26px; color: var(--code); }
.preview-code.bad b { color: var(--red); font-size: 15px; }
.advanced { border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; background: var(--paper-2); }
.advanced > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; font-weight: 600; cursor: pointer; list-style: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::after { content: '＋'; margin-left: auto; font-weight: 700; }
.advanced[open] > summary::after { content: '－'; }
.advanced[open] { padding-bottom: 14px; }

.qr-box { padding: 12px; background: #fff; border: var(--bw) solid var(--ink); border-radius: 18px; box-shadow: var(--sh); line-height: 0; transition: filter 0.3s; }
.qr-box svg { max-width: min(70vw, 280px); height: auto; }
.qr-box.blurred { filter: blur(9px); }
.warn-box, .info-box {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px;
  background: var(--yellow-soft); font-size: 14px; text-align: left;
}
.info-box { background: var(--blue-soft); }
.warn-box > .ico, .info-box > .ico { margin-top: 2px; }
details.warn-box { display: block; }
details.warn-box summary { cursor: pointer; font-weight: 600; }
details.warn-box ul { margin: 8px 0 0; padding-left: 18px; }

/* ---------- scanner ---------- */
.sheet.scanner { background: #0b0f24; color: #fff; }
.sheet.scanner .sheet-head { background: #0b0f24; color: #fff; border-bottom: var(--bw) solid var(--ink); }
.sheet.scanner .sheet-head .btn { color: #fff; }
.sheet.scanner .sheet-body { padding: 0; }
.scan-wrap { position: relative; height: 100%; min-height: 60dvh; overflow: hidden; background: #000; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 42%; width: min(68vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%); box-shadow: 0 0 0 100vmax rgba(5, 8, 25, 0.48); border-radius: 24px; }
.scan-frame i { position: absolute; width: 46px; height: 46px; border: 7px solid var(--yellow); filter: drop-shadow(2px 2px 0 var(--ink)); }
.scan-frame i:nth-child(1) { top: -4px; left: -4px; border-right: 0; border-bottom: 0; border-radius: 22px 0 0 0; }
.scan-frame i:nth-child(2) { top: -4px; right: -4px; border-left: 0; border-bottom: 0; border-radius: 0 22px 0 0; }
.scan-frame i:nth-child(3) { bottom: -4px; left: -4px; border-right: 0; border-top: 0; border-radius: 0 0 0 22px; }
.scan-frame i:nth-child(4) { bottom: -4px; right: -4px; border-left: 0; border-top: 0; border-radius: 0 0 22px 0; }
.scan-laser { position: absolute; left: 10%; right: 10%; height: 4px; border-radius: 4px; background: var(--blue); box-shadow: 0 0 12px var(--blue); animation: laser 2.2s ease-in-out infinite; }
@keyframes laser { 0%, 100% { top: 12%; } 50% { top: 86%; } }
.scan-bottom { position: absolute; left: 16px; right: 16px; bottom: calc(20px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.scan-hint { padding: 10px 14px; border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--text); box-shadow: var(--sh); text-align: center; font-weight: 500; max-width: 420px; }
.scan-count { padding: 4px 12px; border: 2px solid var(--ink); border-radius: 99px; background: var(--yellow); color: #141414; font-weight: 700; }

/* ---------- password manager ---------- */
.pm-list { display: grid; gap: 12px; }
.pm-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 12px; padding: 12px 10px 12px 12px; cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.pm-row:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.pm-row:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.pm-info { min-width: 0; }
.pm-title { display: flex; align-items: center; gap: 5px; font-weight: 700; }
.pm-title span, .pm-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-sub { color: var(--muted); font-size: 14px; }
.pm-badges { display: flex; gap: 4px; }

.detail-head { display: flex; align-items: center; gap: 14px; }
.detail-head > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.detail-head h3 { font-size: 21px; overflow-wrap: anywhere; }
.field-card { padding: 4px 0; overflow: hidden; }
.field-card:empty { display: none; }
.field-row { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; }
.field-row + .field-row { border-top: 2px dashed color-mix(in srgb, var(--ink) 25%, transparent); }
.fr-main { flex: 1; min-width: 0; }
.fr-main small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.fr-value { overflow-wrap: anywhere; font-size: 16px; }
.fr-value.big { font-size: 26px; font-weight: 700; color: var(--code); }
.fr-actions { display: flex; flex: none; }
.cf-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto auto; gap: 6px; align-items: center; }
.cf-row input { min-height: 42px !important; padding: 8px 10px !important; }

.passkey-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px; text-align: left; cursor: pointer; }
.pk-ico { display: grid; place-items: center; width: 42px; height: 42px; border: var(--bw) solid var(--ink); border-radius: 12px; background: var(--blue); color: #fff; }
.pk-text { display: flex; flex-direction: column; min-width: 0; }
.pk-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-badge { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: var(--bw) solid var(--ink); border-radius: 14px; font-weight: 700; box-shadow: var(--sh-sm); }
.result-badge.ok { background: var(--mint); color: #141414; }
.result-badge.bad { background: var(--red); color: #fff; }
.checklist { padding: 12px 14px; }
.checklist ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: center; }
.checklist li.ok .ico { color: var(--green); }
.checklist li.bad .ico { color: var(--red); }
.code-block { max-height: 260px; overflow: auto; margin: 0 0 10px; padding: 10px; border: 2px solid var(--ink); border-radius: 10px; background: #0f1430; color: #d9e2ff; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-all; }

.gen-box { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--blue-soft); }
.gen-output { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; color: var(--code); }
.gen-output.pop { animation: pop 0.25s ease; }
@keyframes pop { 50% { transform: scale(1.04); } }

/* ---------- import / export ---------- */
.pick-list { display: flex; flex-direction: column; border: var(--bw) solid var(--ink); border-radius: 16px; overflow: hidden; background: var(--paper); }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.pick-row + .pick-row { border-top: 2px dashed color-mix(in srgb, var(--ink) 25%, transparent); }
.pick-row.dup { opacity: 0.6; }
.pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-text b, .pick-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-text small { color: var(--muted); }
.format-list { display: grid; gap: 10px; }
.format-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; text-align: left; cursor: pointer; }
.format-item > span { display: flex; flex-direction: column; min-width: 0; }
.format-item small { color: var(--muted); font-size: 13px; }
.format-item:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.howto { border: 2px solid var(--ink); border-radius: 14px; padding: 0 14px; background: var(--paper-2); }
.howto summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; font-weight: 600; }
.howto-list { display: grid; gap: 10px; padding-bottom: 14px; }
.howto-item p { color: var(--muted); font-size: 14px; }
.brand-hint { padding: 14px 16px; background: var(--yellow-soft); }
.brand-hint ol { margin: 6px 0 0; padding-left: 20px; }

/* ---------- settings ---------- */
.settings { display: flex; flex-direction: column; gap: 22px; }
.set-title { font-size: 14px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 0 0 8px 4px; }
.set-card { overflow: hidden; padding: 0; }
.set-item {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
  width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left; cursor: pointer;
}
.set-item:hover { background: var(--yellow-soft); }
.set-card > * + * { border-top: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent); }
.set-ico { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 11px; background: var(--blue-soft); }
.set-item.danger .set-ico { background: var(--red-soft); color: var(--red); }
.set-item.danger b { color: var(--red); }
.set-text { display: flex; flex-direction: column; min-width: 0; }
.set-text small { color: var(--muted); font-size: 13px; }
.set-row { padding: 12px 14px; }
.account-card { display: flex; align-items: center; gap: 14px; padding: 16px 14px; background: var(--yellow-soft); }
.account-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid var(--ink); border-radius: 14px; background: var(--paper); font-weight: 600; font-size: 13.5px; cursor: pointer; box-shadow: var(--sh-sm); }
.theme-opt.active { background: var(--yellow); color: #141414; }
.about { padding: 14px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- empty ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 36px 16px; }
.empty p { max-width: 380px; }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(12, 16, 40, 0.5);
  opacity: 0; transition: opacity 0.2s;
}
.sheet-backdrop.in { opacity: 1; }
.sheet-backdrop.out { opacity: 0; }
.sheet {
  position: relative; width: 100%; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--sheet);
  border: var(--bw) solid var(--ink); border-bottom: 0;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -4px 0 var(--ink);
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.05);
}
.sheet-backdrop.in .sheet { transform: translateY(0); }
.sheet-backdrop.out .sheet { transform: translateY(100%); }
.sheet-grip { width: 48px; height: 6px; margin: 10px auto 0; border-radius: 99px; background: var(--ink); opacity: 0.25; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 14px 6px 20px; flex: none; }
.sheet-title { font-size: 21px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 20px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; flex: none; padding: 12px 20px calc(12px + var(--safe-b)); border-top: var(--bw) solid var(--ink); background: var(--paper-2); }
.sheet-foot > .btn { flex: 1; }
.sheet.full { height: 100dvh; max-height: none; border-radius: 0; border: 0; }
.sheet.full .sheet-grip { display: none; }
.sheet.full .sheet-head { padding-top: calc(10px + var(--safe-t)); }
.sheet.full .sheet-body { display: flex; flex-direction: column; }
.sheet.full .scan-wrap { flex: 1; }
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; max-height: 88dvh; border: var(--bw) solid var(--ink); border-radius: 24px; box-shadow: var(--sh-lg); transform: translateY(30px) scale(0.97); }
  .sheet.wide { max-width: 760px; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 16px; }
  .sheet-foot { border-radius: 0 0 22px 22px; }
  .sheet-foot > .btn { flex: none; min-width: 120px; }
  .sheet-backdrop.in .sheet { transform: none; }
  .sheet-backdrop.out .sheet { transform: translateY(30px) scale(0.97); }
  .sheet.full { max-width: 640px; height: 86dvh; border: var(--bw) solid var(--ink); border-radius: 24px; overflow: hidden; }
}
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 52px; padding: 10px 14px;
  border: 2px solid var(--ink); border-radius: 14px; background: var(--paper);
  font-weight: 600; text-align: left; cursor: pointer; box-shadow: var(--sh-sm);
}
.action-item:active { transform: translate(2px, 2px); box-shadow: none; }
.action-item.danger { color: var(--red); }
.action-item small { margin-left: auto; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 200; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  width: fit-content; max-width: min(520px, 100%);
  padding: 8px 8px 8px 10px;
  border: var(--bw) solid var(--ink); border-radius: 16px;
  background: var(--paper); color: var(--text);
  box-shadow: var(--sh); font-weight: 500; font-size: 15px;
  animation: toast-in 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.toast.out { animation: toast-out 0.22s forwards; }
.toast-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 2px solid var(--ink); border-radius: 10px; background: var(--mint); color: #141414; }
.toast-error .toast-ico { background: var(--red); color: #fff; }
.toast-warn .toast-ico { background: var(--yellow); }
.toast-info .toast-ico { background: var(--blue); color: #fff; }
.toast-msg { flex: 1; }
.toast-x { border: 0; background: none; padding: 6px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
@keyframes toast-in { from { transform: translateY(-20px) scale(0.95); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-14px); opacity: 0; } }

.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
