:root {
  --bg: #090909;
  --panel: #111111;
  --panel-2: #151515;
  --line: #292929;
  --text: #f3f3f0;
  --muted: #949494;
  --gold: #e4b83f;
  --gold-soft: #c6a342;
  --danger: #ff6b5f;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

.app-shell {
  width: min(1500px, calc(100vw - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 22px 0 16px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 4px 18px;
}

.brand-wrap { display: flex; align-items: flex-start; gap: 24px; min-width: 0; }

.brand-line {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--gold);
  font-size: clamp(22px, 2.2vw, 34px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: .035em;
}
.brand { color: inherit; font-weight: inherit; font-size: inherit; }
.brand-home {
  text-decoration: none;
  color: var(--gold);
}
.brand-home:hover, .brand-home:focus-visible {
  color: #f2ca59;
  text-decoration: none;
  outline: none;
}
.product { color: inherit; font-weight: inherit; font-size: inherit; white-space: nowrap; }
.strapline { margin-top: 6px; color: var(--muted); font-size: 13px; letter-spacing: .01em; }

.top-actions { display: flex; align-items: center; gap: 16px; }
.compat-note {
  margin: -6px 4px 14px;
  padding: 10px 13px 11px;
  border: 1px solid #2d2a20;
  border-radius: 7px;
  background: #11100c;
  color: #b9b6ab;
  font-size: 12px;
  line-height: 1.4;
}
.compat-note strong { color: var(--gold); font-weight: 800; letter-spacing: .025em; }
.privacy { color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; }
.flag-it {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 68px;
  height: 46px;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  flex: 0 0 auto;
  margin-top: 2px;
}
.flag-it span:nth-child(1) { background: #009246; }
.flag-it span:nth-child(2) { background: #f1f2f1; }
.flag-it span:nth-child(3) { background: #ce2b37; }

.dashboard {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.86fr) minmax(330px, 1fr);
  gap: 16px;
}

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 44px rgba(0,0,0,.18);
}

.preview-panel {
  position: relative;
  overflow: hidden;
  min-height: 620px;
  display: grid;
  place-items: center;
  cursor: pointer;
  outline: none;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.028), transparent 42%),
    #0d0d0d;
}
.preview-panel:focus-visible { border-color: var(--gold); }
.preview-panel.dragging {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold), 0 16px 44px rgba(0,0,0,.18);
}

.empty-state { text-align: center; padding: 36px; user-select: none; }
.drop-mark {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border: 1px solid #3b3b3b;
  color: var(--gold);
  font-weight: 250;
  font-size: 42px;
  line-height: 1;
}
.drop-title { font-size: clamp(19px, 2vw, 29px); font-weight: 720; }
.drop-subtitle { margin-top: 8px; color: var(--muted); font-size: 14px; }
.original-file-warning {
  width: min(560px, 88%);
  margin: 22px auto 0;
  padding-top: 16px;
  border-top: 1px solid #292929;
  color: #b8b8b8;
  font-size: 12px;
  line-height: 1.45;
}

.preview-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #050505;
}
.preview-stage[hidden] { display: none; }
#previewCanvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 36px rgba(0,0,0,.42);
}
.filename-overlay {
  position: absolute;
  left: 30px;
  bottom: 26px;
  max-width: calc(100% - 60px);
  padding: 7px 10px 8px;
  border-radius: 7px;
  color: #fff;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.loading-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(8,8,8,.88);
  color: var(--muted);
  z-index: 5;
}
.loading-state[hidden] { display: none; }
.spinner {
  width: 36px; height: 36px; margin: 0 auto;
  border: 3px solid #333;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.right-column {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1.03fr) minmax(0, .97fr);
  gap: 16px;
}

.info-panel { padding: clamp(24px, 2.2vw, 34px); overflow: hidden; }
.camera-name {
  min-height: 54px;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-weight: 850;
  font-size: clamp(26px, 2.4vw, 38px);
  line-height: 1.05;
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}
.info-grid {
  display: grid;
  grid-template-columns: minmax(105px, .75fr) minmax(0, 1.55fr);
  gap: 13px 14px;
  align-items: baseline;
}
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .065em;
}
.value {
  min-width: 0;
  color: #eee;
  font-size: 15px;
  font-weight: 610;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.count-panel {
  padding: clamp(24px, 2.2vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.count-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .14em;
}
.count-total {
  margin: 10px 0 20px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: clamp(54px, 5.7vw, 92px);
  font-weight: 900;
  line-height: .96;
  letter-spacing: -.05em;
  white-space: nowrap;
}
.count-breakdown {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}
.count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 2px;
  text-align: left;
}
.count-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .09em;
}
.count-row strong {
  color: var(--text);
  font-size: clamp(22px, 2vw, 31px);
  font-variant-numeric: tabular-nums;
}
.count-note {
  min-height: 34px;
  margin-top: 15px;
  color: #777;
  font-size: 11px;
  line-height: 1.4;
}
.count-note.error { color: var(--danger); }

.footer {
  min-height: 42px;
  padding: 12px 4px 0;
  display: flex;
  align-items: center;
  color: #666;
  font-size: 11px;
}

@media (max-width: 900px) {
  .app-shell { width: min(100% - 20px, 720px); padding-top: 12px; }
  .topbar { min-height: 68px; }
  .strapline, .privacy { display: none; }
  .dashboard { grid-template-columns: 1fr; grid-template-rows: minmax(440px, 58vh) auto; }
  .preview-panel { min-height: 440px; }
  .right-column { grid-template-rows: auto auto; }
  .info-panel, .count-panel { min-height: 340px; }
  .count-total { font-size: clamp(58px, 13vw, 90px); }
}

@media (max-width: 520px) {
  .app-shell { width: calc(100% - 12px); }
  .topbar { padding-left: 4px; padding-right: 4px; }
  .brand-wrap { gap: 12px; }
  .brand-line { gap: 8px; font-size: 19px; flex-wrap: wrap; }
  .brand, .product { font-size: inherit; }
  .flag-it { width: 44px; height: 30px; }
  .dashboard { gap: 10px; }
  .right-column { gap: 10px; }
  .panel { border-radius: 14px; }
  .info-grid { grid-template-columns: 105px 1fr; }
}
