[hidden] { display: none !important; }
a { color: var(--accent-ink); }
.skip { position: fixed; top: -10rem; z-index: 5; padding: 1rem; background: var(--panel); }
.skip:focus { top: 0; }
.shell { min-height: 100dvh; }
aside {
  position: fixed;
  inset: 24px auto 24px 20px;
  z-index: 3;
  width: 204px;
  padding: 14px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
}
.brand-row { display: flex; align-items: center; min-height: 98px; margin-bottom: 24px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -1px;
  text-decoration: none;
  border-radius: 12px;
}
.brand img { display: block; width: 36px; height: 36px; }
aside .brand { margin: 4px 10px 24px; }
nav { display: grid; gap: 8px; }
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 10px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  line-height: 1.25;
  text-decoration: none;
}
nav a[aria-current="page"], nav a:not([aria-current]):hover { color: var(--ink); background: var(--raised); }
nav a > span:first-child { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 14px; font-size: 21px; }
nav a[aria-current="page"] > span:first-child { color: var(--on-accent); background: var(--accent); }
nav svg { width: 21px; height: 21px; }
main { width: 100%; max-width: 920px; margin: auto; padding: 36px 38px 48px; }
.shell:has(aside:not([hidden])) main { width: calc(100% - 252px); max-width: 1270px; margin-left: 252px; }
.shell:has(.brand-row:not([hidden])) main { padding-top: 0; }
header { display: grid; gap: 6px; margin-bottom: 24px; }
.stack, form { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > input[type=search] { flex: 1 1 220px; }
.panel { min-width: 0; padding: clamp(16px, 2.8vw, 26px); border-radius: var(--card-radius); border: 1px solid var(--line); background: var(--panel); }
.panel h2 { overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stats strong { display: block; font-size: clamp(22px, 2.75vw, 34px); font-weight: 550; line-height: 1.15; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.card { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-content: start; gap: 14px; }
.card > .stack { gap: 8px; }
.cover { display: grid; place-items: center; width: 76px; max-width: 100%; aspect-ratio: 2 / 3; object-fit: cover; color: var(--muted); background: var(--raised); border-radius: 12px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
progress { width: 100%; height: 7px; accent-color: var(--accent); }
input:not([type=checkbox]), select { min-height: 44px; max-width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--raised); color: var(--ink); }
label { display: grid; gap: 6px; }
label:has(input[type=checkbox]) { display: flex; align-items: center; min-height: 44px; }
.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 650; }
.primary:hover:not(:disabled) { border-color: var(--accent); filter: brightness(1.08); }
.volume[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.danger { color: var(--danger); background: var(--danger-surface); }
.volumes { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; }
.volume.read { text-decoration: underline; text-underline-offset: 4px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
#feedback { padding: 14px; margin-bottom: 16px; background: var(--raised); border-radius: var(--control-radius); }
#feedback.error { color: var(--danger); background: var(--danger-surface); }
.auth { max-width: 420px; margin: min(12vh, 100px) auto; padding: 32px; border-radius: 28px; }
.auth img { margin-bottom: 12px; }
video { max-width: 100%; width: 480px; border-radius: var(--control-radius); }
details summary { cursor: pointer; min-height: 44px; padding-block: 10px; }
@media (max-width: 1050px) {
  .shell:has(aside:not([hidden])) main { width: calc(100% - 210px); margin-left: 210px; padding-inline: 26px; }
  aside { width: 170px; left: 16px; padding: 10px; }
  nav a { padding: 7px; gap: 8px; }
}
@media (max-width: 650px) {
  aside {
    inset: auto 14px max(12px, env(safe-area-inset-bottom));
    width: calc(100% - 28px);
    height: 82px;
    padding: 7px 8px;
    overflow: visible;
    border-radius: 25px;
    box-shadow: 0 8px 35px #0003;
  }
  aside .brand { display: none; }
  .brand-row { min-height: 78px; margin-bottom: 16px; }
  .brand { font-size: 24px; gap: 10px; }
  .brand img { width: 33px; height: 33px; }
  nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; height: 100%; align-items: center; }
  nav a { flex-direction: column; justify-content: center; gap: 5px; min-height: 64px; padding: 0; font-size: 10px; text-align: center; text-wrap: balance; }
  nav a > span:first-child { width: 39px; height: 39px; }
  nav a[aria-current="page"], nav a:not([aria-current]):hover { background: transparent; }
  main { padding: 24px 20px 48px; }
  .shell:has(aside:not([hidden])) main { width: 100%; max-width: none; margin: 0; padding-inline: 20px; padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .card { grid-template-columns: 60px minmax(0, 1fr); gap: 12px; }
  .panel { border-radius: 22px; }
  .auth { padding: 27px 23px; border-radius: 28px; }
  input:not([type=checkbox]), select { font-size: 16px; }
  h1 { font-size: clamp(27px, 8vw, 35px); letter-spacing: -1.2px; }
}
@media (max-width: 360px) {
  main, .shell:has(aside:not([hidden])) main { padding-inline: 14px; }
  aside { inset-inline: 10px; width: calc(100% - 20px); }
  nav a { font-size: 9px; }
  nav a > span:first-child { width: 34px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

.pin {
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 24px;
  letter-spacing: .45em;
  padding-inline-start: calc(12px + .45em);
}

#feedback {
  position: fixed;
  inset: auto 20px max(20px, env(safe-area-inset-bottom)) auto;
  z-index: 4;
  width: max-content;
  max-width: calc(100vw - 40px);
  margin: 0;
  padding: 0;
}
#feedback.has-message { padding: 14px; border: 1px solid var(--line); }
@media (max-width: 650px) {
  .shell:has(aside:not([hidden])) #feedback { bottom: calc(105px + env(safe-area-inset-bottom)); }
}

#view:has(.auth) { display: grid; align-items: center; min-height: calc(100dvh - 84px); }
.auth { width: 100%; margin-block: 0; }
.code-entry { display: block; position: relative; }
input.pin { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.code-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; pointer-events: none; }
.code-cells span { display: grid; place-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); font-size: 19px; }
.code-cells span.filled { border-color: var(--accent); color: var(--accent-ink); }
.code-entry:focus-within .code-cells { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 12px; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.keypad button { padding-inline: 5px; }
