@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@layer styles {
  :root {
    color-scheme: light;
  }

  :root.dark {
    color-scheme: dark;
  }

  html {
    font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  }

  code,
  kbd,
  pre,
  samp {
    font-family: "JetBrains Mono", ui-monospace, monospace;
  }

  body {
    min-height: 100dvh;
    background-color: var(--z-bg);
    color: var(--z-bg-f);
  }

  a:where(:not(.z-button)) {
    color: var(--z-info-f);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }

  a:where(:not(.z-button)):hover {
    color: var(--z-info);
  }

  z-input-pin input:disabled {
    pointer-events: none;
  }

  z-input-pin:not(:defined) {
    display: block;
    min-height: 2.5rem;
  }

  .page-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 3rem 1rem;
  }

  .page-panel {
    width: 100%;
    max-width: 24rem;
  }

  .page-panel .z-button {
    width: 100%;
  }

  .page-title {
    margin-bottom: 2.5rem;
    font-size: 1.875rem;
    line-height: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-align: center;
  }

  .page-title:has(+ .page-subtitle) {
    margin-bottom: 0.5rem;
  }

  .page-subtitle {
    margin: 0 0 2.5rem;
    font-size: 0.875rem;
    text-align: center;
    color: var(--z-muted-f);
  }

  .page-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
  }

  .page-settings {
    max-width: 42rem;
    margin-inline: auto;
    padding: 2rem 1rem 5rem;
  }

  .page-settings .page-title {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 600;
    text-align: left;
  }

  .stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .z-card-body > [role="alert"]:empty {
    display: none;
  }

  form:not(.htmx-request) .z-button > .z-spinner {
    display: none;
  }

  .z-input {
    width: 100%;
  }

  .check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
  }

  .detail dt {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--z-muted-f);
  }

  .detail dd {
    margin: 0;
    font-size: 0.875rem;
  }

  .status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
  }

  .status-dot {
    flex-shrink: 0;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 9999px;
    background-color: var(--z-muted-f);
  }

  .status-dot-connected {
    background-color: var(--z-success-f);
  }

  .muted {
    color: var(--z-muted-f);
  }

  #discogs-status:has(> :not([hidden])) {
    margin-bottom: 1rem;
  }

  #lang-button {
    justify-content: space-between;
  }

  #lang-listbox {
    --z-dropdown-width: 100%;
    z-index: 1020;
  }

  .z-alert-close svg *,
  .z-notification-close svg * {
    stroke: currentColor;
  }

  .z-alert:has(> .z-alert-close) {
    padding-right: 3rem;
  }

  .z-alert-close {
    inset: 0.25rem 0.25rem auto auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
  }

  .z-notification-close,
  .z-notification-close:hover {
    color: inherit;
  }

  .z-notification {
    padding-top: env(safe-area-inset-top);
  }

  .tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    display: flex;
    height: 4rem;
    background-color: var(--z-bg);
    border-top: 1px solid color-mix(in srgb, var(--z-border) var(--z-border-o), transparent);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .tab-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--z-muted-f);
    text-decoration: none;
    transition: color 0.15s ease;
  }

  .tab-bar-item svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .alert-spaced {
    margin-bottom: 1rem;
  }

  .tab-bar-item.is-active {
    color: var(--z-bg-f);
    font-weight: 600;
    box-shadow: inset 0 2px 0 currentColor;
  }

  .scanner-shell {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    background-color: var(--z-bg);
    padding-bottom: 4rem;
  }

  @media (min-width: 640px) {
    .scanner-shell {
      max-width: 480px;
      margin-inline: auto;
      height: auto;
      min-height: calc(100dvh - 4rem);
    }
  }

  .scanner-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
    min-height: 0;
  }

  @media (min-width: 640px) {
    .scanner-viewport {
      flex: none;
      aspect-ratio: 4 / 3;
      border-radius: calc(var(--z-global-radius) * 1.5);
    }
  }

  #reader {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
  }

  .scan-camera-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: #fff;
  }

  .scan-camera-error[hidden] {
    display: none;
  }

  .scan-camera-error-icon {
    margin-bottom: 0.5rem;
    opacity: 0.7;
  }

  .scan-camera-error-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
  }

  .scan-camera-error-message {
    margin: 0;
    max-width: 22rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    opacity: 0.75;
  }

  #reader__scan_region {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }

  #reader__scan_region video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
  }

  #reader__dashboard {
    display: none !important;
  }

  .scan-result-thumb {
    width: 100%;
    max-height: 12rem;
    object-fit: contain;
    border-radius: var(--z-global-radius);
    background: color-mix(in srgb, var(--z-muted) var(--z-muted-o), transparent);
    margin-bottom: 0.75rem;
  }

  .scan-result-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.125rem 0.75rem;
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
  }

  .scan-result-meta dt {
    color: var(--z-muted-f);
    font-weight: 500;
  }

  .scan-result-catno,
  .scan-conflict-catno {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.875rem;
  }

  .z-modal.z-open {
    display: flex !important;
  }

  .z-modal.z-open > .z-modal-dialog {
    margin: auto;
  }

  .scan-dialog-narrow {
    --z-modal-dialog-width: 22rem;
  }

  .scan-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
  }

  .scan-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .scan-actions .z-button {
    width: 100%;
  }

  .z-modal-header > .muted {
    margin: 0.5rem 0 0;
  }

  .scan-conflict-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .scan-conflict-item {
    border: 1px solid color-mix(in srgb, var(--z-border) var(--z-border-o), transparent);
    border-radius: var(--z-global-radius);
    overflow: hidden;
  }

  .scan-conflict-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
    min-height: 3.5rem;
    cursor: pointer;
  }

  .scan-conflict-label:has(input:checked) {
    background-color: color-mix(in srgb, var(--z-muted) var(--z-muted-o), transparent);
    border-color: var(--z-primary);
  }

  .scan-owned-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0.75rem;
  }

  .scan-conflict-label .z-radio {
    flex: none;
    box-sizing: border-box;
    width: 1.125rem;
    height: 1.125rem;
    border: 1.5px solid var(--z-muted-f);
  }

  .scan-conflict-thumb {
    flex: none;
    box-sizing: border-box;
    width: 3rem;
    min-width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: calc(var(--z-global-radius) / 2);
  }

  .scan-conflict-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
  }

  .scan-conflict-info strong {
    font-size: 0.9375rem;
    line-height: 1.3;
  }

  .scan-conflict-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.375rem;
    font-size: 0.8125rem;
    color: var(--z-muted-f);
  }

  .scan-conflict-detail {
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    color: var(--z-muted-f);
  }

  .scan-conflict-variant {
    color: var(--z-primary);
    font-weight: 500;
  }

  .scan-conflict-meta span + span::before {
    content: "·";
    margin-right: 0.375rem;
  }

  .scanner-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    background-color: var(--z-bg);
    border-top: 1px solid color-mix(in srgb, var(--z-border) var(--z-border-o), transparent);
  }

  .scanner-bar-btn {
    width: 100%;
    max-width: 20rem;
  }

  .scan-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.25rem 1rem;
    color: var(--z-muted-f);
    font-size: 0.9375rem;
  }
}
