* { box-sizing: border-box; }

:root {
  --bg0: #03060c;
  --bg1: #06101c;
  --ink: #e8fbff;
  --muted: rgba(180, 230, 255, 0.7);
  --cyan: #3ad0ff;
  --cyan2: #5ef0ff;
  --mint: #7cffc4;
  --warn: #ffd36a;
  --danger: #ff6b8a;
  --glass: rgba(6, 22, 36, 0.62);
  --glass-border: rgba(58, 208, 255, 0.28);
  --glow: 0 0 18px rgba(58, 208, 255, 0.45);
  --radius: 4px;
  --font: "Orbitron", sans-serif;
  --mono: "Share Tech Mono", ui-monospace, monospace;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, rgba(20, 60, 100, 0.45), transparent 60%), var(--bg0);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

.app, .stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  background: #02050a;
  overflow: hidden;
}

/* Yüz kılavuzu ve analiz efekti aynı elips geometrisini paylaşır */
.stage {
  --oval-w: min(76vw, 376px, 39.1vh);
  --oval-h: min(101vw, 500px, 52vh);
  --oval-top: 40%;
}

.hud-grid {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(58, 208, 255, 0.15) 1px, transparent 1px),
    linear-gradient(90deg, rgba(58, 208, 255, 0.12) 1px, transparent 1px);
  background-size: 42px 42px;
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, #000 20%, transparent 75%);
  -webkit-animation: gridDrift 18s linear infinite;
  animation: gridDrift 18s linear infinite;
}

@-webkit-keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 42px, 42px 0; }
}
@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 42px, 42px 0; }
}

.hud-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 50% at 50% 45%, transparent 35%, rgba(0, 8, 16, 0.55) 100%),
    linear-gradient(180deg, rgba(0, 20, 40, 0.35), transparent 18%, transparent 78%, rgba(0, 10, 20, 0.7));
}

.hud-corners .c {
  position: absolute;
  z-index: 4;
  width: 28px;
  height: 28px;
  pointer-events: none;
  border: 2px solid rgba(58, 208, 255, 0.75);
  box-shadow: var(--glow);
}
.hud-corners .c-tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.hud-corners .c-tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.hud-corners .c-bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.hud-corners .c-br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.cam-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  background: #050a12;
}

.cam-source {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  -webkit-clip-path: inset(100%);
  clip-path: inset(100%);
}

.cam-preview,
.cam-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.cam-preview { background: #050a12; }
.cam-overlay {
  z-index: 2;
  pointer-events: none;
  background: transparent;
}

.face-frame {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  -webkit-transition: opacity 0.4s ease;
  transition: opacity 0.4s ease;
}

/* Tek geometri: karartma, çerçeve ve ilerleme halkası aynı elipsi kullanır */
.face-oval {
  position: absolute;
  left: 50%;
  top: var(--oval-top);
  width: var(--oval-w);
  height: var(--oval-h);
  margin-left: calc(var(--oval-w) / -2);
  margin-top: calc(var(--oval-h) / -2);
  border-radius: 50%;
  border: 1.5px solid rgba(150, 226, 255, 0.55);
  box-shadow:
    0 0 0 9999px rgba(2, 6, 14, 0.5),
    0 0 24px rgba(126, 231, 255, 0.14);
  overflow: hidden;
  -webkit-transition: border-color 0.35s ease, box-shadow 0.35s ease;
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.face-frame.is-ready .face-oval {
  border-color: rgba(124, 255, 196, 0.9);
  box-shadow:
    0 0 0 9999px rgba(2, 6, 14, 0.34),
    0 0 30px rgba(124, 255, 196, 0.28);
}

.face-scan-beam {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  top: 10%;
  background: linear-gradient(90deg, transparent, rgba(150, 226, 255, 0.75), transparent);
  -webkit-animation: faceBeam 3s ease-in-out infinite;
  animation: faceBeam 3s ease-in-out infinite;
}

.face-frame.is-ready .face-scan-beam {
  background: linear-gradient(90deg, transparent, rgba(124, 255, 196, 0.75), transparent);
}

@-webkit-keyframes faceBeam {
  0% { top: 6%; opacity: 0; }
  18% { opacity: 0.9; }
  82% { opacity: 0.9; }
  100% { top: 92%; opacity: 0; }
}
@keyframes faceBeam {
  0% { top: 6%; opacity: 0; }
  18% { opacity: 0.9; }
  82% { opacity: 0.9; }
  100% { top: 92%; opacity: 0; }
}

.hold-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.hold-progress {
  fill: none;
  stroke: var(--mint);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  -webkit-transition: stroke-dashoffset 0.1s linear;
  transition: stroke-dashoffset 0.1s linear;
}

.face-frame.is-off {
  opacity: 0;
  visibility: hidden;
}

.cue {
  position: absolute;
  top: var(--oval-top);
  z-index: 6;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  color: var(--cyan2);
  text-shadow: 0 0 12px rgba(58, 208, 255, 0.8);
}

.cue[hidden] { display: none !important; }
.cue-left { left: 12px; -webkit-animation: bobL 1s ease-in-out infinite; animation: bobL 1s ease-in-out infinite; }
.cue-right { right: 12px; -webkit-animation: bobR 1s ease-in-out infinite; animation: bobR 1s ease-in-out infinite; }

.cue-arrow { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.cue-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 5px 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  box-shadow: var(--glow);
}

@-webkit-keyframes bobL {
  0%, 100% { -webkit-transform: translateX(0); transform: translateX(0); }
  50% { -webkit-transform: translateX(-8px); transform: translateX(-8px); }
}
@keyframes bobL {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8px); }
}
@-webkit-keyframes bobR {
  0%, 100% { -webkit-transform: translateX(0); transform: translateX(0); }
  50% { -webkit-transform: translateX(8px); transform: translateX(8px); }
}
@keyframes bobR {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(8px); }
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: radial-gradient(circle, #9ef7ff, #3ad0ff 40%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.flash.on {
  -webkit-animation: flash 0.45s ease-out;
  animation: flash 0.45s ease-out;
}
@-webkit-keyframes flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}
@keyframes flash {
  0% { opacity: 0.85; }
  100% { opacity: 0; }
}

.scan {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 2px;
  top: 18%;
  z-index: 7;
  background: linear-gradient(90deg, transparent, var(--cyan2), transparent);
  box-shadow: 0 0 20px var(--cyan);
  pointer-events: none;
  -webkit-animation: scan 1.4s linear infinite;
  animation: scan 1.4s linear infinite;
}
.scan[hidden] { display: none !important; }
@-webkit-keyframes scan {
  0% { top: 16%; opacity: 0; }
  20% { opacity: 1; }
  100% { top: 78%; opacity: 0; }
}
@keyframes scan {
  0% { top: 16%; opacity: 0; }
  20% { opacity: 1; }
  100% { top: 78%; opacity: 0; }
}

.analyze-fx {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  background: radial-gradient(ellipse 62% 55% at 50% var(--oval-top), rgba(2, 8, 16, 0.15), rgba(2, 8, 16, 0.72) 100%);
}
.analyze-fx[hidden] { display: none !important; }

/* Tarama alanı yüz kılavuzuyla birebir aynı elips */
.analyze-scope {
  position: absolute;
  left: 50%;
  top: var(--oval-top);
  width: var(--oval-w);
  height: var(--oval-h);
  margin-left: calc(var(--oval-w) / -2);
  margin-top: calc(var(--oval-h) / -2);
  border-radius: 50%;
  overflow: hidden;
}

.analyze-mesh {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(rgba(150, 226, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 226, 255, 0.28) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 35%, transparent 100%);
}

.analyze-sweep {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 34%;
  top: -34%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(124, 255, 196, 0.06) 55%,
    rgba(124, 255, 196, 0.22) 92%,
    rgba(180, 255, 224, 0.95) 100%
  );
  -webkit-animation: analyzeSweep 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation: analyzeSweep 2.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.analyze-sweep::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(190, 255, 230, 0.98) 20%, rgba(190, 255, 230, 0.98) 80%, transparent);
  box-shadow: 0 0 18px rgba(124, 255, 196, 0.85);
}

.analyze-edge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 255, 196, 0.75);
  box-shadow: inset 0 0 30px rgba(124, 255, 196, 0.18);
  -webkit-animation: analyzeEdge 2.6s ease-in-out infinite;
  animation: analyzeEdge 2.6s ease-in-out infinite;
}

@-webkit-keyframes analyzeSweep {
  0% { top: -34%; }
  100% { top: 100%; }
}
@keyframes analyzeSweep {
  0% { top: -34%; }
  100% { top: 100%; }
}

@-webkit-keyframes analyzeEdge {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
@keyframes analyzeEdge {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.analyze-hud {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--oval-top) + var(--oval-h) / 2 + 26px);
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-align-items: center;
  align-items: center;
  gap: 12px;
}

.analyze-ticker {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d7f7ff;
  text-shadow: 0 0 14px rgba(94, 240, 255, 0.55);
}

.analyze-bar {
  width: min(58vw, 260px);
  height: 2px;
  border-radius: 2px;
  background: rgba(150, 226, 255, 0.18);
  overflow: hidden;
}

.analyze-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan2), var(--mint));
  box-shadow: 0 0 12px rgba(124, 255, 196, 0.7);
  -webkit-animation: analyzeFill 16s cubic-bezier(0.12, 0.75, 0.2, 1) forwards;
  animation: analyzeFill 16s cubic-bezier(0.12, 0.75, 0.2, 1) forwards;
}

@-webkit-keyframes analyzeFill {
  0% { width: 0; }
  100% { width: 94%; }
}
@keyframes analyzeFill {
  0% { width: 0; }
  100% { width: 94%; }
}

.top, .center-copy, .bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 9;
  padding-left: 18px;
  padding-right: 18px;
}

.top {
  top: 0;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.brand-row {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--cyan2);
  text-shadow: 0 0 10px rgba(58, 208, 255, 0.6);
}

.brand-mark {
  color: var(--mint);
  -webkit-animation: spin 8s linear infinite;
  animation: spin 8s linear infinite;
  display: inline-block;
}

.brand-name {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
}

.progress { text-align: center; }

.progress-track {
  display: -webkit-flex;
  display: flex;
  gap: 6px;
  -webkit-justify-content: center;
  justify-content: center;
  max-width: 200px;
  margin: 0 auto;
}

.progress-seg {
  -webkit-flex: 1;
  flex: 1;
  height: 3px;
  background: rgba(58, 208, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(58, 208, 255, 0.15);
  -webkit-transition: background 0.25s ease, box-shadow 0.25s ease;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.progress-seg.is-active {
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(58, 208, 255, 0.7);
}
.progress-seg.is-done {
  background: var(--mint);
  box-shadow: 0 0 10px rgba(124, 255, 196, 0.55);
}

.progress-label {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.light-meter {
  margin: 8px auto 0;
  width: -webkit-fit-content;
  width: fit-content;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  box-shadow: var(--glow);
}

.light-meter[hidden] { display: none !important; }

.light-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px rgba(255, 211, 106, 0.7);
}

.light-meter.is-ok .light-dot {
  background: var(--mint);
  box-shadow: 0 0 10px rgba(124, 255, 196, 0.8);
}
.light-meter.is-bad .light-dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(255, 107, 138, 0.7);
}

.thumbs {
  display: -webkit-flex;
  display: flex;
  gap: 8px;
  -webkit-justify-content: center;
  justify-content: center;
  margin-top: 8px;
}

.mode-live .thumbs,
.mode-idle .thumbs,
.mode-busy .thumbs { display: none; }

.thumbs img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glow);
}

.thumbs img[hidden] { display: none !important; }

.model-badge {
  margin: 8px auto 0;
  width: -webkit-fit-content;
  width: fit-content;
  padding: 5px 12px;
  border: 1px solid rgba(255, 211, 106, 0.35);
  background: rgba(40, 30, 8, 0.65);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--warn);
  box-shadow: 0 0 12px rgba(255, 211, 106, 0.25);
}

.model-badge[hidden] { display: none !important; }

.mode-live .face-frame,
.mode-live .center-copy .hint,
.mode-idle .face-frame,
.mode-busy .face-frame,
.mode-busy .center-copy,
.mode-busy .bottom {
  opacity: 0;
  visibility: hidden;
}

.mode-live .center-copy {
  top: auto;
  bottom: 28%;
  -webkit-transform: none;
  transform: none;
}

.mode-live .headline {
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  opacity: 0.9;
}

/* Kılavuz metni her zaman ovalin hemen altında durur */
.center-copy {
  top: calc(var(--oval-top) + var(--oval-h) / 2 + 26px);
  bottom: auto;
  text-align: center;
  pointer-events: none;
  -webkit-transform: none;
  transform: none;
}

.headline {
  margin: 0;
  font-size: clamp(0.95rem, 3.2vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: none;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.75);
}

.headline.pop {
  -webkit-animation: popIn 0.35s ease;
  animation: popIn 0.35s ease;
}

@-webkit-keyframes popIn {
  from { opacity: 0; -webkit-transform: translateY(8px) skewX(-4deg); transform: translateY(8px) skewX(-4deg); }
  to { opacity: 1; -webkit-transform: translateY(0) skewX(0); transform: translateY(0) skewX(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) skewX(-4deg); }
  to { opacity: 1; transform: translateY(0) skewX(0); }
}

.hint {
  margin: 10px 0 0;
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: var(--warn);
  text-shadow: 0 0 10px rgba(255, 211, 106, 0.35);
}

.hint.ok {
  color: var(--mint);
  text-shadow: 0 0 10px rgba(124, 255, 196, 0.45);
}

.bottom {
  bottom: 0;
  z-index: 16;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(0deg, rgba(2, 8, 16, 0.92), transparent);
  text-align: center;
}

.status {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.actions {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  gap: 16px;
  min-height: 78px;
}

.btn-ghost,
.btn-primary {
  min-width: 100px;
  height: 44px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--cyan2);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: var(--glow);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(58, 208, 255, 0.35), rgba(20, 80, 110, 0.55));
  color: var(--ink);
  min-width: 126px;
  border-color: rgba(124, 255, 196, 0.45);
}

.btn-primary.is-pulse {
  -webkit-animation: pulseGo 1.2s ease-in-out infinite;
  animation: pulseGo 1.2s ease-in-out infinite;
}

@-webkit-keyframes pulseGo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(58, 208, 255, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(58, 208, 255, 0); }
}
@keyframes pulseGo {
  0%, 100% { box-shadow: 0 0 0 0 rgba(58, 208, 255, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(58, 208, 255, 0); }
}

.btn-ghost:disabled,
.btn-primary:disabled,
.shutter:disabled,
.link-btn:disabled { opacity: 0.35; }

.btn-ghost[hidden],
.btn-primary[hidden],
.shutter[hidden],
.link-btn[hidden],
.layers[hidden],
.sheet[hidden],
.toast[hidden],
.scan[hidden] {
  display: none !important;
}

.mode-live .actions { display: none; }

.shutter {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.shutter-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cyan2);
  box-shadow: var(--glow), inset 0 0 18px rgba(58, 208, 255, 0.2);
  -webkit-animation: shutterSpin 6s linear infinite;
  animation: shutterSpin 6s linear infinite;
}

@-webkit-keyframes shutterSpin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes shutterSpin {
  to { transform: rotate(360deg); }
}

.shutter-core {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9ef7ff, #1a7aaa 55%, #062030);
  box-shadow: 0 0 16px rgba(58, 208, 255, 0.55);
}

.shutter-label {
  position: absolute;
  inset: 0;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--ink);
  text-shadow: 0 0 10px rgba(58, 208, 255, 0.8);
}

.shutter:active .shutter-core {
  -webkit-transform: scale(0.92);
  transform: scale(0.92);
}

.actions-sub {
  margin-top: 10px;
  display: -webkit-flex;
  display: flex;
  gap: 18px;
  -webkit-justify-content: center;
  justify-content: center;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  cursor: pointer;
}
.link-btn:hover { color: var(--cyan2); }

.layers {
  margin-top: 12px;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 6px;
  -webkit-justify-content: center;
  justify-content: center;
}

.layers label {
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.layers label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  pointer-events: auto;
  accent-color: var(--cyan);
  cursor: pointer;
}

.layers .opacity {
  pointer-events: auto;
}

.layers .opacity input[type="range"] {
  width: 84px;
  vertical-align: middle;
  pointer-events: auto;
}

.sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 168px;
  z-index: 14;
  max-height: 40%;
  overflow: auto;
  padding: 16px;
  background: rgba(4, 14, 24, 0.94);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glow);
  -webkit-animation: up 0.35s ease;
  animation: up 0.35s ease;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

@-webkit-keyframes up {
  from { -webkit-transform: translateY(20px); transform: translateY(20px); opacity: 0; }
  to { -webkit-transform: translateY(0); transform: translateY(0); opacity: 1; }
}
@keyframes up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 40px;
  height: 3px;
  margin: 0 auto 10px;
  background: rgba(58, 208, 255, 0.4);
}

.sheet-close {
  position: absolute;
  right: 12px;
  top: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--cyan2);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  cursor: pointer;
}

.sheet h2 {
  margin: 10px 0;
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  color: var(--cyan2);
}

.kv {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.kv li {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(58, 208, 255, 0.12);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.sides {
  display: -webkit-flex;
  display: flex;
  gap: 8px;
}

.sides-three figure,
.sides figure {
  margin: 0;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}

.sides figcaption {
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.sides canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #02060c;
  border: 1px solid var(--glass-border);
}

.toast {
  display: none !important;
}

.bottom.has-fail .status,
.bottom.has-fail .actions,
.bottom.has-fail .actions-sub,
.bottom.has-fail .layers {
  display: none !important;
}

.fail-dock {
  position: relative;
  margin: 0 auto;
  max-width: 420px;
  overflow: hidden;
  padding: 18px 18px 16px;
  text-align: center;
  background: rgba(16, 8, 12, 0.88);
  border: 1px solid rgba(255, 176, 120, 0.42);
  box-shadow: 0 0 28px rgba(255, 120, 90, 0.18);
  -webkit-transform: translateY(18px);
  transform: translateY(18px);
  opacity: 0;
}

.fail-dock[hidden] { display: none !important; }

.fail-dock.is-in {
  -webkit-animation: failRise 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation: failRise 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@-webkit-keyframes failRise {
  to { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}
@keyframes failRise {
  to { opacity: 1; transform: translateY(0); }
}

.fail-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  top: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 196, 140, 0.95), transparent);
  box-shadow: 0 0 14px rgba(255, 176, 120, 0.7);
  -webkit-animation: failSweep 2.2s ease-in-out infinite;
  animation: failSweep 2.2s ease-in-out infinite;
}

@-webkit-keyframes failSweep {
  0% { top: 0; opacity: 0; }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes failSweep {
  0% { top: 0; opacity: 0; }
  18% { opacity: 1; }
  82% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.fail-kicker {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffc48a;
}

.fail-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff4ea;
}

.fail-copy {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(255, 226, 206, 0.82);
}

.fail-btn {
  width: 100%;
  height: 48px;
  border: 1px solid rgba(124, 255, 196, 0.55);
  background: linear-gradient(180deg, rgba(124, 255, 196, 0.28), rgba(20, 80, 70, 0.55));
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(124, 255, 196, 0.28);
  -webkit-animation: failPulse 1.6s ease-in-out infinite;
  animation: failPulse 1.6s ease-in-out infinite;
}

@-webkit-keyframes failPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 255, 196, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(124, 255, 196, 0); }
}
@keyframes failPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 255, 196, 0.35); }
  50% { box-shadow: 0 0 0 10px rgba(124, 255, 196, 0); }
}
