﻿:root {
  --bg: #050814;
  --panel: rgba(11, 16, 32, .88);
  --panel-strong: rgba(11, 16, 32, .96);
  --line: rgba(255, 255, 255, .16);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --faint: #94a3b8;
  --accent: #f2bd2f;
  --good: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --sample-x: 50%;
  --sample-y: 36%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; }
button { touch-action: manipulation; }

.app {
  position: fixed;
  inset: 0;
  min-height: 100dvh;
  background: #020617;
  overflow: hidden;
  user-select: none;
}

.camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020617;
}

.camera.frozen { filter: saturate(.8) brightness(.8); }

.glass,
.sheet,
.start-card {
  background: linear-gradient(145deg, rgba(15, 23, 42, .92), rgba(15, 23, 42, .80));
  border: 1px solid var(--line);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .34);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.topbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 0 12px;
  pointer-events: none;
}

.title-pill,
.mode-pill {
  border-radius: 22px;
  padding: 10px 13px;
  pointer-events: auto;
}

.title-pill strong {
  display: block;
  font-size: clamp(15px, 4vw, 18px);
  line-height: 1.05;
  letter-spacing: -.02em;
}

.title-pill span,
.mode-pill {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.mode-pill {
  min-height: 42px;
  display: grid;
  place-items: center;
}

.reticle {
  position: absolute;
  left: var(--sample-x);
  top: var(--sample-y);
  z-index: 4;
  width: clamp(88px, 28vw, 148px);
  height: clamp(88px, 28vw, 148px);
  transform: translate(-50%, -50%);
  border: 3px solid var(--accent);
  border-radius: 22px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 28px rgba(242,189,47,.25);
  pointer-events: none;
}

.reticle span,
.reticle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  border-radius: 999px;
}

.reticle span { width: 32px; height: 2px; }
.reticle::before { width: 2px; height: 32px; }

.labels {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.float-label {
  position: absolute;
  transform: translate(-50%, -110%);
  max-width: min(80vw, 340px);
  padding: 8px 12px;
  border: 2px solid currentColor;
  border-radius: 999px;
  background: rgba(0,0,0,.76);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 34px rgba(0,0,0,.35);
}

.sheet {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 12;
  border-radius: 26px;
  padding: 12px;
  max-height: min(49dvh, 430px);
  overflow: auto;
  scrollbar-width: none;
}

.sheet::-webkit-scrollbar { display: none; }

.result-main {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.swatch {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: #000;
  border: 3px solid rgba(255,255,255,.86);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.26);
}

.name-block { min-width: 0; }

.eyebrow {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-weight: 900;
  font-size: 12px;
  line-height: 1.1;
}

.color-name {
  display: block;
  margin-top: 4px;
  font-size: clamp(23px, 7vw, 36px); line-height: .95;
  letter-spacing: -.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confidence {
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(34, 197, 94, .18);
  color: #bbf7d0;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.confidence.medium { background: rgba(245, 158, 11, .18); color: #fde68a; }
.confidence.low { background: rgba(239, 68, 68, .18); color: #fecaca; }

.family-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.family-name {
  display: block;
  margin-top: 2px;
  font-size: clamp(23px, 7vw, 36px);
  line-height: 1;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.hex-chip {
  color: #fff;
  background: rgba(255,255,255,.09);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.details summary {
  padding: 10px 0 4px;
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  list-style: none;
  cursor: pointer;
}

.details summary::-webkit-details-marker { display: none; }

.facts {
  display: grid;
  gap: 4px;
  margin: 4px 0 12px;
}

.facts div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.facts dt {
  color: var(--muted);
  font-size: 14px;
}

.facts dd {
  margin: 0;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hex-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hex-form div {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 8px;
}

.hex-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.08);
  color: #fff;
  min-height: 46px;
  padding: 0 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

button {
  border: 1px solid var(--line);
  border-radius: 18px;
  min-height: 48px;
  padding: 8px 9px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

button.primary {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: rgba(255,255,255,.24);
  color: #03120a;
}

button:disabled {
  opacity: .4;
}

button.full { width: 100%; }

.start-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 20%, rgba(242,189,47,.18), transparent 36%),
    #050814;
}

.start-screen.hidden { display: none; }

.start-card {
  width: min(100%, 430px);
  border-radius: 28px;
  padding: 20px;
}

.app-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--accent);
  color: #111827;
  font-weight: 1000;
  margin-bottom: 14px;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -.04em;
}

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

.note {
  font-size: 13px;
  color: var(--faint);
}

@media (max-width: 380px) {
  .title-pill strong { font-size: 14px; }
  .title-pill span, .mode-pill { font-size: 11px; }
  .mode-pill { display: none; }
  .sheet { left: 7px; right: 7px; padding: 10px; border-radius: 22px; }
  .result-main { grid-template-columns: 54px minmax(0, 1fr) auto; gap: 9px; }
  .swatch { width: 54px; height: 54px; border-radius: 16px; }
  .confidence { font-size: 12px; padding: 7px 8px; }
  .controls { gap: 7px; }
  button { min-height: 46px; border-radius: 16px; }
}

@media (orientation: landscape) and (max-height: 560px) {
  :root { --sample-x: 42%; --sample-y: 50%; }
  .sheet {
    left: auto;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: min(390px, 44vw);
    max-height: none;
  }
  .topbar { right: min(410px, 46vw); }
  .color-name { font-size: clamp(23px, 7vw, 36px); }
  .family-name { font-size: clamp(22px, 4vw, 32px); }
}

@media (min-width: 760px) and (orientation: portrait) {
  :root { --sample-y: 38%; }
  .sheet {
    left: 24px;
    right: 24px;
    max-height: min(42dvh, 430px);
  }
}
/* EIC minimal ColorBlind UI patch start */
#dataStatus,
#sampleStatus,
#sampleBtn,
#freezeBtn,
#labelBtn,
#torchBtn {
  display: none !important;
}

/* Hide the floating top-left title/status badge and top-right sample badge. */
.topbar,
.brand,
.statusbar,
.status-bar,
.hud-top,
.app-header,
.sample-status,
.camera-status {
  display: none !important;
}

/* Keep only Auto and Copy in the controls area. */
.controls {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 0.55rem !important;
}

#autoBtn,
#copyBtn {
  display: inline-flex !important;
}

/* Move remaining result card up slightly after removing the top badges. */
.result-card {
  margin-top: 0 !important;
}

/* EIC minimal ColorBlind UI patch end */
/* EIC PWA install UI patch start */
.install-btn {
  width: 100%;
  margin-top: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.install-btn:hover,
.install-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.install-hint {
  margin: 0.7rem 0 0;
  color: rgba(226, 232, 240, 0.82);
  font-size: 0.9rem;
  line-height: 1.35;
}

.install-hint.is-visible {
  display: block;
}
/* EIC PWA install UI patch end */

