/* ================================================
   SSW LEARNING CENTER — DESIGN SYSTEM
   Rawliet.ID · 2026
   ================================================ */

/* ------------------------------------------------
   DESIGN TOKENS
   ------------------------------------------------ */
:root {
  /* Core palette */
  --bg-base:       #0A0C12;
  --bg-surface:    #13161F;
  --bg-card:       #161B28;
  --bg-elevated:   #1C2235;

  /* Accent colors */
  --blue:          #5B8CFF;
  --blue-dim:      rgba(91, 140, 255, 0.12);
  --blue-border:   rgba(91, 140, 255, 0.25);
  --orange:        #FF6B35;
  --orange-dim:    rgba(255, 107, 53, 0.12);
  --orange-border: rgba(255, 107, 53, 0.25);
  --green:         #34D399;
  --green-dim:     rgba(52, 211, 153, 0.12);
  --green-border:  rgba(52, 211, 153, 0.25);

  /* Typography */
  --text-1:  #EFF2FF;
  --text-2:  #A0AACC;
  --text-3:  #5A6380;

  /* Glass / borders */
  --border:        rgba(255, 255, 255, 0.07);
  --border-hover:  rgba(255, 255, 255, 0.14);
  --glass-bg:      rgba(255, 255, 255, 0.03);
  --glass-border:  rgba(255, 255, 255, 0.08);

  /* Fonts */
  --font-display: 'Sora', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Spacing & layout */
  --nav-h:      70px;
  --px:         20px;
  --radius-sm:  10px;
  --radius-md:  16px;
  --radius-lg:  22px;
  --radius-xl:  30px;
  --radius-full: 9999px;
}


/* ------------------------------------------------
   RESET & BASE
   ------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-1);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

ul { list-style: none; }

::-webkit-scrollbar { width: 0; }


/* ------------------------------------------------
   AMBIENT BACKGROUND (signature atmosphere)
   ------------------------------------------------ */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
}

.orb-1 {
  width: 420px; height: 420px;
  background: var(--blue);
  opacity: 0.09;
  top: -140px; right: -100px;
  animation: orbDrift 10s ease-in-out infinite;
}

.orb-2 {
  width: 320px; height: 320px;
  background: var(--orange);
  opacity: 0.07;
  bottom: 180px; left: -80px;
  animation: orbDrift 13s ease-in-out infinite reverse;
}

.orb-3 {
  width: 260px; height: 260px;
  background: #A78BFA;
  opacity: 0.06;
  top: 45%; right: -70px;
  animation: orbDrift 16s ease-in-out infinite 3s;
}

@keyframes orbDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(24px, -32px) scale(1.06); }
  66%       { transform: translate(-18px, 22px) scale(0.94); }
}


/* ------------------------------------------------
   APP SHELL & VIEWS
   ------------------------------------------------ */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
}

.view {
  display: none;
  flex-direction: column;
  min-height: calc(100dvh - var(--nav-h));
  padding-bottom: calc(var(--nav-h) + 24px);
  animation: viewIn 0.28s ease;
}

.view.active { display: flex; }

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


/* ------------------------------------------------
   HOME HEADER
   ------------------------------------------------ */
.home-header {
  padding: 52px var(--px) 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.brand-flag { font-size: 13px; }

.home-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-1);
  /* Subtle blue gradient on the title */
  background: linear-gradient(160deg, #fff 30%, var(--blue) 120%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-subtitle {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.55;
  margin-top: -4px;
}

.home-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 12px;
  color: var(--green);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.status-dot.pulse {
  animation: dotPulse 2.2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45); }
  50%       { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}


/* ------------------------------------------------
   SECTOR GRID
   ------------------------------------------------ */
.sector-grid-section {
  padding: 0 var(--px);
}

.sector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Sector Card ── */
.sector-card {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px 16px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 158px;
  transition:
    transform   0.22s ease,
    border-color 0.22s ease,
    box-shadow  0.22s ease;
}

.sector-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}

.sector-card:active {
  transform: scale(0.96);
  transition-duration: 0.1s;
}

/* Hover glow using sector color */
.sector-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    ellipse at 75% 85%,
    var(--sector-color, var(--blue)),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sector-card:hover::after { opacity: 0.08; }

/* ── SIGNATURE ELEMENT: kanji watermark ── */
/* Each card shows its sector's kanji character barely visible behind content.
   On hover it breathes slightly — culturally grounded, visually distinctive. */
.card-kanji {
  position: absolute;
  bottom: -8px;
  right: -2px;
  font-size: 90px;
  font-weight: 900;
  color: var(--sector-color, var(--blue));
  opacity: 0.07;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  /* Use a serif font for authentic kanji feel */
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', serif;
}

.sector-card:hover .card-kanji {
  opacity: 0.13;
  transform: scale(1.06) translateY(-4px);
}

/* Card content layout */
.card-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-emoji {
  font-size: 28px;
  line-height: 1;
  display: block;
}

.card-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.card-subtitle {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.35;
  margin-top: 2px;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.card-jp {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.05em;
}

.card-arrow {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.sector-card:hover .card-arrow {
  background: rgba(91, 140, 255, 0.2);
  transform: translateX(2px);
}

.card-arrow svg {
  width: 12px; height: 12px;
  stroke: var(--blue);
}


/* ------------------------------------------------
   QUICK STATS BAR
   ------------------------------------------------ */
.quick-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 20px var(--px) 4px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  margin: 20px var(--px) 0;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 12px 0;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}


/* ------------------------------------------------
   SHARED PAGE HEADER
   ------------------------------------------------ */
.page-header {
  padding: 50px var(--px) 24px;
}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--blue);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.1;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
}


/* ------------------------------------------------
   SECTOR DETAIL
   ------------------------------------------------ */
.detail-hero {
  position: relative;
  padding: 48px var(--px) 24px;
  overflow: hidden;
}

/* Gradient bleed from sector color */
.detail-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 80% 0%,
    var(--sector-color, var(--blue)),
    transparent 60%
  );
  opacity: 0.11;
  pointer-events: none;
}

/* Large kanji on detail hero — more visible */
.detail-kanji {
  position: absolute;
  top: 10px;
  right: -12px;
  font-size: 150px;
  font-weight: 900;
  color: var(--sector-color, var(--blue));
  opacity: 0.065;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', serif;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  padding: 6px 0;
  margin-bottom: 18px;
  transition: color 0.2s;
  position: relative;
}

.detail-back:hover { color: var(--text-1); }

.detail-back svg {
  width: 14px; height: 14px;
}

.detail-emoji {
  font-size: 42px;
  display: block;
  margin-bottom: 12px;
  position: relative;
}

.detail-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin-bottom: 5px;
  position: relative;
}

.detail-subtitle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  position: relative;
}

.detail-jp {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.detail-dot-sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-3);
}

.detail-en {
  font-size: 12px;
  color: var(--text-3);
}

.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--orange-dim);
  border: 1px solid var(--orange-border);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 11px;
  color: var(--orange);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  position: relative;
}

/* Detail body */
.detail-body {
  padding: 0 var(--px) 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-desc {
  font-size: 14px;
  line-height: 1.72;
  color: var(--text-2);
}

/* Progress card */
.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.progress-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.progress-step {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 14px;
}

.progress-track {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--sector-color, var(--blue)) 0%, var(--blue) 100%);
  width: 0%;
  transition: width 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sector-color, var(--blue));
  font-weight: 500;
}

.progress-note {
  font-size: 11px;
  color: var(--text-3);
}

/* Info grid */
.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.info-card-icon {
  font-size: 20px;
  display: block;
  margin-bottom: 8px;
}

.info-card-heading {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.info-card-list { display: flex; flex-direction: column; gap: 6px; }

.info-card-list li {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
  display: flex;
  gap: 7px;
  align-items: flex-start;
}

.info-card-list li::before {
  content: '▸';
  color: var(--sector-color, var(--blue));
  font-size: 9px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Coming soon list */
.cs-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.cs-card-heading {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 14px;
}

.cs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.cs-item:first-of-type { padding-top: 0; }
.cs-item:last-of-type  { border-bottom: none; padding-bottom: 0; }

.cs-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cs-item-icon { font-size: 17px; }

.cs-item-name {
  font-size: 13px;
  color: var(--text-2);
}

.cs-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--orange);
  border: 1px solid var(--orange-border);
  border-radius: 5px;
  padding: 3px 8px;
  text-transform: uppercase;
  flex-shrink: 0;
}


/* ------------------------------------------------
   ROADMAP
   ------------------------------------------------ */
.roadmap-wrap {
  padding: 0 var(--px);
}

.roadmap-phases {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Vertical connector line */
.roadmap-phases::before {
  content: '';
  position: absolute;
  left: 23px;
  top: 28px;
  bottom: 28px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--green),
    var(--blue) 40%,
    var(--bg-elevated)
  );
  border-radius: 2px;
}

.phase-item {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 28px;
  position: relative;
}

.phase-item:last-child { padding-bottom: 0; }

/* Phase dot */
.phase-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
}

.phase-dot.done {
  background: var(--green-dim);
  border-color: var(--green);
}

.phase-dot.active {
  background: var(--blue-dim);
  border-color: var(--blue);
  animation: phasePulse 2.5s ease-in-out infinite;
}

.phase-dot.upcoming {
  background: var(--bg-elevated);
  border-color: var(--border);
}

@keyframes phasePulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(91, 140, 255, 0.35); }
  50%       { box-shadow: 0 0 0 10px rgba(91, 140, 255, 0); }
}

/* Phase content */
.phase-content { flex: 1; padding-top: 6px; }

.phase-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 3px;
}

.phase-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 5px;
}

.phase-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 8px;
}

.phase-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 5px;
}

.phase-tag.done     { background: var(--green-dim);  color: var(--green);  }
.phase-tag.active   { background: var(--blue-dim);   color: var(--blue);   }
.phase-tag.upcoming { background: var(--bg-elevated); color: var(--text-3); }


/* ------------------------------------------------
   FEATURES GRID
   ------------------------------------------------ */
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 var(--px);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

/* Top accent line per card, using nth-child variety */
.feature-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue), transparent);
}

.feature-card:nth-child(2)::before { background: linear-gradient(90deg, var(--orange), transparent); }
.feature-card:nth-child(3)::before { background: linear-gradient(90deg, #A78BFA, transparent); }
.feature-card:nth-child(4)::before { background: linear-gradient(90deg, var(--green), transparent); }
.feature-card:nth-child(5)::before { background: linear-gradient(90deg, #F59E0B, transparent); }
.feature-card:nth-child(6)::before { background: linear-gradient(90deg, #22D3EE, transparent); }

.feature-emoji { font-size: 28px; }

.feature-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
}

.feature-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.55;
  flex: 1;
}

.feature-cs-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  color: var(--orange);
  border: 1px solid var(--orange-border);
  border-radius: 5px;
  padding: 3px 8px;
  align-self: flex-start;
  text-transform: uppercase;
}

/* Features footer */
.features-footer {
  padding: 16px var(--px) 0;
}

.features-footer-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ff-icon { font-size: 22px; flex-shrink: 0; margin-top: 2px; }

.ff-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}


/* ------------------------------------------------
   ABOUT
   ------------------------------------------------ */
.about-content {
  padding: 0 var(--px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Hero card with large kanji background text */
.about-card--hero .about-kanji {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 44px;
  font-weight: 900;
  color: var(--blue);
  opacity: 0.1;
  pointer-events: none;
  user-select: none;
  font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', serif;
  letter-spacing: 0.05em;
}

.about-icon { font-size: 26px; margin-bottom: 12px; }

.about-card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 8px;
}

.about-card-text {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.72;
}

/* Sector chips preview */
.about-sectors-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.asp-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.asp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.asp-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-2);
}

/* Dev card */
.about-card--dev {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.dev-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.dev-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dev-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
}

.dev-role {
  font-size: 12px;
  color: var(--text-3);
}


/* ------------------------------------------------
   BOTTOM NAVIGATION
   ------------------------------------------------ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: rgba(10, 12, 18, 0.88);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  color: var(--text-3);
  transition: color 0.2s, background 0.2s;
}

.nav-item span {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.nav-icon {
  width: 20px; height: 20px;
  stroke: currentColor;
  fill: none;
  transition: stroke 0.2s;
}

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

/* Active indicator: small pill under the icon stack */
.nav-item.active::after {
  /* We use color shift instead of a dot to keep it clean */
  content: none;
}


/* ------------------------------------------------
   RESPONSIVE — LARGER SCREENS
   ------------------------------------------------ */
@media (min-width: 480px) {
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .bottom-nav { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

@media (min-width: 640px) {
  .sector-grid { grid-template-columns: repeat(3, 1fr); }
  .features-grid { grid-template-columns: repeat(3, 1fr); }
}


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


/* ================================================
   PM MODULES VIEW
   ================================================ */

.pm-modules-header {
  padding: 24px var(--px) 20px;
  position: relative;
}

.pm-modules-header .detail-back {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s;
}
.pm-modules-header .detail-back svg {
  width: 16px; height: 16px;
}
.pm-modules-header .detail-back:hover { color: var(--text-1); }

.pm-modules-grid {
  padding: 0 var(--px) calc(var(--nav-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pm-module-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-body);
  color: var(--text-1);
}

.pm-module-card--active {
  border-color: var(--orange-border);
  background: linear-gradient(135deg, var(--bg-card), rgba(255, 107, 53, 0.06));
}
.pm-module-card--active:hover {
  background: linear-gradient(135deg, var(--bg-elevated), rgba(255, 107, 53, 0.1));
  border-color: rgba(255, 107, 53, 0.45);
  transform: translateY(-1px);
}
.pm-module-card--active:active { transform: translateY(0); }

.pm-module-card--placeholder {
  opacity: 0.5;
  cursor: not-allowed;
}

.pm-module-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}

.pm-module-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pm-module-name {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-1);
}
.pm-module-sub {
  font-size: 12px;
  color: var(--text-3);
}

.pm-module-arrow {
  color: var(--orange);
  flex-shrink: 0;
}
.pm-module-arrow svg {
  width: 18px; height: 18px;
}


/* ================================================
   JP MODULE READER
   ================================================ */

/* Reader view fills screen, no bottom nav padding */
#view-jp-reader {
  flex-direction: column;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

/* ID reader shares all layout rules with JP reader */
#view-id-reader {
  flex-direction: column;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

/* ---- Top bar ---- */
.reader-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.reader-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s, background 0.18s;
}
.reader-back:hover { color: var(--text-1); background: var(--bg-elevated); }
.reader-back svg { width: 18px; height: 18px; }

.reader-topbar-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.reader-title-short {
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-1);
  line-height: 1.2;
}
.reader-page-indicator {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.reader-toc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s, background 0.18s;
}
.reader-toc-btn:hover { color: var(--text-1); background: var(--bg-elevated); }
.reader-toc-btn svg { width: 18px; height: 18px; }

/* ---- Progress bar ---- */
.reader-progress-bar {
  height: 2px;
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.reader-progress-fill {
  height: 100%;
  background: var(--orange);
  transition: width 0.3s ease;
  width: 0%;
}

/* ---- Page content ---- */
.reader-content {
  flex: 1;
  overflow: auto;                    /* scroll both axes when zoomed */
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Allow pinch-to-zoom natively inside this scroll area */
  touch-action: pan-x pan-y pinch-zoom;
}

/* Canvas wrapper — stretches to canvas width when zoomed */
#pdf-canvas-wrap,
#id-pdf-canvas-wrap {
  position: relative;   /* anchor for annotation canvas */
  width: 100%;
  display: flex;
  justify-content: center;
}

/* PDF canvas */
#pdf-canvas,
#id-pdf-canvas {
  display: block;
  background: #fff;
  box-shadow: 0 2px 16px rgba(0,0,0,.15);
}

/* ---- Annotation overlay canvas ---- */
.annot-canvas {
  position: absolute;
  top: 0;
  left: 0;           /* positioned purely by JS in annotSyncSize */
  transform: none;
  pointer-events: none;
  touch-action: none;
  cursor: crosshair;
}
.annot-canvas.active { pointer-events: auto; }

/* ---- Annotation toolbar ---- */
.annot-toolbar {
  position: fixed;
  bottom: calc(var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 6px 10px;
  z-index: 80;
  box-shadow: 0 4px 20px rgba(0,0,0,.35);
  transition: opacity 0.2s;
  max-width: calc(100vw - 24px);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}
.annot-toolbar::-webkit-scrollbar { display: none; }
.annot-toolbar.hidden { opacity: 0; pointer-events: none; }

.annot-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  font-size: 16px;
  transition: background 0.15s, border-color 0.15s;
}
.annot-btn:hover  { background: var(--bg-hover); }
.annot-btn.active { border-color: var(--accent); background: rgba(59,130,246,.15); }

.annot-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}

/* color swatches */
.annot-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, border-color 0.15s;
}
.annot-color:hover   { transform: scale(1.2); }
.annot-color.active  { border-color: #fff; transform: scale(1.15); }

/* stroke size dots */
.annot-size {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.annot-size.active { border-color: var(--accent); }
.annot-size-dot {
  border-radius: 50%;
  background: var(--text-1);
  flex-shrink: 0;
}

/* opacity buttons */
.annot-opacity {
  height: 28px;
  min-width: 36px;
  padding: 0 5px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.annot-opacity:hover  { background: var(--bg-hover); color: var(--text-1); }
.annot-opacity.active { border-color: var(--accent); color: var(--text-1); }

/* ---- Side navigation panels ---- */
.reader-side-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 96px;
  z-index: 60;
  border: none;
  background: rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.reader-side-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.reader-side-btn:active  { background: rgba(0, 0, 0, 0.42); }
.reader-side-btn:disabled {
  opacity: 0.18;
  pointer-events: none;
}
.reader-side-prev {
  left: 0;
  border-radius: 0 10px 10px 0;
}
.reader-side-next {
  right: 0;
  border-radius: 10px 0 0 10px;
}

/* ---- Zoom controls in topbar ---- */
.reader-zoom-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
}
.reader-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-elevated);
  color: var(--text-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.reader-zoom-btn svg { width: 16px; height: 16px; }
.reader-zoom-btn:active { background: var(--bg-card); }

/* Loading spinner */
.pdf-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Bottom nav in reader ---- */
.reader-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.reader-nav-page {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

.reader-zoom-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  white-space: nowrap;
}

/* ---- TOC Drawer ---- */
.toc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.toc-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.toc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(320px, 90vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toc-drawer.open {
  transform: translateX(0);
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.toc-title {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-1);
}
.toc-close {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s;
}
.toc-close:hover { color: var(--text-1); }

.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 24px;
}

.toc-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 10px 18px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  color: var(--text-2);
  font-family: var(--font-body);
}
.toc-item:hover { background: var(--glass-bg); }
.toc-item.active {
  background: var(--orange-dim);
  color: var(--text-1);
}
.toc-item-page {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  min-width: 26px;
  padding-top: 1px;
  flex-shrink: 0;
}
.toc-item.active .toc-item-page { color: var(--orange); }
.toc-item-label {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}


/* ================================================
   VOCABULARY FLASHCARD SYSTEM
   ================================================ */

/* View fills screen exactly like JP reader */
#view-vocab {
  flex-direction: column;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
}

/* ---- Top bar ---- */
.vocab-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.vocab-shuffle-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s;
  white-space: nowrap;
}
.vocab-shuffle-btn svg { width: 13px; height: 13px; }
.vocab-shuffle-btn.active {
  background: var(--orange-dim);
  border-color: var(--orange-border);
  color: var(--orange);
}

/* ---- Category filter chips ---- */
.vocab-filter-bar {
  display: flex;
  gap: 7px;
  padding: 9px 14px;
  overflow-x: auto;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.vocab-filter-bar::-webkit-scrollbar { display: none; }

.vocab-filter-chip {
  flex-shrink: 0;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s;
  white-space: nowrap;
}
.vocab-filter-chip:hover { border-color: var(--border-hover); color: var(--text-2); }
.vocab-filter-chip.active {
  background: var(--orange-dim);
  border-color: var(--orange-border);
  color: var(--orange);
}

/* ---- Progress bar ---- */
.vocab-progress-bar {
  height: 2px;
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.vocab-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #FF9A6C);
  transition: width 0.35s ease;
  width: 0%;
}

/* ---- Flashcard area ---- */
.vocab-card-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 20px 8px;
  overflow: hidden;
  /* perspective for 3D flip */
  perspective: 1200px;
  -webkit-perspective: 1200px;
}

/* Gives the card a stable size */
.vocab-card-scene {
  width: 100%;
  max-width: 440px;
  height: 220px;
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Slightly taller on large screens */
@media (min-height: 700px) {
  .vocab-card-scene { height: 250px; }
}
@media (min-height: 800px) {
  .vocab-card-scene { height: 270px; }
}

/* The flip container */
.vocab-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}
.vocab-card.flipped {
  transform: rotateY(180deg);
}

/* Shared face styles */
.vocab-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 24px 36px;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Front face */
.vocab-card-front {
  background: linear-gradient(145deg, var(--bg-card) 0%, #1a2038 100%);
  border-color: rgba(255, 107, 53, 0.22);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Back face — mirrored so it reads correctly after flip */
.vocab-card-back {
  background: linear-gradient(145deg, #151d30 0%, var(--bg-card) 100%);
  border-color: rgba(91, 140, 255, 0.22);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: rotateY(180deg);
}

/* Category badge — top-right of card */
.vocab-cat-badge {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card number badge — top-left */
.vocab-num-badge {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

/* Front: furigana (small, dimmed, above word) */
.vocab-furigana {
  font-size: 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.4;
  word-break: break-all;
  max-width: 100%;
}

/* Front: main word */
.vocab-word {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-1);
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}

/* Tap hint at card bottom */
.vocab-tap-hint {
  position: absolute;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-3);
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}
.vocab-tap-hint svg { width: 11px; height: 11px; opacity: 0.6; }

/* Back: meaning (large) */
.vocab-meaning {
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-1);
  text-align: center;
  line-height: 1.3;
  margin-bottom: 12px;
  max-width: 100%;
  word-break: break-word;
}

/* Back: context sentence */
.vocab-context {
  font-size: 11.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.65;
  max-width: 100%;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Controls row (counter + reset) ---- */
.vocab-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 20px;
  flex-shrink: 0;
}

.vocab-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.vocab-reset-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: none;
  border: 1px solid transparent;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--font-display);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.18s;
}
.vocab-reset-btn:hover {
  border-color: var(--border);
  color: var(--text-2);
  background: var(--glass-bg);
}
.vocab-reset-btn svg { width: 11px; height: 11px; }

/* ---- Bottom nav (Prev / count / Next) ---- */
.vocab-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.vocab-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s, border-color 0.18s, opacity 0.18s;
}
.vocab-nav-btn:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--border-hover);
}
.vocab-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.vocab-nav-btn svg { width: 16px; height: 16px; }

.vocab-nav-page {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}


/* ================================================
   DESKTOP LAYOUT — ≥ 900px
   Sidebar kiri + topbar + content area di kanan
   ================================================ */

/* ---- Sidebar & topbar: hidden on mobile ---- */
#desktop-sidebar,
#desktop-topbar { display: none; }

@media (min-width: 900px) {

  /* ---- CSS vars for desktop geometry ---- */
  :root {
    --ds-w:    260px;   /* sidebar width */
    --dt-h:     60px;   /* topbar height */
    --nav-h:     0px;   /* bottom nav gone on desktop */
  }

  /* ---- Kill mobile-only chrome ---- */
  .bottom-nav { display: none !important; }

  /* ---- Body becomes the layout grid ---- */
  body {
    display: grid;
    grid-template-columns: var(--ds-w) 1fr;
    grid-template-rows: var(--dt-h) 1fr;
    grid-template-areas:
      "sidebar topbar"
      "sidebar content";
    min-height: 100dvh;
    overflow: hidden;   /* sidebar + topbar stay fixed; content scrolls */
  }

  /* ---- Ambient orbs — reposition for widescreen ---- */
  .ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
  }

  /* ---- Sidebar ---- */
  #desktop-sidebar {
    display: flex;
    flex-direction: column;
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100dvh;
    width: var(--ds-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px 20px;
    gap: 0;
    z-index: 200;
    overflow: hidden;
  }

  /* Brand block */
  .ds-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
  }
  .ds-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }
  .ds-logo svg { width: 36px; height: 36px; display: block; }
  .ds-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }
  .ds-app-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.2px;
  }
  .ds-app-sub {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  /* Nav items */
  .ds-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .ds-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
  }
  .ds-nav-item:hover {
    background: var(--glass-bg);
    color: var(--text-1);
  }
  .ds-nav-item.active {
    background: var(--blue-dim);
    color: var(--blue);
    font-weight: 600;
  }
  .ds-nav-item.active .ds-nav-icon { stroke: var(--blue); }
  .ds-nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    transition: stroke 0.15s;
  }

  /* Status */
  .ds-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(52, 211, 153, 0.06);
    border: 1px solid rgba(52, 211, 153, 0.15);
    margin-bottom: 10px;
  }
  .ds-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s ease infinite;
  }
  .ds-status-text {
    font-size: 11px;
    color: var(--green);
    font-weight: 600;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
  }
  .ds-footer {
    font-size: 11px;
    color: var(--text-3);
    text-align: center;
    padding: 4px 0 0;
  }

  /* ---- Topbar ---- */
  #desktop-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-area: topbar;
    height: var(--dt-h);
    padding: 0 28px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 190;
  }
  .dt-left {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
  }
  .dt-sub {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .dt-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-1);
    letter-spacing: -0.2px;
  }
  .dt-right { display: flex; align-items: center; gap: 10px; }
  .dt-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--blue-dim);
    border: 1px solid var(--blue-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--blue);
  }
  .dt-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
    flex-shrink: 0;
  }

  /* ---- Content area ---- */
  #app {
    grid-area: content;
    max-width: none;          /* unlock mobile max-width */
    width: 100%;
    height: calc(100dvh - var(--dt-h));
    overflow-y: auto;
    overflow-x: hidden;
    border: none;
    position: relative;
    scroll-behavior: smooth;
  }

  /* ---- Views: reset mobile constraints ---- */
  .view {
    min-height: 0;
    padding-bottom: 40px;
    max-width: 820px;         /* comfortable reading width */
    margin: 0 auto;
    width: 100%;
  }

  /* Reader views stay full-area (no max-width, no padding) */
  #view-jp-reader,
  #view-id-reader {
    max-width: none;
    margin: 0;
    width: 100%;
    height: calc(100dvh - var(--dt-h));
    overflow: hidden;
    padding-bottom: 0;
  }

  /* ---- Reader topbar + sidebar buttons on desktop ---- */
  .reader-topbar {
    padding: 0 16px;
  }
  .reader-side-btn {
    /* On desktop: thinner, more refined */
    width: 32px;
    height: 80px;
  }

  /* ---- Annotation toolbar: above the bottom (no nav-h offset) ---- */
  .annot-toolbar {
    bottom: 16px;
  }

  /* ---- Home view ---- */
  .home-header {
    padding: 32px 32px 0;
  }
  .stat-grid {
    margin: 0 32px;
  }

  /* Sector grid: 4 columns on desktop */
  .sector-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* Features grid: 3 cols (already set but reinforce) */
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* PM Modules card wider */
  .pm-module-card {
    padding: 18px 20px;
  }

  /* Vocab: wider card */
  .vocab-card-scene {
    max-width: 560px;
    margin: 0 auto;
  }

  /* Roadmap: wider timeline */
  .roadmap-timeline {
    max-width: 680px;
    margin: 0 auto;
  }
}

/* ---- Intermediate: tablet (600–900px) ---- */
@media (min-width: 600px) and (max-width: 899px) {
  #app {
    max-width: 100%;
    border: none;
  }
  .bottom-nav {
    border: none;
  }
  .sector-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}


/* ================================================
   DESKTOP READER — full viewport inside content area
   ================================================ */
@media (min-width: 900px) {
  /* When a reader view is active, #app itself should not overflow-scroll
     because the reader manages its own internal scroll */
  #app:has(#view-jp-reader.active),
  #app:has(#view-id-reader.active) {
    overflow: hidden;
  }

  /* Reader content fills exactly the space below topbar */
  #view-jp-reader .reader-content,
  #view-id-reader .reader-content {
    height: calc(100dvh - var(--dt-h) - 56px - 4px - 44px);
    /* 56px topbar, 4px progress, 44px bottom nav-reader */
  }

  /* Side nav buttons: account for no bottom-nav offset */
  #view-jp-reader .reader-side-btn,
  #view-id-reader .reader-side-btn {
    top: 50%;
  }

  /* Annotation toolbar: no bottom nav offset on desktop */
  #view-jp-reader ~ .annot-toolbar,
  #view-id-reader ~ .annot-toolbar {
    bottom: 20px;
  }
}
