/* AI Card Grader — Standalone Styles */

/* ── Reset & Base ───────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --g-bg: #08080f;
  --g-bg2: #0f0f1a;
  --g-bg3: #16162a;
  --g-bg4: #1e1e32;
  --g-accent: #8b5cf6;
  --g-accent2: #a78bfa;
  --g-accent3: #c4b5fd;
  --g-glow: rgba(139,92,246,.25);
  --g-green: #22c55e;
  --g-yellow: #eab308;
  --g-red: #ef4444;
  --g-orange: #f97316;
  --g-t1: #f0f0ff;
  --g-t2: #a0a0c0;
  --g-t3: #50506a;
  --g-t4: #30303f;
  --g-border: rgba(139,92,246,.18);
  --g-border2: rgba(139,92,246,.08);
  --g-glass: rgba(10,10,20,.92);
  --nav-h: 60px;
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

html {
  height: 100%;
  background: var(--g-bg);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--g-bg);
  color: var(--g-t1);
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  position: relative;
}

#grader-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAV BAR ────────────────────────────── */
.nav-bar {
  height: var(--nav-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--g-glass);
  border-bottom: 1px solid var(--g-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.nav-brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--g-accent), #6d28d9);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px var(--g-glow);
  flex-shrink: 0;
}

.nav-brand-text {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  background: linear-gradient(135deg, var(--g-accent3), var(--g-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--g-t2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:active, .nav-btn:hover {
  background: var(--g-bg3);
  border-color: var(--g-border);
  color: var(--g-accent2);
}

/* ── CONTENT SCROLL AREA ────────────────── */
.grader-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-bot) + 32px);
}

/* ── CAPTURE VIEW ───────────────────────── */
.gcapture {
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* Camera frame */
.gcapture-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.gcapture-camera-wrap {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 3/4;
  border-radius: 20px;
  overflow: hidden;
  background: var(--g-bg3);
  border: 1px solid var(--g-border);
  box-shadow: 0 0 40px rgba(139,92,246,.12), 0 8px 32px rgba(0,0,0,.5);
}

.gcapture-camera-wrap.cam-unavailable::after {
  content: '📷 Camera unavailable\AUse upload instead';
  white-space: pre;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--g-t3);
  text-align: center;
  line-height: 2;
}

#gcam {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Camera frame overlay */
.gcam-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gcam-frame {
  position: relative;
  width: 70%;
  height: 84%;
}

/* Corner brackets */
.gcf {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: var(--g-accent);
  border-style: solid;
  border-width: 0;
  opacity: .85;
}

.gcf-tl { top: 0; left: 0; border-top-width: 2.5px; border-left-width: 2.5px; border-radius: 5px 0 0 0; }
.gcf-tr { top: 0; right: 0; border-top-width: 2.5px; border-right-width: 2.5px; border-radius: 0 5px 0 0; }
.gcf-bl { bottom: 0; left: 0; border-bottom-width: 2.5px; border-left-width: 2.5px; border-radius: 0 0 0 5px; }
.gcf-br { bottom: 0; right: 0; border-bottom-width: 2.5px; border-right-width: 2.5px; border-radius: 0 0 5px 0; }

.gcam-hint {
  font-size: 10px;
  color: rgba(167,139,250,.75);
  margin-top: 12px;
  font-family: 'Orbitron', monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Controls row */
.gcapture-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  width: 100%;
}

.gcam-right-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.gcam-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--g-bg3);
  border: 1px solid var(--g-border);
  color: var(--g-t2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  font-size: 13px;
}

.gcam-btn:active {
  background: rgba(139,92,246,.2);
  border-color: var(--g-accent);
  color: var(--g-accent);
  transform: scale(.92);
}

.gzoom-btn {
  font-family: 'Orbitron', monospace !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  width: 44px !important;
  height: 44px !important;
  color: var(--g-t2) !important;
}

.gzoom-btn.gzoom-active {
  background: rgba(139,92,246,.2) !important;
  border-color: var(--g-accent) !important;
  color: var(--g-accent) !important;
}

/* Shutter button */
.gshutter {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: transparent;
  border: 3px solid var(--g-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 20px var(--g-glow);
  flex-shrink: 0;
}

.gshutter:active {
  transform: scale(.88);
  box-shadow: 0 0 8px var(--g-glow);
}

.gshutter-inner {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g-accent), #6d28d9);
  transition: all .12s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.15);
}

.gshutter:active .gshutter-inner {
  transform: scale(.85);
  background: linear-gradient(135deg, #6d28d9, var(--g-accent));
}

/* Focus ring */
.gcam-focus-ring {
  position: absolute;
  width: 56px;
  height: 56px;
  border: 2px solid var(--g-accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: gfocus-pulse 0.7s ease-out forwards;
  z-index: 10;
}

@keyframes gfocus-pulse {
  0%   { opacity: 1; transform: translate(-50%,-50%) scale(1.3); }
  50%  { opacity: .7; transform: translate(-50%,-50%) scale(0.9); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(0.8); }
}

/* ── HOW TO GRADE (collapsible) ─────────── */
.gscale-ref {
  background: var(--g-bg2);
  border: 1px solid var(--g-border2);
  border-radius: 14px;
  overflow: hidden;
}

.gscale-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--g-t2);
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.gscale-summary::-webkit-details-marker { display: none; }
.gscale-summary > svg { color: var(--g-accent); flex-shrink: 0; }
.gscale-summary .gscale-chev { margin-left: auto; color: var(--g-t3); display: flex; }

.gscale-body {
  padding: 4px 16px 18px;
}

/* Photo tips */
.ge-tips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ge-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--g-t2);
  line-height: 1.5;
}

.ge-tip-icon {
  flex-shrink: 0;
  color: var(--g-accent);
  display: flex;
  align-items: center;
  margin-top: 1px;
}

/* ── CSS Card Illustrations for How-to ─── */
.gscale-illus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.gillus-card {
  background: var(--g-bg3);
  border: 1px solid var(--g-border2);
  border-radius: 10px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gillus-icon {
  position: relative;
  width: 52px;
  height: 68px;
}

/* Base card */
.gillus-icon::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #2a2a40, #1a1a28);
  border-radius: 4px;
  border: 1.5px solid rgba(139,92,246,.3);
}

/* Centering illustration */
.gillus-centering .gillus-inner {
  position: absolute;
  top: 8px; left: 14px; right: 5px; bottom: 8px;
  border: 1.5px dashed var(--g-green);
  border-radius: 2px;
}

/* Corners illustration */
.gillus-corners .corner-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--g-green);
}
.gillus-corners .corner-dot.tl { top: 3px; left: 3px; }
.gillus-corners .corner-dot.tr { top: 3px; right: 3px; }
.gillus-corners .corner-dot.bl { bottom: 3px; left: 3px; }
.gillus-corners .corner-dot.br { bottom: 3px; right: 3px; }

/* Edges illustration */
.gillus-edges .edge-line {
  position: absolute;
  background: var(--g-yellow);
  border-radius: 2px;
}
.gillus-edges .edge-line.top    { top: 2px; left: 10px; right: 10px; height: 2.5px; }
.gillus-edges .edge-line.bottom { bottom: 2px; left: 10px; right: 10px; height: 2.5px; }
.gillus-edges .edge-line.left   { top: 10px; bottom: 10px; left: 2px; width: 2.5px; }
.gillus-edges .edge-line.right  { top: 10px; bottom: 10px; right: 2px; width: 2.5px; }

/* Surface illustration */
.gillus-surface .scratch {
  position: absolute;
  height: 1.5px;
  background: var(--g-red);
  border-radius: 1px;
  transform-origin: left center;
}
.gillus-surface .scratch.s1 { top: 20px; left: 8px; width: 36px; transform: rotate(-15deg); opacity: .7; }
.gillus-surface .scratch.s2 { top: 35px; left: 12px; width: 22px; transform: rotate(8deg); opacity: .5; }
.gillus-surface .scratch.s3 { top: 48px; left: 6px; width: 28px; transform: rotate(-5deg); opacity: .6; }

.gillus-label {
  font-family: 'Orbitron', monospace;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--g-t3);
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: center;
}

/* Grade scale */
.gscale-divider {
  height: 1px;
  background: rgba(255,255,255,.05);
  margin: 12px 0;
}

.gscale-label {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--g-t3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.gscale-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.gscale-item {
  flex: 1;
  background: var(--g-bg3);
  border-radius: 8px;
  padding: 10px 8px;
  border: 1px solid rgba(255,255,255,.04);
  text-align: center;
}

.gsr {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}

.gsr-gm  { color: #4ade80; }
.gsr-nm  { color: #22c55e; }
.gsr-vg  { color: #eab308; }
.gsr-fp  { color: #f97316; }
.gsr-dam { color: #ef4444; }

.gsl {
  font-size: 11px;
  font-weight: 500;
  color: var(--g-t2);
}

/* ── RESULTS VIEW ───────────────────────── */
.gresults {
  padding: 16px 16px 32px;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

/* Hero grade card */
.gres-hero {
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.gres-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,.12), transparent 70%);
  pointer-events: none;
}

.ggrade-ring-wrap {
  position: relative;
  flex-shrink: 0;
  width: 130px;
  height: 130px;
}

.ggrade-ring-svg {
  display: block;
  width: 130px;
  height: 130px;
}

.gring-bg {
  stroke: var(--g-bg4);
}

.gring-fill {
  transition: stroke-dashoffset 1.3s cubic-bezier(.22,1,.36,1);
  filter: drop-shadow(0 0 6px currentColor);
}

.gring-green  { stroke: #22c55e; }
.gring-yellow { stroke: #eab308; }
.gring-red    { stroke: #ef4444; }

.ggrade-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', monospace;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  padding-bottom: 18px;
}

.ggrade-green  { color: #22c55e; }
.ggrade-yellow { color: #eab308; }
.ggrade-red    { color: #ef4444; }

.ggrade-label {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 8.5px;
  font-weight: 700;
  color: var(--g-t2);
  letter-spacing: .09em;
  text-transform: uppercase;
  font-family: 'Orbitron', monospace;
}

.gres-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gmeta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  background: var(--g-bg3);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.04);
}

.gmeta-key {
  font-size: 10px;
  color: var(--g-t3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.gmeta-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--g-t1);
}

.text-green { color: var(--g-green) !important; }
.text-yellow { color: var(--g-yellow) !important; }
.text-red   { color: var(--g-red) !important; }

/* Section cards */
.gres-section {
  background: var(--g-bg2);
  border: 1px solid var(--g-border2);
  border-radius: 16px;
  padding: 18px 16px;
  margin-bottom: 12px;
}

.gres-section-title {
  font-family: 'Orbitron', monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--g-t3);
  margin-bottom: 14px;
}

.gres-section-sub {
  font-size: 11px;
  color: var(--g-t3);
  margin: -10px 0 12px;
  line-height: 1.5;
}

/* ── Overlay Images ─────────────────────── */
.goverlay-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--g-bg3);
}

.goverlay-img {
  display: block;
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  object-fit: contain;
}

.gcen-ratios {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 10px;
}

.gcen-ratio-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--g-bg3);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.04);
}

.gcen-ratio-label {
  font-size: 12px;
  color: var(--g-t2);
  font-weight: 500;
}

.gcen-ratio-val {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
}

.gcen-ratio-green  { color: var(--g-green); }
.gcen-ratio-yellow { color: var(--g-yellow); }
.gcen-ratio-red    { color: var(--g-red); }

.gcen-note {
  font-size: 10px;
  color: var(--g-t3);
  text-align: center;
  line-height: 1.5;
  font-style: italic;
}

/* ── Sub-grade Bars ─────────────────────── */
.gres-subgrades {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gsb-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.gsb-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--g-t1);
}

.gsb-val {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
}

.gsb-green  { color: var(--g-green); }
.gsb-yellow { color: var(--g-yellow); }
.gsb-red    { color: var(--g-red); }

.gsb-max {
  font-size: 10px;
  font-weight: 400;
  color: var(--g-t3);
  margin-left: 1px;
}

.gsb-track {
  height: 7px;
  background: var(--g-bg4);
  border-radius: 4px;
  overflow: hidden;
}

.gsb-fill {
  height: 100%;
  border-radius: 4px;
  width: 0%;
  transition: width .8s cubic-bezier(.22,1,.36,1);
}

.gsb-fill-green  { background: linear-gradient(90deg, #16a34a, #22c55e, #4ade80); }
.gsb-fill-yellow { background: linear-gradient(90deg, #a16207, #eab308, #fde047); }
.gsb-fill-red    { background: linear-gradient(90deg, #b91c1c, #ef4444, #f87171); }

.gsb-detail {
  display: flex;
  gap: 6px;
  margin-top: 5px;
}

.gsb-detail span {
  font-size: 10px;
  color: var(--g-t3);
  font-family: 'Inter', monospace;
  background: var(--g-bg3);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ── Individual corners/edges grid ─────── */
.gres-indiv {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--g-t3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
  font-family: 'Orbitron', monospace;
}

.gi-items {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.gi-item {
  background: var(--g-bg3);
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.04);
}

.gi-name {
  font-size: 9.5px;
  color: var(--g-t3);
  margin-bottom: 4px;
  font-family: 'Orbitron', monospace;
  letter-spacing: .04em;
}

.gi-val {
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
}

.gi-green  { color: var(--g-green); }
.gi-yellow { color: var(--g-yellow); }
.gi-red    { color: var(--g-red); }

/* ── Worth Grading ──────────────────────── */
.gwz-verdict {
  border: 1px solid;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.gwz-verdict-label {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .05em;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.gwz-verdict-summary {
  font-size: 12.5px;
  color: var(--g-t2);
  line-height: 1.55;
}

.gwz-factors { margin-bottom: 14px; }

.gwz-factors-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--g-t3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
  font-family: 'Orbitron', monospace;
}

.gwz-factor {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}

.gwz-factor:last-child { border-bottom: none; }

.gwz-factor-icon { flex-shrink: 0; margin-top: 1px; display: flex; }

.gwz-factor-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--g-t1);
  margin-bottom: 2px;
}

.gwz-factor-detail {
  font-size: 11px;
  color: var(--g-t3);
  line-height: 1.5;
}

/* Grading tier cards */
.gwz-tiers-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--g-t3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
  font-family: 'Orbitron', monospace;
}

.gwz-tier-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.gwz-tier-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.gwz-tier-card {
  background: var(--g-bg3);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  transition: border-color .15s;
}

.gwz-tier-card:hover { border-color: var(--g-border); }

.gwz-tier-company {
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  font-weight: 900;
  color: var(--g-accent2);
  margin-bottom: 2px;
}

.gwz-tier-service {
  font-size: 10px;
  color: var(--g-t3);
  margin-bottom: 8px;
  font-weight: 500;
}

.gwz-tier-cost {
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--g-t1);
  margin-bottom: 6px;
}

.gwz-net-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
}

.gwz-net-positive { background: rgba(34,197,94,.15); color: var(--g-green); }
.gwz-net-neutral  { background: rgba(234,179,8,.1); color: var(--g-yellow); }
.gwz-net-negative { background: rgba(239,68,68,.1); color: var(--g-red); }

.gwz-tiers-note {
  font-size: 10px;
  color: var(--g-t3);
  margin-top: 4px;
  font-style: italic;
  line-height: 1.4;
  text-align: center;
}

/* ── Results Actions ────────────────────── */
.gres-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 0 16px;
}

.gcta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  background: rgba(139,92,246,.15);
  border: 1px solid rgba(139,92,246,.35);
  border-radius: 12px;
  color: var(--g-accent2);
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.gcta-btn:active {
  background: rgba(139,92,246,.28);
  transform: scale(.96);
}

.gcta-btn.secondary {
  background: var(--g-bg3);
  border-color: var(--g-border2);
  color: var(--g-t2);
}

.gtext-btn {
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
  color: inherit;
}

.gtext-btn:active { background: rgba(255,255,255,.05); }

/* ── HISTORY VIEW ───────────────────────── */
.ghistory {
  padding: 16px;
  max-width: 520px;
  margin: 0 auto;
}

.ghist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.ghist-title {
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--g-t1);
}

.ghist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ghist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--g-bg2);
  border: 1px solid var(--g-border2);
  border-radius: 14px;
  padding: 12px;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}

.ghist-item:active {
  background: var(--g-bg3);
  transform: scale(.99);
}

.ghist-thumb {
  width: 54px;
  height: 54px;
  border-radius: 10px;
  background: var(--g-bg3);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ghist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ghist-thumb-placeholder { color: var(--g-t3); }

.ghist-info {
  flex: 1;
  min-width: 0;
}

.ghist-grade-badge {
  display: inline-block;
  font-family: 'Orbitron', monospace;
  font-size: 13px;
  font-weight: 900;
  padding: 2px 10px;
  border-radius: 6px;
  margin-bottom: 3px;
}

.gbadge-green  { background: rgba(34,197,94,.15); color: var(--g-green); }
.gbadge-yellow { background: rgba(234,179,8,.12); color: var(--g-yellow); }
.gbadge-red    { background: rgba(239,68,68,.12); color: var(--g-red); }

.ghist-cond { font-size: 12.5px; font-weight: 600; color: var(--g-t1); }
.ghist-date { font-size: 10px; color: var(--g-t3); margin-top: 2px; }
.ghist-sub  { font-size: 10px; color: var(--g-t3); margin-top: 2px; }
.ghist-arrow { font-size: 22px; color: var(--g-t3); flex-shrink: 0; }

/* Empty state */
.ghistory-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 12px;
}

.ghist-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--g-bg2);
  border: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g-t3);
  margin-bottom: 4px;
}

.ghistory-empty h3 {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  color: var(--g-t1);
  font-weight: 700;
}

.ghistory-empty p {
  font-size: 13px;
  color: var(--g-t3);
  margin-bottom: 8px;
}

/* ── LOADING OVERLAY ────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,15,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity .25s;
}

.loading-overlay.hidden {
  display: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.loading-spinner-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.loading-ring {
  width: 72px;
  height: 72px;
  animation: loading-spin 1.2s linear infinite;
}

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

.loading-ring-bg {
  stroke: var(--g-bg4);
}

.loading-ring-arc {
  stroke: var(--g-accent);
  filter: drop-shadow(0 0 6px var(--g-accent));
}

.loading-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.loading-text {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--g-t1);
  letter-spacing: .06em;
}

.loading-sub {
  font-size: 12px;
  color: var(--g-t3);
  line-height: 1.5;
  max-width: 220px;
}

/* ── TOASTS ─────────────────────────────── */
#toast-container {
  position: fixed;
  top: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: calc(100% - 32px);
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid;
  pointer-events: auto;
}

.toast-error {
  background: rgba(239,68,68,.15);
  border-color: rgba(239,68,68,.3);
  color: #fca5a5;
}

.toast-success {
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.25);
  color: #86efac;
}

.toast-info {
  background: rgba(139,92,246,.12);
  border-color: rgba(139,92,246,.25);
  color: var(--g-accent3);
}

/* ── FOOTER ─────────────────────────────── */
.grader-footer {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--g-t3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.grader-footer a {
  color: var(--g-t3);
  text-decoration: none;
  transition: color .15s;
}

.grader-footer a:hover { color: var(--g-accent2); }

/* ── DESKTOP POLISH ─────────────────────── */
@media (min-width: 600px) {
  .gcapture { padding: 24px 24px 32px; }
  .gcapture-camera-wrap { max-width: 360px; }
  .gres-hero { padding: 28px 24px; }
  .gresults { padding: 24px 24px 40px; }
  .gwz-tier-row { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .gcapture { padding: 32px; }
}
