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

:root {
  --bg:          #111111;
  --surface:     #1c1c1e;
  --surface2:    #2c2c2e;
  --accent:      #00cfff;
  --accent-dark: #0099cc;
  --text:        #f0f0f0;
  --text-muted:  #8e8e93;
  --radius:      14px;
  --green:       #34c759;
  --yellow:      #ffd60a;
  --orange:      #ff9f0a;
  --red:         #ff453a;
  --grey:        #8e8e93;
}

html { min-height: 100%; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; max-width: 640px; width: 100%; margin: 0 auto; padding: 40px 18px; }

.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.pc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { font-size: 1.8rem; font-weight: 700; }
.pc-lang {
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--surface2); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.pc-lang:hover { border-color: var(--accent); }
.subtitle { color: var(--text-muted); font-size: 0.95rem; margin: 6px 0 22px; }

/* ── Tabs ── */
.pc-tabs { display: flex; gap: 6px; background: var(--surface); border-radius: var(--radius); padding: 5px; margin-bottom: 18px; }
.pc-tab {
  flex: 1; background: transparent; border: none; color: var(--text-muted);
  padding: 10px 8px; border-radius: 10px; font-size: 0.92rem; font-weight: 600; cursor: pointer; transition: all .15s ease;
}
.pc-tab.active { background: var(--surface2); color: var(--text); }
.pc-tab:hover:not(.active) { color: var(--text); }

.pc-panel { display: none; }
.pc-panel.active { display: block; }

/* ── Buttons / inputs ── */
.pc-btn { border: none; border-radius: var(--radius); padding: 13px 18px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .15s ease, opacity .15s ease; }
.pc-btn-primary { background: var(--accent); color: var(--bg); }
.pc-btn-primary:hover { background: var(--accent-dark); }
.pc-btn-accent { background: var(--surface2); color: var(--text); }
.pc-btn-accent:hover { background: #3a3a3c; }
.pc-btn-block { width: 100%; margin-top: 10px; }
.pc-btn:active { transform: scale(0.98); }

.pc-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin: 14px 0 6px; }
.pc-row { display: flex; gap: 8px; }
.pc-input, .pc-textarea {
  flex: 1; width: 100%; padding: 12px 14px; background: var(--surface); border: 1px solid var(--surface2);
  border-radius: var(--radius); color: var(--text); font-size: 1rem; outline: none; font-family: inherit; resize: vertical;
}
.pc-input:focus, .pc-textarea:focus { border-color: var(--accent); }
.pc-hint { color: var(--text-muted); font-size: 0.85rem; margin-top: 10px; text-align: center; }

/* ── Camera ── */
.pc-cam-stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; }
.pc-cam-stage video { width: 100%; height: 100%; object-fit: cover; display: none; }
.pc-cam-stage.pc-live video { display: block; }
.pc-cam-hint { position: absolute; bottom: 12px; left: 12px; right: 12px; text-align: center; font-size: 0.85rem; color: #fff; background: rgba(0,0,0,.5); padding: 6px 10px; border-radius: 8px; }
.pc-cam-stage:not(.pc-live) .pc-cam-hint { position: static; background: none; color: var(--text-muted); }
.pc-cam-controls { display: flex; gap: 8px; margin-top: 12px; }
.pc-cam-controls .pc-btn { flex: 1; }

.pc-file-label {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--bg); border-radius: var(--radius); padding: 28px 18px;
  font-size: 1.05rem; font-weight: 600; cursor: pointer; text-align: center;
}
.pc-file-label:hover { background: var(--accent-dark); }

/* ── Status ── */
.pc-status { margin-top: 18px; padding: 14px; background: var(--surface); border-radius: var(--radius); text-align: center; color: var(--text-muted); }

/* ── Result ── */
.pc-output { margin-top: 18px; }
.pc-msg { padding: 16px; background: var(--surface); border-radius: var(--radius); color: var(--text-muted); text-align: center; }
.pc-result { display: flex; flex-direction: column; gap: 16px; }

.pc-verdict { border-radius: var(--radius); padding: 22px 18px; text-align: center; }
.pc-verdict-label { font-size: 1.7rem; font-weight: 800; letter-spacing: .3px; }
.pc-verdict-src { font-size: 0.82rem; opacity: .85; margin-top: 4px; }
.pc-verdict-sub { font-size: 0.9rem; margin-top: 10px; opacity: .95; }
.pc-v-vegan   { background: rgba(52,199,89,.16);  border: 1px solid var(--green);  color: var(--green); }
.pc-v-likely  { background: rgba(52,199,89,.10);  border: 1px solid var(--green);  color: #7ee29a; }
.pc-v-vegetarian { background: rgba(255,214,10,.14); border: 1px solid var(--yellow); color: var(--yellow); }
.pc-v-non-vegetarian { background: rgba(255,69,58,.14); border: 1px solid var(--red); color: #ff6b62; }
.pc-v-unknown { background: var(--surface); border: 1px solid var(--surface2); color: var(--text-muted); }

.pc-sec { background: var(--surface); border: 1px solid var(--surface2); border-radius: var(--radius); padding: 14px 16px; }
.pc-sec h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--text); }

.pc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-chip { font-size: 0.82rem; padding: 4px 10px; border-radius: 20px; background: var(--surface2); border: 1px solid transparent; }
.pc-warn { background: rgba(255,69,58,.16); border-color: var(--red); color: #ff8079; }
.pc-uncertain { background: rgba(255,214,10,.12); border-color: var(--yellow); color: #ffe066; }
.pc-allergen { background: rgba(255,159,10,.14); color: #ffc266; }
.pc-add-no { background: rgba(255,69,58,.16); color: #ff8079; }
.pc-add-maybe { background: rgba(255,214,10,.12); color: #ffe066; }
.pc-add-yes { background: rgba(52,199,89,.14); color: #7ee29a; }
.pc-add-unknown { background: var(--surface2); color: var(--text-muted); }

/* Nutri-Score / NOVA */
.pc-nutri-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pc-nutri { padding: 5px 12px; border-radius: 8px; font-weight: 700; color: #000; }
.pc-nutri-a { background: #2e8b3d; color: #fff; } .pc-nutri-b { background: #7dc043; }
.pc-nutri-c { background: #ffd200; } .pc-nutri-d { background: #f08000; }
.pc-nutri-e { background: #e23a30; color: #fff; }
.pc-nova { padding: 5px 12px; border-radius: 8px; background: var(--surface2); color: var(--text); font-weight: 600; }

/* Produkt */
.pc-prod-box { display: flex; gap: 14px; align-items: flex-start; }
.pc-prod-img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 8px; flex-shrink: 0; }
.pc-prod-meta { font-size: 0.9rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; }
.pc-prod-name { color: var(--text); font-weight: 600; font-size: 1rem; }
.pc-off-link { color: var(--accent); text-decoration: none; margin-top: 4px; }

/* Zutatentext (interaktiv) */
.pc-ingredients { line-height: 1.9; font-size: 0.95rem; word-break: break-word; }
.pc-tok { border-radius: 5px; padding: 1px 3px; }
.pc-clickable { cursor: pointer; }
.pc-vegan   { background: rgba(52,199,89,.20);  color: #9be3ad; }
.pc-nonvegan{ background: rgba(255,159,10,.22); color: #ffc266; }
.pc-nonveg  { background: rgba(255,69,58,.22);  color: #ff8a82; }
.pc-maybe   { background: rgba(255,214,10,.18); color: #ffe066; }
.pc-unknown { text-decoration: underline dotted var(--text-muted); }
.pc-ok      { color: var(--text-muted); }
.pc-clickable:hover { outline: 1px solid var(--accent); }
.pc-taphint { font-size: 0.78rem; color: var(--text-muted); margin-top: 10px; }
.pc-traces { font-size: 0.82rem; color: var(--text-muted); margin-top: 8px; font-style: italic; }

.pc-report-btn { width: 100%; background: transparent; border: 1px solid var(--surface2); color: var(--text-muted); border-radius: 10px; padding: 9px; font-size: 0.82rem; cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.pc-report-btn:hover { border-color: var(--red); color: #ff8079; }
.pc-report-btn.pc-reported, .pc-report-btn:disabled { border-color: var(--green); color: var(--green); cursor: default; opacity: .9; }
.pc-attrib { font-size: 0.75rem; color: var(--text-muted); text-align: center; padding-top: 4px; }

/* ── Feedback Popover ── */
.pc-fb-pop { position: absolute; z-index: 100; background: var(--surface2); border: 1px solid #3a3a3c; border-radius: 12px; padding: 12px; width: 250px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.pc-fb-q { font-size: 0.85rem; margin-bottom: 10px; color: var(--text); }
.pc-fb-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-fb-opt { background: var(--surface); border: 1px solid #3a3a3c; color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 0.82rem; cursor: pointer; }
.pc-fb-opt:hover { border-color: var(--accent); }
.pc-fb-info { background: var(--surface); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.pc-fb-status { background: transparent; padding: 0; border-radius: 0; font-weight: 700; font-size: 0.86rem; }
.pc-fb-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }
.pc-has-note { border-bottom: 1px dotted currentColor; }
.pc-region { font-size: 0.58rem; font-weight: 700; vertical-align: super; background: var(--accent); color: var(--bg); border-radius: 4px; padding: 0 3px; margin-left: 2px; letter-spacing: .3px; }

/* ── Toast ── */
.pc-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--surface2); color: var(--text); padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); opacity: 0; transition: all .3s ease; z-index: 200; font-size: 0.9rem; }
.pc-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer { padding: 24px 20px; text-align: center; font-size: 0.8rem; }
footer a { color: var(--text-muted); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ── Foto-Flow: Stages ── */
.pc-fstage { display: none; }
.pc-fstage.active { display: block; }

/* Crop (Zeichnen / Ecken justieren) */
.pc-crop-viewport {
  position: relative;
  height: min(70vh, 520px);
  display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: var(--radius); overflow: hidden;
}
#pc-crop-canvas { max-width: 100%; max-height: 100%; touch-action: none; display: block; }
.pc-loupe {
  position: absolute; display: none;
  border-radius: 50%; border: 2px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0,0,0,.55);
  pointer-events: none; z-index: 20; background: #000;
}

/* Wort-Auswahl */
.pc-ws-wrap { text-align: center; }
.pc-ws-stage {
  position: relative; display: inline-block; max-width: 100%;
  line-height: 0; touch-action: none; user-select: none; -webkit-user-select: none;
}
.pc-ws-img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }
.pc-ws-box {
  position: absolute; box-sizing: border-box;
  border: 1.5px solid var(--accent); background: rgba(0,207,255,.18);
  border-radius: 3px; cursor: pointer;
}
.pc-ws-box.pc-ws-off { border-color: transparent; background: rgba(120,120,120,.5); }
