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

:root {
  --bg: #0d0f1a;
  --surface: #161928;
  --surface-2: #1e2235;
  --border: #2a2f4a;
  --accent: #e84040;
  --accent-2: #f5a623;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --text: #e8ecf4;
  --text-muted: #8890a8;
  --speed-bar: #4ade80;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.45);
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100dvh;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.main {
  flex: 1;
  width: min(860px, 100%);
  margin-inline: auto;
  padding: 2rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Header ─────────────────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #1a0a0a 0%, #0d0f1a 60%, #0a0d1a 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.75rem 1.25rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -20%, rgba(232,64,64,.25) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner { position: relative; }

.pokeball-icon {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--text);
  background: linear-gradient(to bottom, var(--accent) 50%, #fff 50%);
  position: relative;
  margin-bottom: .75rem;
}
.pokeball-icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--text);
}
.pokeball-icon::after {
  content: "";
  position: absolute;
  top: calc(50% - 2px);
  left: -4px;
  right: -4px;
  height: 4px;
  background: var(--text);
}

.title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}

.subtitle {
  color: var(--text-muted);
  margin-top: .3rem;
  font-size: .95rem;
}

/* ── Drop Zone ───────────────────────────────────────────────────── */
.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.drop-zone {
  width: 100%;
  max-width: 620px;
  min-height: 220px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  outline: none;
  position: relative;
  overflow: hidden;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: #1e0e0e;
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 2rem 1.5rem;
  text-align: center;
}

.upload-icon {
  width: 52px;
  height: 52px;
  color: var(--text-muted);
}
.upload-icon svg { width: 100%; height: 100%; }

.drop-label {
  font-size: 1rem;
  font-weight: 600;
}

.drop-hint {
  font-size: .85rem;
  color: var(--text-muted);
}

kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .4em;
  font-family: monospace;
  font-size: .8em;
}

/* ── Preview ─────────────────────────────────────────────────────── */
.preview-container {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem;
}

.preview-image {
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  box-shadow: var(--shadow);
}

.clear-btn {
  font-size: .85rem;
  color: var(--text-muted);
}
.clear-btn:hover { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  padding: .6em 1.4em;
  transition: all .18s;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  padding: .75em 2.5em;
  border-radius: 50px;
  box-shadow: 0 0 20px rgba(232,64,64,.4);
}
.btn-primary:hover:not(:disabled) {
  background: #c43030;
  box-shadow: 0 0 28px rgba(232,64,64,.55);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-primary.loading .btn-text { opacity: 0; }
.btn-primary.loading .spinner { display: block !important; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: .3em .8em;
}

.analyze-btn { align-self: center; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ─────────────────────────────────────────────────────── */
.results-section { display: flex; flex-direction: column; gap: 1rem; }

/* ── Controls row ────────────────────────────────────────────────── */
.controls-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-toggle {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 600;
  padding: .4em .9em;
  border-radius: 50px;
  gap: .35rem;
  transition: all .18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn-toggle:hover  { border-color: var(--accent); color: var(--text); }
.btn-toggle.active { background: rgba(99,187,91,.15); border-color: #63bb5b; color: #63bb5b; }
.btn-toggle-danger.active { background: rgba(232,64,64,.12); border-color: var(--accent); color: #f87171; }

.modifier-note {
  font-size: .8rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 6px;
  padding: .4rem .75rem;
  border-left: 3px solid var(--accent-2);
}

.results-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.01em;
}

.results-hint {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: -.5rem;
}

.pokemon-list {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

/* ── Pokemon Card ────────────────────────────────────────────────── */
.pokemon-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: grid;
  grid-template-columns: 48px 88px 1fr;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow);
  animation: fadeUp .35s ease both;
  transition: transform .18s, box-shadow .18s;
}
.pokemon-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
}

.pokemon-card:nth-child(1) { animation-delay: 0s; }
.pokemon-card:nth-child(2) { animation-delay: .07s; }
.pokemon-card:nth-child(3) { animation-delay: .14s; }
.pokemon-card:nth-child(4) { animation-delay: .21s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Rank badge */
.rank-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1rem;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 2px solid var(--border);
}
.rank-badge[data-rank="1"] { background: rgba(255,215,0,.15); border-color: var(--gold);   color: var(--gold);   }
.rank-badge[data-rank="2"] { background: rgba(192,192,192,.1); border-color: var(--silver); color: var(--silver); }
.rank-badge[data-rank="3"] { background: rgba(205,127,50,.12); border-color: var(--bronze); color: var(--bronze); }

/* Sprite */
.pokemon-sprite-wrap { position: relative; flex-shrink: 0; }

.pokemon-sprite {
  width: 88px;
  height: 88px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
}

.pokemon-sprite-placeholder {
  width: 88px;
  height: 88px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.pokemon-sprite.error ~ .pokemon-sprite-placeholder { display: flex; }
.pokemon-sprite.hidden { display: none; }

/* Info column */
.pokemon-info {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  min-width: 0;
}

.pokemon-name-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.type-badges { display: flex; gap: .3rem; flex-wrap: wrap; }
.type-badge {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #fff;
  border-radius: 4px;
  padding: .15em .5em;
  white-space: nowrap;
}

.pokemon-name {
  font-size: 1.15rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Speed row */
.speed-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.speed-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.speed-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--speed-bar);
  min-width: 2.5ch;
}

.speed-effective {
  font-size: .85rem;
  font-weight: 700;
  color: var(--accent-2);
}

.speed-bar-wrap {
  flex: 1;
  height: 7px;
  background: var(--surface-2);
  border-radius: 50px;
  overflow: hidden;
  min-width: 60px;
}

.speed-bar {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: width .5s ease;
}

/* Stat grid */
.stat-grid {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface-2);
  border-radius: 6px;
  padding: .2rem .5rem;
  min-width: 42px;
}

.stat-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.stat-val {
  font-size: .9rem;
  font-weight: 700;
}

/* Error state */
.pokemon-error {
  font-size: .8rem;
  color: var(--accent);
  margin-top: .15rem;
}

/* Trick Room active card */
.pokemon-card.trick-room { border-color: #7c5cbf; }
.pokemon-card.trick-room .rank-badge[data-rank="1"] { background: rgba(124,92,191,.15); border-color: #7c5cbf; color: #b39ddb; }

/* Per-card modifier pills */
.card-modifiers {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .15rem;
}

.card-mod-btn {
  font-size: .7rem;
  font-weight: 600;
  padding: .25em .65em;
  border-radius: 50px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all .15s;
  line-height: 1.4;
}
.card-mod-btn:hover { border-color: #63bb5b; color: #63bb5b; }
.card-mod-btn.active { background: rgba(99,187,91,.15); border-color: #63bb5b; color: #63bb5b; }
.card-mod-danger:hover { border-color: var(--accent); color: #f87171; }
.card-mod-danger.active { background: rgba(232,64,64,.12); border-color: var(--accent); color: #f87171; }

/* ── Identification badge + inline edit ───────────────────────────── */
.ident-badge {
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .45em;
  white-space: nowrap;
  flex-shrink: 0;
}

.card-edit-btn {
  margin-left: auto;
  padding: .25rem .4rem;
  opacity: .35;
  flex-shrink: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: opacity .15s;
}
.card-edit-btn:hover { opacity: 1; color: var(--text); }

.card-variant-btns {
  display: flex;
  gap: .25rem;
  align-items: center;
  flex-shrink: 0;
}

.card-variant-btn {
  font-size: .7rem;
  font-weight: 600;
  padding: .25em .65em;
  border-radius: 50px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: all .15s;
  line-height: 1.4;
}
.card-variant-btn:hover  { border-color: #a89aff; color: #a89aff; }
.card-variant-btn.active { background: rgba(124,106,255,.15); border-color: #a89aff; color: #a89aff; cursor: default; }
.card-variant-btn:disabled { opacity: .45; cursor: default; }

.card-edit-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  padding: .4rem 0 .2rem;
}

.card-edit-input {
  flex: 1;
  min-width: 130px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .3rem .6rem;
  font-size: .85rem;
  outline: none;
  transition: border-color .15s;
}
.card-edit-input:focus { border-color: var(--accent); }

.card-edit-ok {
  background: var(--accent);
  color: #fff;
  padding: .3rem .65rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
}
.card-edit-ok:disabled { opacity: .5; cursor: default; }

.card-edit-error {
  width: 100%;
  font-size: .75rem;
  color: #f87171;
  margin: 0;
}

/* ── Type Matchup Cards ───────────────────────────────────────────── */
.matchups-section { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }

.matchup-grid {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* Team label dividers */
.mup-team-label {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: .15rem 0;
  border-bottom: 1px solid var(--border);
}

/* Individual breakdown card */
.mup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

/* Card header */
.mup-header {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.mup-sprite {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}

.mup-name-wrap {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}

.mup-name {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Type rows (weak / resist / immune) */
.mup-row {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  flex-wrap: wrap;
}

.mup-row-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  padding-top: .18rem;
  min-width: 76px;
  flex-shrink: 0;
}

.mup-row-weak   .mup-row-label { color: #f87171; }
.mup-row-resist .mup-row-label { color: #63bb5b; }
.mup-row-immune .mup-row-label { color: var(--text-muted); }

.mup-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

/* Each type + multiplier pair */
.mup-type-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}

.mup-mult {
  font-size: .62rem;
  font-weight: 800;
  color: var(--text-muted);
  line-height: 1;
}
.mup-row-weak   .mup-mult { color: #f87171; }
.mup-row-resist .mup-mult { color: #63bb5b; }

/* Field advantage section */
.mup-advantage {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border-top: 1px solid var(--border);
  padding-top: .55rem;
  margin-top: .1rem;
}

.mup-advantage .mup-row-label {
  color: var(--accent-2);
  min-width: 0;
}

.mup-hits {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.mup-hit {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .35rem .6rem;
  flex-wrap: wrap;
}

.mup-hit-sprite {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
  flex-shrink: 0;
}

.mup-hit-name {
  font-size: .82rem;
  font-weight: 600;
  flex: 1;
  min-width: 60px;
}

.mup-eff-label {
  font-size: .85rem;
  font-weight: 900;
  border-radius: 6px;
  padding: .15em .45em;
}
.mup-eff-label.eff-super { background: rgba(99,187,91,.2);  color: #63bb5b; }
.mup-eff-label.eff-ultra { background: rgba(99,187,91,.35); color: #86efac; }

/* ── Error Banner ────────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  background: rgba(232,64,64,.1);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: #f87171;
  font-size: .9rem;
  max-width: 620px;
  margin-inline: auto;
  width: 100%;
}

.error-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.25rem;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}
.footer a { color: var(--text-muted); text-decoration: underline; }
.footer a:hover { color: var(--text); }

/* ── Upload actions row ──────────────────────────────────────────── */
.upload-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Camera button — outlined on desktop, becomes primary on mobile */
.btn-camera {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-camera:hover { border-color: var(--accent); color: var(--accent); }

/* Sticky bar — just centers on desktop */
.sticky-bar {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* ── Camera Modal ────────────────────────────────────────────────── */
.camera-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.camera-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}

.camera-dialog {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  animation: fadeUp .25s ease;
}

.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.camera-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.camera-close {
  font-size: 1.1rem;
  line-height: 1;
}

.camera-viewfinder {
  position: relative;
  background: #000;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Subtle corner-guide overlay */
.camera-guide {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255,255,255,.25);
  border-radius: 8px;
  pointer-events: none;
}
.camera-guide::before, .camera-guide::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(255,255,255,.7);
  border-style: solid;
}
.camera-guide::before {
  top: -2px; left: -2px;
  border-width: 3px 0 0 3px;
  border-radius: 4px 0 0 0;
}
.camera-guide::after {
  bottom: -2px; right: -2px;
  border-width: 0 3px 3px 0;
  border-radius: 0 0 4px 4px;
}

.camera-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

/* Shutter button */
.camera-shutter {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255,255,255,.4);
  box-shadow: 0 0 0 3px var(--surface-2), 0 0 0 5px rgba(255,255,255,.25);
  cursor: pointer;
  transition: transform .12s, background .12s;
  flex-shrink: 0;
}
.camera-shutter:active {
  transform: scale(.9);
  background: #d4d4d4;
}

/* ── Utilities ───────────────────────────────────────────────────── */
.hidden { display: none !important; }
.desktop-only { display: block; /* hidden at ≤640px via media query */ }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Mobile ≤ 640px ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Compact header */
  .header { padding: .9rem 1rem .85rem; }
  .pokeball-icon { width: 34px; height: 34px; margin-bottom: .45rem; }
  .pokeball-icon::before { width: 10px; height: 10px; }
  .title { font-size: 1.55rem; }
  .subtitle { font-size: .8rem; }

  /* Main: smaller padding, bottom space for sticky bar */
  .main { padding: 1rem .875rem 5.5rem; gap: 1.1rem; }

  /* Drop zone: remove all visual chrome — just a layout container */
  .drop-zone {
    border: none;
    background: transparent;
    min-height: 0;
    cursor: default;
    border-radius: 0;
  }
  .drop-zone:hover,
  .drop-zone:focus-visible,
  .drop-zone.drag-over {
    border: none;
    background: transparent;
  }

  /* Hide desktop-only decorative elements */
  .desktop-only { display: none; }

  /* Drop zone inner: full-width column */
  .drop-zone-inner { padding: 0; gap: .75rem; width: 100%; }

  /* Preview: static flow (not absolute) on mobile */
  .preview-container {
    position: static;
    padding: 0;
    width: 100%;
  }
  .preview-image { max-height: 210px; width: 100%; border-radius: var(--radius); }

  /* Upload actions: stacked, full-width */
  .upload-actions { flex-direction: column; width: 100%; gap: .75rem; }

  /* Camera = primary hero button on mobile */
  .btn-camera {
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: 0 0 28px rgba(232,64,64,.4);
    width: 100%;
    min-height: 64px;
    justify-content: center;
  }
  .btn-camera:hover { background: var(--accent); }
  .btn-camera:active { transform: scale(.97); background: #c43030; box-shadow: none; }

  /* Browse = full-width secondary */
  .btn-browse {
    width: 100%;
    min-height: 52px;
    font-size: 1rem;
    border-radius: var(--radius);
    justify-content: center;
  }

  /* Sticky analyze bar */
  .sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: .875rem 1rem;
    padding-bottom: calc(.875rem + env(safe-area-inset-bottom, 0px));
    background: rgba(13, 15, 26, .92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    z-index: 40;
  }
  .analyze-btn {
    width: 100%;
    font-size: 1.1rem;
    padding: .9em 1.5em;
    border-radius: var(--radius);
  }

  /* Results */
  .results-title { font-size: 1.2rem; }
  .results-hint  { font-size: .78rem; }
  .controls-row  { gap: .4rem; }
  .btn-toggle    { font-size: .75rem; padding: .35em .75em; }

  /* Pokemon cards */
  .pokemon-card {
    grid-template-columns: 32px 68px 1fr;
    gap: .6rem;
    padding: .8rem .875rem;
  }
  .rank-badge   { width: 28px; height: 28px; font-size: .8rem; border-width: 1.5px; }
  .pokemon-sprite { width: 68px; height: 68px; }
  .pokemon-sprite-placeholder { width: 68px; height: 68px; font-size: 1.6rem; }
  .pokemon-name  { font-size: .98rem; }
  .speed-value   { font-size: 1.1rem; }
  .stat-grid     { gap: .35rem; }
  .stat-item     { padding: .15rem .35rem; min-width: 36px; }
  .stat-val      { font-size: .8rem; }
  .stat-label    { font-size: .6rem; }

  /* Camera modal: full-screen sheet */
  .camera-modal  { padding: 0; align-items: flex-end; }
  .camera-dialog {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 96dvh;
    animation: slideUp .28s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .camera-viewfinder { aspect-ratio: unset; height: 55dvh; }
  .camera-shutter    { width: 72px; height: 72px; }
  .camera-footer {
    padding: 1.1rem 1.5rem;
    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }
  .camera-close { font-size: 1.3rem; padding: .4em .6em; }
}
