.tool-hero {
  background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
  padding: 5rem 1.5rem 3rem;
  margin-top: 68px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tool-hero::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -150px;
  right: -100px;
}

.tool-hero::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -100px;
  left: -50px;
}

.tool-hero-content { position: relative; z-index: 1; }

.tool-hero-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.25rem;
  border: 1px solid rgba(255,255,255,0.2);
}

.tool-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  color: white;
  letter-spacing: -1px;
  margin-bottom: 0.75rem;
}

.tool-hero p {
  font-size: 1rem;
  color: rgba(255,255,255,0.75);
  max-width: 480px;
  margin: 0 auto;
}

.tool-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

.cgpa-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.cgpa-controls-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.semester-count-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.semester-count-input {
  width: 80px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  background: white;
}

.semester-count-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,56,202,0.08);
}

.semesters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.semester-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  border: 1.5px solid var(--border);
  transition: var(--transition);
}

.semester-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,56,202,0.06);
}

.semester-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.semester-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.semester-number {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.input-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.input-field {
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  background: var(--bg);
  width: 100%;
}

.input-field:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(67,56,202,0.06);
}

.input-field::placeholder { color: var(--text-light); }

.calculate-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

/* ── RESULT CARD ── */
.result-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: none;
}

.result-card.show { display: block; }

.result-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.result-card-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(67,56,202,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.result-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.result-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.result-metric {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.result-metric.primary {
  background: var(--gradient-primary);
  color: white;
}

.result-metric.primary .metric-label { color: rgba(255,255,255,0.75); }
.result-metric.primary .metric-value { color: white; }

.metric-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -1px;
  color: var(--text);
  display: block;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.metric-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-grade-bar {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

.grade-bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.grade-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.grade-bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.semester-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.semester-table th {
  background: var(--bg);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.semester-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.semester-table tr:last-child td { border-bottom: none; }

.semester-table tr:hover td { background: var(--bg); }

.grade-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
}

.grade-A { background: rgba(16,185,129,0.1); color: #059669; }
.grade-B { background: rgba(59,130,246,0.1); color: #2563eb; }
.grade-C { background: rgba(245,158,11,0.1); color: #d97706; }
.grade-D { background: rgba(239,68,68,0.1); color: #dc2626; }

@media (max-width: 640px) {
  .cgpa-controls { flex-direction: column; align-items: flex-start; }
  .semesters-grid { grid-template-columns: 1fr; }
  .result-metrics { grid-template-columns: 1fr 1fr; }
}
