:root {
  color-scheme: light;
  --ink: #1c2430;
  --muted: #667184;
  --line: #dbe2eb;
  --paper: #f5f7fb;
  --surface: #ffffff;
  --accent: #d93f3f;
  --accent-dark: #b92f35;
  --blue: #2f68c2;
  --green: #1f9d69;
  --gold: #c98917;
  --shadow: 0 12px 32px rgba(28, 36, 48, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.08;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.top-actions,
.field-row,
.filters,
.scan-actions,
.metric-row,
.tag-row {
  display: grid;
  gap: 10px;
}

.icon-button,
.text-button,
.primary-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.icon-button {
  width: 44px;
  display: inline-grid;
  place-items: center;
}

.text-button,
.primary-button {
  padding: 0 14px;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.danger-button {
  border-color: #b92f35;
  background: #b92f35;
}

.primary-button:disabled,
.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 14px 14px calc(92px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}

.screen.active {
  display: block;
}

.panel-heading,
.library-tools,
.dialog-head,
.candidate-head,
.owned-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 104, 194, 0.16);
}

.status-line,
#libraryHint,
.microcopy {
  color: var(--muted);
  font-size: 0.86rem;
}

.photo-scan {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.identity-panel,
.home-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.identity-panel {
  padding: 14px;
  border: 1px solid #efc0c0;
  border-radius: 8px;
  background: #fff8f8;
}

.identity-panel[hidden] {
  display: none;
}

.identity-form,
.identity-actions {
  display: grid;
  gap: 10px;
}

.home-hero,
.highlight-card,
.advisor-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.home-hero h2 {
  font-size: 1.8rem;
  line-height: 1.15;
}

.dashboard-metrics,
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.dashboard-metrics article {
  padding: 10px;
  border-radius: 8px;
  background: #f3f6fa;
}

.dashboard-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.dashboard-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
}

.highlight-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
  align-items: center;
}

.highlight-card img {
  width: 112px;
  aspect-ratio: 0.716;
  object-fit: cover;
  border-radius: 7px;
  background: #edf1f6;
}

#highlightPrice {
  display: block;
  margin: 8px 0;
  color: var(--gold);
}

.advisor-head {
  display: grid;
  gap: 10px;
}

.advisor-content {
  display: grid;
  gap: 8px;
}

.advisor-modes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 12px 0;
}

.advisor-content p {
  margin-bottom: 0;
  color: var(--ink);
  line-height: 1.45;
}

.advisor-content section {
  display: grid;
  gap: 4px;
}

.advisor-content h4 {
  margin: 0;
  color: var(--accent);
  font-size: 0.82rem;
}

.advisor-footer {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.secondary-scan {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.scan-hero {
  display: grid;
  gap: 14px;
  padding: 2px;
}

.primary-scan {
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.primary-scan strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1.04rem;
}

.primary-scan p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.scan-copy {
  padding: 14px;
  border: 1px solid #efc0c0;
  border-radius: 8px;
  background: #fff8f8;
}

.scan-action {
  position: relative;
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 16px;
  text-align: left;
  box-shadow: 0 8px 22px rgba(28, 36, 48, 0.07);
}

.scan-action span {
  font-size: 1.05rem;
  font-weight: 950;
}

.scan-action small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.scan-action input,
.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.primary-action {
  border-color: #f0b5b5;
  background: #ffffff;
}

.primary-action span {
  color: var(--accent);
}

.binder-action {
  background: #f3f6fa;
  border-style: dashed;
}

.file-action {
  position: relative;
  overflow: hidden;
}

.scan-preview-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#photoPreview {
  display: none;
  width: 82px;
  height: 114px;
  border-radius: 7px;
  object-fit: cover;
  background: #edf1f6;
}

.identify-button {
  width: 100%;
}

.home-metrics {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.home-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.collection-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.home-metric-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.collection-stats article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.home-metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.collection-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.home-metric-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
}

.collection-stats strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
}

.ai-result {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.best-match-card,
.alt-match-card,
.result-card,
.owned-card,
.analytics-card,
.settings-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.best-match-card {
  display: grid;
  gap: 14px;
  padding: 12px;
}

.best-match-main {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
}

.best-match-main img,
.owned-card img,
.result-card img,
#dialogImage,
#detailImage {
  display: block;
  object-fit: cover;
  background: #edf1f6;
}

.best-match-main img {
  width: 92px;
  height: 128px;
  border-radius: 7px;
}

.match-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.fact {
  padding: 9px;
  border-radius: 8px;
  background: #f3f6fa;
}

.fact span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.fact strong {
  display: block;
  margin-top: 2px;
  font-size: 0.92rem;
}

.match-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.alt-list {
  display: grid;
  gap: 8px;
}

.alt-match-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.alt-match-card img {
  width: 50px;
  height: 70px;
  border-radius: 5px;
  object-fit: cover;
}

.manual-fallback {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.manual-fallback summary {
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
}

.manual-fallback summary::-webkit-details-marker {
  display: none;
}

.manual-fallback summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.manual-fallback[open] summary::after {
  content: "-";
}

.search-form,
.search-results,
.library-grid,
.analytics-grid,
.settings-list,
.mover-list,
.set-list {
  display: grid;
  gap: 12px;
}

.search-results {
  max-height: 48vh;
  margin-top: 12px;
  overflow: auto;
}

.result-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.result-card img {
  width: 54px;
  height: 75px;
  border-radius: 5px;
}

.result-card p,
.owned-card p,
.alt-match-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-card span,
.price-note {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.library-tools {
  display: grid;
  margin-bottom: 14px;
}

.view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6fa;
}

.view-toggle button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.view-toggle button.active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 3px 10px rgba(28, 36, 48, 0.08);
}

.filters {
  margin-bottom: 12px;
}

.collection-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.sample-banner {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #f1c84b;
  border-radius: 8px;
  background: #fff9df;
  box-shadow: 0 8px 20px rgba(28, 36, 48, 0.05);
}

.sample-banner[hidden] {
  display: none;
}

.sample-banner h3 {
  margin: 0;
}

.sample-banner p {
  margin-bottom: 0;
  color: var(--muted);
}

.danger-text {
  color: #b92f35;
}

.sample-home-reminder {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #f1c84b;
  border-radius: 8px;
  background: #fff9df;
}

.sample-home-reminder[hidden] {
  display: none;
}

.sample-home-reminder h3,
.sample-home-reminder p {
  margin: 0;
}

.sample-home-reminder p {
  color: var(--muted);
}

.library-grid.grid-view {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.owned-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(28, 36, 48, 0.06);
}

.owned-card.sample-card {
  border-color: #f1c84b;
}

.library-grid.list-view .owned-card {
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
}

.owned-card > img {
  width: 100%;
  aspect-ratio: 0.716;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(28, 36, 48, 0.08);
}

.library-grid.list-view .owned-card > img {
  width: 74px;
  height: 103px;
}

.owned-head {
  gap: 8px;
}

.owned-card h3 {
  font-size: 0.94rem;
}

.metric-row {
  grid-template-columns: 1fr;
  margin-top: 8px;
}

.metric-row span {
  padding: 8px;
  border-radius: 8px;
  background: #f1f4f8;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-row strong {
  display: block;
  color: var(--ink);
}

.positive,
.change.positive {
  color: var(--green);
}

.negative,
.change.negative {
  color: #b92f35;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
}

.tag {
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf1f6;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.sample-badge {
  background: #f1c84b;
  color: #1c2430;
}

.sparkline,
.portfolio-history {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 3px;
  height: 44px;
  margin-top: 10px;
  border-bottom: 1px solid var(--line);
}

.sparkline i,
.portfolio-history i {
  display: block;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
}

.hero-value {
  margin: 12px 0;
  padding: 18px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.hero-value span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.hero-value strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 2.1rem;
}

.hero-value p {
  margin-bottom: 0;
  color: var(--muted);
}

.hero-value em {
  font-style: normal;
  font-weight: 900;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.summary-grid article,
.analytics-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.12rem;
}

.mover-row,
.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.mover-row:last-child,
.set-row:last-child {
  border-bottom: 0;
}

.mover-row strong,
.set-row strong {
  color: var(--ink);
}

.insight-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.empty-state {
  display: none;
  padding: 42px 18px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--ink);
}

.settings-list {
  margin-top: 12px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.settings-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.settings-group .settings-row {
  border: 1px solid var(--line);
}

.settings-row {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  line-height: 1.25;
}

.settings-row span {
  font-weight: 900;
  min-width: 0;
}

.settings-row strong {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.82rem;
}

.settings-button-grid {
  display: grid;
  gap: 8px;
}

.backup-group .settings-copy {
  margin-bottom: 0;
}

.danger-row strong,
.danger-text,
.settings-row.danger-row strong {
  color: #b92f35;
}

.app-build-footer {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: center;
}

.bottom-nav {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
}

.bottom-nav button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
}

.bottom-nav button.active {
  background: #fbe8e8;
  color: var(--accent);
}

dialog {
  width: min(760px, calc(100% - 20px));
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

dialog::backdrop {
  background: rgba(20, 28, 38, 0.48);
}

.card-form {
  margin: 0;
  padding: 16px;
}

.card-form.compact {
  width: min(520px, 100%);
}

.dialog-body,
.detail-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

#dialogImage,
#detailImage {
  width: 140px;
  height: 196px;
  border-radius: 8px;
}

.form-grid,
.detail-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-stats .fact {
  background: #f3f6fa;
}

.story-panel,
.grade-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
}

.story-panel[hidden],
.grade-panel[hidden] {
  display: none;
}

.story-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-head h3 {
  margin-bottom: 0;
}

.story-content p {
  margin: 0 0 10px;
  color: var(--ink);
  line-height: 1.5;
}

.story-content p:last-child {
  margin-bottom: 0;
}

.story-meta {
  color: var(--muted) !important;
  font-size: 0.78rem;
  font-weight: 800;
}

.story-stale {
  padding: 8px;
  border-radius: 8px;
  background: #fff3d7;
  color: #7b5208 !important;
  font-size: 0.84rem;
  font-weight: 850;
}

.match-debug {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.match-debug summary {
  cursor: pointer;
  font-weight: 900;
}

.match-debug pre,
.match-debug table {
  width: 100%;
  overflow: auto;
  font-size: 0.74rem;
}

.match-debug pre {
  padding: 8px;
  border-radius: 8px;
  background: #ffffff;
}

.match-debug table {
  border-collapse: collapse;
}

.match-debug th,
.match-debug td {
  padding: 6px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.grade-disclaimer {
  padding: 10px;
  border-radius: 8px;
  background: #f3f6fa;
  color: var(--muted) !important;
  font-size: 0.84rem;
  line-height: 1.45;
}

.info-content {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.info-content p,
.info-content li {
  color: var(--ink);
  line-height: 1.5;
}

.info-content ul {
  margin: 0;
  padding-left: 20px;
}

.wide {
  grid-column: 1 / -1;
}

menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}

.detail-actions {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.settings-copy {
  color: var(--muted);
}

@media (min-width: 720px) {
  h1 {
    font-size: 2rem;
  }

  .topbar {
    padding: 20px clamp(22px, 4vw, 44px);
  }

  .app-shell {
    padding: 22px clamp(22px, 4vw, 44px) 40px;
  }

  .scan-actions,
  .field-row,
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collection-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .collection-actions {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    align-items: center;
  }

  .settings-button-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .identity-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .identity-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .advisor-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .advisor-modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .scan-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .library-tools {
    display: flex;
  }

  .view-toggle {
    width: 210px;
  }

  .library-grid.grid-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dialog-body,
  .detail-body {
    grid-template-columns: 180px 1fr;
  }

  #dialogImage,
  #detailImage {
    width: 180px;
    height: 252px;
  }

  .form-grid,
  .detail-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-actions {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

@media (min-width: 1180px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(720px, calc(100% - 32px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -8px 28px rgba(28, 36, 48, 0.08);
  }

  .app-shell {
    width: min(1180px, 100%);
    display: block;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .screen.active {
    display: block;
  }

  .library-grid.grid-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
