:root {
  color-scheme: dark;
  --canvas: #10101b;
  --panel: #1a1928;
  --panel-deep: #12121f;
  --raised: #232235;
  --line: #343248;
  --line-bright: #514d65;
  --text: #f8f6fb;
  --soft: #d3cfe0;
  --muted: #aaa5bf;
  --accent: #ffae65;
  --accent-hover: #ffc18b;
  --accent-text: #251507;
  --error: #ffb4bb;
  --success: #9de3c6;
  font-family: "DM Sans", "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  font-synthesis: none;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse 78rem 32rem at 48% -12rem, #282136 0%, transparent 75%), var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button, input, select {
  font: inherit;
}

button, a, input, select, summary {
  -webkit-tap-highlight-color: transparent;
}

button, summary {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .55;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a {
  color: inherit;
}

img, video {
  display: block;
  max-width: 100%;
}

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

.shell {
  width: min(100% - 64px, 1160px);
  margin-inline: auto;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.36fr) minmax(0, 1fr);
  align-items: start;
  column-gap: 20px;
  row-gap: 16px;
  padding-block: max(12px, env(safe-area-inset-top)) 20px;
}

.scan-card, .result-card, .manual {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(155deg, #201e2f, var(--panel) 64%);
  box-shadow: 0 14px 36px #07071138;
}

.result-card {
  min-height: 405px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}

.card-head > * {
  min-width: 0;
}

.card-head :is(h1, h2) {
  margin-top: 2px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.055em;
  line-height: 1.3;
}

.language-picker {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-deep);
}

.language-picker legend {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chip {
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.chip:hover, .chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.active, .chip.is-active, .chip:has(input:checked) {
  border-color: #6d503c;
  background: #3d2d26;
  color: var(--accent);
}

.chip input {
  accent-color: var(--accent);
}

.scan-stage {
  position: relative;
  display: grid;
  min-height: 266px;
  overflow: hidden;
  isolation: isolate;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background-color: #12121e;
  background-image: radial-gradient(ellipse at center, #5e3a3025, transparent 70%), linear-gradient(#34314751 1px, transparent 1px), linear-gradient(90deg, #34314751 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
}

.scan-stage-inner {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  width: 100%;
  min-height: inherit;
  padding: 34px 22px;
  pointer-events: none;
}

.stage-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #634a41;
  border-radius: 15px;
  background: #2a232d;
  color: var(--accent);
  font-size: 25px;
  line-height: 1;
}

.stage-icon svg {
  width: 25px;
  height: 25px;
}

.stage-corners {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(76%, 346px);
  height: 139px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.corner {
  position: absolute;
  display: block;
  width: 19px;
  height: 19px;
  border: 0 solid var(--accent);
}

.c-tl {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 5px;
}

.c-tr {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
  border-top-right-radius: 5px;
}

.c-bl {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
  border-bottom-left-radius: 5px;
}

.c-br {
  right: 0;
  bottom: 0;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 5px;
}

.scanline {
  position: absolute;
  top: 50%;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ffa26380, transparent);
  box-shadow: 0 0 13px #ff914d73;
  opacity: .68;
  pointer-events: none;
}

.stage-copy {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: min(100%, 246px);
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  word-break: keep-all;
}

.stage-copy :is(strong, h2, h3) {
  font-size: 15px;
  letter-spacing: -.035em;
}

.stage-copy :is(p, small, span) {
  color: var(--muted);
  font-size: 11px;
}

.scan-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d0c13;
}

.scan-media :is(img, video, canvas) {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.scan-stage.has-media .stage-icon,
.scan-stage.has-media .stage-copy {
  visibility: hidden;
}

.scan-stage.has-media .stage-corners {
  width: min(88%, 420px);
  height: 43%;
}

.scan-stage.has-media .scanline {
  opacity: .9;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.button {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--raised);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
}

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

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

.button-secondary {
  border-color: var(--line-bright);
}

.button-secondary:hover, .button-quiet:hover {
  border-color: #6c657f;
  background: #302d43;
}

.button-quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--soft);
}

.actions .button-primary, .actions .button-secondary {
  flex: 1 1 auto;
}

.status {
  min-height: 1.55em;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.status:empty {
  min-height: 0;
  margin-top: 0;
}

.status:is([data-tone="error"], [data-state="error"], .error, .is-error, [role="alert"]) {
  color: var(--error);
}

.status:is([data-tone="success"], [data-state="success"], .success, .is-success) {
  color: var(--success);
}

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

.manual .card-head {
  margin-bottom: 8px;
}

.manual-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.field {
  display: grid;
  flex: 1 1 115px;
  gap: 5px;
  min-width: 0;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
}

.field :is(input, select), input.field, select.field {
  width: 100%;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid var(--line-bright);
  border-radius: 9px;
  background: var(--panel-deep);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.field input::placeholder, input.field::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

.example {
  min-height: 27px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-deep);
  color: var(--soft);
  font-size: 11px;
  text-decoration: none;
}

.example:hover {
  border-color: #7c573b;
  color: var(--accent);
}

.empty-state {
  display: grid;
  min-height: 288px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px 14px;
  border: 1px dashed var(--line-bright);
  border-radius: 15px;
  background: #15142186;
  color: var(--soft);
  text-align: center;
  word-break: keep-all;
}

.empty-state svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.empty-state > :has(> svg) {
  display: grid;
  width: 53px;
  height: 53px;
  margin-bottom: 3px;
  place-items: center;
  border: 1px solid var(--line-bright);
  border-radius: 16px;
  background: var(--raised);
}

.empty-state :is(h2, h3, strong) {
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.035em;
}

.empty-state p {
  max-width: 28ch;
  color: var(--muted);
  font-size: 12px;
}

.result-list, .sale-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-deep);
  overflow-wrap: anywhere;
}

.result-item h3 {
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.04em;
}

.result-item p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.card-preview {
  flex: none;
  display: block;
  width: 60px;
  height: 84px;
  object-fit: contain;
  border-radius: 5px;
}

.card-label {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid #674936;
  border-radius: 6px;
  background: #31251f;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.market-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.market-link {
  display: inline-flex;
  min-height: 35px;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line-bright);
  border-radius: 8px;
  background: var(--raised);
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

.market-link:hover {
  border-color: #7c573b;
  color: var(--accent);
}

.market-link svg {
  width: 13px;
  height: 13px;
}

.sale-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sale-section h3 {
  margin-bottom: 5px;
  font-size: 13px;
}

.sale-section .sale-list {
  gap: 0;
}

.sale-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.sale-row:last-child {
  border-bottom: 0;
}

.sale-row strong {
  color: var(--text);
  white-space: nowrap;
}

.scan-stage.has-camera video {
  object-fit: cover;
}

.guide-label {
  display: none;
}

.scan-stage.has-camera .stage-corners {
  width: min(91%, 525px);
  height: clamp(46px, 18%, 63px);
  border-radius: 9px;
  box-shadow: 0 0 0 100vmax rgb(8 8 14 / 56%);
}

.scan-stage.has-camera .scanline {
  left: 3%;
  right: 3%;
  height: 2px;
  background: repeating-linear-gradient(90deg, #ff9c50d9 0 10px, transparent 10px 16px);
  opacity: .83;
}

.scan-stage.has-camera .guide-label {
  display: block;
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  max-width: 96%;
  padding: 5px 9px;
  border-radius: 5px;
  background: #131326;
  color: #ffb97a;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.scan-stage:has(#photo:not([hidden])) .stage-corners {
  display: none;
}

.card-identity, .result-choice {
  display: flex;
  align-items: center;
  gap: 12px;
}


.result-choice {
  justify-content: space-between;
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.result-choice:hover {
  border-color: var(--accent);
}

.candidate-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.candidate-copy small, .sale-note, .result-note {
  color: var(--muted);
  font-size: 12px;
}

.official-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--soft);
  font-size: 11px;
  text-underline-offset: 3px;
}

.selected-card > .button-quiet {
  margin-top: 9px;
}

.link-arrow {
  color: var(--accent);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  padding: 17px 0 29px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.footer > :first-child {
  color: var(--soft);
  font-weight: 800;
}

@media (max-width: 775px) {
  .shell {
    width: min(100% - 36px, 630px);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .scan-card, .result-card, .manual {
    padding: 14px;
    border-radius: 17px;
  }

  .result-card {
    min-height: 0;
  }

  .card-head {
    margin-bottom: 12px;
  }

  .empty-state {
    min-height: 120px;
  }

  .field :is(input, select), input.field, select.field {
    font-size: 16px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: calc(100% - 26px);
  }

  .scan-stage {
    min-height: 215px;
  }

  .stage-corners {
    width: 86%;
    height: 123px;
  }

  .card-head :is(h1, h2) {
    font-size: 18px;
  }

  .chip {
    padding-inline: 6px;
  }

  .manual-form .button {
    flex-grow: 1;
  }
}

@media (max-width: 775px) and (max-height: 680px) {
  .scan-stage.has-camera {
    min-height: 185px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
