/* =========================================================
   PH Public API + Kuya AI
   Mobile-first, flat design, PH flag accents, dark mode
   ========================================================= */

/* === Design tokens (light) === */
:root {
  /* PH flag accents */
  --ph-blue:    #0038A8;
  --ph-blue-2:  #002A80;
  --ph-red:     #CE1126;
  --ph-yellow:  #FCD116;

  /* Semantic — light */
  --bg:           #FFFFFF;
  --bg-subtle:    #F8FAFC;
  --bg-elevated:  #FFFFFF;
  --bg-inverse:   #0F172A;
  --fg:           #0F172A;
  --fg-muted:     #475569;
  --fg-subtle:    #64748B;
  --fg-on-inverse:#F8FAFC;
  --border:       #E2E8F0;
  --border-strong:#CBD5E1;
  --primary:      var(--ph-blue);
  --primary-fg:   #FFFFFF;
  --accent:       var(--ph-red);
  --success:      #16A34A;
  --warning:      var(--ph-yellow);
  --danger:       #DC2626;

  /* Effects (flat — no big shadows) */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 2px 6px rgba(15,23,42,0.06);
  --shadow-lg: 0 8px 20px rgba(15,23,42,0.10);
  --shadow-press: 0 0 0 4px rgba(0,56,168,0.12);

  /* Spacing rhythm (4/8) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  /* Z-scale */
  --z-header: 50;
  --z-sticky-fab: 60;
  --z-toast: 80;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* === Dark mode token override === */
[data-theme="dark"] {
  --bg:           #0F172A;
  --bg-subtle:    #1E293B;
  --bg-elevated:  #1E293B;
  --bg-inverse:   #F8FAFC;
  --fg:           #F1F5F9;
  --fg-muted:     #94A3B8;
  --fg-subtle:    #64748B;
  --fg-on-inverse:#0F172A;
  --border:       #334155;
  --border-strong:#475569;
  --ph-blue:      #3B82F6; /* lift blue in dark for readability */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.45);
  --shadow-press: 0 0 0 4px rgba(59,130,246,0.22);
}

/* === Reset === */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; padding: 0; min-width: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
}
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 200ms ease, color 200ms ease;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea {
  font: inherit;
  max-width: 100%;
  width: 100%;
}
img, svg, video, iframe { display: block; max-width: 100%; height: auto; }
pre, code {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--s4);
}
@media (min-width: 768px) { .container { padding: 0 var(--s5); } }

/* Prevent any element from breaking out */
section, header, footer, main { max-width: 100vw; overflow: visible; }
section { overflow-x: clip; }

.text-gradient {
  background: linear-gradient(120deg, var(--ph-blue), var(--ph-red) 60%, var(--ph-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  height: 60px;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-weight: 700; font-size: 16px; color: var(--fg);
}
.brand-name { font-size: 15px; }
.brand-flag {
  position: relative;
  width: 28px; height: 20px;
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.10);
  display: inline-block; flex-shrink: 0;
}
.flag-blue, .flag-red {
  position: absolute; right: 0; width: calc(100% - 8px); height: 50%;
}
.flag-blue { top: 0; background: #0038A8; }
.flag-red  { bottom: 0; background: #CE1126; }
.flag-tri {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  border-left: 12px solid #fff;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
}
.flag-sun {
  position: absolute; left: -10px; top: -3px; width: 6px; height: 6px;
  border-radius: 50%; background: #FCD116;
}
.nav-links {
  display: flex; align-items: center; gap: var(--s2);
  font-size: 14px; font-weight: 500;
}
.nav-link {
  color: var(--fg-muted);
  transition: color 150ms ease;
  padding: var(--s2);
  min-height: 44px;
  display: inline-flex; align-items: center;
}
.nav-link:hover, .nav-link:focus-visible { color: var(--fg); }
.lang-picker { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  color: var(--fg-muted);
  font-size: 13px; font-weight: 600;
  min-height: 36px;
  transition: background 150ms ease, color 150ms ease;
}
.lang-btn:hover { background: var(--bg-subtle); color: var(--fg); }
.lang-btn:active { transform: scale(0.95); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 80;
  min-width: 150px;
  display: flex; flex-direction: column; gap: 2px;
}
.lang-menu[hidden] { display: none; }
.lang-opt {
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  white-space: nowrap;
}
.lang-opt:hover { background: var(--bg-subtle); }
.lang-opt.active {
  background: var(--ph-blue);
  color: white;
  font-weight: 600;
}
@media (max-width: 480px) {
  .lang-btn { padding: 6px 8px; }
  .lang-btn svg { width: 16px; height: 16px; }
}

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  color: var(--fg-muted);
  transition: background 150ms ease, transform 150ms ease;
}
.theme-toggle:hover { background: var(--bg-subtle); color: var(--fg); }
.theme-toggle:active { transform: scale(0.92); }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
.nav-cta {
  display: inline-flex; align-items: center; gap: var(--s2);
  background: var(--fg); color: var(--bg);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  min-height: 38px;
  transition: opacity 150ms ease, transform 150ms ease;
}
.nav-cta:hover { opacity: 0.88; }
.nav-cta:active { transform: scale(0.97); }
.menu-btn {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--fg);
}
.menu-btn:hover { background: var(--bg-subtle); }

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .nav-link { display: none; }
  .nav-row { gap: var(--s2); }
}
@media (max-width: 480px) {
  .nav-cta span, .nav-cta svg ~ * { display: none; }
  .brand-name { display: none; }
}

/* === Mobile slide-out menu === */
.mobile-menu {
  display: none;
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: var(--s3) var(--s4);
  z-index: var(--z-header);
}
.mobile-menu.open { display: block; }
.mobile-menu a {
  display: block;
  padding: var(--s3) var(--s2);
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.mobile-menu a:last-child { border-bottom: none; }

/* === Hero === */
.hero {
  padding: var(--s6) 0 var(--s7);
  position: relative;
  overflow: hidden;
}
@media (min-width: 768px) {
  .hero { padding: var(--s9) 0 var(--s8); }
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(0,56,168,0.06), transparent 60%),
    radial-gradient(50% 50% at 90% 30%, rgba(252,209,22,0.10), transparent 60%),
    radial-gradient(40% 40% at 80% 90%, rgba(206,17,38,0.05), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
[data-theme="dark"] .hero::before {
  background:
    radial-gradient(60% 60% at 15% 10%, rgba(59,130,246,0.14), transparent 60%),
    radial-gradient(50% 50% at 90% 30%, rgba(252,209,22,0.08), transparent 60%),
    radial-gradient(40% 40% at 80% 90%, rgba(206,17,38,0.10), transparent 60%);
}

.hero-pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 12px; font-weight: 500;
  padding: 6px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg-muted);
  margin-bottom: var(--s4);
}
.hero-pill-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 20%, transparent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.hero-title {
  font-size: clamp(28px, 7vw, 60px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--s4);
  color: var(--fg);
  max-width: 100%;
  word-wrap: break-word;
}
.hero-title-accent {
  display: inline;
  background: linear-gradient(120deg, var(--ph-blue), var(--ph-red) 60%, var(--ph-yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--fg-muted);
  max-width: 680px;
  margin-bottom: var(--s5);
  line-height: 1.6;
}

.hero-search {
  display: flex; align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px 6px 6px var(--s3);
  max-width: 100%;
  margin-bottom: var(--s4);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  overflow: hidden;
}
@media (min-width: 768px) { .hero-search { max-width: 700px; } }
.hero-search:focus-within {
  border-color: var(--ph-blue);
  box-shadow: var(--shadow-press);
}
.hero-search-method {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: #fff; background: var(--ph-blue);
  padding: 4px 8px;
  border-radius: 4px;
  margin-right: var(--s2);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
#hero-url {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg);
  min-width: 0;
  outline: none;
}
.hero-copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--fg);
  color: var(--bg);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  min-height: 36px;
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease;
  flex-shrink: 0;
}
.hero-copy-btn:hover { opacity: 0.88; }
.hero-copy-btn:active { transform: scale(0.97); }
.hero-copy-btn.copied { background: var(--success); color: white; }
@media (max-width: 480px) {
  .hero-copy-btn span { display: none; }
  .hero-copy-btn { padding: var(--s2); }
}

.hero-actions {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s7);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  min-height: 44px;
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ph-blue); color: #fff;
}
.btn-primary:hover { background: var(--ph-blue-2); }
.btn-primary:active { transform: scale(0.97); }
.btn-accent {
  background: linear-gradient(120deg, var(--ph-red), #E11D48);
  color: #fff;
}
.btn-accent:hover { opacity: 0.92; }
.btn-accent:active { transform: scale(0.97); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--fg);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { border-color: var(--fg); }
.btn-secondary:active { transform: scale(0.97); }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s4);
  max-width: 720px;
  padding-top: var(--s5);
  border-top: 1px solid var(--border);
}
@media (min-width: 640px) {
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
}
.stat-num {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 13px;
  color: var(--fg-subtle);
  margin-top: 4px;
}

/* === Sections === */
.section { padding: var(--s7) 0; }
@media (min-width: 768px) { .section { padding: var(--s9) 0; } }
.section-muted { background: var(--bg-subtle); }

.section-head {
  text-align: center;
  margin-bottom: var(--s6);
  max-width: 700px;
  margin-left: auto; margin-right: auto;
}
.section-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--s3);
  line-height: 1.15;
}
.section-subtitle {
  font-size: 15px;
  color: var(--fg-muted);
}
@media (min-width: 768px) { .section-subtitle { font-size: 16px; } }

/* === Endpoint cards === */
.endpoint-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 640px) {
  .endpoint-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--s4);
  }
}
.endpoint-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s4);
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  cursor: pointer;
  position: relative;
}
.endpoint-card:hover {
  border-color: var(--ph-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.endpoint-card:active { transform: scale(0.99); }
.endpoint-card.highlight-new::before,
.endpoint-card.highlight-ai::before {
  content: ''; position: absolute; inset: 0;
  border-radius: var(--radius-md);
  padding: 1px;
  background: linear-gradient(120deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.5;
}
.endpoint-head {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s3);
  flex-wrap: wrap;
}
.method {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  background: color-mix(in srgb, var(--ph-blue) 10%, transparent);
  color: var(--ph-blue);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.method-post {
  background: color-mix(in srgb, var(--ph-red) 12%, transparent);
  color: var(--ph-red);
}
.path {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 600;
  color: var(--fg);
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.badge-new, .badge-ai {
  font-size: 10px;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: auto;
}
.badge-new { background: var(--ph-yellow); color: #78350F; }
.badge-ai  { background: linear-gradient(120deg, var(--ph-red), #DB2777); color: #fff; }
.endpoint-desc {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
}
.endpoint-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
  padding-top: var(--s3);
  border-top: 1px dashed var(--border);
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

/* === Try-it box === */
.try-box {
  max-width: 900px; margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  box-shadow: var(--shadow-md);
}
@media (min-width: 768px) { .try-box { padding: var(--s5); } }
.try-row {
  display: flex; flex-direction: column; gap: var(--s2);
  margin-bottom: var(--s4);
}
@media (min-width: 640px) {
  .try-row { flex-direction: row; gap: var(--s3); }
}
#try-endpoint {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  min-height: 44px;
  cursor: pointer;
  transition: border-color 150ms ease;
}
#try-endpoint:focus { outline: none; border-color: var(--ph-blue); box-shadow: var(--shadow-press); }
#try-send { min-width: 100px; }
.try-output {
  background: #0F172A;
  color: #E2E8F0;
  padding: var(--s4);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 380px;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) {
  .try-output { font-size: 13px; padding: var(--s5); }
}
.try-output .key   { color: #FCD116; }
.try-output .str   { color: #86EFAC; }
.try-output .num   { color: #93C5FD; }
.try-output .bool  { color: #F0ABFC; }
.try-output .null  { color: #94A3B8; }
.try-output .err   { color: #FCA5A5; }

/* === AI tutor === */
.ai-box {
  max-width: 820px; margin: 0 auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  box-shadow: var(--shadow-md);
}
@media (min-width: 768px) { .ai-box { padding: var(--s5); } }
.ai-chat {
  display: flex; flex-direction: column; gap: var(--s3);
  min-height: 240px;
  max-height: 480px;
  overflow-y: auto;
  padding: var(--s2);
  margin-bottom: var(--s4);
  scroll-behavior: smooth;
}
.ai-msg { display: flex; gap: var(--s3); align-items: flex-start; }
.ai-msg-user { flex-direction: row-reverse; }
.ai-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red));
  color: #fff;
}
.ai-msg-user .ai-avatar {
  background: var(--fg);
  color: var(--bg);
}
.ai-bubble {
  background: var(--bg-subtle);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  max-width: calc(100% - 52px);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
@media (min-width: 640px) {
  .ai-bubble { font-size: 15px; max-width: 75%; }
}
.ai-msg-user .ai-bubble {
  background: var(--ph-blue);
  color: #fff;
}
.ai-bubble.loading::after {
  content: '●●●';
  animation: dots 1.4s ease-in-out infinite;
  letter-spacing: 3px;
  color: var(--fg-muted);
}
@keyframes dots {
  0%, 80%, 100% { opacity: 0.3; }
  40% { opacity: 1; }
}

.ai-suggestions {
  display: flex; flex-wrap: wrap; gap: var(--s2);
  margin-bottom: var(--s3);
}
.ai-chip {
  font-size: 13px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg);
  font-weight: 500;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
  min-height: 36px;
}
.ai-chip:hover { border-color: var(--ph-blue); }
.ai-chip:active { transform: scale(0.96); }

.ai-form {
  display: flex; gap: var(--s2);
  align-items: stretch;
}
#ai-input {
  flex: 1;
  padding: 12px var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  min-height: 44px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
#ai-input:focus { border-color: var(--ph-blue); box-shadow: var(--shadow-press); }
.ai-disclaimer {
  font-size: 12px;
  color: var(--fg-subtle);
  text-align: center;
  margin-top: var(--s3);
}

/* === For students grid === */
.student-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 640px) { .student-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s4); } }
@media (min-width: 1024px) { .student-grid { grid-template-columns: repeat(3, 1fr); } }
.student-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s5);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.student-card:hover {
  transform: translateY(-2px);
  border-color: var(--ph-blue);
  box-shadow: var(--shadow-md);
}
.student-icon {
  font-size: 28px;
  margin-bottom: var(--s3);
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--ph-blue) 10%, transparent);
}
.student-card h3 {
  font-size: 17px; font-weight: 700; margin-bottom: var(--s2);
  color: var(--fg);
}
.student-card p {
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.6;
}

/* === Free APIs grid === */
.api-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 640px) { .api-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .api-grid { grid-template-columns: repeat(3, 1fr); } }
.api-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s4);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  display: flex; flex-direction: column; gap: var(--s2);
  cursor: pointer;
  color: var(--fg);
}
.api-card:hover {
  border-color: var(--ph-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.api-card-name {
  font-size: 16px; font-weight: 700;
}
.api-card-desc {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
  flex: 1;
}
.api-card-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  border-radius: var(--radius-full);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* === Free Office cards === */
.office-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .office-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .office-grid { grid-template-columns: repeat(3, 1fr); } }
.office-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  display: flex; flex-direction: column;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.office-card:hover {
  border-color: var(--ph-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.office-card.featured {
  border: 2px solid var(--ph-yellow);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ph-yellow) 8%, var(--bg-elevated)) 0%, var(--bg-elevated) 50%);
}
.office-card.featured::before {
  content: '⭐ FREE FOR PH STUDENTS WITH .EDU.PH EMAIL';
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #78350F;
  background: var(--ph-yellow);
  padding: 4px 8px;
  border-radius: var(--radius-full);
  margin-bottom: var(--s3);
  align-self: flex-start;
}
.office-card h3 {
  font-size: 19px; font-weight: 700; margin-bottom: var(--s2);
}
.office-card .office-tag {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
  line-height: 1.5;
}
.office-meta {
  display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3);
  font-size: 13px;
  margin-bottom: var(--s4);
  padding: var(--s3);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}
.office-meta dt { font-weight: 600; color: var(--fg-muted); }
.office-meta dd { color: var(--fg); }
.office-steps {
  list-style: none;
  counter-reset: step;
  display: flex; flex-direction: column; gap: var(--s2);
  margin-bottom: var(--s4);
}
.office-steps li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  font-size: 14px;
  color: var(--fg);
  line-height: 1.5;
}
.office-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 26px; height: 26px;
  border-radius: var(--radius-full);
  background: var(--ph-blue);
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.office-card .btn {
  align-self: stretch;
  margin-top: auto;
}

/* === Tools section (GPA, Pomodoro, Currency) === */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .tools-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tools-grid { grid-template-columns: repeat(3, 1fr); } }
.tool-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  display: flex; flex-direction: column;
}
.tool-card h3 {
  font-size: 18px; font-weight: 700; margin-bottom: var(--s2);
  display: flex; align-items: center; gap: var(--s2);
}
.tool-card p { font-size: 13px; color: var(--fg-muted); margin-bottom: var(--s4); }

/* GPA Calculator */
.gpa-grid {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: var(--s2);
  margin-bottom: var(--s2);
  align-items: center;
}
.gpa-grid input, .gpa-grid select {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  min-height: 38px;
  outline: none;
}
.gpa-grid input:focus, .gpa-grid select:focus {
  border-color: var(--ph-blue);
}
.gpa-add {
  font-size: 13px; font-weight: 600;
  color: var(--ph-blue);
  padding: var(--s2);
  margin-top: var(--s2);
}
.gpa-add:hover { text-decoration: underline; }
.gpa-result {
  margin-top: var(--s4);
  padding: var(--s4);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
}
.gpa-result-num {
  font-size: 32px; font-weight: 800;
  color: var(--ph-blue);
  font-variant-numeric: tabular-nums;
}
.gpa-result-label {
  font-size: 12px; color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* Pomodoro */
.pomo-display {
  font-size: 56px; font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ph-blue);
  margin: var(--s4) 0;
  letter-spacing: -0.02em;
}
.pomo-controls {
  display: flex; gap: var(--s2); justify-content: center;
}
.pomo-state {
  text-align: center;
  font-size: 13px; color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600;
}

/* Currency converter widget */
.curr-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s2); align-items: end; margin-bottom: var(--s3); }
.curr-row label { font-size: 12px; color: var(--fg-muted); display: block; margin-bottom: 4px; }
.curr-row input, .curr-row select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg); color: var(--fg);
  font-size: 14px;
  outline: none;
}
.curr-row input:focus, .curr-row select:focus { border-color: var(--ph-blue); }
.curr-swap {
  align-self: end;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 200ms ease;
}
.curr-swap:hover { transform: rotate(180deg); background: var(--ph-blue); color: white; }
.curr-result {
  margin-top: var(--s3);
  padding: var(--s3) var(--s4);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 600;
  text-align: center;
  color: var(--ph-blue);
  font-variant-numeric: tabular-nums;
}

/* === Examples grid === */
.examples-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .examples-grid { grid-template-columns: repeat(2, 1fr); } }
.example-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.example-head {
  padding: var(--s2) var(--s4);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.example-lang {
  font-size: 11px; font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.example-card pre {
  padding: var(--s4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg-elevated);
}
@media (min-width: 768px) { .example-card pre { font-size: 13px; } }

/* === Instructions / Getting Started === */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
  max-width: 900px;
  margin: 0 auto;
}
@media (min-width: 768px) { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
.step-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s5);
  display: flex; gap: var(--s4); align-items: flex-start;
}
.step-num {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--ph-blue); color: #fff;
  font-size: 17px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-card h3 { font-size: 16px; font-weight: 700; margin-bottom: var(--s2); }
.step-card p { font-size: 14px; color: var(--fg-muted); line-height: 1.6; }
.step-card code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--s7) 0 var(--s5);
  background: var(--bg-subtle);
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s6);
  margin-bottom: var(--s6);
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }

.footer-dev {
  display: flex; gap: var(--s3); align-items: flex-start;
}
.footer-dev-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,56,168,0.20);
}
.footer-dev-name {
  font-weight: 700; font-size: 17px; color: var(--fg);
  letter-spacing: -0.01em;
}
.footer-dev-role {
  font-size: 13px; color: var(--fg-muted);
  margin-top: 2px; margin-bottom: var(--s3);
}
.footer-dev-contact {
  display: flex; flex-direction: column; gap: var(--s2);
  font-size: 13px;
}
.footer-dev-contact a {
  color: var(--ph-blue);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  transition: opacity 150ms ease;
  word-break: break-all;
}
.footer-dev-contact a:hover { opacity: 0.7; }

.footer-section {
  display: flex; flex-direction: column; gap: var(--s2);
}
.footer-h {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg);
  margin-bottom: var(--s2);
}
.footer-section a {
  font-size: 13px;
  color: var(--fg-muted);
  transition: color 150ms ease;
  padding: 2px 0;
}
.footer-section a:hover { color: var(--ph-blue); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
  display: flex; flex-direction: column; gap: var(--s2);
  font-size: 12px; color: var(--fg-muted);
}
@media (min-width: 768px) {
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}
.footer-bottom a { color: var(--ph-blue); font-weight: 600; }
.footer-tags { font-size: 11px; opacity: 0.7; }

/* === AI mode tabs === */
.ai-modes {
  display: flex; gap: var(--s2);
  margin-bottom: var(--s4);
  overflow-x: auto;
  padding-bottom: var(--s2);
  scrollbar-width: thin;
}
.ai-mode-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--s2) var(--s4);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 2px solid transparent;
  color: var(--fg-muted);
  font-size: 13px; font-weight: 600;
  min-width: 78px;
  min-height: 56px;
  transition: all 150ms ease;
  flex-shrink: 0;
}
.ai-mode-tab:hover { color: var(--fg); border-color: var(--border-strong); }
.ai-mode-tab:active { transform: scale(0.96); }
.ai-mode-tab.active {
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red));
  color: #fff;
  border-color: transparent;
}
.ai-mode-emoji { font-size: 18px; }
.ai-mode-label { font-size: 12px; letter-spacing: 0.02em; }

/* === AI image generator output === */
.img-output-card {
  margin-top: var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
}
.img-output-card img {
  width: 100%;
  display: block;
  min-height: 200px;
  background: linear-gradient(135deg, var(--bg-subtle), var(--border));
}
.img-output-card .img-meta {
  padding: var(--s3) var(--s4);
  font-size: 12px;
  color: var(--fg-muted);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s2);
}
.img-output-card .img-meta a {
  color: var(--ph-blue); font-weight: 500;
}

/* === Programming language cards === */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 640px) { .lang-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s4); } }
@media (min-width: 1024px) { .lang-grid { grid-template-columns: repeat(3, 1fr); } }
.lang-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s5);
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.lang-card:hover {
  border-color: var(--ph-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.lang-card-feature {
  border-top: 3px solid var(--ph-yellow);
}
.lang-header {
  display: flex; align-items: center; gap: var(--s3);
  margin-bottom: var(--s2);
}
.lang-icon {
  font-size: 28px;
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--ph-blue) 10%, transparent);
  display: flex; align-items: center; justify-content: center;
}
.lang-card h3 {
  font-size: 17px; font-weight: 700;
  color: var(--fg);
}
.lang-card > p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
  line-height: 1.5;
}
.lang-links {
  list-style: none;
  font-size: 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.lang-links li::before {
  content: '→ ';
  color: var(--ph-blue);
  font-weight: 700;
}
.lang-links a {
  color: var(--fg);
  transition: color 150ms ease;
}
.lang-links a:hover { color: var(--ph-blue); text-decoration: underline; }
.lang-card h4 {
  font-size: 13px; font-weight: 700;
  color: var(--fg);
  margin: var(--s3) 0 var(--s2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* === Office skill cards === */
.office-skills-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .office-skills-grid { grid-template-columns: repeat(3, 1fr); } }
.skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.skill-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.skill-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  color: #fff;
  margin-bottom: var(--s3);
}
.skill-card h3 {
  font-size: 22px; font-weight: 800;
  color: var(--fg);
  margin-bottom: var(--s2);
}
.skill-card > p {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
}
.skill-card h4 {
  font-size: 12px; font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--s4);
  margin-bottom: var(--s2);
}

/* === Category headers for API list === */
.api-cat-head {
  font-size: 14px; font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: var(--s6) 0 var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--border);
}
.api-cat-head:first-of-type { margin-top: 0; }

/* === Builders (AI-powered) === */
.builders-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .builders-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .builders-grid { grid-template-columns: repeat(3, 1fr); } }

.builder-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  display: flex; flex-direction: column;
  max-width: 100%;
  overflow: hidden;
}
@media (min-width: 640px) {
  .builder-card { padding: var(--s5); }
}
.builder-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
.builder-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.builder-card h3 { font-size: 18px; font-weight: 700; }
.builder-card > p { font-size: 13px; color: var(--fg-muted); margin-bottom: var(--s3); }

.builder-card textarea,
.builder-card input[type="text"],
.builder-card input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit; font-size: 13px;
  outline: none;
  transition: border-color 150ms ease;
  resize: vertical;
}
.builder-card textarea:focus,
.builder-card input:focus,
.builder-card select:focus { border-color: var(--ph-blue); box-shadow: var(--shadow-press); }

.resume-form {
  display: flex; flex-direction: column; gap: var(--s2);
  margin-bottom: var(--s2);
}

.builder-output {
  margin-top: var(--s3);
  padding: var(--s4);
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}
.builder-output.resume-rendered {
  background: white;
  color: #0F172A;
  font-family: 'Inter', sans-serif;
  padding: var(--s6);
  border: 1px solid var(--border);
}
.builder-output.resume-rendered h1 { font-size: 24px; margin-bottom: 4px; }
.builder-output.resume-rendered .r-meta { font-size: 12px; color: #475569; margin-bottom: var(--s4); }
.builder-output.resume-rendered h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #0038A8; margin-top: var(--s4); margin-bottom: var(--s2);
  padding-bottom: 4px; border-bottom: 2px solid #0038A8;
}
.builder-output.resume-rendered p { margin-bottom: var(--s2); }

/* === Real Office app icons (Microsoft brand-style) === */
.skill-icon.ms-icon-excel,
.skill-icon.ms-icon-word,
.skill-icon.ms-icon-ppt {
  position: relative;
  border-radius: 8px;
  font-family: 'Segoe UI', -apple-system, sans-serif;
  font-weight: 700;
  overflow: hidden;
}
.skill-icon.ms-icon-excel {
  background: linear-gradient(135deg, #185C37, #21A366);
  color: white;
}
.skill-icon.ms-icon-excel::before {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 33%, rgba(255,255,255,0.2) 33%, rgba(255,255,255,0.2) 66%, transparent 66%),
    linear-gradient(90deg, transparent 33%, rgba(255,255,255,0.2) 33%, rgba(255,255,255,0.2) 66%, transparent 66%);
  opacity: 0.3;
}
.skill-icon.ms-icon-word {
  background: linear-gradient(135deg, #2B579A, #185ABD);
  color: white;
}
.skill-icon.ms-icon-word::before {
  content: '';
  position: absolute; left: 8px; right: 8px; top: 12px; height: 2px;
  background: rgba(255,255,255,0.5);
  box-shadow: 0 6px 0 rgba(255,255,255,0.4), 0 12px 0 rgba(255,255,255,0.3), 0 18px 0 rgba(255,255,255,0.25);
}
.skill-icon.ms-icon-ppt {
  background: linear-gradient(135deg, #B7472A, #D24726);
  color: white;
}
.skill-icon.ms-icon-ppt::before {
  content: '';
  position: absolute; left: 10px; top: 10px; width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  box-shadow: inset -2px -2px 0 rgba(255,255,255,0.3);
}
.skill-icon span {
  position: relative;
  z-index: 2;
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* === AI Toolbox === */
.ai-tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 768px) { .ai-tools-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1200px) { .ai-tools-grid { grid-template-columns: repeat(3, 1fr); } }

.ai-tool-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  display: flex; flex-direction: column;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  position: relative;
  overflow: hidden;
}
.ai-tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--ph-blue);
  box-shadow: var(--shadow-md);
}
.ai-tool-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ph-blue), var(--ph-red));
  opacity: 0.7;
}
.ai-tool-head {
  display: flex; align-items: center; gap: var(--s2);
  margin-bottom: var(--s2);
}
.ai-tool-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ph-blue) 12%, transparent), color-mix(in srgb, var(--ph-red) 12%, transparent));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.ai-tool-card h3 { font-size: 16px; font-weight: 700; }
.ai-tool-card > p {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
  line-height: 1.5;
}

.translator-controls {
  display: flex; gap: var(--s2); align-items: center;
  margin-bottom: var(--s2);
}
.ai-tool-select {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  min-height: 36px;
}
.ai-tool-select:focus { outline: none; border-color: var(--ph-blue); }

.ai-tool-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  margin-bottom: var(--s2);
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.ai-tool-input:focus { border-color: var(--ph-blue); box-shadow: var(--shadow-press); }

.ai-tool-btn {
  width: 100%;
  margin-top: var(--s2);
}
.ai-tool-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ai-tool-output {
  margin-top: var(--s3);
  padding: var(--s3);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--ph-blue);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 320px;
  overflow-y: auto;
  color: var(--fg);
}
.ai-tool-output.loading::before {
  content: '✨ Thinking';
  color: var(--fg-muted);
}
.ai-tool-output.loading::after {
  content: '...';
  animation: dots 1.4s ease-in-out infinite;
  color: var(--fg-muted);
}
.ai-tool-copy {
  margin-top: var(--s2);
  font-size: 12px;
  padding: 6px 12px;
  min-height: 32px;
}

/* === Inline Kuya AI hero demo === */
.hero-ai-demo {
  margin-top: var(--s5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s4);
  max-width: 720px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.hero-ai-demo::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
}
.hero-ai-head {
  display: flex; align-items: center; gap: var(--s3);
  margin-bottom: var(--s3);
}
.hero-ai-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  flex-shrink: 0;
}
.hero-ai-head strong {
  display: block;
  font-size: 15px;
  color: var(--fg);
}
.hero-ai-sub {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 2px;
}
.hero-ai-pill {
  margin-left: auto;
  font-size: 11px;
  padding: 4px 10px;
  background: color-mix(in srgb, #22C55E 12%, transparent);
  color: #16A34A;
  border-radius: var(--radius-full);
  font-weight: 600;
  flex-shrink: 0;
}
[data-theme="dark"] .hero-ai-pill { color: #4ADE80; }

.hero-ai-form {
  display: flex; gap: var(--s2);
  margin-bottom: var(--s3);
}
#hero-ai-input {
  flex: 1;
  padding: 12px var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  min-height: 44px;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
#hero-ai-input:focus {
  border-color: var(--ph-blue);
  box-shadow: var(--shadow-press);
}
#hero-ai-send { min-width: 80px; flex-shrink: 0; }

.hero-ai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--s3);
}
.hero-chip {
  font-size: 12px;
  padding: 6px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg-muted);
  font-weight: 500;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
  min-height: 30px;
}
.hero-chip:hover { border-color: var(--ph-blue); color: var(--fg); }
.hero-chip:active { transform: scale(0.96); }

.hero-ai-output {
  background: var(--bg-subtle);
  border-left: 3px solid var(--ph-blue);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 280px;
  overflow-y: auto;
  color: var(--fg);
}
.hero-ai-output.loading::before {
  content: 'Kuya AI is thinking';
  color: var(--fg-muted);
}
.hero-ai-output.loading::after {
  content: '...';
  animation: dots 1.4s ease-in-out infinite;
  letter-spacing: 3px;
  color: var(--fg-muted);
}
.hero-ai-output .provider-tag {
  display: block;
  font-size: 11px;
  color: var(--fg-subtle);
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px dashed var(--border);
}

@media (max-width: 640px) {
  .hero-ai-form { flex-direction: column; }
  #hero-ai-send { width: 100%; }
  .hero-ai-demo { padding: var(--s3); }
}

/* === Skills Roadmap (4-quadrant overview) === */
.skills-roadmap {
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
  border: 1px solid #21A366;
  border-radius: var(--radius-lg);
  padding: var(--s5);
  margin-bottom: var(--s6);
  position: relative;
  overflow: hidden;
}
[data-theme="dark"] .skills-roadmap {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(33,163,102,0.08) 100%);
  border-color: #21A366;
}
.skills-roadmap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(33,163,102,0.08) 2px, transparent 3px),
    radial-gradient(circle at 88% 82%, rgba(24,92,55,0.06) 2px, transparent 3px);
  background-size: 30px 30px;
  pointer-events: none;
  opacity: 0.6;
}

.roadmap-header {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding-bottom: var(--s4);
  margin-bottom: var(--s4);
  border-bottom: 2px solid #21A366;
  position: relative;
}
.roadmap-logo { flex-shrink: 0; }
.excel-logo-box {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #185C37, #21A366);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800;
  font-family: 'Segoe UI', sans-serif;
  box-shadow: 0 4px 12px rgba(24,92,55,0.3);
}
.roadmap-title {
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #185C37;
  line-height: 1;
  margin-bottom: 4px;
}
[data-theme="dark"] .roadmap-title { color: #4ADE80; }
.roadmap-sub {
  font-size: 13px;
  color: var(--fg-muted);
  margin: 0;
}
.roadmap-chart {
  margin-left: auto;
  display: flex; align-items: flex-end; gap: 4px;
  flex-shrink: 0;
}
.roadmap-chart .bar {
  width: 12px; background: #21A366;
  border-radius: 2px 2px 0 0;
  display: inline-block;
}
.roadmap-chart .b1 { height: 22px; background: #4ADE80; }
.roadmap-chart .b2 { height: 32px; background: #22C55E; }
.roadmap-chart .b3 { height: 44px; background: #16A34A; }
.roadmap-chart .arrow {
  color: #16A34A; font-size: 24px; font-weight: 700;
  margin-left: 4px; align-self: flex-start;
}
@media (max-width: 640px) {
  .roadmap-chart { display: none; }
  .roadmap-title { font-size: 20px; }
}

.roadmap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
  position: relative;
}
@media (min-width: 768px) { .roadmap-grid { grid-template-columns: 1fr 1fr; gap: var(--s4); } }

.roadmap-quad {
  background: var(--bg-elevated);
  border: 1px solid #d1fae5;
  border-radius: var(--radius-md);
  padding: var(--s4);
  position: relative;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
[data-theme="dark"] .roadmap-quad { border-color: rgba(33,163,102,0.3); }
.roadmap-quad:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(24,92,55,0.12);
  border-color: #21A366;
}
.quad-num {
  position: absolute;
  top: -14px; left: var(--s4);
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #185C37, #21A366);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
  box-shadow: 0 2px 8px rgba(24,92,55,0.3);
}
.roadmap-quad h4 {
  font-size: 18px; font-weight: 800;
  color: #185C37;
  background: linear-gradient(90deg, #185C37, #21A366);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-left: 44px;
  margin-bottom: var(--s3);
  padding-top: 4px;
  margin-top: 4px;
}
[data-theme="dark"] .roadmap-quad h4 {
  background: linear-gradient(90deg, #4ADE80, #22C55E);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.roadmap-quad ul {
  list-style: none;
  padding: 0;
  margin-bottom: var(--s3);
}
.roadmap-quad li {
  display: flex; align-items: center; gap: var(--s2);
  padding: 6px 0;
  font-size: 14px;
  color: var(--fg);
  border-bottom: 1px dashed var(--border);
}
.roadmap-quad li:last-child { border-bottom: none; }
.quad-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: #d1fae5;
  color: #185C37;
  border-radius: 6px;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
[data-theme="dark"] .quad-icon { background: rgba(33,163,102,0.2); color: #4ADE80; }
.quad-link {
  display: inline-block;
  font-size: 13px; font-weight: 600;
  color: #185C37;
  margin-top: var(--s2);
  transition: opacity 150ms ease;
}
[data-theme="dark"] .quad-link { color: #4ADE80; }
.quad-link:hover { opacity: 0.7; }
.roadmap-cta {
  text-align: center;
  padding: var(--s4) 0 0;
  margin-top: var(--s4);
  border-top: 2px solid #21A366;
  font-size: 14px;
  color: #185C37;
}
[data-theme="dark"] .roadmap-cta { color: #4ADE80; }

/* === Excel Mastery === */
.excel-tabs {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s5);
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.excel-tab {
  padding: 10px 16px;
  font-size: 14px; font-weight: 600;
  color: var(--fg-muted);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 150ms ease;
}
.excel-tab:hover { color: var(--fg); }
.excel-tab.active {
  color: #185C37;
  border-bottom-color: #185C37;
  background: rgba(33,163,102,0.06);
}
.excel-tabs-sub {
  display: flex; gap: var(--s2);
  margin-bottom: var(--s4);
}
.excel-sub-tab {
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.excel-sub-tab.active { background: #21A366; color: white; border-color: #21A366; }

.excel-panel { display: none; }
.excel-panel.active { display: block; }

.excel-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 640px) { .excel-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .excel-cards { grid-template-columns: repeat(3, 1fr); } }

.excel-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-top: 3px solid #21A366;
  padding: var(--s5);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.excel-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.excel-card-feature { border-top-color: #FCD116; background: linear-gradient(180deg, rgba(252,209,22,0.04) 0%, var(--bg-elevated) 60%); }

.excel-card h3 {
  font-size: 17px; font-weight: 700;
  margin-bottom: var(--s3);
  color: var(--fg);
}
.excel-card p { font-size: 14px; color: var(--fg-muted); margin-bottom: var(--s2); line-height: 1.6; }
.excel-code, .excel-card pre {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: var(--s3);
  background: #0F172A;
  color: #86EFAC;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
}
.excel-card kbd, kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--fg);
  font-weight: 600;
}

.mini-sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--font-mono);
  margin-top: var(--s3);
}
.mini-sheet th, .mini-sheet td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
}
.mini-sheet th {
  background: #185C37;
  color: white;
  font-weight: 600;
  text-align: center;
}
.mini-sheet tr th:first-child { background: #21A366; }

.excel-example {
  background: var(--bg-subtle);
  padding: var(--s3);
  border-radius: var(--radius-sm);
}

.excel-search-wrap {
  margin-bottom: var(--s4);
}
.excel-search-wrap input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  min-height: 44px;
}
.excel-search-wrap input:focus { outline: none; border-color: #21A366; box-shadow: 0 0 0 3px rgba(33,163,102,0.15); }

.excel-formulas {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 768px) { .excel-formulas { grid-template-columns: 1fr 1fr; } }

.formula-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid #21A366;
  border-radius: var(--radius-sm);
  padding: var(--s4);
  transition: all 200ms ease;
}
.formula-card:hover { border-left-color: #185C37; box-shadow: var(--shadow-sm); }
.formula-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #185C37;
  font-size: 15px;
  margin-bottom: 4px;
}
.formula-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  margin-bottom: var(--s2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cat-math { background: #DBEAFE; color: #1E40AF; }
.cat-lookup { background: #FED7AA; color: #9A3412; }
.cat-text { background: #DDD6FE; color: #5B21B6; }
.cat-logical { background: #FECACA; color: #991B1B; }
.cat-date { background: #BBF7D0; color: #14532D; }
.cat-stat { background: #FEF3C7; color: #92400E; }
.formula-desc { font-size: 13px; color: var(--fg-muted); margin-bottom: var(--s2); }
.formula-syntax {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-subtle);
  padding: 6px 10px;
  border-radius: 4px;
  margin-bottom: var(--s2);
  color: var(--fg);
  word-break: break-all;
}
.formula-example {
  font-family: var(--font-mono);
  font-size: 12px;
  background: #0F172A;
  color: #86EFAC;
  padding: 8px 12px;
  border-radius: 4px;
  word-break: break-all;
}

.excel-shortcuts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s3);
}
@media (min-width: 640px) { .excel-shortcuts { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .excel-shortcuts { grid-template-columns: repeat(3, 1fr); } }

.shortcut-group { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s4); }
.shortcut-group h4 { font-size: 14px; font-weight: 700; color: #185C37; margin-bottom: var(--s2); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 13px; gap: var(--s2); }
.shortcut-row span:first-child { color: var(--fg); flex: 1; }
.shortcut-keys { display: flex; gap: 2px; flex-shrink: 0; }

/* === Universal Search === */
.search-trigger {
  display: flex; align-items: center; gap: var(--s2);
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--fg-muted);
  font-size: 13px;
  min-height: 36px;
  transition: all 150ms ease;
  margin-right: var(--s2);
}
.search-trigger:hover { border-color: var(--ph-blue); color: var(--fg); }
.search-trigger-text { font-weight: 500; }
.search-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-muted);
}
@media (max-width: 640px) {
  .search-trigger-text, .search-kbd { display: none; }
  .search-trigger { padding: 8px; min-width: 36px; justify-content: center; }
}

.search-modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh var(--s4) var(--s4);
}
.search-modal[hidden] {
  display: none !important;
}
.search-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.7);
  backdrop-filter: blur(4px);
}
.search-box {
  position: relative;
  width: 100%; max-width: 640px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-wrap {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4);
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
}
.search-input-wrap input {
  flex: 1; border: none; background: transparent;
  font-size: 16px; color: var(--fg);
  outline: none;
}
.search-close {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: 14px;
}
.search-close:hover { background: var(--border); }
.search-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--s3);
}
.search-hint {
  padding: var(--s4);
  font-size: 13px;
  color: var(--fg-muted);
  text-align: center;
  line-height: 1.6;
}
.search-hint em {
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 4px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
}
.search-group {
  margin-bottom: var(--s4);
}
.search-group-head {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ph-blue);
  padding: 0 var(--s2);
  margin-bottom: var(--s2);
}
.search-result {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--fg);
  transition: background 150ms ease;
}
.search-result:hover, .search-result:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}
.search-result-title { font-size: 14px; font-weight: 600; }
.search-result-desc { font-size: 12px; color: var(--fg-muted); }
.search-result mark {
  background: var(--ph-yellow);
  color: #78350F;
  padding: 0 2px;
  border-radius: 2px;
}
.search-empty {
  padding: var(--s5);
  text-align: center;
  color: var(--fg-muted);
  font-size: 13px;
}

/* === Code Playground === */
.playground { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--bg); }
.pg-tabs { display: flex; gap: 0; background: var(--bg-subtle); border-bottom: 1px solid var(--border); padding: 4px; flex-wrap: wrap; }
.pg-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  color: var(--fg-muted); border-radius: var(--radius-sm);
  transition: all 150ms ease;
}
.pg-tab.active { background: var(--bg-elevated); color: var(--ph-blue); box-shadow: var(--shadow-sm); }
.pg-tab:hover:not(.active) { color: var(--fg); }
.pg-run, .pg-reset {
  margin-left: auto; padding: 8px 14px;
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--ph-blue); color: white;
  transition: opacity 150ms ease;
}
.pg-reset { background: var(--bg-elevated); color: var(--fg-muted); border: 1px solid var(--border); margin-left: 8px; }
.pg-run:hover { opacity: 0.88; }
.pg-editors { position: relative; }
.pg-editor {
  display: none;
  width: 100%; min-height: 200px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--s4);
  border: none;
  background: #0F172A;
  color: #E2E8F0;
  outline: none;
  resize: vertical;
  -webkit-tap-highlight-color: transparent;
}
.pg-editor.active { display: block; }
.pg-preview-wrap { border-top: 1px solid var(--border); background: white; }
#pg-preview { width: 100%; min-height: 250px; border: none; background: white; }

/* === Tracker === */
.tracker-progress { margin-bottom: var(--s4); }
.tracker-bar { height: 12px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden; margin-bottom: var(--s2); }
.tracker-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
  border-radius: 999px;
  transition: width 300ms ease;
}
.tracker-stats {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.tracker-stats strong { color: var(--ph-blue); }
.tracker-weeks {
  max-height: 480px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--s3);
}
.tracker-week {
  margin-bottom: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--border);
}
.tracker-week:last-child { border-bottom: none; margin-bottom: 0; }
.tracker-week-head {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ph-blue);
  margin-bottom: var(--s2);
}
.tracker-task {
  display: flex; gap: var(--s2); align-items: flex-start;
  padding: 6px 0; font-size: 14px;
  cursor: pointer;
}
.tracker-task input { margin-top: 3px; width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; accent-color: var(--ph-blue); }
.tracker-task.done label { text-decoration: line-through; color: var(--fg-subtle); }
.tracker-task label { cursor: pointer; flex: 1; line-height: 1.5; }

/* === Template picker === */
.builder-card-wide { grid-column: 1 / -1; }
@media (max-width: 767px) { .builder-card-wide { grid-column: auto; } }

.tpl-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s2);
  margin-bottom: var(--s4);
}
@media (min-width: 640px) { .tpl-picker { grid-template-columns: repeat(4, 1fr); } }

.tpl-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s2);
  cursor: pointer;
  display: flex; flex-direction: column;
  text-align: center;
  transition: border-color 150ms ease, transform 150ms ease;
}
.tpl-option:hover { border-color: var(--ph-blue); transform: translateY(-2px); }
.tpl-option.active {
  border-color: var(--ph-blue);
  background: color-mix(in srgb, var(--ph-blue) 5%, var(--bg));
}

.tpl-preview {
  height: 80px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--s2);
  padding: 8px;
  position: relative;
  overflow: hidden;
  font-size: 8px;
}
.tpl-preview-dark-glow {
  background: radial-gradient(circle at 30% 40%, #1e1b4b 0%, #0f172a 70%);
}
.tpl-preview-dark-glow .tp-orb {
  position: absolute; right: 8px; top: 8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #06b6d4);
  box-shadow: 0 0 12px rgba(139,92,246,0.6);
}
.tpl-preview-dark-glow .tp-name {
  color: #fff; font-weight: 800; font-size: 10px;
  background: linear-gradient(120deg, #06b6d4, #8b5cf6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tpl-preview-dark-glow .tp-line {
  height: 3px; background: rgba(255,255,255,0.15); margin-top: 6px; border-radius: 2px;
}
.tpl-preview-dark-glow .tp-line.short { width: 50%; }
.tpl-preview-ph-pride {
  background: #fff; display: flex; align-items: flex-start; flex-direction: column;
}
.tpl-preview-ph-pride .tp-stripe { height: 4px; width: 30%; margin-bottom: 2px; border-radius: 2px; }
.tpl-preview-ph-pride .tp-blue { background: #0038A8; }
.tpl-preview-ph-pride .tp-red { background: #CE1126; }
.tpl-preview-ph-pride .tp-yellow { background: #FCD116; }
.tpl-preview-ph-pride .tp-name { color: #0f172a; font-weight: 800; font-size: 10px; margin-top: 6px; }
.tpl-preview-ph-pride .tp-line { height: 3px; background: #e2e8f0; margin-top: 4px; border-radius: 2px; }
.tpl-preview-minimal {
  background: #FAFAFA; padding: 12px;
}
.tpl-preview-minimal .tp-name {
  font-family: serif; font-weight: 700; color: #171717; font-size: 11px;
}
.tpl-preview-minimal .tp-line { height: 3px; background: #d4d4d4; margin-top: 5px; border-radius: 2px; }
.tpl-preview-minimal .tp-line.short { width: 40%; }
.tpl-preview-sunset {
  background: linear-gradient(135deg, #FFF7ED 0%, #FCA5A5 100%);
  position: relative;
}
.tpl-preview-sunset .tp-orb {
  position: absolute; right: 12px; top: 8px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F97316, #DC2626);
}
.tpl-preview-sunset .tp-name { color: #1c1917; font-weight: 800; font-size: 10px; }
.tpl-preview-sunset .tp-line { height: 3px; background: rgba(28,25,23,0.15); margin-top: 6px; border-radius: 2px; }

/* Resume template previews */
.tpl-preview-r-modern { background: #fff; padding: 8px; }
.tpl-preview-r-modern .rp-bar { height: 4px; background: #0038A8; width: 40%; margin-bottom: 4px; }
.tpl-preview-r-modern .rp-name { font-weight: 800; color: #0f172a; font-size: 10px; }
.tpl-preview-r-modern .rp-head { height: 5px; background: #0038A8; margin: 5px 0 3px; width: 30%; }
.tpl-preview-r-modern .rp-line { height: 3px; background: #cbd5e1; margin-top: 3px; border-radius: 2px; }
.tpl-preview-r-classic { background: #fff; padding: 10px; text-align: center; }
.tpl-preview-r-classic .rp-name.center { font-family: serif; font-weight: 700; color: #000; font-size: 11px; }
.tpl-preview-r-classic .rp-rule { height: 2px; background: #000; margin: 4px auto; width: 60%; }
.tpl-preview-r-classic .rp-line { height: 3px; background: #d4d4d4; margin: 3px auto; border-radius: 2px; width: 80%; }
.tpl-preview-r-creative { background: #fff; padding: 0; position: relative; }
.tpl-preview-r-creative .rp-side { position: absolute; left: 0; top: 0; bottom: 0; width: 30%; background: #1e293b; }
.tpl-preview-r-creative .rp-name.shifted { margin-left: 35%; font-weight: 800; color: #0f172a; font-size: 10px; padding-top: 10px; }
.tpl-preview-r-creative .rp-line.shifted { margin-left: 35%; height: 3px; background: #cbd5e1; margin-top: 4px; border-radius: 2px; }
.tpl-preview-r-minimal { background: #fff; padding: 8px; }
.tpl-preview-r-minimal .rp-name.small { font-weight: 600; color: #0f172a; font-size: 9px; }
.tpl-preview-r-minimal .rp-line { height: 2px; background: #e5e7eb; margin-top: 3px; border-radius: 1px; }
.tpl-preview-r-minimal .rp-line.short { width: 50%; }

.tpl-name { font-size: 12px; font-weight: 700; color: var(--fg); }
.tpl-desc { font-size: 10px; color: var(--fg-muted); margin-top: 2px; }

/* === Floating AI button === */
.fab-ai {
  position: fixed;
  bottom: var(--s4); right: var(--s4);
  width: 56px; height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--ph-blue), var(--ph-red));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-lg);
  z-index: var(--z-sticky-fab);
  transition: transform 200ms ease;
}
.fab-ai:hover { transform: scale(1.05); }
.fab-ai:active { transform: scale(0.95); }

/* === Star nudge banner === */
.star-nudge {
  position: fixed;
  bottom: var(--s4);
  left: var(--s4);
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--s4);
  z-index: 70;
  display: flex;
  gap: var(--s3);
  animation: starSlideUp 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.star-nudge[hidden] { display: none; }
@keyframes starSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.star-nudge::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--ph-blue), var(--ph-red), var(--ph-yellow));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.star-close {
  position: absolute; top: 8px; right: 10px;
  font-size: 16px;
  color: var(--fg-muted);
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.star-close:hover { background: var(--bg-subtle); color: var(--fg); }
.star-icon {
  font-size: 32px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(252, 209, 22, 0.5));
}
.star-content { flex: 1; min-width: 0; padding-right: 16px; }
.star-content strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--fg);
}
.star-content p {
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: var(--s3);
  line-height: 1.5;
}
.star-actions {
  display: flex; gap: var(--s2);
  margin-bottom: 6px;
}
.star-actions .btn {
  font-size: 12px;
  padding: 6px 12px;
  min-height: 32px;
}
.star-stargazers {
  font-size: 11px;
  color: var(--fg-subtle);
}
@media (max-width: 640px) {
  .star-nudge {
    left: var(--s3);
    right: var(--s3);
    bottom: 80px;
    max-width: none;
  }
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: var(--s4);
  left: 50%; transform: translateX(-50%) translateY(150%);
  background: var(--fg); color: var(--bg);
  padding: var(--s3) var(--s5);
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  z-index: var(--z-toast);
  transition: transform 250ms ease;
  pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* === Focus rings === */
:focus-visible {
  outline: 2px solid var(--ph-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* === COMPREHENSIVE MOBILE RESPONSIVE === */
@media (max-width: 900px) {
  .nav-link { display: none; }
  .menu-btn { display: inline-flex; }
  .nav-row { gap: var(--s2); }
}
@media (max-width: 768px) {
  .container { padding: 0 var(--s3); }
  .hero { padding: var(--s5) 0 var(--s5); }
  .section { padding: var(--s6) 0; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: var(--s3); padding-top: var(--s4); }
  .try-row { flex-direction: column; }
  #try-send { width: 100%; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: var(--s2); }
  .hero-actions .btn { width: 100%; justify-content: center; }
  .ai-modes { padding-bottom: var(--s2); -webkit-overflow-scrolling: touch; gap: 6px; }
  .ai-mode-tab { min-width: 64px; padding: 6px 10px; min-height: 50px; }
  .ai-mode-emoji { font-size: 16px; }
  .ai-mode-label { font-size: 11px; }
  .endpoint-grid, .api-grid, .office-grid, .student-grid,
  .lang-grid, .builders-grid, .tools-grid, .office-skills-grid,
  .examples-grid, .steps-grid { grid-template-columns: 1fr !important; gap: var(--s3); }
  .builder-card, .office-card, .api-card, .student-card, .lang-card,
  .skill-card, .tool-card, .endpoint-card { padding: var(--s4); }
  .tpl-picker { grid-template-columns: 1fr 1fr; }
  iframe#p-preview, iframe#r-preview { height: 420px; }
  .ai-bubble { font-size: 14px; }
  .ai-chat { padding: var(--s2); }
  .ai-msg { gap: var(--s2); }
  .footer-row { flex-direction: column; gap: var(--s2); text-align: center; font-size: 12px; }
  .fab-ai { width: 48px; height: 48px; bottom: var(--s3); right: var(--s3); font-size: 18px; }
  .resume-form { gap: var(--s2); }
  .resume-form input, .resume-form textarea, .resume-form select { font-size: 16px; } /* prevents iOS zoom */
  .gpa-grid input, .gpa-grid select { font-size: 16px; }
  #curr-from-amount, #curr-from, #curr-to, #word-input, #cite-authors, #cite-year, #cite-title, #cite-source { font-size: 16px; }
  #hero-url, #try-endpoint, #ai-input { font-size: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--s3); }
  .hero { padding: var(--s4) 0 var(--s4); }
  .section { padding: var(--s5) 0; }
  .section-head { margin-bottom: var(--s4); }
  .hero-title { font-size: 30px; line-height: 1.12; }
  .hero-subtitle { font-size: 14px; }
  .section-title { font-size: 22px; }
  .section-subtitle { font-size: 13px; }
  .hero-pill { font-size: 11px; padding: 4px 10px; }
  .stat-num { font-size: 22px; }
  .stat-label { font-size: 11px; }
  .btn { padding: 12px 16px; font-size: 14px; }
  .ai-chip { font-size: 12px; padding: 6px 12px; min-height: 32px; }
  .nav-row { height: 56px; }
  .brand-flag { width: 24px; height: 18px; }
  .brand-name { font-size: 14px; }
  .nav-cta { padding: 6px 10px; min-height: 34px; }
  .nav-cta span { display: none; }
  iframe#p-preview, iframe#r-preview { height: 360px; }
  .ai-chat { min-height: 200px; max-height: 350px; }
  .gpa-grid { grid-template-columns: 1fr 60px 80px; gap: 6px; }
  .gpa-grid input, .gpa-grid select { font-size: 14px; padding: 6px 8px; min-height: 36px; }
  .curr-row { grid-template-columns: 1fr; gap: var(--s2); }
  .curr-swap { width: 36px; margin: 0 auto; }
  .pomo-display { font-size: 44px; }
  .ai-modes { flex-wrap: wrap; }
  .ai-mode-tab { flex: 1; min-width: 60px; max-width: calc(33% - 4px); }
  .api-cat-head { font-size: 12px; margin: var(--s5) 0 var(--s3); }
  .api-card-name { font-size: 14px; }
  .api-card-desc { font-size: 12px; line-height: 1.4; }
  .endpoint-head { flex-wrap: wrap; }
  .badge-new, .badge-ai { margin-left: 0; }
  .office-card .btn, .office-card.featured { padding: var(--s4); }
  .footer-row { padding: 0 var(--s3); }
  pre, code { font-size: 11px !important; }
  .example-card pre { padding: var(--s3); }
  .try-output { font-size: 10px; padding: var(--s3); }
  .hero-search { padding: 4px 4px 4px 10px; }
  .hero-search-method { font-size: 10px; padding: 3px 6px; }
  #hero-url { font-size: 11px; }
  .hero-copy-btn { padding: 6px 10px; min-height: 32px; font-size: 12px; }
  .skill-icon { width: 48px; height: 48px; font-size: 22px; }
}

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