:root {
  color-scheme: light;
  --surface: #ffffff;
  --background: #f1f6f3;
  --text: #1b2e25;
  --muted: #53675b;
  --line: #dce7df;
  --accent: #13735b;
  --accent-dark: #0d5a46;
  --accent-light: #e6f4ec;
  --danger: #a1362a;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.55;
}

button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible {
  outline: 3px solid #74bca6;
  outline-offset: 2px;
}

.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: min(100% - 2.5rem, 69rem);
  margin-inline: auto;
  min-height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.brand-icon { flex: none; border-radius: .7rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.45rem; letter-spacing: .03em; font-weight: 750; }
h2 { font-size: 1.16rem; font-weight: 750; letter-spacing: .025em; }

.privacy-label {
  display: inline-flex;
  gap: .55rem;
  align-items: center;
  white-space: nowrap;
  color: #195e49;
  background: var(--accent-light);
  border-radius: 1.5rem;
  padding: .4rem .7rem;
  font-size: .875rem;
  font-weight: 650;
}

.lock-icon {
  display: inline-block;
  width: .72rem;
  height: .57rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  position: relative;
  margin-top: .19rem;
}

.lock-icon::before {
  content: "";
  position: absolute;
  width: .4rem;
  height: .38rem;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  top: -.44rem;
  left: 50%;
  transform: translateX(-50%);
}

.layout {
  width: min(100% - 2.5rem, 69rem);
  margin: 2.25rem auto 3rem;
  display: grid;
  grid-template-columns: minmax(20rem, .9fr) minmax(0, 1.2fr);
  gap: 1.25rem;
  align-items: start;
}

.inputs { display: grid; gap: 1.25rem; min-width: 0; }

.panel {
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 2px 4px #234f3610;
}

.inventory-status {
  margin-top: .5rem;
  margin-bottom: .95rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.inventory-status.loaded { color: var(--accent-dark); font-weight: 650; }
.inventory-warning {
  margin: -.4rem 0 .95rem;
  color: #784d0c;
  font-size: .875rem;
}
.error { color: var(--danger); }

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}

.button {
  min-height: 2.875rem;
  padding: .6rem .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.2;
}

.primary { color: #fff; background: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-dark); }
.secondary { color: var(--accent-dark); border-color: #c8dad0; background: var(--surface); }
.secondary:hover:not(:disabled), .quiet:hover:not(:disabled) { background: var(--accent-light); }
.quiet { color: var(--muted); background: transparent; }
.button:disabled { opacity: .52; cursor: default; }

.camera-icon {
  width: 1.22rem;
  height: .87rem;
  border: 1.6px solid currentColor;
  border-radius: 3px;
  position: relative;
}

.camera-icon::before, .camera-icon::after { content: ""; position: absolute; }
.camera-icon::before {
  height: .36rem;
  width: .36rem;
  border: 1.4px solid currentColor;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.camera-icon::after {
  background: currentColor;
  border-radius: 2px 2px 0 0;
  width: .46rem;
  height: .19rem;
  top: -.26rem;
  left: .12rem;
}

.file-icon {
  position: relative;
  width: .8rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}
.file-icon::before {
  position: absolute;
  content: "";
  top: .26rem;
  left: .13rem;
  right: .13rem;
  height: .25rem;
  border-block: 1px solid currentColor;
}

.scan-actions {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: .6rem;
}

.camera-preview {
  margin-top: .85rem;
  background: #e8eeea;
  border: 1px solid var(--line);
  border-radius: .75rem;
  overflow: hidden;
}

.camera-preview video {
  width: 100%;
  max-height: min(50vh, 23rem);
  min-height: 7rem;
  object-fit: contain;
  display: block;
  background: #172b23;
}

.camera-actions { padding: .7rem; }
.scan-status { margin-top: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.scan-status.error { color: var(--danger); }

.lookup-form {
  padding-top: 1rem;
  margin-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.lookup-form label {
  display: block;
  margin-bottom: .45rem;
  font-size: .92rem;
  font-weight: 680;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
}

.lookup-row input {
  min-width: 0;
  border: 1px solid #c8d9d0;
  border-radius: .55rem;
  padding: .55rem .7rem;
  color: var(--text);
  background: #f8faf9;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}

.lookup-row input::placeholder { color: #61756a; }
.lookup-row input[aria-invalid="true"] { border-color: var(--danger); }

.results-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}
.results-header h2:focus { outline: none; }
.results-count {
  padding: .25rem .55rem;
  color: var(--accent-dark);
  background: var(--accent-light);
  border-radius: .4rem;
  font-size: .875rem;
  font-weight: 700;
}

.result-placeholder {
  display: grid;
  place-items: center;
  align-content: center;
  gap: .8rem;
  min-height: 20rem;
  margin-top: 1.05rem;
  padding: 1.25rem;
  border: 1px dashed #ceded3;
  border-radius: .7rem;
  background: #f8fbf9;
  color: var(--muted);
  text-align: center;
}

.scan-icon {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  color: #40856d;
  background:
    linear-gradient(currentColor 0 0) top left / .56rem 2px,
    linear-gradient(currentColor 0 0) top left / 2px .56rem,
    linear-gradient(currentColor 0 0) top right / .56rem 2px,
    linear-gradient(currentColor 0 0) top right / 2px .56rem,
    linear-gradient(currentColor 0 0) bottom left / .56rem 2px,
    linear-gradient(currentColor 0 0) bottom left / 2px .56rem,
    linear-gradient(currentColor 0 0) bottom right / .56rem 2px,
    linear-gradient(currentColor 0 0) bottom right / 2px .56rem;
  background-repeat: no-repeat;
}

.scan-icon span {
  width: 1.15rem;
  height: 2px;
  background: currentColor;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: .95rem 0 0;
  display: grid;
  gap: .7rem;
}
.result-list:empty { margin: 0; }

.result-item {
  border: 1px solid var(--line);
  border-radius: .72rem;
  padding: .95rem 1rem;
  min-width: 0;
}

.result-item h3 {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}
.result-item.unmatched { background: #f8faf9; color: var(--muted); }
.result-item.unmatched h3 { font-size: .95rem; }
.result-meta {
  margin-top: .22rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .875rem;
}
.result-meta code {
  font: .92rem ui-monospace, "Cascadia Mono", "Menlo", monospace;
  overflow-wrap: anywhere;
}
.result-metrics {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: .6rem;
  border-top: 1px solid var(--line);
  padding-top: .7rem;
  margin: .75rem 0 0;
}
.result-metrics dt { color: var(--muted); font-size: .875rem; }
.result-metrics dd {
  margin: .12rem 0 0;
  font-size: 1.1rem;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.result-metrics .price { color: var(--accent-dark); }

@media (max-width: 47rem) {
  .header-inner, .layout { width: calc(100% - 1.75rem); }
  .header-inner { min-height: 4.25rem; }
  .layout { grid-template-columns: minmax(0, 1fr); margin-top: 1rem; gap: .85rem; }
  .inputs { gap: .85rem; }
  .panel { padding: 1.08rem; }
  .result-placeholder { min-height: 9.5rem; }
}

@media (max-width: 24rem) {
  .header-inner { gap: .35rem; }
  .brand { gap: .5rem; }
  h1 { font-size: 1.22rem; }
  .privacy-label { padding-inline: .5rem; }
  .panel { padding: .88rem; }
  .scan-actions .button { padding-inline: .4rem; }
  .result-metrics { gap: .35rem; }
  .result-metrics dd { font-size: 1rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .button { transition: background-color .14s ease; }
}

