:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  --bg: #f4f5f9;
  --surface: #fff;
  --ink: #10141d;
  --muted: #626b79;
  --blue: #0068df;
  --accent: #07f;
  --red: #c72e2e;
  --subtle: #e7eaf0;
  --line: #d9dee6;
  --glass: #ffffffdf;
  --ring: #168ad523;
  --glow: #b3e6ffab;
  --aqua: #9cf3ed80;
  --sky: #c9dcffad;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101115;
    --surface: #1d1f25;
    --ink: #f5f7fa;
    --muted: #adb3bf;
    --blue: #66b3ff;
    --accent: #0a73ea;
    --red: #ff7067;
    --subtle: #272a31;
    --line: #34373e;
    --glass: #22262ada;
    --ring: #5cbad12e;
    --glow: #064c72b8;
    --aqua: #055a5c66;
    --sky: #14315e9e;
  }
}
* { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 17px; letter-spacing: -.02em; }
body:has(dialog[open]) { overflow: hidden; }
button, input { color: inherit; font: inherit; letter-spacing: inherit; }
button {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border: none; background: none; color: var(--blue); cursor: pointer;
  min-height: 44px; padding: 0; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:active { opacity: .65; }
button:disabled { cursor: auto; opacity: .4; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden], :empty:is(.error, #notice, .version, small) { display: none; }
svg {
  width: 23px; height: 23px; flex: none; fill: none;
  stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
h1 { font-size: clamp(30px, 8.6vw, 36px); font-weight: 730; line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 21px; letter-spacing: -.035em; }
h3 { font-size: 20px; letter-spacing: -.03em; }
p { line-height: 1.42; }
.primary, .secondary, .plain {
  width: 100%; border-radius: 16px; min-height: 53px;
  font-size: 17px; font-weight: 600; padding: 11px 14px;
}
.primary { background: var(--accent); color: white; }
.primary.danger { background: #d6322c; }
.secondary { background: var(--surface); }
.plain { font-size: 16px; font-weight: 510; }
.plain svg { width: 20px; height: 20px; }
.destructive, .error { color: var(--red); }
.icon-button { flex: none; width: 44px; height: 44px; background: var(--surface); border-radius: 50%; }
.loading, .welcome {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: flex; align-items: center; flex-direction: column; justify-content: center;
}
.welcome {
  background: radial-gradient(ellipse 92% 50% at 72% 13%, var(--aqua), transparent 84%),
    radial-gradient(ellipse 90% 58% at 12% 18%, var(--sky), transparent 90%), var(--bg);
  padding: calc(32px + var(--top)) 24px calc(18px + var(--bottom)); text-align: center;
}
.welcome-content { margin: auto 0; max-width: 410px; padding: 20px 0 48px; }
.hero {
  position: relative; display: grid; place-items: center; isolation: isolate;
  width: clamp(126px, 21svh, 196px); aspect-ratio: 1; margin: 0 auto clamp(34px, 5vh, 54px);
}
.hero::before, .hero::after {
  content: ""; position: absolute; z-index: -1; border-radius: 50%; border: 1px solid var(--ring);
  mask-image: linear-gradient(black 58%, transparent 94%);
}
.hero::before { inset: -49%; background: radial-gradient(closest-side, var(--glow), transparent); }
.hero::after { inset: -95%; opacity: .8; }
.hero img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 16px 19px #0c799630) drop-shadow(0 4px 5px #0b3b5114);
}
.welcome h1 { font-size: clamp(34px, 10vw, 46px); letter-spacing: -.05em; text-wrap: balance; }
.welcome-content p { margin: 14px auto 0; color: var(--muted); max-width: 345px; text-wrap: balance; }
.welcome-actions { width: min(100%, 370px); padding-bottom: 2vh; }
.welcome-actions button + button { margin-top: 6px; }
.code {
  display: block; margin: 22px 0; font-size: 36px; letter-spacing: .08em;
  color: var(--blue); font-variant-numeric: tabular-nums;
}
.spinner {
  margin: 20px auto; width: 28px; height: 28px; border: 3px solid var(--line);
  border-top-color: var(--blue); border-radius: 50%; animation: spin .85s linear infinite;
}
.refreshing svg { animation: spin .7s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } }

.page {
  max-width: 760px; margin: 0 auto;
  padding: calc(24px + var(--top)) max(18px, env(safe-area-inset-right)) calc(114px + var(--bottom)) max(18px, env(safe-area-inset-left));
}
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 8px; }
.page-header .icon-button { width: 42px; height: 42px; }
.offline {
  font-size: 14px; color: var(--muted); margin-bottom: 16px;
  background: var(--surface); padding: 12px 15px; border-radius: 12px;
}
.search, .link-form input {
  display: flex; align-items: center; background: var(--subtle); border: none;
  color: var(--muted); border-radius: 13px; padding: 0 12px; min-height: 44px; gap: 6px;
}
.search:focus-within { outline: 2px solid var(--blue); }
.search svg { width: 19px; height: 19px; stroke-width: 2.3; }
.search input {
  flex: 1; min-width: 0; padding: 0; border: 0; height: 44px;
  font-size: 16px; color: var(--ink); background: none; outline: none;
}
input::placeholder { color: var(--muted); opacity: 1; }
.filters { display: flex; gap: 8px; margin: 16px 0 12px; }
.filters button {
  padding: 8px 14px; color: var(--muted); min-height: 36px; border-radius: 30px;
  font-size: 15px; font-weight: 550; background: var(--surface);
}
.filters [aria-pressed="true"] { background: var(--accent); color: white; }
.list, .group { border-radius: 20px; background: var(--surface); overflow: hidden; }
.app-row, .download, .copy-row, .metadata {
  position: relative; display: flex; align-items: center; text-align: left; gap: 12px;
  padding: 13px 15px; color: var(--ink); width: 100%;
}
.app-row + .app-row::before, .download + .download::before, .group > * + *::before {
  content: ""; position: absolute; left: 79px; top: 0; right: 0; height: 1px;
  transform: scaleY(.5); background: var(--line);
}
.app-row > svg { width: 14px; height: 14px; stroke-width: 2.6; color: var(--muted); opacity: .7; }
.artwork {
  flex: none; position: relative; overflow: hidden; display: grid; place-items: center;
  width: 52px; height: 52px; border-radius: 23%; font-size: 23px; font-weight: 600;
  background: linear-gradient(135deg, #2486e7, #14b1bf); color: #fff;
}
.artwork img { position: absolute; inset: 0; width: 100%; height: 100%; }
.artwork::after { content: ""; position: absolute; inset: 0; border: 1px solid #82899522; border-radius: inherit; }
.summary { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.summary strong, .summary small, .version { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary strong { font-weight: 600; font-size: 16px; }
.summary small, .version { font-size: 13px; color: var(--muted); }
.summary .error { color: var(--red); }
.version { max-width: 28%; text-align: right; }
.version svg { color: var(--blue); display: block; width: 17px; height: 17px; margin: 4px 0 0 auto; }
.download .icon-button, .sheet-header .icon-button { background: var(--subtle); }
.download .icon-button svg { stroke-width: 2.8; width: 19px; }
progress { width: 100%; height: 5px; accent-color: var(--accent); margin: 4px 0; border: none; }
progress::-webkit-progress-bar { background: var(--subtle); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
.empty {
  background: var(--bg); text-align: center; min-height: 44vh;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.empty svg { color: var(--muted); width: 42px; height: 42px; margin: 16px; }
.empty p { max-width: 300px; color: var(--muted); font-size: 15px; margin-top: 8px; }
nav {
  position: fixed; z-index: 2; bottom: calc(12px + var(--bottom)); left: 50%; transform: translateX(-50%);
  display: flex; width: min(415px, 94%); border-radius: 38px; padding: 5px;
  background: var(--glass); border: .5px solid #8e9db042; box-shadow: 0 4px 20px #1526401a;
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
}
nav button {
  flex: 1; font-weight: 540; gap: 3px; flex-direction: column;
  color: var(--muted); font-size: 11px; min-height: 54px; border-radius: 30px;
}
nav button[aria-current] { color: var(--blue); background: #0789fa17; }
nav svg { stroke-width: 2; }
dialog {
  width: min(100%, 520px); max-width: 100%; max-height: 90vh; max-height: 90dvh;
  margin: auto auto 0; background: var(--bg); color: var(--ink); padding: 0 20px calc(24px + var(--bottom));
  border: 0; border-radius: 28px 28px 0 0; overscroll-behavior: contain;
}
dialog::backdrop { background: #05111e68; }
.sheet-header {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; gap: 8px; background: var(--bg); z-index: 1;
}
.sheet-header .icon-button { width: 36px; height: 36px; }
.sheet-header .icon-button svg { width: 19px; color: var(--muted); stroke-width: 2.6; }
.sheet-header h2 { flex: 1; }
.help-row { display: flex; align-items: flex-start; gap: 14px; line-height: 1.38; margin: 8px 0 20px; font-size: 16px; }
.help-row svg { width: 26px; height: 26px; color: var(--blue); }
.body { margin-bottom: 20px; }
.footnote, .error { font-size: 14px; margin: 16px 0; }
.footnote { color: var(--muted); }
.link-form input { width: 100%; background: var(--surface); min-height: 52px; color: var(--ink); font-size: 16px; }
.link-form .primary { margin-top: 12px; }
video { width: 100%; border-radius: 18px; max-height: 32vh; object-fit: cover; }
.identity { display: flex; gap: 14px; align-items: center; overflow-wrap: anywhere; margin: 8px 0 24px; }
.identity p { font-size: 15px; color: var(--muted); margin-top: 5px; }
.identity .artwork { width: 76px; height: 76px; font-size: 34px; }
.group { margin-bottom: 18px; }
.group > * + *::before { left: 15px; }
.metadata, .copy-row { justify-content: space-between; font-size: 15px; min-height: 50px; }
.metadata span:first-child { color: var(--muted); flex: none; }
.metadata span:last-child { text-align: right; overflow-wrap: anywhere; }
.section-title { font-size: 18px; margin: 24px 0 12px; }
#notice {
  position: fixed; z-index: 5; bottom: calc(var(--bottom) + 96px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(88%, 450px); background: var(--ink); color: var(--bg);
  padding: 12px 18px; font-size: 15px; border-radius: 16px; text-align: center;
}
@media (min-width: 560px) {
  dialog { margin: auto; border-radius: 26px; padding: 0 24px 24px; }
  .page { padding-top: calc(44px + var(--top)); }
  .welcome-content { margin: 0; padding-bottom: 48px; }
  .welcome-actions { min-height: 130px; }
}
@media (max-width: 355px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .app-row, .download { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .filters button { font-size: 14px; padding-inline: 12px; }
  .welcome { padding-inline: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .refreshing svg, .spinner { animation: none; }
}
