@font-face { font-family: "Cooper Hewitt"; src: url("fonts/CooperHewitt-Book.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cooper Hewitt"; src: url("fonts/CooperHewitt-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cooper Hewitt"; src: url("fonts/CooperHewitt-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Cooper Hewitt"; src: url("fonts/CooperHewitt-Heavy.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
/* ---- Layout, header, collection grid, dialogs ---- */
:root {
  /* Type scale: use these six sizes for all text. */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-base: 14px;
  --text-md: 18px;
  --text-lg: 28px;
  --text-xl: 36px;
  /* Typefaces (docs/design-system.md): Cooper Hewitt for Latin, BIZ UDPGothic for Japanese. */
  --font-display: "Cooper Hewitt", "BIZ UDPGothic", sans-serif;
  --font-body: "Cooper Hewitt", "BIZ UDPGothic", sans-serif;
  --font-label: "Cooper Hewitt", "BIZ UDPGothic", sans-serif;
  /* Black and white carry the page; color only marks a state. */
  --ink: #000000;
  --paper: #ffffff;
  --cream: #f2f2f2;
  --muted: #595959;
  --line: #d4d4d4;
  --orange: #ff4f00;
  --green: #00704a;
  /* Status text on white: darker variants that keep 4.5:1 contrast. */
  --orange-ink: #b83900;
  --red: #c4001a;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
/* Keyboard focus is always visible; text inputs show it with their underline instead. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
body {
  font-size: var(--text-base);
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
}
.topbar {
  height: 78px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4vw;
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 10;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  /* The wordmark is set in the heaviest weight, like a label on a shelf. */
  font: 900 22px var(--font-display);
}
.top-actions {
  display: flex;
  gap: 10px;
}
.add-btn,
.secondary {
  border: 0;
  cursor: pointer;
}
.add-btn {
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  font: 500 var(--text-sm) var(--font-label);
}
.add-btn:hover {
  background: #333333;
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 0 4vw 80px;
}
.eyebrow {
  font: 700 var(--text-sm) var(--font-label);
  color: var(--ink);
  margin: 0 0 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  border-bottom: 1px solid var(--line);
  padding-top: 24px;
}
.stat {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
}
.stat:last-child {
  border: 0;
}
.stat strong {
  font: 600 var(--text-lg) var(--font-display);
  display: block;
}
.stat-action {
  display: block;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 500 var(--text-sm) var(--font-body);
  cursor: pointer;
}
.stat-action:hover {
  background: #333333;
  color: #fff;
}
.stat-progress {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font: 500 var(--text-xs) var(--font-label);
}
.stat span {
  font: var(--text-xs) var(--font-label);
  color: var(--muted);
}
section {
  padding-top: 60px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 24px;
}
.section-head h2 {
  font: 600 var(--text-xl) var(--font-display);
  margin: 0;
}
.tools {
  display: flex;
  gap: 10px;
}
.search {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--ink);
  padding: 9px 4px;
}
.search input {
  border: 0;
  background: transparent;
  outline: 0;
  width: 240px;
  font-family: inherit;
}
select {
  font-family: inherit;
}
.tools select,
.sort-direction {
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px;
}
.sort-direction {
  color: var(--ink);
  font: var(--text-sm) var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.genre-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}
.chip {
  border: 1px solid var(--line);
  background: transparent;
  padding: 7px 12px;
  font: var(--text-xs) var(--font-label);
  cursor: pointer;
}
.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 28px 18px;
}
.card {
  cursor: pointer;
}
/* Crate dividers span the grid; a heavy rule marks where the bin is split. */
.crate-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 -10px;
  padding-top: 8px;
  border-top: 3px solid var(--ink);
  scroll-margin-top: 96px;
}
.crate-divider:first-of-type {
  margin-top: 0;
}
.crate-divider span {
  font: 800 var(--text-md) var(--font-display);
}
.crate-divider small {
  color: var(--muted);
  font-size: var(--text-xs);
}
.crate-index {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
}
.crate-index > span {
  color: var(--muted);
  font-size: var(--text-xs);
}
.crate-index button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 700 var(--text-sm) var(--font-body);
  cursor: pointer;
}
.crate-index button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cover {
  aspect-ratio: 1;
  background: #ddd;
  overflow: hidden;
  position: relative;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: .3s;
}
.card:hover .cover img {
  transform: scale(1.025);
}
.condition {
  position: absolute;
  right: 8px;
  top: 8px;
  background: var(--paper);
  font: var(--text-xs) var(--font-label);
  padding: 5px 7px;
}
.card-meta {
  padding: 12px 1px;
}
.card-meta h3 {
  font: 600 var(--text-md) var(--font-display);
  margin: 2px 0 4px;
}
.card-meta p {
  font-size: var(--text-sm);
  color: var(--muted);
  margin: 0;
}
.price-row {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font: var(--text-xs) var(--font-label);
}
.price-row b {
  color: var(--ink);
}
.empty {
  text-align: center;
  padding: 80px 20px;
  border: 1px solid var(--line);
}
.empty-disc {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #171717;
  margin: auto;
  box-shadow: inset 0 0 0 26px #292929;
}
.hidden {
  display: none!important;
}
/* A name the AI has not read yet, or could not find. */
.unknown-name {
  color: var(--muted);
}
dialog {
  border: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  width: min(760px,94vw);
  max-height: 92vh;
  border: 1px solid var(--ink);
}
dialog::backdrop {
  background: rgb(0 0 0 / 60%);
}
dialog form,
#detailContent {
  padding: 30px;
}
.dialog-head {
  display: flex;
  justify-content: space-between;
}
.dialog-head h2 {
  font: 600 var(--text-xl) var(--font-display);
  margin: 0;
}
.close {
  border: 0;
  background: none;
  font-size: var(--text-lg);
  cursor: pointer;
}
.upload-zone {
  height: 210px;
  border: 1px dashed #aaa;
  margin: 25px 0 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
}
.upload-zone img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}
.upload-zone.has-image img {
  display: block;
}
.upload-zone.has-image #uploadPrompt {
  display: none;
}
#uploadPrompt {
  text-align: center;
  display: grid;
  gap: 6px;
}
.camera {
  font-size: var(--text-lg);
}
#uploadPrompt span {
  font-size: var(--text-xs);
  color: var(--muted);
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0;
}
form label {
  font: var(--text-xs) var(--font-label);
  display: grid;
  gap: 7px;
}
form input,
form select,
form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 9px 2px;
  font: var(--text-base) var(--font-body);
  outline: 0;
}
form input:focus,
form textarea:focus {
  border-color: var(--ink);
}
.search:focus-within {
  border-bottom-color: var(--ink);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.secondary {
  background: transparent;
  border: 1px solid var(--line);
  padding: 12px 18px;
}
.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  background: var(--ink);
  color: #fff;
  padding: 13px 18px;
  font-size: var(--text-sm);
  transform: translateY(90px);
  transition: .25s;
  z-index: 50;
}
.toast button {
  margin-left: 16px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: 700 var(--text-sm) var(--font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.toast.show {
  transform: translateY(0);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px;
}
.detail-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}
.detail-grid h2 {
  font: 600 var(--text-xl)/1 var(--font-display);
  margin: 8px 0;
}
.detail-grid h3 {
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--muted);
}
.spec-sheet {
  margin: 20px 0 0;
  border-bottom: 1px solid var(--line);
}
.spec-sheet > div {
  display: grid;
  grid-template-columns: 8.5em 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.spec-sheet dt {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}
.spec-sheet dd {
  margin: 0;
  min-width: 0;
  font-size: var(--text-sm);
  line-height: 1.7;
}
.spec-sheet p {
  margin: 0;
}
.tracklist + .spec-sheet {
  margin-top: 0;
}
.tracklist + .spec-sheet > div:first-child {
  border-top: 0;
}
.spec-sheet .spec-empty {
  color: var(--muted);
}
.delete-btn {
  color: var(--red);
  border: 0;
  padding: 0;
  background: none;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 22px;
}
@media (max-width:900px) {
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  .grid {
    grid-template-columns: repeat(2,1fr);
  }
  .section-head {
    align-items: start;
    gap: 20px;
  }
  .tools {
    flex-direction: column;
  }
}
@media (max-width:560px) {
  .add-label-long {
    display: none;
  }
  .topbar {
    padding: 0 18px;
  }
  .add-btn {
    padding: 12px;
  }
  .brand {
    font-size: 18px;
  }
  main {
    padding: 0 18px 60px;
  }
  .stats {
    margin: 0 -18px;
  }
  .stat {
    padding: 20px 18px;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px 10px;
  }
  .card-meta h3 {
    font-size: var(--text-md);
  }
  .section-head {
    display: block;
  }
  .tools {
    margin-top: 18px;
  }
  .search input {
    width: 100%;
  }
  .search {
    width: 100%;
  }
  .fields,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  dialog form,
  #detailContent {
    padding: 22px;
  }
}
.detail-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.edit-btn {
  padding: 8px 16px;
  font: 500 var(--text-xs) var(--font-label);
}
.edit-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.detail-edit {
  padding: 0!important;
}
.detail-edit .fields {
  margin-top: 0;
}
.detail-edit textarea {
  resize: vertical;
}
.detail-edit-error {
  color: var(--red);
  font-size: var(--text-sm);
  min-height: 1em;
  margin: 10px 0 0;
}
/* Prices: recorded = ink, AI estimate = needs checking (orange), none = muted. */
.price-row b.price-estimate,
.price-estimate {
  color: var(--orange-ink);
}
.price-row b.price-none,
.price-none {
  color: var(--muted);
  font-weight: 400;
}

/* ---- AI sources and re-analysis button ---- */
.ai-sources {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 1.1em;
}
.ai-sources a {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ai-retry {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: var(--text-xs) var(--font-body);
  cursor: pointer;
}
.ai-retry:hover {
  background: #333333;
  color: #fff;
}

/* ---- Stats, added dates, market research notes ---- */
.stats {
  grid-template-columns: repeat(3, 1fr);
}

.added-date {
  color: var(--muted);
  display: block;
  font: var(--text-xs) var(--font-label);
  margin-top: 8px;
}

@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Camera capture ---- */
.camera-panel {
  display: none;
  background: #080808;
  margin: 25px 0 12px;
  position: relative;
  overflow: hidden;
}
.camera-panel.active {
  display: block;
}
.camera-panel video {
  display: block;
  width: 100%;
  height: min(58vh, 520px);
  object-fit: cover;
  transition:
    transform 0.16s ease,
    filter 0.16s ease;
}
.camera-panel.just-captured video {
  transform: scale(0.985);
  filter: brightness(0.84);
}
.camera-controls {
  align-items: center;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 18px;
  position: absolute;
  width: 100%;
  background: linear-gradient(transparent, #000b);
  z-index: 4;
}
.camera-controls .secondary {
  color: #fff;
  border-color: #fff6;
}
.shutter {
  background: #fff;
  border: 5px solid #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #111;
  height: 62px;
  width: 62px;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease;
}
.shutter:active,
.shutter.pressed {
  transform: scale(0.84);
  box-shadow:
    inset 0 0 0 7px #111,
    0 0 0 8px #ffffff35;
}
.camera-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}
.camera-flash.active {
  animation: camera-flash 0.42s ease-out;
}
.shot-confirmation {
  align-items: center;
  background: #000b;
  border-radius: 24px;
  color: #fff;
  display: flex;
  gap: 8px;
  left: 50%;
  opacity: 0;
  padding: 8px 13px;
  pointer-events: none;
  position: absolute;
  top: 14px;
  transform: translate(-50%, -10px) scale(0.9);
  z-index: 7;
}
.shot-confirmation span {
  background: #fff;
  border-radius: 50%;
  color: #111;
  display: grid;
  height: 20px;
  place-items: center;
  width: 20px;
}
.shot-confirmation b {
  font: 500 var(--text-xs) var(--font-body);
  white-space: nowrap;
}
.shot-confirmation.active {
  animation: shot-confirm 0.62s ease;
}
.last-shot {
  bottom: 18px;
  height: 58px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  right: 16px;
  transform: translateY(12px) scale(0.82);
  width: 58px;
  z-index: 5;
  border: 2px solid #fff;
  box-shadow: 0 5px 16px #0009;
}
.last-shot img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}
.last-shot.active {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.capture-status {
  display: none;
}
.capture-status.active {
  display: block;
  position: absolute;
  right: 14px;
  top: 14px;
  z-index: 5;
  background: #000c;
  color: #fff;
  padding: 8px 11px;
  border-radius: 20px;
  font: 500 var(--text-xs) var(--font-label);
}
.capture-status.count-pop {
  animation: count-pop 0.48s cubic-bezier(0.2, 0.9, 0.3, 1.45);
}
.batch-camera-active .add-tabs,
.batch-camera-active .quick-capture {
  display: none !important;
}
.batch-camera-active .camera-panel {
  margin-bottom: 0;
}
.photo-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.photo-actions button {
  border: 1px solid var(--ink);
  background: transparent;
  font: var(--text-xs) var(--font-label);
  padding: 9px 12px;
  cursor: pointer;
}
.photo-actions button:first-child {
  background: var(--ink);
  color: #fff;
}
.upload-zone #uploadPrompt small {
  color: var(--muted);
  font-size: var(--text-xs);
  margin-top: 4px;
}
@keyframes camera-flash {
  0% {
    opacity: 0.94;
  }
  26% {
    opacity: 0.64;
  }
  100% {
    opacity: 0;
  }
}
@keyframes shot-confirm {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.9);
  }
  22%,
  72% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 2px) scale(0.98);
  }
}
@keyframes count-pop {
  0% {
    transform: scale(0.82);
  }
  55% {
    transform: scale(1.16);
    background: var(--ink);
  }
  100% {
    transform: scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .camera-panel video,
  .shutter,
  .last-shot {
    transition: none;
  }
  .camera-flash.active,
  .shot-confirmation.active,
  .capture-status.count-pop {
    animation-duration: 0.01ms;
  }
}
@media (max-width: 560px) {
  .camera-panel {
    margin: 15px -22px 12px;
  }
  .camera-panel video {
    height: 62vh;
  }
  .last-shot {
    bottom: 20px;
    right: 14px;
  }
}

/* ---- List view and record table ---- */
.view-switch {
  border: 1px solid var(--line);
  display: flex;
}
.view-switch button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-md);
  line-height: 1;
  padding: 7px 10px;
}
.view-switch button.active {
  background: var(--ink);
  color: #fff;
}
.grid.list-view {
  display: block;
}
.grid.list-view .card {
  align-items: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 92px 1fr;
  padding: 12px 0;
}
.grid.list-view .cover {
  height: 92px;
  width: 92px;
}
.grid.list-view .card-meta {
  display: grid;
  grid-template-columns: 1fr 1.2fr 220px;
  align-items: center;
  gap: 20px;
  padding: 0;
}
.grid.list-view .card-meta h3 {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
}
.grid.list-view .card-meta > p {
  grid-column: 1;
  grid-row: 1;
}
.grid.list-view .price-row {
  border: 0;
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  padding: 0;
}
.grid.list-view .condition {
  font-size: var(--text-xs);
}
.list-view .card:hover {
  background: #e9e3d7;
}
@media (max-width:900px) {
  .view-switch {
    align-self: flex-start;
  }
  .grid.list-view .card-meta {
    grid-template-columns: 1fr 120px;
  }
  .grid.list-view .card-meta > p {
    grid-column: 1;
  }
  .grid.list-view .card-meta h3 {
    grid-column: 1;
    grid-row: 2;
  }
  .grid.list-view .price-row {
    grid-column: 2;
    grid-row: 1/3;
    display: grid;
    gap: 5px;
    text-align: right;
  }
}
@media (max-width:560px) {
  .tools {
    display: grid;
    grid-template-columns: 1fr auto auto;
  }
  .tools .search {
    grid-column: 1/-1;
  }
  .tools select {
    min-width: 0;
  }
  .grid.list-view .card {
    grid-template-columns: 72px 1fr;
  }
  .grid.list-view .cover {
    height: 72px;
    width: 72px;
  }
  .grid.list-view .card-meta {
    display: block;
  }
  .grid.list-view .card-meta h3 {
    font-size: var(--text-md);
    margin: 3px 0;
  }
  .grid.list-view .price-row {
    display: flex;
  }
  .grid.list-view .condition {
    display: none;
  }
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -10px 0 22px;
  font-size: var(--text-xs);
  color: var(--muted);
}
.filter-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-bar select {
  max-width: 220px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: var(--text-sm) var(--font-body);
}
#resultCount {
  margin-left: auto;
  font: var(--text-xs) var(--font-label);
}
#clearFilters {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: var(--text-xs) var(--font-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
#clearFilters[hidden] {
  display: none;
}
@media (max-width: 560px) {
  .filter-bar label {
    flex: 1;
    min-width: 0;
  }
  .filter-bar select {
    flex: 1;
    min-width: 0;
    max-width: none;
  }
}
.grid.list-view .added-date {
  grid-column: 1;
  grid-row: 2;
  color: var(--muted);
  font-size: var(--text-xs);
}
.grid.list-view {
  display: block;
  overflow: visible;
}
.record-table-scroll {
  border: 1px solid var(--line);
  overflow-x: auto;
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}
.record-table {
  border-collapse: collapse;
  min-width: 1080px;
  text-align: left;
  width: 100%;
  font-size: var(--text-base);
}
.record-table th,
.record-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}
.record-table th {
  background: var(--cream);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1;
}
.record-table th button {
  appearance: none;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  font: 600 var(--text-sm) var(--font-body);
  padding: 4px 2px;
  text-align: left;
  width: 100%;
}
.record-table th button:hover,
.record-table th button.sorted {
  color: var(--ink);
}
.record-table th button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.record-table .cover-heading {
  width: 116px;
}
.record-table tbody tr {
  cursor: pointer;
  transition: background .15s;
}
.record-table tbody tr:nth-child(even) {
  background: #ebe6dc;
}
.record-table tbody tr:hover,
.record-table tbody tr:focus {
  background: #e1d9ca;
}
.record-table .record-table-cover {
  padding: 7px 11px;
  width: 116px;
}
.record-table-cover img {
  display: block;
  height: 92px;
  object-fit: cover;
  width: 92px;
}
.record-table-title {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-table-title strong {
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-table-title .ai-status {
  margin-top: 4px;
}
.record-table .table-no-results {
  color: var(--muted);
  padding: 28px;
  text-align: center;
}
.listen-links .listen-apple {
  order: -1;
}
@media (max-width:560px) {
  .record-table-cover img {
    height: 72px;
    width: 72px;
  }
  .record-table .cover-heading,
  .record-table .record-table-cover {
    width: 94px;
  }
  .record-table .record-table-cover {
    padding: 7px 10px;
  }
  .record-table {
    min-width: 980px;
  }
}

/* ---- Track lists and listen links ---- */
.side-field {
  border-left: 3px solid var(--ink);
  padding-left: 10px;
}
.side-b {
  border-color: var(--ink);
}
.mini-tracklist {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 3px;
  margin-top: 9px;
  padding-top: 8px;
}
.mini-tracklist span {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: var(--text-xs);
  gap: 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-tracklist b {
  background: var(--ink);
  color: #fff;
  display: grid;
  font: var(--text-xs) var(--font-label);
  height: 17px;
  place-items: center;
  width: 17px;
}
.mini-tracklist span + span b {
  background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink);
}
.tracklist {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 16px 0;
}
.tracklist .eyebrow {
  margin-bottom: 8px;
}
.track-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 26px 1fr;
  padding: 9px 0;
}
.track-row > b {
  background: var(--ink);
  color: #fff;
  display: grid;
  font: var(--text-xs) var(--font-label);
  height: 24px;
  place-items: center;
  width: 24px;
}
.track-row:nth-of-type(3) > b {
  background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink);
}
.track-row > span {
  font: 500 var(--text-base) var(--font-body);
}
.listen-links {
  display: flex;
  gap: 7px;
  grid-column: 2;
  flex-wrap: wrap;
}
.listen-links a {
  border: 1px solid var(--line);
  color: var(--muted);
  font: var(--text-xs) var(--font-label);
  padding: 6px 8px;
  text-decoration: none;
}
.listen-links .listen-apple {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  font-weight: 500;
  order: -2;
}
.empty-track {
  color: var(--muted);
}
.empty-track span {
  font-weight: 400;
}
@media (max-width: 560px) {
  .mini-tracklist {
    display: none;
  }
  .track-row {
    grid-template-columns: 26px 1fr;
  }
  .listen-links {
    flex-wrap: wrap;
  }
}

/* ---- Batch photo capture ---- */
.add-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 20px;
  border-bottom: 1px solid var(--line);
}
.add-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  cursor: pointer;
  font: 500 var(--text-base) var(--font-body);
  padding: 12px 8px;
}
.add-tabs button[aria-selected="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}
.add-tabs button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}
.quick-capture[hidden],
.manual-entry[hidden] {
  display: none;
}
.manual-entry {
  padding-top: 20px;
}
.quick-capture {
  padding: 22px !important;
  margin: 20px 0 18px;
  background: var(--ink);
  color: #fff;
}
.quick-copy {
  display: grid;
  gap: 5px;
}
.quick-copy h3 {
  font: 600 var(--text-lg) var(--font-display);
  margin: 0;
}
.quick-copy p {
  color: #aaa;
  font-size: var(--text-xs);
  line-height: 1.7;
  margin: 0;
}
.quick-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}
.quick-actions button,
.quick-actions label {
  flex: 1;
}
.quick-camera {
  border: 0;
  background: var(--ink);
  color: #fff;
  padding: 14px 16px;
  font: 500 var(--text-sm) var(--font-body);
  cursor: pointer;
}
.quick-capture .secondary {
  color: #fff;
  border-color: #555;
}
.file-trigger {
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
  font: 500 var(--text-sm) var(--font-body);
}
.visually-hidden-file {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}
.capture-message {
  min-height: 18px;
  color: #9bd7c1;
  font-size: var(--text-xs);
  margin: 0 0 8px;
}
.capture-message.error {
  color: #ff9d86;
}
.capture-queue {
  min-height: 112px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  border-top: 1px solid #444;
  border-bottom: 1px solid #444;
}
.capture-queue > p {
  margin: auto;
  color: #777;
  font-size: var(--text-xs);
}
.queue-photo {
  position: relative;
  flex: 0 0 88px;
  height: 88px;
}
.queue-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.queue-photo button {
  position: absolute;
  right: -5px;
  top: -5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.queue-photo span {
  position: absolute;
  left: 5px;
  bottom: 4px;
  background: #000c;
  color: #fff;
  padding: 2px 5px;
  font: var(--text-xs) var(--font-label);
}
.queue-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
}
.queue-actions span {
  font: 500 var(--text-sm) var(--font-label);
}
.queue-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
@media (max-width: 560px) {
  .quick-capture {
    margin-left: -22px;
    margin-right: -22px;
    padding: 22px !important;
  }
  .quick-actions {
    display: grid;
  }
  .quick-copy h3 {
    font-size: var(--text-lg);
  }
  .capture-queue {
    margin-right: -22px;
  }
}

/* ---- Cloud sync, login, AI status badges ---- */
.top-actions {
  align-items: center;
}
.account-status {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: 500 var(--text-xs) var(--font-label);
  padding: 10px 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-status:hover {
  color: var(--ink);
}
.sync-status {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font: 500 var(--text-xs) var(--font-label);
  gap: 7px;
  padding: 10px;
}
.sync-status i {
  background: #d28738;
  border-radius: 50%;
  height: 7px;
  width: 7px;
}
.sync-status.syncing i {
  background: #d28738;
  animation: sync-pulse 1s infinite;
}
.sync-status.synced {
  color: var(--green);
}
.sync-status.synced i {
  background: var(--green);
}
.sync-status.local {
  color: var(--muted);
}
.sync-status.local i {
  background: var(--muted);
}
.sync-status.error i,
.sync-status.required i {
  background: var(--orange);
}
.sync-dialog {
  width: min(520px, 92vw);
}
.sync-dialog::backdrop {
  background: rgb(0 0 0 / 85%);
}
.sync-dialog-inner {
  padding: 34px;
}
.sync-dialog-inner h2 {
  font: 600 var(--text-xl)/1.05 var(--font-display);
  margin: 0 0 18px;
}
.sync-dialog-inner > p {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.8;
}
.sync-dialog-inner form {
  display: grid;
  gap: 14px;
  padding: 20px 0 8px;
}
.sync-dialog-inner form[hidden] {
  display: none;
}
.sync-dialog-inner form label {
  font: var(--text-xs) var(--font-label);
}
.sync-dialog-inner form label[hidden] {
  display: none;
}
.sync-dialog-inner form input {
  border: 1px solid var(--line);
  padding: 13px;
}
.sync-dialog-inner form .add-btn {
  width: 100%;
}
.auth-reset {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.auth-switch {
  background: none;
  border: 0;
  color: var(--orange-ink);
  cursor: pointer;
  display: block;
  font-size: var(--text-base);
  font-weight: 700;
  padding: 8px 0;
}
.auth-reset[hidden],
.auth-switch[hidden] {
  display: none;
}
.local-continue {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font-size: var(--text-sm);
  margin-top: 8px;
  padding: 12px;
  width: 100%;
}
.local-continue:hover {
  border-color: var(--ink);
}
.local-only-note {
  margin-top: 8px;
}
.sync-login-message {
  min-height: 24px;
}
/* ---- マイページ: account, listening services, links ---- */
#mypageDialog {
  width: min(560px, 94vw);
}
.mypage {
  padding: 30px;
}
.mypage-section {
  padding: 20px 0 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}
.mypage-section h3 {
  font: 700 var(--text-sm) var(--font-body);
  margin: 0 0 10px;
}
.mypage-section .spec-sheet {
  margin-top: 0;
}
.mypage-section .spec-sheet dd {
  overflow-wrap: anywhere;
}
.mypage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.mypage-note {
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.8;
  margin: 10px 0;
}
.listen-options {
  display: grid;
  gap: 4px;
}
.listen-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: var(--text-base);
  cursor: pointer;
}
.listen-options input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}
.mypage-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: var(--text-sm);
}
.mypage-links a {
  color: var(--ink);
}
@media (max-width: 560px) {
  .mypage {
    padding: 22px;
  }
}
.local-continue[hidden],
.local-only-note[hidden] {
  display: none;
}
.sync-dialog-inner small {
  color: var(--muted);
  display: block;
  font-size: var(--text-xs);
  line-height: 1.7;
}
@keyframes sync-pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.72);
  }
}
@media (max-width: 560px) {
  .sync-status {
    padding: 9px;
  }
  .account-status {
    font-size: var(--text-xs);
    padding: 9px 2px;
  }
  .sync-status span {
    display: none;
  }
  .sync-dialog-inner {
    padding: 26px;
  }
  .sync-dialog-inner h2 {
    font-size: var(--text-lg);
  }
}
/* AI state badge: black = working, orange outline = check it, red = error. */
.ai-status {
  background: var(--ink);
  border: 1px solid var(--ink);
  color: #fff;
  display: inline-block;
  font: 500 var(--text-xs) var(--font-body);
  line-height: 1.4;
  padding: 3px 7px;
}
.cover .ai-status {
  left: 8px;
  position: absolute;
  top: 8px;
}
.ai-status.review,
.ai-status.no_resources {
  background: var(--paper);
  border-color: var(--orange);
  color: var(--orange-ink);
}
.ai-status.error {
  background: var(--red);
  border-color: var(--red);
}
.detail-grid .ai-status {
  margin-bottom: 10px;
}
.ai-note {
  border-left: 3px solid var(--orange);
  color: var(--ink);
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 12px 0;
  padding: 2px 12px;
}
.ai-error {
  background: #fff0e9;
  border-left: 3px solid var(--red);
  color: var(--red);
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 12px 0;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}
.sync-dialog-inner {
  position: relative;
}
.sync-close {
  position: absolute;
  right: 18px;
  top: 14px;
}
.sync-hint {
  align-items: center;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 14px;
  padding: 10px 4vw;
}
.sync-hint p {
  flex: 1;
  font-size: var(--text-sm);
  margin: 0;
}
.sync-hint .add-btn {
  padding: 9px 14px;
}
.sync-hint .close {
  font-size: var(--text-md);
  line-height: 1;
}
.sync-hint[hidden] {
  display: none;
}
@media (max-width: 560px) {
  .sync-hint {
    padding: 10px 18px;
  }
}

/* ---- Footer, sign-up consent and the data-handling page ---- */
.site-footer {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 20px;
  margin-top: 40px;
  padding: 24px 4vw 40px;
}
.site-footer a,
.auth-consent a {
  color: var(--muted);
  font-size: var(--text-sm);
  text-underline-offset: 3px;
}
/* Overrides the dialog's text-field rules for this checkbox row. */
.sync-dialog-inner form label.auth-consent {
  align-items: flex-start;
  display: flex;
  font: var(--text-sm)/1.7 var(--font-body);
  gap: 8px;
  letter-spacing: 0;
}
.sync-dialog-inner form .auth-consent input {
  accent-color: var(--ink);
  flex: none;
  height: 16px;
  margin: 3px 0 0;
  padding: 0;
  width: 16px;
}
.auth-consent a {
  color: var(--ink);
  font-size: inherit;
}
.sync-dialog-inner form label.auth-consent[hidden] {
  display: none;
}
.doc-page {
  line-height: 1.9;
  margin: 0 auto;
  max-width: 760px;
  padding: 40px 4vw 80px;
}
.doc-page h1 {
  font-size: var(--text-lg);
  margin: 8px 0 0;
}
.doc-page ol {
  padding-left: 1.4em;
}
.doc-page ol li + li {
  margin-top: 6px;
}
.doc-page h2 {
  font-size: var(--text-md);
  margin: 40px 0 8px;
}
.doc-page a {
  color: var(--orange-ink);
}
.doc-updated {
  color: var(--muted);
  font-size: var(--text-sm);
}
.doc-summary {
  background: var(--cream);
  margin-top: 24px;
  padding: 4px 20px;
}
.doc-summary h2 {
  margin-top: 16px;
}
.doc-table {
  overflow-x: auto;
}
.doc-table table {
  border-collapse: collapse;
  font-size: var(--text-base);
  min-width: 520px;
  width: 100%;
}
.doc-table th,
.doc-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}
.doc-back {
  margin-top: 48px;
}
.account-delete {
  color: var(--red);
  display: block;
  margin-top: 16px;
}

/* ---- First-run guide (empty collection) and guest notices ---- */
.empty h3 {
  font-size: var(--text-md);
  margin: 20px 0 0;
}
.empty-steps {
  counter-reset: step;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  margin: 28px auto 0;
  max-width: 720px;
  padding: 0;
  text-align: left;
}
.empty-steps li {
  border-top: 2px solid var(--ink);
  counter-increment: step;
  padding-top: 10px;
}
.empty-steps b::before {
  color: var(--ink);
  content: counter(step) " ";
  font-family: var(--font-label);
}
.empty-steps b,
.empty-steps span {
  display: block;
}
.empty-steps span {
  color: var(--muted);
  font-size: var(--text-base);
  line-height: 1.7;
  margin-top: 4px;
}
.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 28px auto 0;
  max-width: 320px;
}
.empty-actions .local-continue {
  margin-top: 0;
}
.empty-note {
  color: var(--muted);
  font-size: var(--text-sm);
}
.empty-note a {
  color: inherit;
  margin-left: 6px;
}
.empty-actions [hidden],
.empty-note[hidden],
.capture-guest-note[hidden] {
  display: none;
}
.capture-guest-note {
  border-left: 3px solid var(--orange);
  color: #f2eee5;
  font-size: var(--text-sm);
  line-height: 1.8;
  margin: 0 0 16px;
  padding: 2px 12px;
}
.capture-guest-note button {
  background: none;
  border: 0;
  color: #ff9d86;
  cursor: pointer;
  font-weight: 700;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 560px) {
  .empty {
    padding: 48px 16px;
  }
  .empty-steps {
    grid-template-columns: 1fr;
  }
}
.collection-empty .stats,
.collection-empty .shelf-stats,
.collection-empty .collection-footer,
.collection-empty .section-head .tools,
.collection-empty .genre-row,
.collection-empty .filter-bar {
  display: none;
}

/* ---- In-store search: pinned field on phones and a plain answer ---- */
.search-bar {
  display: none;
}
@media (max-width: 560px) {
  .search-bar {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: block;
    padding: 6px 18px 10px;
    position: sticky;
    top: 78px;
    z-index: 9;
  }
  .search-bar .search input {
    font-size: 16px;
  }
  .collection-empty .search-bar {
    display: none;
  }
  /* While searching on a phone, the answer comes right under the field. */
  .searching .stats,
  .searching .shelf-stats,
  .searching .sync-hint,
  .searching .section-head,
  .searching .genre-row,
  .searching .filter-bar {
    display: none;
  }
  .searching #collectionView {
    padding-top: 16px;
  }
}
.search input::-webkit-search-cancel-button {
  cursor: pointer;
}
.search-result {
  border-left: 3px solid var(--ink);
  margin: 0 0 18px;
  padding: 6px 14px;
}
.search-result strong {
  display: block;
  font-size: var(--text-md);
}
.search-result.found strong::before {
  content: "✓ ";
}
.search-result.missing {
  border-left-color: var(--orange);
}
.search-result small {
  color: var(--muted);
  display: block;
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-top: 2px;
}
.search-result button {
  background: none;
  border: 0;
  color: var(--orange-ink);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 700;
  margin-top: 6px;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.search-result[hidden] {
  display: none;
}

/* iOS Safari zooms the page when focusing a field smaller than 16px. */
@media (max-width: 560px) {
  input:not([type="checkbox"]),
  select,
  textarea {
    font-size: 16px;
  }
}

.stat-unit {
  display: none;
}
/* Shelf stats: one big fact and a decade histogram. Heights are classes because the CSP blocks inline styles. */
.shelf-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 32px;
  align-items: end;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.shelf-stats[hidden] {
  display: none;
}
.shelf-fact {
  display: grid;
  gap: 4px;
}
.shelf-fact span,
.shelf-fact small {
  color: var(--muted);
  font-size: var(--text-xs);
}
.shelf-fact strong {
  font: 800 var(--text-xl)/1.1 var(--font-display);
  margin-bottom: 4px;
}
.decade-bars {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 96px;
  margin: 0;
}
.decade-bars > div {
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
}
.decade-bars i {
  grid-row: 1;
  grid-column: 1;
  align-self: end;
  min-height: 1px;
  background: var(--line);
}
.decade-bars .top i {
  background: var(--ink);
}
.decade-bars span {
  padding-top: 4px;
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
}
.decade-bars .top span {
  color: var(--ink);
  font-weight: 700;
}
.decade-bars i[data-h="0"] { height: 0%; }
.decade-bars i[data-h="1"] { height: 10%; }
.decade-bars i[data-h="2"] { height: 20%; }
.decade-bars i[data-h="3"] { height: 30%; }
.decade-bars i[data-h="4"] { height: 40%; }
.decade-bars i[data-h="5"] { height: 50%; }
.decade-bars i[data-h="6"] { height: 60%; }
.decade-bars i[data-h="7"] { height: 70%; }
.decade-bars i[data-h="8"] { height: 80%; }
.decade-bars i[data-h="9"] { height: 90%; }
.decade-bars i[data-h="10"] { height: 100%; }
.collection-footer {
  margin-top: 32px;
  text-align: right;
}
.text-link {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-sm);
  padding: 8px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.text-link:hover {
  color: var(--ink);
}

/* On phones the totals are one compact line, so the shelf stays close to the top. */
@media (max-width: 560px) {
  .stats {
    align-items: baseline;
    display: grid;
    gap: 2px 14px;
    grid-template-columns: auto auto 1fr;
    margin: 0;
    padding: 12px 0;
  }
  .stat {
    border: 0;
    padding: 0;
  }
  .stat:last-child {
    display: contents;
  }
  .stat strong {
    font: 500 var(--text-base) var(--font-body), sans-serif;
  }
  .stat:last-child strong {
    font-weight: 700;
    text-align: right;
  }
  .stat-unit {
    display: inline;
    font-style: normal;
    margin-left: 2px;
  }
  .stat:not(:last-child) span {
    display: none;
  }
  .stat:last-child span,
  .stat-action,
  .stat-progress {
    grid-column: 1 / -1;
  }
  .shelf-stats {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    padding: 14px 0;
  }
  .shelf-fact strong {
    font-size: var(--text-lg);
  }
  .crate-divider {
    scroll-margin-top: 160px;
  }
  .shelf-genre {
    display: none;
  }
  .decade-bars {
    height: 56px;
  }
}
