@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Share+Tech+Mono&display=swap');

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

:root {
  --red:        #e63910;
  --red-bright: #ff5a2e;
  --red-dim:    #7a1e08;
  --red-glow:   rgba(230, 57, 16, 0.35);
  --bg:         #060606;
  --surface:    #0f0f0f;
  --border:     #1f1f1f;
  --text:       #f0ece8;
  --muted:      #5a5350;
  --mono:       'Share Tech Mono', monospace;
  --display:    'Bebas Neue', 'Impact', sans-serif;
  --radius:     4px;
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(230,57,16,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230,57,16,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

/* Scanline overlay */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  animation: flicker 8s step-end infinite;
}

@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96%           { opacity: 0.85; }
  97%           { opacity: 1; }
  98%           { opacity: 0.9; }
}

/* ── Layout ── */
.container {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Header ── */
header { text-align: center; }

.header-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--red);
  margin-bottom: 8px;
  opacity: 0.8;
}

h1 {
  font-family: var(--display);
  font-size: clamp(4rem, 14vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow:
    0 0 20px var(--red-glow),
    0 0 60px rgba(230,57,16,0.15);
}

.subtitle {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-top: 10px;
}

/* ── Corner brackets ── */
.bracket {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--red-dim);
  border-style: solid;
  transition: border-color 0.2s, width 0.2s, height 0.2s;
}
.bracket--tl { top: -1px; left: -1px;  border-width: 2px 0 0 2px; }
.bracket--tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.bracket--bl { bottom: -1px; left: -1px;  border-width: 0 0 2px 2px; }
.bracket--br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* ── Drop zone ── */
.drop-zone {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.2s, background 0.2s;
  outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--red-dim);
  background: #120a08;
}

.drop-zone:hover .bracket,
.drop-zone:focus-visible .bracket,
.drop-zone.drag-over .bracket {
  border-color: var(--red);
  width: 24px;
  height: 24px;
}

.drop-zone__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.crosshair {
  width: 56px;
  height: 56px;
  color: var(--red-dim);
  transition: color 0.2s;
  animation: crosshair-spin 12s linear infinite;
}

.drop-zone:hover .crosshair,
.drop-zone.drag-over .crosshair {
  color: var(--red);
}

@keyframes crosshair-spin {
  to { transform: rotate(360deg); }
}

.drop-zone__label {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: var(--text);
}

.drop-zone__hint {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.drop-zone__cta {
  font-size: 0.7rem;
  color: var(--red-dim);
  letter-spacing: 0.15em;
  transition: color 0.2s;
}

.drop-zone:hover .drop-zone__cta {
  color: var(--red);
}

/* ── Preview ── */
.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.preview-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.preview-img {
  max-height: 320px;
  max-width: 100%;
  display: block;
  border-radius: var(--radius);
  filter: contrast(1.05) saturate(0.9);
}

/* Scanning line on preview */
.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  box-shadow: 0 0 8px var(--red), 0 0 20px var(--red-glow);
  animation: scan 2.4s ease-in-out infinite;
  top: 0;
}

@keyframes scan {
  0%   { top: 0%;   opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.clear-btn:hover {
  color: var(--red);
  border-color: var(--red-dim);
}

/* ── Analyze button ── */
.analyze-btn {
  position: relative;
  width: 100%;
  padding: 16px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s;
}

.analyze-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0s;
}

.analyze-btn:hover { background: var(--red-bright); }
.analyze-btn:hover::before { transform: translateX(100%); transition: transform 0.5s; }
.analyze-btn:active { transform: scale(0.99); }

/* ── Loading ── */
.loading {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.hud-loading {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud-loading__bar-wrap {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.hud-loading__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red-dim), var(--red), var(--red-bright));
  box-shadow: 0 0 8px var(--red);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.hud-loading__msg {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--red);
  min-height: 1.2em;
}

.hud-loading__msg::after {
  content: '▌';
  animation: blink 0.8s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hud-loading__hint {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* ── Result ── */
.result {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  overflow: hidden;
}

.result::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(230,57,16,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.result .bracket { border-color: var(--red-dim); }

.result__header {
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.result__score-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.result__score-label {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.result__number {
  font-family: var(--display);
  font-size: clamp(5rem, 20vw, 8rem);
  line-height: 1;
  color: var(--red);
  text-shadow:
    0 0 30px var(--red-glow),
    0 0 80px rgba(230,57,16,0.2);
  transition: text-shadow 0.3s;
}

/* Color per score */
.result__number[data-score="5"] { color: #ff2200; text-shadow: 0 0 40px rgba(255,34,0,0.6), 0 0 100px rgba(255,34,0,0.2); }
.result__number[data-score="4"] { color: #ff4411; }
.result__number[data-score="3"] { color: #e06020; }
.result__number[data-score="2"] { color: #b07030; }
.result__number[data-score="1"] { color: #705040; }

/* Likeness meter */
.result__meter {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.meter-seg {
  width: 36px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s, box-shadow 0.3s, height 0.3s;
}

.meter-seg[data-seg="1"] { height: 16px; }
.meter-seg[data-seg="2"] { height: 22px; }
.meter-seg[data-seg="3"] { height: 30px; }
.meter-seg[data-seg="4"] { height: 40px; }
.meter-seg[data-seg="5"] { height: 52px; }

.meter-seg.active {
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
}

.result__message {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text);
  max-width: 380px;
  line-height: 1.5;
}

.result__data {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.data-label {
  color: var(--muted);
}

.data-value {
  color: var(--red);
}

/* ── Error ── */
.error-box {
  border: 1px solid var(--red-dim);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  background: #0d0504;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.error-icon {
  width: 36px;
  height: 36px;
  color: var(--red-dim);
}

.error-message {
  font-size: 0.82rem;
  color: #e08070;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

/* ── Secondary button ── */
.secondary-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 24px;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.secondary-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

/* ── Footer ── */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
footer a:hover { color: var(--red); }

.footer-dot { font-size: 0.4rem; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Intro animation ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

header  { animation: fadeUp 0.6s ease both; }
main    { animation: fadeUp 0.6s 0.15s ease both; }
footer  { animation: fadeUp 0.6s 0.3s ease both; }
