@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

:root {
  --ink: #1a1a2e;
  --ink-soft: #3d3d5c;
  --ink-muted: #7c7c9a;
  --paper: #fafaf7;
  --paper-warm: #f4f3ee;
  --paper-card: #ffffff;
  --accent: #e8522a;
  --accent-light: #fdf0eb;
  --accent-glow: rgba(232, 82, 42, 0.15);
  --green: #2d9e6b;
  --green-light: #edf7f3;
  --amber: #d4830a;
  --amber-light: #fef6e4;
  --border: rgba(26, 26, 46, 0.1);
  --border-strong: rgba(26, 26, 46, 0.18);
  --shadow-sm: 0 1px 3px rgba(26,26,46,0.06), 0 1px 2px rgba(26,26,46,0.04);
  --shadow-md: 0 4px 16px rgba(26,26,46,0.08), 0 2px 6px rgba(26,26,46,0.05);
  --shadow-lg: 0 12px 40px rgba(26,26,46,0.12), 0 4px 16px rgba(26,26,46,0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --max-width: 480px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  overscroll-behavior: none;
}

/* ── LAYOUT ── */
.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

/* Sidebar always hidden on mobile — JS + CSS together control tablet/desktop */
.sidebar-nav { display: none; }

.page {
  display: none;
  flex: 1;
  flex-direction: column;
  animation: fadeUp 0.35s ease both;
}

.page.active {
  display: flex;
}

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

/* ── TOP NAV ── */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-btn:hover { background: var(--paper-warm); color: var(--ink); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  white-space: nowrap;
  -webkit-appearance: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(232, 82, 42, 0.3);
}

.btn-primary:hover, .btn-primary:active {
  background: #d44420;
  box-shadow: 0 6px 20px rgba(232, 82, 42, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--paper-card);
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { background: var(--paper-warm); transform: translateY(-1px); }

.btn-ghost {
  background: none;
  color: var(--ink-soft);
  padding: 10px 16px;
}

.btn-ghost:hover { color: var(--ink); background: var(--paper-warm); }

.btn-full { width: 100%; }

.btn-lg { padding: 18px 28px; font-size: 1.05rem; border-radius: var(--radius-lg); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── CARDS ── */
.card {
  background: var(--paper-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body { padding: 20px; }
.card-body-lg { padding: 24px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-card);
  transition: all 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--ink-muted); }

/* Textareas — auto-resize via JS, min-height so never collapsed */
textarea.form-input {
  min-height: 120px;
  resize: none;
  overflow-y: hidden;
  line-height: 1.6;
}

/* ── TYPOGRAPHY ── */
h1 { font-family: var(--font-display); font-size: 2rem; font-weight: 900; line-height: 1.15; letter-spacing: -0.03em; }
h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.3; }

.text-muted { color: var(--ink-muted); font-size: 0.9rem; }
.text-small { font-size: 0.82rem; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }

/* ── SCORE RING ── */
.score-ring-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring svg { transform: rotate(-90deg); }

.score-ring-track { fill: none; stroke: var(--paper-warm); stroke-width: 8; }
.score-ring-fill  { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1.2s cubic-bezier(0.34, 1.1, 0.64, 1); }

.score-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.score-ring-num {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--ink);
}

.score-ring-denom {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ── GRADE BADGE ── */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
}

.grade-9 { background: #fff0e8; color: #c0390f; }
.grade-8 { background: #fff0e8; color: #e8522a; }
.grade-7 { background: #fef6e4; color: #c47509; }
.grade-6 { background: #fef6e4; color: #d4830a; }
.grade-5 { background: #edf7f3; color: #2d9e6b; }
.grade-4 { background: #edf7f3; color: #3dab79; }
.grade-3 { background: #f0f0f8; color: #5b5b8a; }
.grade-2 { background: #f0f0f8; color: #7c7c9a; }
.grade-1 { background: #f5f5f5; color: #aaaaaa; }

/* ── UPLOAD ZONES ── */
.upload-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--paper-warm);
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  width: 48px;
  height: 48px;
  background: var(--paper-card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: var(--shadow-sm);
  color: var(--accent);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-light);
}

.upload-zone.has-file .upload-icon { background: var(--green-light); color: var(--green); }

/* ── THUMBNAIL STRIP ── */
.thumb-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.thumb-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}

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

.thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  background: rgba(26,26,46,0.7);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
}

.thumb-add {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  border: 2px dashed var(--border-strong);
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-size: 22px;
  transition: all 0.2s;
  position: relative;
  flex-shrink: 0;
}

.thumb-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.thumb-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ── STEP INDICATOR ── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 20px 20px 0;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.3s;
}

.step-dot.done { background: var(--green); color: white; }
.step-dot.active { background: var(--accent); color: white; box-shadow: 0 0 0 4px var(--accent-glow); }
.step-dot.pending { background: var(--paper-warm); color: var(--ink-muted); border: 1.5px solid var(--border); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.step-line.done { background: var(--green); }

/* ── FEEDBACK SECTIONS ── */
.feedback-block {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.feedback-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.feedback-block-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.feedback-block.strengths { background: var(--green-light); }
.feedback-block.strengths .feedback-block-title { color: var(--green); }
.feedback-block.strengths .feedback-block-icon { background: rgba(45,158,107,0.15); }

.feedback-block.improvements { background: var(--amber-light); }
.feedback-block.improvements .feedback-block-title { color: var(--amber); }
.feedback-block.improvements .feedback-block-icon { background: rgba(212,131,10,0.15); }

.feedback-block.tips { background: var(--accent-light); }
.feedback-block.tips .feedback-block-title { color: var(--accent); }
.feedback-block.tips .feedback-block-icon { background: rgba(232,82,42,0.12); }

.feedback-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.feedback-list li {
  font-size: 0.9rem;
  line-height: 1.5;
  padding-left: 16px;
  position: relative;
  color: var(--ink-soft);
}

.feedback-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  font-weight: 700;
}

.strengths .feedback-list li::before { color: var(--green); }
.improvements .feedback-list li::before { color: var(--amber); }
.tips .feedback-list li::before { color: var(--accent); }

/* ── HISTORY LIST ── */
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.18s;
  background: var(--paper-card);
}

.history-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.history-item:last-child { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.history-item:only-child { border-radius: var(--radius); }
.history-item:hover { background: var(--paper-warm); }

.history-score {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--ink);
  min-width: 44px;
  text-align: center;
}

.history-info { flex: 1; min-width: 0; }
.history-title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-date { font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; }
.history-arrow { color: var(--ink-muted); font-size: 18px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-align: center;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ── LOADING ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(250,250,247,0.92);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: 20px;
}

.loading-overlay.active { display: flex; }

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-msg {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  max-width: 240px;
  line-height: 1.5;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(200px);
  background: var(--ink);
  color: #fff;
  padding: 12px 16px 12px 20px;
  border-radius: 40px;
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.35s ease;
  max-width: calc(100vw - 40px);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast.error { background: #c0390f; }
.toast.success { background: var(--green); }

/* Close button — only shown on error toasts */
.toast-close {
  background: rgba(255,255,255,0.25);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s;
  margin-left: auto;
}
.toast-close:hover { background: rgba(255,255,255,0.4); }

/* ── MISC UTILITIES ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  margin: 16px 0;
}

.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.pad { padding: 20px; }
.pad-lg { padding: 24px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.scroll-y { overflow-y: auto; flex: 1; }

/* ── AUTH PAGE ── */
.auth-hero {
  background: var(--ink);
  padding: 52px 28px 40px;
  position: relative;
  overflow: hidden;
}

.auth-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.12;
}

.auth-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 160px; height: 160px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.07;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  color: white;
  letter-spacing: -0.04em;
  position: relative;
  z-index: 1;
}

.auth-logo span { color: var(--accent); }

.auth-tagline {
  color: rgba(255,255,255,0.65);
  margin-top: 10px;
  font-size: 1rem;
  line-height: 1.5;
  position: relative;
  z-index: 1;
  max-width: 280px;
}

.auth-body {
  padding: 28px 24px;
  flex: 1;
}

.auth-tabs {
  display: flex;
  background: var(--paper-warm);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--paper-card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: sticky;
  bottom: 0;
  background: rgba(250, 250, 247, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: none;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav.visible { display: flex; }

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px 8px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-muted);
  transition: all 0.2s;
  position: relative;
}

.bottom-nav-item.active { color: var(--accent); }

.bottom-nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-item.active .bottom-nav-icon {
  transform: translateY(-1px);
}

/* ── MARK FAB ── */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(232, 82, 42, 0.4);
  color: white;
  font-size: 24px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 50;
}

.fab:hover { transform: scale(1.08); }
.fab.visible { display: flex; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 4px;
  opacity: 0.4;
}

/* ── SAFE AREA ── */
@supports (padding: env(safe-area-inset-top)) {
  .top-nav { padding-top: max(14px, env(safe-area-inset-top)); }
}

/* ════════════════════════════════════════════
   RESPONSIVE LAYOUT
   Mobile first — enhancements at 768px (tablet) and 1100px (desktop)
════════════════════════════════════════════ */

/* ── TABLET (768px+) ── */
@media (min-width: 768px) {
  :root {
    --max-width: none;
  }

  body {
    background: var(--paper-warm);
  }

  /* Outer wrapper becomes a centred, max-width frame */
  .app-shell {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  /* Hide mobile bottom nav, show sidebar nav instead */
  .bottom-nav { display: none !important; }
  /* sidebar-nav visibility is controlled by JS (navigateTo sets display).
     On tablet+ we override the initial inline style="display:none" in HTML
     only when the .nav-visible class is present — added by JS when authed */
  .sidebar-nav.nav-visible { display: flex !important; }

  /* Top nav gets a bit more breathing room */
  .top-nav { padding: 16px 28px; }
  .nav-logo { font-size: 1.65rem; }

  /* Page content padding */
  .pad     { padding: 24px; }
  .pad-lg  { padding: 28px; }

  /* Auth page — side-by-side hero + form */
  .auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
  }
  .auth-hero {
    padding: 52px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .auth-logo   { font-size: 4rem; }
  .auth-tagline { font-size: 1.1rem; max-width: 340px; margin-top: 14px; }
  .auth-body   { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }

  /* Stats grid wider */
  .stats-grid { gap: 14px; }
  .stat-num   { font-size: 2rem; }

  /* Submit wizard — constrain form width */
  .submit-step { max-width: 640px; }

  /* Feedback blocks on result page side-by-side */
  .feedback-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .feedback-grid .feedback-block { margin-bottom: 0; }
  .feedback-grid .feedback-block.tips {
    grid-column: 1 / -1;
  }

  /* Score ring header more spacious */
  .result-header-inner { gap: 28px; }
  .score-ring { width: 140px; height: 140px; }
  .score-ring svg { width: 140px; height: 140px; }
  .score-ring-num { font-size: 2.2rem; }

  /* History items get a hover shadow */
  .history-item { padding: 18px 24px; }
  .history-title { font-size: 0.95rem; }

  /* Buttons slightly larger */
  .btn-lg { padding: 18px 32px; font-size: 1.05rem; }

  /* Upload zones bigger */
  .upload-zone { padding: 36px 28px; }
}

/* ── DESKTOP (1100px+) ── */
@media (min-width: 1100px) {
  .app-shell {
    max-width: 1200px;
    flex-direction: row;
    align-items: stretch;
  }

  /* Sidebar navigation */
  .sidebar-nav {
    width: 220px;
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    border-right: 1px solid var(--border);
    border-top: none;
    background: var(--paper-card);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .sidebar-logo {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -0.02em;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-logo span { color: var(--accent); }

  .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-align: left;
    transition: all 0.18s;
    border-radius: 0;
    width: 100%;
  }
  .sidebar-nav-item:hover { background: var(--paper-warm); color: var(--ink); }
  .sidebar-nav-item.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
    border-right: 3px solid var(--accent);
  }
  .sidebar-nav-item svg { flex-shrink: 0; opacity: 0.7; }
  .sidebar-nav-item.active svg { opacity: 1; }

  .sidebar-mark-btn {
    margin: 16px 14px;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(232,82,42,0.3);
    transition: all 0.2s;
  }
  .sidebar-mark-btn:hover {
    background: #d44420;
    box-shadow: 0 6px 20px rgba(232,82,42,0.4);
    transform: translateY(-1px);
  }

  .sidebar-bottom {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
  }
  .sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--ink-muted);
    border-radius: 8px;
    width: 100%;
    transition: all 0.18s;
  }
  .sidebar-logout:hover { color: var(--ink); background: var(--paper-warm); }

  /* Main content area fills the rest */
  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
  }

  /* Hide top nav bar on desktop — sidebar has logo + logout */
  .top-nav { display: none !important; }

  /* Pages get more padding */
  .pad    { padding: 28px 36px; }
  .pad-lg { padding: 32px 40px; }

  /* Dashboard two-column layout */
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
  }
  .dash-col-left  { grid-column: 1; }
  .dash-col-right { grid-column: 2; }
  .dash-cta { grid-column: 1 / -1; }

  /* Submit steps wider */
  .submit-step { max-width: 680px; }

  /* Result page two-column content */
  .result-content-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
  }
  .result-score-col  { grid-column: 1; position: sticky; top: 24px; }
  .result-feedback-col { grid-column: 2; }

  /* Feedback blocks stacked in right column */
  .feedback-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .feedback-grid .feedback-block { margin-bottom: 0; }
  .feedback-grid .feedback-block.tips { grid-column: auto; }

  /* History full width */
  .history-item { padding: 18px 28px; }
}

/* ── VERY WIDE (1400px+) ── */
@media (min-width: 1400px) {
  .app-shell { max-width: 1360px; }
  .sidebar-nav { width: 250px; }
}

