:root {
  color-scheme: light;
  --ink: #17211c;
  --soft-ink: #3e4b44;
  --muted: #768279;
  --line: #e2e7df;
  --paper: #fffdf7;
  --bg: #eef3ed;
  --green: #1f6a4c;
  --deep: #101914;
  --mint: #dff3e8;
  --lime: #bde86f;
  --amber: #d48b1e;
  --red: #b94336;
  --shadow: 0 18px 50px rgba(20, 35, 27, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(189, 232, 111, 0.2), transparent 34%),
    linear-gradient(180deg, #f7faf4 0%, var(--bg) 62%, #e8eee6 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 34px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px 14px;
}

.top-bar div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--deep);
  color: var(--lime);
  font-size: 12px;
  font-weight: 900;
}

.today-pill {
  border: 1px solid #cdd9d0;
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--soft-ink);
  font-size: 12px;
  font-weight: 800;
}

.scan-stage,
.sheet-panel,
.result-panel,
.evidence-panel {
  border: 1px solid rgba(26, 45, 34, 0.08);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.96);
  box-shadow: var(--shadow);
}

.scan-stage {
  overflow: hidden;
  padding: 20px;
  background: var(--deep);
  color: white;
}

.stage-copy {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.scan-stage .eyebrow {
  color: var(--lime);
}

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

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

h2 {
  margin-bottom: 0;
  font-size: 19px;
  line-height: 1.22;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.stage-copy p:last-child {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
}

.photo-card {
  display: block;
  cursor: pointer;
}

.photo-card input {
  display: none;
}

.photo-frame {
  position: relative;
  display: grid;
  min-height: 275px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  text-align: center;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  min-height: 275px;
  object-fit: cover;
}

.photo-frame strong,
.photo-frame small {
  display: block;
}

.photo-frame small {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.66);
}

.camera-glyph {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--deep);
  font-size: 34px;
  font-weight: 900;
}

.secondary-action,
.ghost-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  padding: 14px 15px;
  background: var(--lime);
  color: var(--deep);
  font-weight: 900;
}

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

.analysis-loader {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.1);
}

.analysis-loader[hidden] {
  display: none;
}

.analysis-loader strong,
.analysis-loader span {
  display: block;
}

.analysis-loader span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.loader-ring {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(255, 255, 255, 0.24);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 840ms linear infinite;
}

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

.sheet-panel,
.result-panel,
.evidence-panel {
  margin-top: 12px;
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.analysis-summary {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 12px;
  background: #f0f7f2;
  color: var(--soft-ink);
  font-size: 13px;
  line-height: 1.45;
}

.analysis-summary strong {
  color: var(--green);
}

.analysis-summary small {
  color: var(--muted);
}

.food-list,
.option-list,
.meal-log-list {
  display: grid;
  gap: 9px;
}

.food-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  text-align: left;
}

.food-card span {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
}

.food-card small,
.option-chip small,
.empty-log,
.meal-log-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.food-card.selected {
  border-color: var(--green);
  background: var(--mint);
}

.food-card.primary-match {
  border-color: rgba(31, 106, 76, 0.42);
  background: #f5fbf5;
}

.food-card.primary-match span {
  font-size: 20px;
}

.result-panel {
  background: #ffffff;
}

.meter {
  height: 12px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eee8;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.meter-fill[data-risk="medium"] {
  background: var(--amber);
}

.meter-fill[data-risk="high"] {
  background: var(--red);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.result-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdf9;
}

.result-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.result-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.guidance {
  margin-top: 15px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.guidance p,
.evidence-panel p,
.planner-copy {
  color: var(--muted);
  line-height: 1.55;
}

.swap-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.swap-list span {
  border-radius: 999px;
  padding: 8px 10px;
  background: #edf6ef;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.compact-panel output {
  border-radius: 999px;
  padding: 7px 9px;
  background: var(--deep);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.portion-control {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.portion-control label {
  color: var(--soft-ink);
  font-size: 13px;
  font-weight: 900;
}

.portion-control input {
  width: 100%;
  accent-color: var(--green);
}

.option-chip {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.meal-log-panel {
  box-shadow: none;
}

.meal-log-item,
.empty-log {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fff;
}

.meal-log-item {
  display: grid;
  gap: 4px;
}

.evidence-panel {
  box-shadow: none;
}

.evidence-panel ul {
  padding-left: 18px;
}

.evidence-panel a {
  color: var(--green);
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: auto;
  }
}
