/* LAWSON X SHINNY — Calculator + Private Vault
   ==========================================================================
   Calculator + private vault
   Obsidian / graphite / violet, with restrained electric-cyan accents.
   Animations only touch transform and opacity to stay smooth on low-end phones.
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #07070c;
  --bg-2: #0d0d15;
  --surface: #14141d;
  --surface-2: #1b1b27;
  --surface-3: #242433;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f3f3f8;
  --text-dim: #a2a2b6;
  --text-faint: #6d6d82;
  --violet: #8d72ff;
  --violet-deep: #6a4df0;
  --violet-soft: rgba(141, 114, 255, 0.16);
  --cyan: #3de3f2;
  --cyan-soft: rgba(61, 227, 242, 0.14);
  --danger: #ff6b7d;
  --danger-soft: rgba(255, 107, 125, 0.14);
  --warn: #ffb454;
  --ok: #4fe3a1;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.5, 1);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(141, 114, 255, 0.16), transparent 62%),
    radial-gradient(700px 480px at -10% 108%, rgba(61, 227, 242, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: not-allowed; }
ul { list-style: none; }
h1, h2, h3 { font-weight: 650; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 10px; }
::selection { background: var(--violet-soft); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noscript { padding: 24px; text-align: center; color: var(--text-dim); }
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic--fill { fill: currentColor; stroke: none; }

.app { position: relative; min-height: 100vh; min-height: 100dvh; }
.screen { width: 100%; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 15px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform 0.16s var(--ease), background-color 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:active:not(:disabled) { transform: scale(0.965); }
.btn:disabled { opacity: 0.4; }
.btn--primary { background: linear-gradient(145deg, var(--violet), var(--violet-deep)); color: #fff; box-shadow: 0 8px 24px rgba(106, 77, 240, 0.32); }
.btn--ghost { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.btn--ghost:hover:not(:disabled) { border-color: var(--line-strong); }
.btn--danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255, 107, 125, 0.28); }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 13px; }
.btn--block { width: 100%; }
.btn--lock { min-height: 40px; padding: 0 16px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text); }
.btn--lock .ic { color: var(--cyan); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.link { color: var(--text-dim); font-size: 14px; padding: 8px 6px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.link:hover { color: var(--text); }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  color: var(--text-dim); transition: background-color 0.2s, color 0.2s, transform 0.16s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active:not(:disabled) { transform: scale(0.92); }
.icon-btn:disabled { opacity: 0.3; }

/* ==========================================================================
   CALCULATOR
   ========================================================================== */
.calc {
  max-width: 440px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(8px + var(--safe-t)) 16px calc(20px + var(--safe-b));
}
.calc.is-leaving { animation: calc-out 0.28s var(--ease) forwards; }
.calc__top { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.calc__label { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.calc__spacer { width: 44px; }
.calc__display { flex: 1 1 auto; min-height: 120px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; padding: 8px 6px 18px; }
.calc__prev { min-height: 24px; text-align: right; font-size: 17px; color: var(--text-faint); font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calc__prev[data-state="error"] { color: var(--danger); }
.calc__prev[data-state="info"] { color: var(--text-dim); }
.calc__main {
  text-align: right; font-size: clamp(52px, 17vw, 76px); font-weight: 300; letter-spacing: -0.03em; line-height: 1.12;
  font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; color: var(--text);
  scrollbar-width: none;
}
.calc__main::-webkit-scrollbar { display: none; }
.calc__main.is-empty { color: var(--text-faint); }
.calc__main.pop { animation: pop 0.34s var(--ease); }
.calc__display.shake { animation: shake 0.34s var(--ease); }

.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 2.6vw, 14px); }
.key {
  position: relative; height: clamp(54px, 9.6dvh, 78px); border-radius: 26px;
  display: grid; place-items: center; font-size: clamp(22px, 3.6dvh, 29px); font-weight: 400;
  color: var(--text); background: linear-gradient(180deg, #1d1d29, #151520);
  border: 1px solid var(--line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 14px rgba(0, 0, 0, 0.32);
  transition: transform 0.22s var(--spring), background-color 0.15s, filter 0.15s;
  user-select: none; -webkit-user-select: none;
}
.key:active, .key.is-pressed { transform: scale(0.93); transition-duration: 0.07s; filter: brightness(1.28); }
.key--fn { color: var(--cyan); background: linear-gradient(180deg, #202030, #181825); font-size: clamp(19px, 3.2dvh, 25px); }
.key--op { color: #c9bcff; background: linear-gradient(180deg, rgba(141, 114, 255, 0.26), rgba(141, 114, 255, 0.14)); border-color: rgba(141, 114, 255, 0.28); font-size: clamp(26px, 4.2dvh, 34px); }
.key--zero { grid-column: span 2; place-items: center start; padding-left: clamp(26px, 8vw, 36px); }
.key--eq { background: linear-gradient(145deg, var(--violet), var(--violet-deep)); border-color: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: 0 10px 26px rgba(106, 77, 240, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22); font-size: clamp(28px, 4.4dvh, 36px); }
.key--eq.is-busy { animation: pulse 0.9s ease-in-out infinite; }
.key .ic { width: 1.1em; height: 1.1em; }

/* ---------- history ---------- */
.hist { display: flex; flex-direction: column; max-height: 52dvh; overflow-y: auto; margin: 4px -6px; overscroll-behavior: contain; }
.hist__row { display: flex; flex-direction: column; align-items: flex-end; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.hist__row:last-child { border-bottom: 0; }
.hist__expr { color: var(--text-dim); font-size: 15px; padding: 4px 8px; border-radius: 10px; font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; text-align: right; }
.hist__res { font-size: 26px; font-weight: 300; padding: 2px 8px; border-radius: 10px; font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; text-align: right; }
.hist__expr:hover, .hist__res:hover { background: var(--surface-2); }
.hist__empty { text-align: center; color: var(--text-faint); padding: 28px 0; }

/* ==========================================================================
   VEIL (unlock / lock animation)
   ========================================================================== */
.veil { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: var(--bg); opacity: 0; transition: opacity 0.26s var(--ease); pointer-events: all; }
.veil.is-on { opacity: 1; }
.veil__core { position: relative; width: 132px; height: 132px; display: grid; place-items: center; }
.veil__ring { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(141, 114, 255, 0.55); opacity: 0; }
.veil__ring--2 { border-color: rgba(61, 227, 242, 0.45); }
.veil__lock { width: 64px; height: 64px; position: relative; z-index: 1; overflow: visible; }
.veil__body { fill: var(--surface-2); stroke: var(--violet); stroke-width: 2.2; }
.veil__shackle { fill: none; stroke: var(--text); stroke-width: 3.6; stroke-linecap: round; transform-origin: 42px 29px; transform-box: view-box; }
.veil__hole { fill: var(--cyan); stroke: var(--cyan); stroke-width: 2.4; stroke-linecap: round; }
.veil.is-on[data-mode="unlock"] .veil__ring { animation: ring 0.9s var(--ease) 0.18s both; }
.veil.is-on[data-mode="unlock"] .veil__ring--2 { animation-delay: 0.34s; }
.veil.is-on[data-mode="unlock"] .veil__shackle { animation: shackle-open 0.5s var(--spring) 0.2s both; }
.veil.is-on[data-mode="unlock"] .veil__lock { animation: lock-pop 0.5s var(--ease) both; }
.veil.is-on[data-mode="lock"] .veil__shackle { animation: shackle-close 0.34s var(--spring) 0.05s both; }
.veil.is-on[data-mode="lock"] .veil__ring { animation: ring 0.6s var(--ease) 0.22s both; }

/* ==========================================================================
   TOASTS
   ========================================================================== */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--safe-b)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
html[data-screen="calc"] .toasts { bottom: auto; top: calc(58px + var(--safe-t)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(92vw, 440px);
  padding: 12px 16px; border-radius: 16px; background: rgba(27, 27, 39, 0.96); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); font-size: 14px; animation: toast-in 0.3s var(--ease) both;
}
.toast .ic { color: var(--cyan); }
.toast--ok .ic { color: var(--ok); }
.toast--err .ic { color: var(--danger); }
.toast.is-out { animation: toast-out 0.22s var(--ease) forwards; }

/* ==========================================================================
   DIALOGS
   ========================================================================== */
.dlg { border: 0; background: transparent; color: inherit; padding: 0; max-width: 100vw; max-height: 100dvh; overflow: visible; margin: auto; }
.dlg::backdrop { background: rgba(3, 3, 8, 0.74); }
.dlg[open] { animation: dlg-in 0.24s var(--ease); }
.dlg[open]::backdrop { animation: fade-in 0.24s ease; }
.dlg.is-closing { animation: dlg-out 0.2s var(--ease) forwards; }
.dlg.is-closing::backdrop { animation: fade-out 0.2s ease forwards; }
.dlg__box {
  width: min(92vw, 420px); max-height: 88dvh; overflow-y: auto; padding: 20px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow);
  overscroll-behavior: contain;
}
.dlg--sheet { margin: auto auto 0; width: 100%; max-width: 520px; }
.dlg--sheet .dlg__box { width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(20px + var(--safe-b)); }
.dlg--sheet[open] { animation: sheet-in 0.3s var(--ease); }
.dlg--sheet.is-closing { animation: sheet-out 0.22s var(--ease) forwards; }
.dlg__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dlg__title { font-size: 19px; }
.dlg__text { color: var(--text-dim); font-size: 15px; margin-bottom: 14px; overflow-wrap: anywhere; }
.dlg__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dlg--viewer { width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; }
.dlg--viewer[open] { animation: fade-in 0.22s ease; }

/* ==========================================================================
   FORM PARTS
   ========================================================================== */
.field { display: block; margin-top: 14px; }
.field--inline { margin: 0 0 4px; }
.field__label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 550; }
.field__label em { font-style: normal; color: var(--text-faint); font-weight: 400; }
.input, .select select, .search input {
  width: 100%; min-height: 48px; padding: 0 14px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 14px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, .select select:focus, .search input:focus, .pin:focus-within, .note:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px var(--cyan-soft); }
.pin { display: flex; align-items: center; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
.pin__input { flex: 1; width: 100%; min-width: 0; min-height: 52px; padding: 0 14px; background: transparent; border: 0; outline: none; font-size: 22px; letter-spacing: 0.22em; font-variant-numeric: tabular-nums; }
.pin__input.is-reveal { letter-spacing: 0.16em; }
.pin__eye { width: 48px; height: 52px; display: grid; place-items: center; color: var(--text-dim); }
.pin__eye:hover { color: var(--text); }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.meter i { height: 4px; border-radius: 4px; background: var(--surface-3); transition: background-color 0.25s; }
.meter[data-level="1"] i:nth-child(-n+1) { background: var(--danger); }
.meter[data-level="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-level="3"] i:nth-child(-n+3) { background: var(--violet); }
.meter[data-level="4"] i { background: var(--cyan); }
.hint { margin-top: 8px; font-size: 13px; color: var(--text-faint); min-height: 18px; }
.hint--error { color: var(--danger); }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 18px 0 20px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 8px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); background: var(--bg-2); color: transparent; transition: background-color 0.18s, border-color 0.18s, color 0.18s; }
.check input:checked + .check__box { background: var(--violet); border-color: var(--violet); color: #fff; }
.check input:focus-visible + .check__box { outline: 2px solid var(--cyan); outline-offset: 2px; }
.check__text { font-size: 14px; color: var(--text-dim); }
.check__text b { color: var(--text); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px; height: 30px; border-radius: 30px; background: var(--surface-3); position: relative; cursor: pointer; transition: background-color 0.2s; border: 1px solid var(--line); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.22s var(--spring); }
.switch:checked { background: var(--violet); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.select { position: relative; display: block; }
.select select { appearance: none; -webkit-appearance: none; min-height: 40px; padding-right: 14px; font-size: 14px; background: var(--surface-2); color: var(--text); }
select option { background: var(--surface-2); color: var(--text); }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 13.5px; margin-top: 16px; color: var(--text-dim); }
.notice--info { background: var(--cyan-soft); border: 1px solid rgba(61, 227, 242, 0.22); }
.notice--info .ic { color: var(--cyan); margin-top: 2px; }
.bar { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 8px; background: var(--surface-3); overflow: hidden; display: block; margin-top: 10px; }
.bar::-webkit-progress-bar { background: var(--surface-3); border-radius: 8px; }
.bar::-webkit-progress-value { background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: 8px; transition: width 0.2s; }
.bar::-moz-progress-bar { background: linear-gradient(90deg, var(--violet), var(--cyan)); border-radius: 8px; }
.bar--thin { height: 4px; margin-top: 8px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; }

/* ==========================================================================
   SETUP SCREEN
   ========================================================================== */
.setup { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.setup.is-entering .setup__card { animation: rise 0.45s var(--ease) both; }
.setup__card { width: 100%; min-width: 0; max-width: 440px; padding: 26px 22px 18px; background: linear-gradient(180deg, rgba(27, 27, 39, 0.92), rgba(20, 20, 29, 0.92)); border: 1px solid var(--line-strong); border-radius: 28px; box-shadow: var(--shadow); }
.setup__badge { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--violet-soft); color: var(--violet); border: 1px solid rgba(141, 114, 255, 0.3); margin-bottom: 16px; }
.setup__badge .ic { width: 26px; height: 26px; }
.setup__title { font-size: 25px; margin-bottom: 8px; }
.setup__lead { color: var(--text-dim); font-size: 15px; }
.setup__lead b { color: var(--text); }
.setup__links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; margin-top: 14px; }

/* ==========================================================================
   VAULT
   ========================================================================== */
.vault { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(96px + var(--safe-b)); }
.vault.is-entering .vmain { animation: rise 0.42s var(--ease) both; }
.vault.is-entering .vbar { animation: fade-in 0.3s ease both; }
.vbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: #07070c; border-bottom: 1px solid var(--line); }
.vbar__title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vbar__title h1 { font-size: 18px; line-height: 1.2; }
.vbar__sub { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar__title > div { min-width: 0; }
.vbar__badge { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(145deg, var(--violet-soft), var(--cyan-soft)); color: var(--cyan); border: 1px solid var(--line-strong); flex: none; }
.vmain { max-width: 760px; margin: 0 auto; padding: 16px; }
.pane > * + * { margin-top: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.stat__num { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat__lbl { font-size: 12px; color: var(--text-faint); }
.stat--limit .stat__num { color: var(--cyan); }

.toolbar { display: flex; flex-direction: column; gap: 10px; }
.toolbar__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search { position: relative; display: block; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }
.search input { padding-left: 42px; }
.seg { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; gap: 2px; }
.seg button { min-height: 36px; padding: 0 14px; border-radius: 11px; font-size: 14px; font-weight: 550; color: var(--text-dim); transition: background-color 0.2s, color 0.2s; display: grid; place-items: center; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.seg--icons button { padding: 0 11px; }
.selbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 14px; background: var(--violet-soft); border: 1px solid rgba(141, 114, 255, 0.3); border-radius: 16px; animation: rise 0.25s var(--ease) both; }
.selbar__count { font-weight: 600; font-size: 14px; }
.selbar__actions { display: flex; gap: 8px; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; transition: border-color 0.2s, transform 0.2s var(--ease); }
.tile--new { animation: tile-in 0.36s var(--ease) both; }
.tile--out { animation: tile-out 0.22s var(--ease) forwards; pointer-events: none; }
.tile__open { display: block; width: 100%; text-align: left; }
.tile__media { position: relative; display: block; aspect-ratio: 1; background: var(--bg-2); overflow: hidden; }
.tile__img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fade-in 0.3s ease both; }
.tile__ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-faint); }
.tile__ph .ic { width: 34px; height: 34px; opacity: 0.7; }
.tile__badge { position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 99px; background: rgba(7, 7, 12, 0.72); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile__badge .ic { width: 12px; height: 12px; }
.tile__info { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px 11px; min-width: 0; }
.tile__name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__meta { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__del { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(7, 7, 12, 0.7); color: var(--text); transition: background-color 0.2s, color 0.2s, transform 0.16s var(--ease); }
.tile__del:hover { background: var(--danger-soft); color: var(--danger); }
.tile__del:active { transform: scale(0.9); }
.tile__del .ic { width: 17px; height: 17px; }
.tile__check { position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; border: 1.5px solid rgba(255, 255, 255, 0.7); background: rgba(7, 7, 12, 0.5); color: transparent; pointer-events: none; }
.is-selecting .tile__check { display: grid; }
.is-selecting .tile__del { display: none; }
.tile.is-selected { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan-soft); }
.tile.is-selected .tile__check { background: var(--cyan); border-color: var(--cyan); color: #04141a; }
.gallery[data-view="list"] { grid-template-columns: 1fr; gap: 8px; }
.gallery[data-view="list"] .tile__open { display: flex; align-items: center; gap: 12px; padding-right: 56px; }
.gallery[data-view="list"] .tile__media { width: 68px; height: 68px; aspect-ratio: auto; flex: none; border-radius: 0; }
.gallery[data-view="list"] .tile__info { padding: 8px 0; }
.gallery[data-view="list"] .tile__badge { display: none; }
.gallery[data-view="list"] .tile__del { top: 50%; transform: translateY(-50%); right: 10px; }
.gallery[data-view="list"] .tile__del:active { transform: translateY(-50%) scale(0.9); }
.gallery[data-view="list"] .tile__check { top: 50%; transform: translateY(-50%); left: 22px; }
.skeleton { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.skeleton i { aspect-ratio: 1; border-radius: var(--r-md); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }

.empty { text-align: center; padding: 44px 20px 30px; }
.empty__art { width: 84px; height: 84px; margin: 0 auto 18px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(145deg, var(--violet-soft), var(--cyan-soft)); color: var(--violet); border: 1px solid var(--line-strong); }
.empty__art .ic { width: 38px; height: 38px; }
.empty__title { font-size: 20px; margin-bottom: 6px; }
.empty__text { color: var(--text-dim); max-width: 320px; margin: 0 auto 20px; font-size: 15px; }

.fab { position: fixed; right: 16px; bottom: calc(86px + var(--safe-b)); z-index: 25; display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 22px 0 18px; border-radius: 99px; background: linear-gradient(145deg, var(--violet), var(--violet-deep)); color: #fff; font-weight: 650; box-shadow: 0 12px 30px rgba(106, 77, 240, 0.45); transition: transform 0.2s var(--spring); }
.fab:active { transform: scale(0.94); }
.vnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 24; display: flex; justify-content: center; gap: 6px; padding: 8px 12px calc(8px + var(--safe-b)); background: #0a0a10; border-top: 1px solid var(--line); }
.vnav button { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0; border-radius: 14px; color: var(--text-faint); font-size: 12px; font-weight: 600; transition: color 0.2s, background-color 0.2s; }
.vnav button .ic { width: 23px; height: 23px; }
.vnav button[aria-current="page"] { color: var(--cyan); background: var(--cyan-soft); }

/* cards, rows, notes */
.card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card__title { display: block; font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.card__text { color: var(--text-dim); font-size: 14.5px; }
.card--danger { border-color: rgba(255, 107, 125, 0.22); }
.row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 0; text-align: left; border-top: 1px solid var(--line); }
.card__title + .row { border-top: 0; }
.row__ic { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--violet); flex: none; }
.row__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row__text b { font-size: 15px; font-weight: 600; }
.row__text small { font-size: 12.5px; color: var(--text-faint); }
.row__chev { color: var(--text-faint); }
.row--select select { width: auto; max-width: 150px; flex: none; }
.fineprint { font-size: 12.5px; color: var(--text-faint); margin-top: 12px; }
.about { border-top: 1px solid var(--line); padding: 4px 0; }
.card__title + .about { border-top: 0; }
.about summary { cursor: pointer; padding: 11px 0; font-size: 14.5px; font-weight: 550; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: "+"; color: var(--text-faint); font-size: 20px; line-height: 1; transition: transform 0.2s; }
.about[open] summary::after { transform: rotate(45deg); }
.about p { font-size: 14px; color: var(--text-dim); padding-bottom: 10px; }
.card--note { padding-bottom: 12px; }
.note { width: 100%; min-height: 46dvh; resize: vertical; padding: 14px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 16px; line-height: 1.6; outline: none; transition: border-color 0.2s, box-shadow 0.2s; }
.note__foot { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.note__status { font-size: 13px; font-weight: 600; color: var(--ok); display: inline-flex; align-items: center; gap: 6px; }
.note__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.note__status[data-state="saving"] { color: var(--text-dim); }
.note__status[data-state="saving"]::before { animation: pulse 0.9s ease-in-out infinite; }
.note__status[data-state="error"] { color: var(--danger); }
.note__count { margin-left: auto; font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* import list */
.imp { display: flex; flex-direction: column; gap: 10px; max-height: 40dvh; overflow-y: auto; margin-top: 4px; }
.imp__row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
.imp__name { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp__stat { font-size: 12.5px; color: var(--text-faint); text-align: right; max-width: 60vw; overflow-wrap: anywhere; }
.imp__row .bar { grid-column: 1 / -1; }
.imp__row[data-state="done"] .imp__stat { color: var(--ok); }
.imp__row[data-state="fail"] .imp__stat { color: var(--danger); }
.imp__row[data-state="skipped"] .imp__stat { color: var(--warn); }
.imp__row[data-state="skipped"] .bar, .imp__row[data-state="fail"] .bar { display: none; }

/* viewer */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; background: #050509; overflow: hidden; }
.viewer__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + var(--safe-t)) 8px 8px 18px; }
.viewer__heading { min-width: 0; }
.viewer__title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer__meta { font-size: 12.5px; color: var(--text-faint); }
.viewer__stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 4px; }
.viewer__stage img, .viewer__stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; background: #000; animation: fade-in 0.25s ease both; }
.viewer__spinner { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--text-dim); font-size: 14px; }
.viewer__msg { max-width: 320px; text-align: center; color: var(--text-dim); padding: 20px; }
.viewer__foot { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 8px 10px calc(10px + var(--safe-b)); }
.viewer__pos { font-size: 13px; color: var(--text-faint); min-width: 0; flex: 0 1 auto; white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums; }

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes calc-out { to { opacity: 0; transform: scale(0.95) translateY(-10px); } }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes dlg-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes pop { 0% { transform: translateY(6px) scale(0.97); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes tile-in { from { opacity: 0; transform: scale(0.9) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tile-out { to { opacity: 0; transform: scale(0.88); } }
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ring { 0% { opacity: 0.9; transform: scale(0.55); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes lock-pop { 0% { transform: scale(0.8); opacity: 0.4; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shackle-open { 0% { transform: translateY(0) rotate(0); } 100% { transform: translateY(-7px) rotate(-16deg); } }
@keyframes shackle-close { 0% { transform: translateY(-7px) rotate(-16deg); } 100% { transform: translateY(0) rotate(0); } }

/* ==========================================================================
   REDUCED MOTION (device setting or in-app switch) — no movement, instant state changes
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; border-top-color: var(--cyan); border-right-color: var(--cyan); }
}
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
html[data-motion="reduce"] .spinner { animation: none; border-top-color: var(--cyan); border-right-color: var(--cyan); }
html[data-motion="reduce"] .calc.is-leaving { opacity: 0; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-height: 640px) {
  .calc__top { height: 44px; }
  .calc__display { min-height: 84px; padding-bottom: 8px; }
  .calc__main { font-size: clamp(44px, 14vw, 60px); }
  .key { border-radius: 22px; }
}
@media (max-width: 420px) {
  .row--select { flex-wrap: wrap; }
  .row--select .row__text { flex: 1 1 calc(100% - 60px); }
  .row--select select { max-width: none; width: 100%; margin-left: 52px; flex-basis: calc(100% - 52px); }
  .viewer__foot .btn { padding: 0; width: 44px; min-height: 44px; }
  .viewer__foot .btn span { display: none; }
  .viewer__foot { gap: 6px; padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 360px) {
  .vmain { padding: 12px; }
  .gallery, .skeleton { grid-template-columns: repeat(2, 1fr); }
  .stat__num { font-size: 17px; }
  .btn { padding: 0 14px; }
}
@media (min-width: 720px) {
  .gallery, .skeleton { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .calc { justify-content: center; }
  .dlg--sheet { margin: auto; }
  .dlg--sheet .dlg__box { border-radius: var(--r-lg); padding-bottom: 20px; }
  .toasts { bottom: 28px; }
  html[data-screen="calc"] .toasts { bottom: auto; top: 64px; }
  .fab { right: max(24px, calc(50% - 380px)); }
}
@media (forced-colors: active) {
  .key, .btn, .tile { border: 1px solid CanvasText; }
}


/* ==========================================================================
   BRAND — "LAWSON X SHINNY"
   ========================================================================== */
.brand { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3em; text-transform: uppercase; white-space: nowrap; color: var(--violet); user-select: none; -webkit-user-select: none; }
.brand--top { margin-top: 3px; font-size: 9.5px; letter-spacing: 0.26em; background: linear-gradient(90deg, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.calc__label { text-align: center; line-height: 1.15; }
.brand--card { text-align: center; margin: 18px 0 2px; background: linear-gradient(90deg, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
.brand--veil { position: absolute; left: 0; right: 0; bottom: calc(10vh + var(--safe-b)); text-align: center; opacity: 0; color: var(--text-dim); font-size: 11px; }
.veil.is-on .brand--veil { animation: fade-in 0.5s ease 0.25s both; }
.vcredit { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 34px 0 6px; text-align: center; }
.vcredit__line { width: 44px; height: 1px; background: linear-gradient(90deg, transparent, var(--violet), transparent); }
.vcredit .brand { color: var(--text-dim); }
.vcredit__sub { font-size: 11px; color: var(--text-faint); }
.about__brand { font-size: 17px; font-weight: 750; letter-spacing: 0.22em; margin: 2px 0 6px; background: linear-gradient(90deg, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@media (max-width: 360px) { .brand { letter-spacing: 0.22em; } .brand--top { letter-spacing: 0.2em; } }
@media (forced-colors: active) { .brand--top, .brand--card, .about__brand { -webkit-text-fill-color: CanvasText; color: CanvasText; } }
