:root {
  --bg: #0a0d11;
  --surface: #10151b;
  --surface-alt: #161c24;
  --border: #212933;
  --text-primary: #eef2f5;
  --text-secondary: #6b7785;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.14);
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --violet-soft: rgba(139, 92, 246, 0.14);
  --gradient: linear-gradient(90deg, var(--cyan), var(--violet));
  --radius: 14px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
 
  overflow-x: hidden;
}

button {
  font-family: inherit;
}

button:focus-visible,
.gpa-handle:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  font-size: 0.72rem;
  margin: 0 0 1rem;
}

.landing {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1.5rem;
}

.landing-content {
  position: relative;
}

.landing-content::before {
  display: none;
}

.landing-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 4.5rem);
  letter-spacing: 0.04em;
  color: var(--text-primary);
  white-space: nowrap;
  margin: 0;
}

.enter-btn {
  margin-top: clamp(1.8rem, 5vw, 2.5rem);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--green);
  cursor: pointer;
  transition: all 0.25s ease;
}

.enter-btn:hover {
  background: rgba(52, 211, 153, 0.15);
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.15);
}

.enter-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

#matrixCanvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  background: var(--bg);
  transition: opacity 0.7s ease;
}

#matrixCanvas.visible {
  opacity: 1;
}

.main-page {
  opacity: 0;
  transition: opacity 0.6s ease;
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 5vw, 3rem) 5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.main-page.visible {
  opacity: 1;
}

.main-header {
  position: relative;
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.main-header::before {
  display: none;
}

.main-header::before {
  content: "";
  position: absolute;
  top: -40px;
  left: 50%;
  width: 560px;
  height: 320px;
  max-width: 100vw;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--violet-soft), transparent 70%);
  filter: blur(30px);
  z-index: -1;
}

.main-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  margin: 0;
  letter-spacing: -0.01em;
}

.main-subtitle {
  color: var(--text-secondary);
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 1.5rem;
}

.step-no {
  color: var(--cyan);
  font-size: 0.8rem;
}

.gpa-section {
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.gpa-track {
  position: relative;
  height: 64px;
  margin: 0 clamp(0.5rem, 3vw, 1.5rem);
}

.track-base {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  transform: translateY(-50%);
}

.track-fill {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--gradient);
  border-radius: 2px;
  transform: translateY(-50%);
  transition: width 0.35s ease;
}

.drag-hitarea {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 0;
  right: 0;
  height: 40px;
  transform: translateY(-50%);
  cursor: pointer;
  touch-action: none;
}

.gpa-points {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.gpa-point {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  transform: translateX(-50%);
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  cursor: pointer;
  touch-action: none;
}

.gpa-point .dot {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: all 0.25s ease;
}

.gpa-point:hover:not(.active) .dot {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.45);
}

.gpa-point.active .dot {
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
}

.gpa-point .label {
  position: absolute;
  top: calc(50% + 18px);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.25s ease;
}

.gpa-point.active .label {
  color: var(--text-primary);
}


.gpa-handle {
  display: none !important;
}

.gpa-hint {
  display: none;
}

.mode-section,
.subjects-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}

.mode-section.visible,
.subjects-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.mode-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 560px) {
  .mode-buttons {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.mode-btn:hover {
  border-color: var(--violet);
}

.mode-btn.active {
  border-color: var(--violet);
  background: var(--violet-soft);
  box-shadow: 0 0 0 1px var(--violet);
}

.mode-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.mode-desc {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  font-size: 0.85rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tab:hover {
  border-color: var(--cyan);
}

.tab.active {
  border-color: var(--cyan);
  color: var(--text-primary);
}

.credit-badge {
  display: none !important;
}

.tab.active .credit-badge {
  color: var(--cyan);
  border-color: var(--cyan);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0;
}

.panel-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.grade-chip {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--violet);
  background: var(--violet-soft);
  border: 1px solid var(--violet);
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.stat-card {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-value small {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-left: 0.15rem;
  font-weight: 400;
}

.stat-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 2px;
}

.panel-note {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.center-row-wrapper {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  width: 100%;
}

.center-row-wrapper .stat-card {
  width: 100%;
  max-width: calc(33.333% - 1rem); 
}

@media (max-width: 800px) {
  .center-row-wrapper {
    flex-direction: column;
  }
  .center-row-wrapper .stat-card {
    max-width: 100%;
  }
}

.mid-width-wrapper {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  width: 100%;
}

.mid-width-wrapper .stat-card {
  width: 100%;
  max-width: 55%;
}

@media (max-width: 800px) {
  .mid-width-wrapper .stat-card {
    max-width: 100%;
  }
}

/* --- Mobile Layout Fix --- */
@media (max-width: 768px) {
  /* Forces the grid to stack items vertically on mobile */
  .stat-grid {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Ensures every single card takes up the full width of the screen */
  .stat-card,
  .mid-width-wrapper .stat-card,
  .center-row-wrapper .stat-card,
  .full-width-wrapper .stat-card {
    width: 100% !important;
    max-width: 100% !important;
  }
}