:root {
  color-scheme: dark;
  --bg: #003f32;
  --bg-2: #004b3b;
  --panel: #00c94c;
  --panel-soft: #5be08a;
  --ink: #06342d;
  --text: #eaffc8;
  --muted: rgba(234, 255, 200, 0.72);
  --accent: #d9ff24;
  --accent-soft: rgba(217, 255, 36, 0.18);
  --line: rgba(217, 255, 36, 0.25);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(217, 255, 36, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
summary,
label {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(14px, 3vw, 28px) max(36px, env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: clamp(16px, 3vw, 26px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  font-weight: 950;
  text-decoration: none;
  letter-spacing: 0;
}

.brand img {
  width: clamp(42px, 7vw, 64px);
  height: clamp(38px, 6vw, 58px);
  object-fit: contain;
  opacity: 0.82;
}

.location-chip {
  display: grid;
  justify-items: end;
  min-width: 116px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 85, 65, 0.68);
  color: var(--text);
  text-align: right;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.location-chip span {
  display: grid;
  max-width: 164px;
  overflow: visible;
  font-weight: 950;
  line-height: 1.02;
  text-overflow: clip;
  white-space: normal;
}

.location-chip span small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.location-chip span strong {
  overflow: hidden;
  font-size: 0.98rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-chip small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.location-chip small:empty,
.hidden-controls,
.ai-banner,
.barcode-card {
  display: none !important;
}

.hero-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: clamp(16px, 3vw, 28px);
  align-items: start;
}

.scanner-card,
.result-card,
.manual-card,
.small-panels details {
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.scanner-card {
  display: grid;
  gap: 10px;
}

.camera-stage {
  position: relative;
  overflow: hidden;
  --focus-left: 13%;
  --focus-top: 12%;
  --focus-width: 74%;
  --focus-height: 60%;
  width: 100%;
  min-height: 330px;
  max-height: min(58svh, 620px);
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(217, 255, 36, 0.14);
  border-radius: 28px;
  background: #002f26;
  isolation: isolate;
}

#cameraFeed,
#focusFeed,
#snapshotCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#cameraFeed {
  z-index: 0;
  filter: blur(16px) brightness(0.74) saturate(0.86);
  transform: scale(1.03);
}

#focusFeed {
  z-index: 1;
  clip-path: inset(
    var(--focus-top)
    calc(100% - var(--focus-left) - var(--focus-width))
    calc(100% - var(--focus-top) - var(--focus-height))
    var(--focus-left)
    round 22px
  );
}

#snapshotCanvas {
  display: none;
}

.camera-stage.unmirror-camera #cameraFeed {
  transform: scale(1.03) scaleX(-1);
}

.camera-stage.unmirror-camera #focusFeed {
  transform: scaleX(-1);
}

.camera-stage::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
  background: rgba(0, 63, 50, 0.1);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  background: #00382d;
  color: var(--text);
  text-align: center;
}

.camera-placeholder img {
  width: 62px;
  opacity: 0.85;
}

.camera-placeholder strong {
  font-size: 1.45rem;
  font-weight: 950;
}

.camera-placeholder span {
  max-width: 280px;
  color: var(--muted);
  font-weight: 750;
}

.scan-frame,
.shape-intro {
  position: absolute;
  left: var(--focus-left);
  top: var(--focus-top);
  z-index: 5;
  width: var(--focus-width);
  height: var(--focus-height);
  pointer-events: none;
}

.scan-frame {
  border: 5px solid var(--accent);
  border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(0, 63, 50, 0.12);
}

.scan-frame span {
  display: none;
}

.scan-frame strong {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: calc(100% - 36px);
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font-size: clamp(0.95rem, 2.8vw, 1.25rem);
  font-weight: 950;
}

.shape-intro {
  z-index: 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 22px;
  opacity: 0;
}

.shape-intro svg {
  width: min(56%, 220px);
  height: auto;
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25));
}

.intro-shape {
  opacity: 0;
  transform-origin: 50% 50%;
}

.camera-stage.intro-shapes .shape-intro {
  opacity: 1;
}

.camera-stage.intro-shapes .intro-lamp {
  animation: shapePulse 3.55s both;
}

.camera-stage.intro-shapes .intro-core {
  animation: shapePulse 3.55s 0.82s both;
}

.camera-stage.intro-shapes .intro-bottle {
  animation: shapePulse 3.55s 1.64s both;
}

.camera-stage.intro-shapes .intro-bag {
  animation: shapePulse 3.55s 2.46s both;
}

@keyframes shapePulse {
  0%,
  20% {
    opacity: 0;
    transform: scale(0.88);
  }

  27%,
  44% {
    opacity: 1;
    transform: scale(1);
  }

  52%,
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.capture-preview {
  position: absolute;
  left: var(--focus-left);
  top: var(--focus-top);
  z-index: 7;
  width: var(--focus-width);
  height: var(--focus-height);
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.24);
}

.capture-preview.slide-out {
  animation: captureSlide 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes captureSlide {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(58%) scale(0.9);
  }
}

.scan-button {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 8;
  display: inline-grid;
  place-items: center;
  width: clamp(116px, 24vw, 150px);
  aspect-ratio: 1;
  border: 9px solid rgba(0, 63, 50, 0.22);
  border-radius: 50%;
  background: var(--accent);
  color: var(--ink);
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 950;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

.scan-button .scan-dot {
  display: block;
  width: 18px;
  height: 18px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--ink);
}

.camera-stage.scanning .scan-button {
  color: transparent;
}

.camera-stage.scanning .scan-button::before {
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: url("./assets/chatgft-icon.png") center / contain no-repeat;
  content: "";
  animation: iconSpin 0.9s linear infinite;
}

.camera-stage.scanning .scan-dot,
.camera-stage.scanning .scan-label {
  opacity: 0;
}

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

.turn-button,
.photo-button {
  position: absolute;
  right: 22px;
  bottom: 38px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 999px;
  background: rgba(0, 63, 50, 0.86);
  color: var(--accent);
  font-weight: 950;
}

.photo-button {
  right: auto;
  left: 22px;
  color: var(--text);
}

#uploadFile {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.scan-status {
  display: none;
}

.result-card {
  display: grid;
  gap: 16px;
  min-height: 100%;
  padding: clamp(22px, 3.5vw, 34px);
  background: var(--panel);
  color: var(--ink);
}

.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.caption,
.disposal-kicker,
.result-explanation span {
  display: block;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.72;
}

.feedback-vote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(234, 255, 200, 0.32);
}

.feedback-vote[hidden] {
  display: none;
}

.feedback-vote span {
  padding-left: 7px;
  font-size: 0.72rem;
  font-weight: 950;
}

.feedback-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--text);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
}

.feedback-button.saved {
  background: var(--accent);
}

.result-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
}

.result-title-row h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.result-photo {
  width: clamp(66px, 12vw, 96px);
  aspect-ratio: 1;
  border: 5px solid rgba(234, 255, 200, 0.55);
  border-radius: 20px;
  object-fit: cover;
}

.result-card > p {
  margin: 0;
  color: rgba(6, 52, 45, 0.82);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.45;
  font-weight: 750;
}

.waste-bin {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 20px;
  background: rgba(234, 255, 200, 0.58);
}

.waste-bin span:first-child {
  display: grid;
  place-items: center;
  width: 62px;
  aspect-ratio: 1;
  border-radius: 18px;
  background: rgba(234, 255, 200, 0.72);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 950;
}

.waste-bin strong,
.waste-bin span {
  display: block;
}

.waste-bin strong {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  line-height: 1.05;
}

.waste-bin div span {
  margin-top: 4px;
  color: rgba(6, 52, 45, 0.78);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.25;
}

.waste-bin.paper {
  background: #cfe7ea;
}

.waste-bin.plastic {
  background: #ffad93;
}

.waste-bin.glass {
  background: #b9e4bb;
}

.waste-bin.gft {
  background: #a1e66b;
}

.waste-bin.chemical {
  background: #82c9d8;
}

.waste-bin.textile {
  background: #c6afd6;
}

.waste-bin.residual,
.waste-bin.neutral {
  background: rgba(234, 255, 200, 0.58);
}

.waste-bin.analyzing {
  animation: breathe 1.1s ease-in-out infinite alternate;
}

@keyframes breathe {
  to {
    transform: scale(0.985);
  }
}

.result-explanation,
.disposal-info,
.result-options {
  padding: 18px;
  border-radius: 20px;
  background: rgba(0, 63, 50, 0.08);
}

.result-explanation[hidden],
.disposal-info[hidden],
.result-options[hidden],
.bring-map[hidden] {
  display: none;
}

.result-explanation strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.35;
}

.disposal-info {
  display: grid;
  gap: 10px;
}

.disposal-info strong {
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  line-height: 1.1;
}

.disposal-info p {
  margin: 0;
  color: rgba(6, 52, 45, 0.82);
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 750;
}

.disposal-info a,
.point-button,
.manual-card button,
.general-feedback button,
.municipality-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--accent);
  font-weight: 950;
  text-decoration: none;
}

.disposal-info a[hidden],
#disposalLink[hidden] {
  display: none !important;
}

.bring-map {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.map-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: rgba(6, 52, 45, 0.82);
  font-weight: 950;
}

.map-heading small {
  opacity: 0.76;
}

.map-canvas {
  min-height: 250px;
  overflow: hidden;
  border: 2px solid rgba(0, 63, 50, 0.14);
  border-radius: 18px;
  background: rgba(234, 255, 200, 0.32);
}

.map-empty {
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 20px;
  color: rgba(6, 52, 45, 0.8);
  text-align: center;
  font-weight: 850;
}

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

.result-options {
  display: grid;
  gap: 10px;
}

.option-intro {
  margin: 0;
  color: rgba(6, 52, 45, 0.82);
  font-weight: 900;
}

.option-button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(234, 255, 200, 0.8);
  color: var(--ink);
  text-align: left;
}

.option-button span {
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
  opacity: 0.72;
}

.option-button strong {
  font-size: 1.1rem;
  line-height: 1.15;
}

.option-button-strong {
  background: var(--ink);
  color: var(--accent);
}

.option-button-prominent {
  background: var(--accent);
}

.confidence-line {
  display: none !important;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: auto;
  font-weight: 950;
}

.meter {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 63, 50, 0.18);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width 0.35s ease;
}

.manual-card,
.small-panels {
  margin-top: clamp(18px, 3vw, 28px);
}

.manual-card {
  display: grid;
  gap: 16px;
  padding: clamp(20px, 3vw, 28px);
  background: rgba(0, 85, 65, 0.82);
}

.manual-card h2 {
  margin: 6px 0 0;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1.05;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-row input,
.general-feedback textarea,
.municipality-controls input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(234, 255, 200, 0.1);
  color: var(--text);
  outline: none;
}

.search-row input {
  min-height: 54px;
  padding: 0 18px;
  font-weight: 850;
}

.search-row input::placeholder,
.general-feedback textarea::placeholder,
.municipality-controls input::placeholder {
  color: rgba(234, 255, 200, 0.45);
}

.suggestions {
  display: none;
}

.small-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.small-panels details {
  overflow: hidden;
  background: rgba(0, 85, 65, 0.7);
}

.small-panels summary {
  padding: 18px 20px;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 950;
}

.municipality-controls,
.general-feedback {
  display: grid;
  gap: 10px;
  padding: 0 20px 20px;
}

.municipality-controls label {
  color: var(--muted);
  font-weight: 900;
}

.municipality-controls input {
  min-height: 48px;
  padding: 0 14px;
}

.rule-grid {
  display: grid;
  gap: 8px;
  padding: 0 20px 20px;
}

.rule-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(234, 255, 200, 0.08);
}

.rule-card strong {
  color: var(--text);
  font-size: 0.92rem;
}

.rule-card span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.general-feedback textarea {
  min-height: 118px;
  padding: 14px;
  resize: vertical;
}

.general-feedback span {
  min-height: 20px;
  color: var(--muted);
  font-weight: 850;
}

@media (max-width: 860px) {
  .app-shell {
    max-width: 560px;
  }

  .hero-flow,
  .small-panels {
    grid-template-columns: 1fr;
  }

  .camera-stage {
    min-height: 330px;
    max-height: none;
    aspect-ratio: 1 / 0.82;
  }

  .result-card {
    gap: 12px;
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: max(10px, env(safe-area-inset-top)) 10px max(24px, env(safe-area-inset-bottom));
  }

  .app-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand img {
    width: 34px;
    height: 31px;
  }

  .brand span {
    font-size: 1.18rem;
  }

  .location-chip {
    min-width: 116px;
    min-height: 38px;
    padding: 6px 10px;
  }

  .location-chip span {
    max-width: 116px;
  }

  .location-chip span strong {
    font-size: 0.9rem;
  }

  .camera-stage {
    --focus-left: 8%;
    --focus-top: 11%;
    --focus-width: 84%;
    --focus-height: 60%;
    min-height: min(320px, 46svh);
    aspect-ratio: 1 / 0.84;
    border-radius: 24px;
  }

  .scan-button {
    bottom: 12px;
    width: 96px;
    border-width: 7px;
    font-size: 1rem;
  }

  .scan-button .scan-dot {
    width: 14px;
    height: 14px;
    margin-bottom: 0;
  }

  .turn-button,
  .photo-button {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 0.82rem;
  }

  .turn-button {
    right: 12px;
    bottom: 26px;
  }

  .photo-button {
    left: 12px;
    bottom: 26px;
  }

  .result-card {
    gap: 10px;
    padding: 16px;
    border-radius: 22px;
  }

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

  .manual-card button {
    width: 100%;
  }

  .result-title-row h1 {
    font-size: clamp(1.7rem, 8vw, 2.55rem);
    line-height: 1;
  }

  .result-card > p {
    font-size: 0.98rem;
    line-height: 1.32;
  }

  .waste-bin {
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
  }

  .waste-bin span:first-child {
    width: 52px;
    border-radius: 16px;
  }

  .waste-bin strong {
    font-size: 1.18rem;
  }

  .waste-bin div span {
    font-size: 0.98rem;
  }

  .confidence-line {
    margin-top: 0;
  }

  .feedback-vote {
    max-width: 178px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
