:root {
  color-scheme: light;
  --leaf: #315c48;
  --leaf-2: #557d55;
  --ink: #203028;
  --muted: #68766d;
  --paper: #fbfaf5;
  --line: #d7dfd3;
  --petal: #e9829f;
  --sun: #f2c94c;
  --sky: #72aebd;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(251,250,245,.98)),
    radial-gradient(circle at 8% 0%, rgba(233,130,159,.22), transparent 32%),
    radial-gradient(circle at 100% 10%, rgba(114,174,189,.18), transparent 34%),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 16px;
}

.app-icon {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(32,48,40,.12);
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(32,48,40,.15);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p,
dd {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 11vw, 52px);
  line-height: 1;
  letter-spacing: 0;
}

.camera-stage,
.result-card,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
  box-shadow: 0 14px 28px rgba(32,48,40,.08);
}

.camera-stage {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.camera-button {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 196px;
  padding: 20px;
  border: 1px dashed rgba(49,92,72,.45);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.76), transparent 38%),
    linear-gradient(135deg, rgba(233,130,159,.22), rgba(114,174,189,.22));
  color: var(--leaf);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.camera-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.camera-symbol {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 22px rgba(32,48,40,.12);
  font-size: 42px;
}

.preview-frame {
  margin: 0;
}

.preview-frame img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-frame figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.analyze-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--leaf);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(49,92,72,.22);
}

.analyze-button:disabled {
  background: #a7b5aa;
  box-shadow: none;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.result-card {
  padding: 16px;
}

.result-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
}

.result-head h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.scientific {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-style: italic;
}

.confidence {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(49,92,72,.12);
  color: var(--leaf);
  font-weight: 900;
}

.info-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-list div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--leaf);
  font-weight: 900;
}

dd {
  margin: 0;
  color: #394a42;
  line-height: 1.65;
}

.history-panel {
  margin-top: 14px;
  padding: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.section-title button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--leaf);
  font-weight: 800;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.history-item img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
}

.history-item strong {
  display: block;
}

.history-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 420px) {
  .app {
    padding-inline: 12px;
  }

  .info-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
