:root {
  --scanner-bg: linear-gradient(150deg, #f9fafc 0%, #ffffff 48%, #eef3ff 100%);
  --scanner-card: #ffffff;
  --scanner-ink: #0f172a;
  --scanner-muted: #516078;
  --scanner-line: #d7dfeb;
  --scanner-shadow: 0 18px 40px rgba(20, 36, 70, 0.08);
  --risk-green: #168a4b;
  --risk-yellow: #b57900;
  --risk-red: #b42318;
}

.scanner-section {
  padding: 92px 20px;
  background: var(--scanner-bg);
}

.scanner-shell {
  max-width: 1140px;
  margin: 0 auto;
}

.scanner-head {
  max-width: 760px;
  margin-bottom: 34px;
}

.scanner-eyebrow {
  margin: 0;
  color: #1b66dc;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scanner-head h2 {
  margin: 8px 0 12px;
  color: var(--scanner-ink);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.scanner-head p {
  margin: 0;
  color: var(--scanner-muted);
  font-size: 18px;
  line-height: 1.6;
}

.scanner-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
}

.scan-card,
.result-card {
  background: var(--scanner-card);
  border: 1px solid var(--scanner-line);
  border-radius: 24px;
  box-shadow: var(--scanner-shadow);
}

.scan-card {
  padding: 20px;
}

.upload-drop {
  display: grid;
  place-items: center;
  border: 1.4px dashed #93a6c4;
  border-radius: 18px;
  min-height: 220px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  background: linear-gradient(165deg, #f7f9fd 0%, #ffffff 100%);
}

.upload-drop:hover {
  border-color: #4c84de;
  transform: translateY(-1px);
}

.upload-drop.dragover {
  border-color: #1b66dc;
  box-shadow: 0 0 0 4px rgba(27, 102, 220, 0.08) inset;
}

.upload-drop input {
  display: none;
}

.upload-copy {
  text-align: center;
  color: var(--scanner-ink);
}

.upload-copy strong {
  display: block;
  font-size: 17px;
  margin-bottom: 6px;
}

.upload-copy span {
  color: var(--scanner-muted);
  font-size: 14px;
}

.preview-wrap {
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid var(--scanner-line);
  overflow: hidden;
  display: none;
  background: #f2f5fa;
}

.preview-wrap img {
  display: block;
  width: 100%;
  max-height: 250px;
  object-fit: cover;
}

.analyze-btn {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #0f172a 0%, #1f3a67 100%);
  cursor: pointer;
}

.analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.scan-status {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  font-size: 13px;
}

.scan-status.loading {
  color: #19417e;
  background: #eaf1ff;
}

.scan-status.error {
  color: #8b1a1a;
  background: #ffefef;
}

.scan-status.debug {
  display: none;
  color: #40506a;
  background: #f4f7fc;
  border: 1px solid #dbe4f1;
}

.result-card {
  padding: 26px;
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.result-top h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 32px);
  color: var(--scanner-ink);
  letter-spacing: -0.01em;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 7px 14px;
  background: #edf2ff;
  color: #314b79;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.result-summary {
  margin: 12px 0 20px;
  color: var(--scanner-muted);
  line-height: 1.62;
}

.composition-panel,
.visual-panel,
.hidden-panel {
  border: 1px solid var(--scanner-line);
  border-radius: 18px;
  padding: 16px;
  background: #ffffff;
}

.visual-panel,
.hidden-panel {
  margin-top: 16px;
}

.composition-panel h4,
.visual-panel h4,
.hidden-panel h4 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--scanner-ink);
}

.composition-list {
  display: grid;
  gap: 10px;
}

.composition-item {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 10px;
}

.composition-name {
  color: #263447;
  font-size: 13px;
  font-weight: 600;
}

.composition-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #edf2fb;
  overflow: hidden;
}

.composition-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.composition-percent {
  font-size: 13px;
  color: var(--scanner-muted);
  font-weight: 700;
}

.panel-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.panel-topline span {
  font-size: 12px;
  color: #576785;
}

.visual-renderer {
  margin-top: 12px;
  min-height: 250px;
  border-radius: 16px;
  border: 1px solid #dbe3ef;
  background: linear-gradient(180deg, #f9fbff 0%, #f0f4fb 100%);
  padding: 16px;
  display: grid;
  place-items: center;
}

.visual-empty {
  color: #6a7890;
  font-size: 14px;
}

.layer-label {
  font-size: 11px;
  font-weight: 600;
  color: #263447;
  letter-spacing: 0.01em;
}

.glass {
  width: 170px;
  height: 220px;
  border: 2px solid rgba(69, 94, 131, 0.5);
  border-radius: 14px 14px 24px 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  background: rgba(255, 255, 255, 0.5);
}

.glass-layer {
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-cross {
  width: min(100%, 460px);
  height: 84px;
  border-radius: 18px;
  border: 1px solid #c2cfdf;
  overflow: hidden;
  display: flex;
}

.bar-layer {
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cake-slice {
  width: 230px;
  height: 210px;
  border: 1px solid #c2cfdf;
  border-radius: 14px;
  clip-path: polygon(4% 100%, 76% 100%, 95% 0%, 24% 0%);
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
}

.cake-layer {
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack-block {
  width: 190px;
  height: 220px;
  border: 1px solid #c2cfdf;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
}

.stack-layer {
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sugar-emphasis {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.hidden-list {
  display: grid;
  gap: 10px;
}

.hidden-item {
  border: 1px solid #dbe2ef;
  border-radius: 14px;
  padding: 12px;
  background: #fdfefe;
}

.hidden-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.hidden-name {
  margin: 0;
  font-size: 15px;
  color: #1f2e44;
}

.risk {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
}

.risk-green {
  color: var(--risk-green);
  background: #e8f8f0;
}

.risk-yellow {
  color: var(--risk-yellow);
  background: #fff8e6;
}

.risk-red {
  color: var(--risk-red);
  background: #ffeceb;
}

.hidden-item p {
  margin: 4px 0;
  color: #435269;
  font-size: 13px;
  line-height: 1.5;
}

.hidden-empty {
  color: #52627b;
  font-size: 14px;
}

@media (max-width: 980px) {
  .scanner-grid {
    grid-template-columns: 1fr;
  }

  .scan-card,
  .result-card {
    border-radius: 18px;
  }
}
