:root {
  color-scheme: dark;
  --bg: #02060b;
  --bg-2: #06111c;
  --panel: rgba(7, 18, 30, 0.82);
  --panel-2: rgba(10, 25, 40, 0.72);
  --line: rgba(96, 239, 255, 0.24);
  --line-strong: rgba(96, 239, 255, 0.58);
  --text: #f3fbff;
  --muted: #8ea3b2;
  --cyan: #00eaff;
  --cyan-2: #00a8ff;
  --green: #32e58f;
  --danger: #ff5a6e;
  --shadow: 0 24px 90px rgba(0, 234, 255, 0.12);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0b1824 0%, var(--bg) 42%, #000 100%);
  color: var(--text);
  overflow-x: hidden;
}
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .55; cursor: wait; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #02060b;
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.hidden { display: none !important; }

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.app-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .42;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 234, 255, .12), transparent 32%),
    radial-gradient(circle at 80% 0%, rgba(0, 140, 255, .12), transparent 28%),
    linear-gradient(transparent 94%, rgba(0, 234, 255, .13) 95%),
    linear-gradient(90deg, transparent 94%, rgba(0, 234, 255, .08) 95%);
  background-size: auto, auto, 42px 42px, 42px 42px;
}
.grid-floor {
  position: absolute;
  left: 50%;
  bottom: -18%;
  width: min(980px, 130vw);
  height: 430px;
  transform: translateX(-50%) perspective(620px) rotateX(68deg);
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(0, 234, 255, .32) 0 1px, transparent 2px 34px),
    repeating-conic-gradient(from 0deg, rgba(0, 234, 255, .18) 0deg 1deg, transparent 1deg 12deg);
  filter: blur(.15px);
  opacity: .35;
}
.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(18px);
  opacity: .46;
}
.orb-a {
  width: 280px;
  height: 280px;
  left: -120px;
  top: 14%;
  background: rgba(0, 234, 255, .18);
}
.orb-b {
  width: 220px;
  height: 220px;
  right: -100px;
  bottom: 18%;
  background: rgba(0, 111, 255, .22);
}
.scanner-line {
  position: absolute;
  top: 25%;
  left: -30%;
  width: 160%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, .85), transparent);
  box-shadow: 0 0 24px rgba(0, 234, 255, .78);
  animation: lineDrift 6s ease-in-out infinite;
}
@keyframes lineDrift {
  0%, 100% { transform: translateY(-18px); opacity: .28; }
  50% { transform: translateY(18px); opacity: .9; }
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 28%, rgba(0, 234, 255, .14), transparent 30%), #02060b;
  transition: opacity .55s ease, visibility .55s ease;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-stage {
  position: relative;
  width: min(92vw, 520px);
  min-height: 520px;
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  transform-style: preserve-3d;
  animation: stageFloat 4.8s ease-in-out infinite;
}
@keyframes stageFloat {
  0%, 100% { transform: translateY(0) rotateX(0deg); }
  50% { transform: translateY(-8px) rotateX(2deg); }
}
.logo-halo {
  position: absolute;
  top: 70px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(0, 234, 255, .18), transparent 55%),
    conic-gradient(from 0deg, transparent, rgba(0, 234, 255, .46), transparent, rgba(0, 168, 255, .35), transparent);
  filter: blur(.2px);
  animation: haloSpin 12s linear infinite, cyanPulse 1s ease-in-out infinite;
}
.logo-halo.compact {
  inset: auto;
  width: 160px;
  height: 160px;
}
@keyframes haloSpin { to { transform: rotate(360deg); } }
@keyframes cyanPulse {
  0%, 100% { opacity: .55; box-shadow: 0 0 22px rgba(0, 234, 255, .24); }
  50% { opacity: 1; box-shadow: 0 0 54px rgba(0, 234, 255, .62); }
}
.brand-logo {
  position: relative;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(0, 234, 255, .44)) drop-shadow(0 22px 34px rgba(0, 0, 0, .64));
}
.splash-logo {
  width: min(300px, 72vw);
  max-height: 300px;
  animation: logoPulse 1s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 14px rgba(0, 234, 255, .35)); }
  50% { transform: scale(1.028); filter: drop-shadow(0 0 34px rgba(0, 234, 255, .8)); }
}
.fallback-logo { display: none; }
img.brand-logo[src=""], img.brand-logo:not([src]) { display: none; }
.css-eye-logo {
  position: relative;
  width: 176px;
  height: 176px;
  margin: 0 auto 14px;
  filter: drop-shadow(0 0 20px rgba(0, 234, 255, .45));
}
.gear-ring {
  position: absolute;
  inset: 13px;
  border-radius: 50%;
  border: 12px solid rgba(220, 232, 238, .72);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .7), 0 0 28px rgba(0, 234, 255, .45);
  background: conic-gradient(from 0deg, transparent 0 10deg, rgba(0, 234, 255, .55) 10deg 28deg, transparent 28deg 55deg);
  animation: haloSpin 9s linear infinite;
}
.gear-ring::before, .gear-ring::after {
  content: "";
  position: absolute;
  background: linear-gradient(#edf7ff, #313942);
  border-radius: 4px;
}
.gear-ring::before { width: 12px; height: 170px; left: 68px; top: -22px; }
.gear-ring::after { height: 12px; width: 170px; left: -22px; top: 68px; opacity: .42; }
.eye-shape {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 62px;
  height: 58px;
  border: 4px solid rgba(240, 250, 255, .84);
  border-radius: 90% 10% 90% 10% / 58% 42% 58% 42%;
  transform: rotate(45deg);
  background: rgba(0, 234, 255, .08);
  box-shadow: inset 0 0 22px rgba(0, 234, 255, .38), 0 0 22px rgba(0, 234, 255, .25);
}
.eye-shape i {
  position: absolute;
  width: 52px;
  height: 52px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff 0 8px, transparent 9px), radial-gradient(circle, #9fffff 0 18%, #00eaff 19% 42%, #033e59 43% 72%, #00111d 73%);
  box-shadow: 0 0 34px rgba(0, 234, 255, .8);
}
.splash-stage h1 {
  margin: 22px 0 8px;
  font-size: clamp(42px, 11vw, 82px);
  letter-spacing: .08em;
  line-height: .95;
  color: #d8e4ec;
  text-shadow: 0 1px 0 #fff, 0 16px 34px rgba(0,0,0,.85), 0 0 18px rgba(0, 234, 255, .22);
}
.splash-stage h1 span {
  display: block;
  margin-top: 9px;
  font-size: .34em;
  color: var(--cyan);
  letter-spacing: .42em;
  text-shadow: 0 0 18px rgba(0, 234, 255, .72);
}
.splash-stage p {
  margin: 18px 0 18px;
  color: var(--cyan);
  font-size: 18px;
  text-shadow: 0 0 16px rgba(0, 234, 255, .6);
}
.load-track {
  width: min(340px, 72vw);
  height: 5px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(79, 199, 255, .13);
  box-shadow: inset 0 0 0 1px rgba(0, 234, 255, .18);
}
.load-track span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--cyan), #fff, var(--cyan), transparent);
  box-shadow: 0 0 24px rgba(0, 234, 255, .9);
  animation: loadSweep 1.25s ease-in-out infinite;
}
@keyframes loadSweep {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(245%); }
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: min(100%, 530px);
  margin: 0 auto;
  padding: 18px 16px calc(96px + var(--safe-bottom));
}
.topbar, .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topbar {
  height: 58px;
  margin-bottom: 18px;
}
.top-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
.mini-logo { width: 36px; height: 36px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(145, 238, 255, .18);
  border-radius: 14px;
  color: var(--text);
  background: rgba(7, 19, 31, .52);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  cursor: pointer;
}
.icon-btn:active, .action-card:active, .main-btn:active, .secondary-btn:active, .mini-card:active { transform: scale(.985); }

.hero-card, .quick-panel, .scan-panel, .processing-panel, .result-panel, .history-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(11, 29, 45, .84), rgba(3, 10, 18, .76));
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255,255,255,.035);
  backdrop-filter: blur(18px);
}
.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  align-items: center;
  gap: 12px;
  padding: 20px;
  overflow: hidden;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(110deg, transparent 0 30%, rgba(0, 234, 255, .12) 48%, transparent 68%);
  transform: translateX(-80%);
  animation: glassSweep 5.5s ease-in-out infinite;
}
@keyframes glassSweep {
  0%, 35% { transform: translateX(-80%); opacity: 0; }
  50% { opacity: 1; }
  76%, 100% { transform: translateX(80%); opacity: 0; }
}
.hero-copy { position: relative; z-index: 1; }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero-copy h2 {
  margin: 8px 0 8px;
  font-size: clamp(25px, 7vw, 42px);
  line-height: 1.02;
}
.hero-copy p { margin: 0; color: var(--muted); line-height: 1.55; }
.hero-logo-wrap {
  min-height: 160px;
  display: grid;
  place-items: center;
  position: relative;
  perspective: 700px;
}
.hero-logo {
  width: 160px;
  height: 160px;
  animation: logoPulse 1s ease-in-out infinite, tilt3d 7s ease-in-out infinite;
}
@keyframes tilt3d {
  0%, 100% { transform: rotateY(-6deg) rotateX(2deg); }
  50% { transform: rotateY(8deg) rotateX(-3deg); }
}
.hero-fallback { width: 140px; height: 140px; margin: 0; }

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}
.action-card {
  min-height: 112px;
  border: 1px solid rgba(141, 229, 255, .16);
  border-radius: 18px;
  padding: 17px;
  text-align: left;
  color: var(--text);
  background: rgba(12, 27, 44, .76);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
.action-card.primary {
  border-color: rgba(0, 234, 255, .42);
  background: linear-gradient(135deg, rgba(0, 234, 255, .22), rgba(0, 100, 170, .28));
}
.action-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 12px;
  border-radius: 12px;
  color: var(--cyan);
  border: 1px solid rgba(0, 234, 255, .36);
  box-shadow: 0 0 18px rgba(0, 234, 255, .18);
}
.action-card strong, .action-card small { display: block; }
.action-card small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.quick-panel { padding: 16px; }
.quick-panel h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-card {
  min-height: 80px;
  border-radius: 16px;
  border: 1px solid rgba(141, 229, 255, .14);
  color: var(--text);
  background: rgba(8, 20, 33, .75);
  cursor: pointer;
}
.mini-card span { display: block; margin-bottom: 8px; color: var(--cyan); }

.scan-panel, .result-panel, .history-panel { padding: 14px; }
.panel-head { margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: .04em; }
.camera-frame {
  position: relative;
  min-height: 58vh;
  max-height: 680px;
  overflow: hidden;
  border-radius: 20px;
  background: #01070c;
  border: 1px solid rgba(0, 234, 255, .18);
  box-shadow: inset 0 0 34px rgba(0, 234, 255, .08);
}
.camera-frame video {
  width: 100%;
  height: 100%;
  min-height: 58vh;
  object-fit: cover;
  display: block;
}
.scan-corners {
  position: absolute;
  inset: 28px;
  border-radius: 16px;
  background:
    linear-gradient(var(--cyan), var(--cyan)) left top / 42px 4px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left top / 4px 42px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right top / 42px 4px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right top / 4px 42px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left bottom / 42px 4px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left bottom / 4px 42px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 42px 4px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 4px 42px no-repeat;
  filter: drop-shadow(0 0 12px rgba(0, 234, 255, .85));
}
.live-sweep {
  position: absolute;
  left: 0;
  right: 0;
  top: 22%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 234, 255, .95), transparent);
  box-shadow: 0 0 18px rgba(0, 234, 255, .85);
  animation: scanMove 2.2s ease-in-out infinite;
}
@keyframes scanMove {
  0%, 100% { transform: translateY(-80px); opacity: .2; }
  50% { transform: translateY(230px); opacity: 1; }
}
.capture-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 18px 0 3px;
}
.shutter {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 5px solid rgba(0, 234, 255, .85);
  background: radial-gradient(circle, #fff 0 45%, rgba(0, 234, 255, .15) 46% 100%);
  box-shadow: 0 0 25px rgba(0, 234, 255, .55);
  cursor: pointer;
}
.small-round {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(145, 238, 255, .2);
  color: var(--text);
  background: rgba(7, 19, 31, .8);
  cursor: pointer;
}

.processing-panel {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 24px;
  text-align: center;
}
.processing-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 216px;
  height: 216px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 23px, rgba(0,234,255,.16) 24px 25px), conic-gradient(from 0deg, rgba(0,234,255,.82), transparent, rgba(0,168,255,.72), transparent);
  animation: haloSpin 5.5s linear infinite;
}
.processing-orb::after {
  content: "";
  position: absolute;
  inset: 16px;
  border-radius: inherit;
  background: rgba(2, 8, 14, .9);
}
.processing-logo, .processing-fallback { position: relative; z-index: 1; width: 124px; height: 124px; animation: logoPulse 1s ease-in-out infinite; }
.processing-fallback { margin: 0; }
.processing-panel h2 { margin: 0 0 8px; }
.processing-panel p { margin: 0 0 18px; color: var(--muted); }
.progress {
  width: min(320px, 72vw);
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(0, 234, 255, .12);
  box-shadow: inset 0 0 0 1px rgba(0, 234, 255, .14);
}
.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-2), var(--cyan));
  box-shadow: 0 0 18px rgba(0, 234, 255, .75);
  transition: width .18s ease;
}
#progressText { margin-top: 10px; color: var(--cyan); }

.result-image-wrap {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  margin-bottom: 12px;
  border-radius: 18px;
  border: 1px solid rgba(0, 234, 255, .16);
}
.result-image-wrap img { width: 100%; display: block; object-fit: cover; }
textarea {
  width: 100%;
  min-height: 42vh;
  resize: vertical;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(141, 229, 255, .18);
  outline: none;
  color: var(--text);
  background: rgba(2, 8, 14, .7);
  line-height: 1.55;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
textarea:focus { border-color: rgba(0, 234, 255, .55); box-shadow: 0 0 0 3px rgba(0, 234, 255, .08); }
.result-actions { display: grid; gap: 10px; margin-top: 12px; }
.main-btn, .secondary-btn {
  min-height: 52px;
  border: 0;
  border-radius: 15px;
  cursor: pointer;
}
.main-btn {
  color: #00131a;
  font-weight: 900;
  background: linear-gradient(135deg, #50f8ff, #00a8ff);
  box-shadow: 0 12px 28px rgba(0, 234, 255, .25);
}
.secondary-btn {
  color: var(--text);
  border: 1px solid rgba(141, 229, 255, .16);
  background: rgba(9, 21, 34, .85);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  margin-bottom: 12px;
  border-radius: 15px;
  border: 1px solid rgba(141, 229, 255, .15);
  color: var(--muted);
  background: rgba(2, 8, 14, .62);
}
.search-box input {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
}
.history-list { display: grid; gap: 10px; }
.history-item {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(141, 229, 255, .13);
  background: rgba(9, 21, 34, .7);
}
.history-thumb {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 234, 255, .08);
}
.history-title { margin: 0 0 4px; font-weight: 800; }
.history-snippet { margin: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item button {
  border: 0;
  color: var(--cyan);
  background: transparent;
  cursor: pointer;
}
.empty-state { padding: 24px; text-align: center; color: var(--muted); }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 10;
  transform: translateX(-50%);
  width: min(100%, 530px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(2, 6, 11, .08), rgba(2, 6, 11, .94) 28%);
  backdrop-filter: blur(18px);
}
.nav-btn {
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(5, 15, 25, .62);
  cursor: pointer;
}
.nav-btn span { display: block; margin-bottom: 2px; }
.nav-btn.active {
  color: var(--cyan);
  border-color: rgba(0, 234, 255, .22);
  box-shadow: inset 0 0 18px rgba(0, 234, 255, .07);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + var(--safe-bottom));
  z-index: 30;
  max-width: min(86vw, 430px);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  border-radius: 999px;
  color: #00131a;
  font-weight: 800;
  background: linear-gradient(135deg, #8affff, #00eaff);
  box-shadow: 0 18px 42px rgba(0, 234, 255, .28);
  transition: .25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 820px) {
  .app-shell {
    width: min(1180px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 18px;
    align-content: start;
    padding-top: 28px;
  }
  .topbar, .bottom-nav { grid-column: 1 / -1; }
  .hero-card { min-height: 300px; }
  .quick-panel { margin-top: 0; }
  .scan-panel, .processing-panel, .result-panel, .history-panel { grid-column: 1 / -1; }
  .bottom-nav { position: sticky; transform: none; left: auto; width: auto; grid-column: 1 / -1; border-radius: 20px; bottom: 10px; }
}

@media (max-width: 380px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-logo-wrap { min-height: 120px; }
  .hero-logo { width: 118px; height: 118px; }
  .quick-grid { grid-template-columns: 1fr; }
}

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