/* ============================================================
   style.css — Clean Light "Bio Lab" design system
   ============================================================ */

:root {
  /* Background */
  --bg-primary: #f8fafc;     /* very light gray-blue */
  --bg-secondary: #eef2f7;
  --surface: #ffffff;        /* cards */
  --surface-soft: #f1f5f9;   /* inset chips / tracks */
  --surface-softer: #f8fafc;

  /* Accent */
  --accent-teal: #00d4b8;
  --accent-teal-ink: #0d9488; /* readable teal for text */
  --accent-cyan: #00b4d8;
  --accent-purple: #7c3aed;
  --accent-orange: #f97316;
  --accent-green: #16a34a;
  --accent-red: #ef4444;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  /* Borders / glass */
  --border: #e2e8f0;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.9);

  /* Shadows */
  --shadow-card: 0 4px 20px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 18px 50px rgba(15, 23, 42, 0.14);

  /* Layout */
  --header-h: 72px;
  --nav-h: 64px;
  --gap: 16px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-x: hidden;
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

h1, h2, h3 { font-family: "Outfit", sans-serif; margin: 0; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }

p { margin: 0; }
.small { font-size: 0.8rem; color: var(--text-secondary); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

::selection { background: rgba(0, 212, 184, 0.25); }

/* ---------- Background atmosphere ---------- */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 78% -12%, rgba(0, 212, 184, 0.08), transparent 60%),
    radial-gradient(900px 600px at 8% 112%, rgba(0, 180, 216, 0.06), transparent 60%),
    linear-gradient(160deg, #f8fafc, #eef2f7);
}

.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 6px rgba(0, 212, 184, 0.4);
  animation: drift linear infinite;
}
@keyframes drift {
  0%   { transform: translateY(0) translateX(0); }
  50%  { transform: translateY(-40px) translateX(20px); }
  100% { transform: translateY(0) translateX(0); }
}

/* ---------- Card (white + soft shadow) ---------- */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

/* ---------- Staggered page-load ---------- */
.stagger {
  opacity: 0;
  transform: translateY(14px);
  animation: stagger-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 100ms);
}
@keyframes stagger-in { to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   HEADER — white / frosted with bottom border
   ============================================================ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 22px;
  min-height: var(--header-h);
  flex-wrap: wrap;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.05);
}

.header-brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  color: var(--accent-teal-ink);
  border-radius: 12px;
  background: rgba(0, 212, 184, 0.1);
  border: 1px solid rgba(0, 212, 184, 0.25);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-text h1 {
  background: linear-gradient(90deg, var(--text-primary), var(--accent-teal-ink));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Shared header stats + pills (used by the quiz page header) */
.header-stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat-icon { width: 15px; height: 15px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 12px;
  background: var(--surface-soft); border: 1px solid var(--border);
  font-weight: 600; font-size: 0.9rem;
  transition: transform 0.2s, box-shadow 0.3s;
}

/* Shared XP track (used by the sidebar stats) */
.stat-sub { color: var(--text-secondary); font-weight: 400; }
.xp-track {
  height: 7px; border-radius: 99px;
  background: #e2e8f0;
  overflow: hidden;
}
.xp-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-orange), #fbbf24);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.45);
  transition: width 0.6s ease-out;
}

.pulse { animation: pulse 0.6s ease; }
@keyframes pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); box-shadow: 0 0 20px rgba(0, 212, 184, 0.3); }
  100% { transform: scale(1); }
}

/* ============================================================
   MAIN LAYOUT — 3 columns (desktop)
   ============================================================ */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 340px;
  gap: var(--gap);
  min-height: 0;
}

/* ---------- Left column ---------- */
.col-left {
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
}

.cell-tabs {
  display: flex; gap: 6px;
  padding: 4px; border-radius: 12px;
  background: var(--surface-soft);
}
.cell-tab {
  flex: 1; padding: 8px 6px;
  border: none; border-radius: 9px;
  background: transparent; color: var(--text-secondary);
  font-size: 0.82rem; font-weight: 600;
  transition: all 0.2s ease;
}
.cell-tab:hover { color: var(--text-primary); }
.cell-tab.active {
  background: var(--surface);
  color: var(--accent-teal-ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1), inset 0 0 0 1px rgba(0, 212, 184, 0.3);
}

.list-hint { margin: 0; }

.organelle-list {
  list-style: none; margin: 0; padding: 2px;
  display: flex; flex-direction: column; gap: 6px;
  overflow: visible; flex: 0 1 auto; min-height: 0;
  transition: opacity 0.3s;
}
.organelle-item {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 6px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 200ms ease, border-color 150ms ease,
    box-shadow 150ms ease, transform 150ms ease;
  outline: none;
}
.organelle-item .org-icon {
  width: 28px; height: 28px; flex: none;
  display: block;
  object-fit: contain;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 2px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.organelle-item:hover .org-icon,
.organelle-item:focus-visible .org-icon {
  border-color: rgba(0, 212, 184, 0.5);
}
/* subtle press feel on click */
.organelle-item:active .org-icon { transform: scale(0.95); }
.org-name { font-size: 0.82rem; font-weight: 500; flex: 1; }
.org-check {
  width: 16px; height: 16px;
  color: var(--accent-teal-ink);
  opacity: 0; transform: scale(0.5);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.org-check svg { width: 100%; height: 100%; }

.organelle-item:hover,
.organelle-item:focus-visible {
  background: var(--surface-softer);
  border-color: rgba(0, 212, 184, 0.4);
  box-shadow: 0 2px 10px rgba(0, 212, 184, 0.08);
  transform: translateX(3px);
}
.organelle-item.active {
  border-left-color: var(--accent-teal);
  background: rgba(0, 212, 184, 0.08);
  color: var(--accent-teal-ink);
  box-shadow: 0 2px 14px rgba(0, 212, 184, 0.12);
}
.organelle-item.active .org-icon {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px rgba(0, 212, 184, 0.25);
  background: rgba(0, 212, 184, 0.1);
}
.organelle-item.learned .org-check { opacity: 1; transform: scale(1); }

.thumb-wrap {
  margin-top: auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding-top: 6px;
}
.cell-thumb {
  width: 90px; height: 90px; object-fit: contain;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 6px;
  cursor: pointer;
  outline: none;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.cell-thumb:hover,
.cell-thumb:focus-visible {
  transform: scale(1.05);
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 2px rgba(0, 212, 184, 0.25), 0 0 14px rgba(0, 212, 184, 0.4);
}
.thumb-caption { text-align: center; }

/* ---------- Sidebar stats (compact badge cards) ---------- */
.sidebar-stats {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 4px;
}
.stat-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
.stat-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 7px; gap: 8px;
}
.stat-card-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-orange);
}
.stat-card-value { font-size: 0.8rem; font-weight: 700; }
.sidebar-stats .stat-icon { width: 14px; height: 14px; }

.stat-card-row { display: flex; gap: 8px; }
.stat-card.mini {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px; text-align: center;
}
.stat-card.mini .stat-icon { width: 16px; height: 16px; }
.stat-card-num { font-size: 1.05rem; font-weight: 700; line-height: 1.1; }
.stat-mini-label {
  font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-secondary);
}
.streak-card { color: var(--accent-orange); }
.learned-card { color: var(--accent-teal-ink); }

/* ---------- Center column — cell viewer (no box) ---------- */
.col-center {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; min-height: 0;
}

.cell-stage {
  position: relative;
  width: 100%; flex: 1;
  display: grid; place-items: center;
  min-height: 0;
}

.cell-glow {
  position: absolute;
  width: min(70%, 520px);
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(0, 212, 184, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* Image sits naturally on the light bg — static, with a soft depth shadow.
   Fixed-aspect box so base + every highlight layer occupy the exact same space. */
.cell-container {
  position: relative;
  width: min(82%, 560px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  opacity: 1;
  transition: opacity 300ms ease;
  filter:
    drop-shadow(0 18px 45px rgba(0, 212, 184, 0.18))
    drop-shadow(0 0 70px rgba(0, 180, 216, 0.08));
}

/* Exact overlay wrapper for the highlight layers */
.cell-layers {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

/* Every image (base + all highlight layers) shares identical placement
   so crossfades have zero positional jump. */
.cell-base, .cell-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center center;
  user-select: none;
}
/* Highlight layer switch: simple opacity crossfade */
.cell-layer {
  opacity: 0;
  will-change: opacity;
  transition: opacity 500ms ease-in-out;
}
.cell-layer.active { opacity: 1; }

/* ---- Loading state (until all cell images are preloaded) ---- */
.cell-loading {
  position: absolute; inset: 0;
  display: none;
  place-items: center;
  z-index: 2;
}
.cell-stage.is-loading .cell-loading { display: grid; }
.cell-stage.is-loading .cell-container { opacity: 0; }
.cell-spinner {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(0, 212, 184, 0.2);
  border-top-color: var(--accent-teal);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.plant-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px;
  text-align: center; color: var(--accent-green);
  padding: 24px;
}
.plant-placeholder svg { width: 64px; height: 64px; opacity: 0.55; }
.plant-placeholder p { max-width: 240px; }

.stage-hint { text-align: center; }

/* ---------- Right column — info panel ---------- */
.col-right {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.info-close {
  display: none; /* only on tablet/mobile */
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 34px; height: 34px;
  place-items: center;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-secondary);
  font-size: 1.4rem; line-height: 1;
  box-shadow: var(--shadow-card);
  transition: all 0.2s;
}
.info-close:hover { color: var(--text-primary); border-color: var(--accent-teal); }

.info-empty {
  margin: auto;
  padding: 30px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.info-empty-icon {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  color: var(--accent-teal-ink);
  border-radius: 50%;
  background: rgba(0, 212, 184, 0.08);
  border: 1px solid rgba(0, 212, 184, 0.2);
}
.info-empty-icon svg { width: 32px; height: 32px; }
.info-empty p { max-width: 220px; }

.info-panel {
  flex: 1 1 auto;
  min-height: 0;
  padding: 26px 24px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 22px;
  will-change: transform, opacity;
}

/* Info panel reveal: fade + slide up — panel first, then content (200ms later) */
.info-panel.reveal { animation: reveal-up 300ms ease-out; }
.info-panel.reveal > * { animation: reveal-up 300ms ease-out 200ms backwards; }
@keyframes reveal-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Return to base: panel slides out to the right */
.info-panel.closing { animation: slide-out-right 200ms ease forwards; }
@keyframes slide-out-right {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

.info-head { position: relative; }
.info-badge {
  display: inline-block;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, white);
  margin-bottom: 8px;
}
.info-title { font-size: 1.4rem; }
.info-latin { font-style: italic; }

.info-image-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  padding: 16px;
  min-height: 200px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.info-image {
  display: block;
  width: 100%; height: auto;
  max-height: 320px;
  object-fit: contain;
  transition: transform 150ms ease;
}
.info-image-wrap:hover .info-image { transform: scale(1.03); }

.info-desc { color: var(--text-primary); font-size: 0.9rem; }

.info-section {
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.info-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: 12px;
}
.info-section-title svg { width: 15px; height: 15px; color: var(--accent-teal-ink); }

.info-functions {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.info-functions li { position: relative; padding-left: 22px; font-size: 0.86rem; }
.info-functions li::before {
  content: "";
  position: absolute; left: 4px; top: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.fun-fact {
  display: flex; gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(124, 58, 237, 0.07);
  border: 1px solid rgba(124, 58, 237, 0.2);
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.06);
}
.fun-fact-icon { font-size: 1.4rem; line-height: 1; }
.fun-fact-label {
  display: block;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent-purple); margin-bottom: 3px;
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */
.bottom-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 8px;
  min-height: var(--nav-h);
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 12px;
  border: 1px solid transparent;
  background: transparent; color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 600;
  transition: all 0.2s ease;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn:hover {
  background: var(--surface-soft);
  color: var(--text-primary);
  border-color: var(--border);
  transform: translateY(-2px);
}
.nav-btn.active {
  background: rgba(0, 212, 184, 0.1);
  color: var(--accent-teal-ink);
  border-color: rgba(0, 212, 184, 0.3);
}

/* ============================================================
   INFO BACKDROP (tablet/mobile only)
   ============================================================ */
.info-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}

/* ============================================================
   ABOUT MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.show { opacity: 1; }
.modal {
  position: relative;
  max-width: 440px; width: 100%;
  padding: 30px;
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-pop);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal h2 { margin-bottom: 12px; }
.modal p { margin-bottom: 12px; }
.modal-close {
  position: absolute; top: 12px; right: 16px;
  width: 32px; height: 32px;
  border: none; border-radius: 8px;
  background: transparent; color: var(--text-secondary);
  font-size: 1.5rem; line-height: 1;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--surface-soft); color: var(--text-primary); }
.modal-mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: grid; place-items: center;
  color: var(--accent-teal-ink); border-radius: 14px;
  background: rgba(0, 212, 184, 0.1);
  border: 1px solid rgba(0, 212, 184, 0.25);
}
.modal-mark svg { width: 30px; height: 30px; }
.modal-tags {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 18px;
}
.modal-tags span {
  font-size: 0.72rem; font-weight: 500;
  padding: 5px 12px; border-radius: 99px;
  background: var(--surface-soft); border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ============================================================
   RESET BUTTON + CELEBRATION
   ============================================================ */
.reset-btn {
  position: fixed; left: 20px; bottom: 16px; z-index: 50;
  font-size: 0.72rem; color: var(--text-muted);
  background: transparent; border: none;
  opacity: 0.7; transition: opacity 0.2s, color 0.2s;
}
.reset-btn:hover { opacity: 1; color: var(--accent-red); }

.celebrate-banner {
  position: fixed; left: 50%; top: 24px; z-index: 200;
  transform: translate(-50%, -120%);
  padding: 14px 28px;
  font-family: "Outfit", sans-serif; font-weight: 600;
  color: var(--accent-teal-ink);
  border-color: rgba(0, 212, 184, 0.4);
  box-shadow: 0 12px 40px rgba(0, 212, 184, 0.2);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.celebrate-banner.show { transform: translate(-50%, 0); }

/* ---------- Scrollbars ---------- */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(0, 212, 184, 0.5); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* ============================================================
   DESKTOP (≥1024px): default 3-column layout (defined above)
   ============================================================ */

/* ============================================================
   TABLET (768–1023px): icon-only sidebar · 260px info panel
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-main { grid-template-columns: 84px minmax(0, 1fr) 260px; }

  /* sidebar collapses to icon-only */
  .col-left { padding: 12px 10px; }
  .cell-tabs { flex-direction: column; gap: 4px; }
  .cell-tab { font-size: 0.68rem; padding: 7px 4px; }
  .list-hint { display: none; }
  .organelle-list { gap: 8px; align-items: center; }
  .organelle-item {
    justify-content: center;
    width: 100%;
    padding: 8px;
    gap: 0;
    min-height: 44px;            /* touch target */
    border-left-width: 0;
  }
  .organelle-item:hover,
  .organelle-item:focus-visible { transform: none; }
  .organelle-item.active {
    box-shadow: inset 0 0 0 1.5px var(--accent-teal), 0 2px 14px rgba(0, 212, 184, 0.12);
  }
  .org-name, .org-check { display: none; }
  .organelle-item .org-icon { width: 36px; height: 36px; }
  .thumb-caption { display: none; }
  .cell-thumb { width: 52px; height: 52px; }
}

/* ============================================================
   MOBILE (<768px): single column · horizontal icon row ·
   full-width square cell · bottom-sheet info panel
   ============================================================ */
@media (max-width: 767px) {
  body { padding: 10px; gap: 12px; }

  .app-header { padding: 12px 16px; }

  .app-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  /* sidebar → horizontal scrollable row of icon buttons at top */
  .col-left {
    padding: 10px 12px;
    gap: 10px;
    overflow: visible;
  }
  .list-hint { display: none; }
  .organelle-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 2px 2px 6px;
    flex: 0 0 auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .organelle-item {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 68px;
    min-height: 64px;            /* touch target */
    padding: 8px 6px;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .organelle-item:hover,
  .organelle-item:focus-visible { transform: none; }
  .organelle-item.active {
    border-bottom-color: var(--accent-teal);
  }
  .organelle-item .org-icon { width: 40px; height: 40px; }
  .org-name {
    flex: none;
    font-size: 0.6rem; line-height: 1.15; text-align: center;
    max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .org-check { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; }
  .thumb-wrap { display: none; }

  /* cell viewer fills width, stays square */
  .col-center { width: 100%; gap: 10px; }
  .cell-stage { width: 100%; }
  .cell-container { width: min(82%, 360px); }

  /* bottom nav hidden — bottom sheet takes over */
  .bottom-nav { display: none; }

  /* info panel → bottom sheet (60vh, rounded top, scrollable) */
  .col-right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    width: 100%; height: 60vh;
    border-radius: 20px 20px 0 0;
    box-shadow: var(--shadow-pop);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
  }
  body.info-open .col-right { transform: translateY(0); }
  body.info-open .info-backdrop { opacity: 1; pointer-events: auto; }

  /* neutralize the staggered page-load intro for the off-screen sheet */
  .col-right.stagger { animation: none; opacity: 1; transform: translateY(100%); }
  body.info-open .col-right.stagger { transform: translateY(0); }

  /* grab handle */
  .col-right::before {
    content: "";
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 99px;
    background: var(--border); z-index: 3;
  }
  .info-close { display: grid; top: 14px; width: 44px; height: 44px; }
  .info-panel { padding-top: 30px; }

  /* ensure comfortable touch targets (min 44x44) */
  .cell-tab { min-height: 44px; }
  .nav-btn { min-height: 44px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
