:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --ink: #222423;
  --muted: #626b68;
  --line: #d8dfda;
  --brand-orange: #f28c28;
  --brand-orange-soft: #fff1df;
  --brand-blue: #2f68d8;
  --brand-blue-dark: #214fa6;
  --brand-blue-soft: #eaf1ff;
  --brand-purple: #7b4bc4;
  --brand-purple-dark: #573191;
  --brand-purple-soft: #f0e9ff;
  --teal: var(--brand-blue);
  --teal-dark: var(--brand-purple-dark);
  --green: #14815f;
  --green-soft: #dff3ea;
  --yellow: #a36d00;
  --yellow-soft: #fff0c9;
  --red: #bd352f;
  --red-soft: #ffe1de;
  --unknown: #59636d;
  --unknown-soft: #e7ebee;
  --focus: #4f7fd1;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(242, 140, 40, 0.2), transparent 260px),
    radial-gradient(circle at 92% 0%, rgba(123, 75, 196, 0.16), transparent 280px),
    linear-gradient(180deg, rgba(47, 104, 216, 0.1), transparent 260px),
    var(--bg);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
.file-action,
select {
  min-height: 52px;
}

button,
.file-action {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-action:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-action {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.nav-action:hover,
.nav-action.active {
  border-color: rgba(123, 75, 196, 0.36);
  background: var(--brand-purple-soft);
  color: var(--brand-purple-dark);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-purple-dark);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 36px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.condition-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(242, 140, 40, 0.34);
  border-radius: 999px;
  padding: 10px 14px;
  color: #7b3d00;
  background: var(--brand-orange-soft);
  font-weight: 700;
}

.app-view {
  display: block;
}

.app-view[hidden] {
  display: none;
}

.condition-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.condition-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(242, 140, 40, 0.34);
  background: var(--brand-orange-soft);
  color: #7b3d00;
  font-weight: 800;
}

.checker-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 18px 44px rgba(47, 104, 216, 0.1);
}

.panel-heading,
.entry-row,
.action-row,
.food-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin-bottom: 0;
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  padding: 0 12px;
}

.entry-row {
  align-items: stretch;
}

input[type="search"] {
  width: 100%;
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: #fbfcff;
  font-size: 20px;
}

.primary-action {
  min-width: 140px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 800;
}

.primary-action:hover {
  background: var(--brand-blue-dark);
}

.action-row {
  margin-top: 12px;
  flex-wrap: wrap;
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 0 18px;
  background: var(--brand-purple-soft);
  color: var(--ink);
  font-weight: 700;
}

.action-row .secondary-action {
  flex: 1 1 140px;
}

.compact-action {
  min-width: 96px;
}

.full-action {
  width: 100%;
  margin-top: 16px;
}

.secondary-action:hover {
  background: #e5dcff;
}

.secondary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.file-action input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.system-note {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.photo-preview {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.photo-preview img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
}

.photo-preview strong,
.photo-preview span {
  display: block;
}

.photo-preview span {
  color: var(--muted);
  margin-top: 4px;
}

.result-panel {
  margin-top: 18px;
}

.result-panel.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.56);
}

.result-panel.loading {
  border: 2px solid rgba(47, 104, 216, 0.34);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(47, 104, 216, 0.14);
}

.loading-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

.loading-card h2 {
  margin-bottom: 6px;
}

.loading-card p {
  margin-bottom: 0;
  color: #33413c;
  font-weight: 700;
}

.loading-target {
  margin-top: 8px;
}

.loading-timer {
  display: inline-flex;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--brand-orange-soft);
  color: #7b3d00;
  font-weight: 900;
}

.loading-spinner {
  width: 72px;
  height: 72px;
  border: 7px solid rgba(123, 75, 196, 0.18);
  border-top-color: var(--brand-blue);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

.result-panel.mic-wait {
  border: 2px solid rgba(123, 75, 196, 0.3);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(123, 75, 196, 0.12);
}

.mic-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

.mic-card h2 {
  margin-bottom: 6px;
}

.mic-card p {
  margin-bottom: 0;
  color: #33413c;
  font-weight: 700;
}

.mic-help {
  margin-top: 8px;
  color: var(--muted);
}

.mic-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-purple);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.empty-state p {
  margin-bottom: 0;
}

.status-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--unknown);
}

.verdict-band {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.verdict-band.green {
  background: var(--green-soft);
  border-color: rgba(20, 129, 95, 0.28);
}

.verdict-band.yellow {
  background: var(--yellow-soft);
  border-color: rgba(163, 109, 0, 0.3);
}

.verdict-band.red {
  background: var(--red-soft);
  border-color: rgba(189, 53, 47, 0.28);
}

.verdict-band.unknown {
  background: var(--unknown-soft);
  border-color: rgba(89, 99, 109, 0.28);
}

.verdict-band h2 {
  margin-bottom: 6px;
}

.item-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.item-identity span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.item-identity strong {
  color: #0d211d;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1.05;
}

.item-identity em {
  color: #33413c;
  font-size: clamp(19px, 2.2vw, 28px);
  font-style: normal;
  font-weight: 900;
}

.verdict-band .corrected-name {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(15, 95, 78, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: #12312a;
  font-size: 15px;
  font-weight: 800;
}

.verdict-band p {
  margin-bottom: 0;
  color: #33413c;
}

.status-mark,
.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.status-mark {
  width: 92px;
  min-height: 72px;
  padding: 8px;
  text-align: center;
}

.mini-status {
  min-width: 86px;
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
}

.status-mark.green,
.mini-status.green {
  background: var(--green);
}

.status-mark.yellow,
.mini-status.yellow {
  background: var(--yellow);
}

.status-mark.red,
.mini-status.red {
  background: var(--red);
}

.status-mark.unknown,
.mini-status.unknown {
  background: var(--unknown);
}

.query-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  color: var(--muted);
}

.query-line span {
  color: var(--brand-blue-dark);
  font-weight: 800;
}

.card-hindi-name {
  margin-top: 4px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.match-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.food-card,
.rule-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.food-card.green {
  border-left: 8px solid var(--green);
}

.food-card.yellow {
  border-left: 8px solid var(--yellow);
}

.food-card.red {
  border-left: 8px solid var(--red);
}

.food-card.unknown {
  border-left: 8px solid var(--unknown);
}

.food-card-top {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.food-card h3 {
  margin-bottom: 0;
}

.category {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.portion {
  color: #303936;
}

.yellow-guidance {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid rgba(163, 109, 0, 0.28);
  border-radius: 8px;
  background: #fff8e8;
}

.yellow-guidance h4 {
  margin: 0 0 5px;
  color: var(--yellow);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.yellow-guidance p,
.yellow-guidance ul {
  margin: 0;
}

.yellow-guidance ul {
  padding-left: 20px;
}

.yellow-guidance li + li {
  margin-top: 5px;
}

.food-card p:last-child,
.rule-tile p:last-child {
  margin-bottom: 0;
}

.safety-footer {
  margin-top: 16px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
}

.source-links a {
  color: var(--brand-blue-dark);
  font-weight: 700;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 16px;
}

.view-heading h2 {
  margin-bottom: 0;
}

.common-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.common-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "status name"
    "status count";
  gap: 4px 12px;
  align-items: center;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.common-card.green {
  border-left-color: var(--green);
}

.common-card.yellow {
  border-left-color: var(--yellow);
}

.common-card.red {
  border-left-color: var(--red);
}

.common-card.unknown {
  border-left-color: var(--unknown);
}

.common-card:hover {
  border-top-color: rgba(123, 75, 196, 0.3);
  border-right-color: rgba(123, 75, 196, 0.3);
  border-bottom-color: rgba(123, 75, 196, 0.3);
}

.common-status {
  grid-area: status;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  min-height: 42px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.common-status.green {
  background: var(--green);
}

.common-status.yellow {
  background: var(--yellow);
}

.common-status.red {
  background: var(--red);
}

.common-status.unknown {
  background: var(--unknown);
}

.common-name {
  grid-area: name;
  font-size: 18px;
  font-weight: 900;
}

.common-count {
  grid-area: count;
  color: var(--muted);
  font-weight: 800;
}

.common-empty {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 28, 25, 0.64);
}

.modal-backdrop[hidden] {
  display: none;
}

.rules-modal {
  width: min(100%, 860px);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 20px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

.rules-modal h2 {
  margin-bottom: 14px;
}

.modal-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.quick-section,
.rules-band {
  margin-top: 24px;
}

.quick-section h2,
.rules-band h2 {
  margin-bottom: 12px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.quick-chip {
  min-height: 54px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 800;
}

.quick-chip:hover {
  border-color: var(--brand-purple);
  color: var(--brand-purple-dark);
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.rule-tile h3 {
  margin-bottom: 8px;
  color: var(--brand-purple-dark);
}

.rule-tile p {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 680px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    gap: 10px;
  }

  .top-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-action {
    width: 100%;
  }

  h1 {
    font-size: 32px;
  }

  .condition-pill {
    width: 100%;
    text-align: center;
  }

  .checker-panel {
    padding: 14px;
  }

  .panel-heading,
  .entry-row {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-action,
  .secondary-action,
  select {
    width: 100%;
  }

  .view-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .verdict-band {
    grid-template-columns: 1fr;
  }

  .status-mark {
    width: 100%;
    min-height: 58px;
  }

  .query-line {
    display: block;
  }

  .query-line span {
    display: block;
    margin-top: 4px;
  }

  .match-list,
  .rules-grid,
  .common-grid {
    grid-template-columns: 1fr;
  }

  .rules-modal {
    max-height: 92vh;
    padding: 14px;
  }
}
