*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  body {
  font-family: 'Poppins', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

  /* Background grid */
  

  

.wrap {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 80px;
  flex: 1;
}


  /* Header */
  header {
    text-align: center;
    padding: 56px 0 40px;
  }

  .badge {
    display: inline-block;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 100px;
    margin-bottom: 20px;
  }

  h1 {
    font-family: 'Syne', sans-serif;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 30%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
  }

  .subtitle {
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 300;
  }

  /* Mode Switcher */
  .mode-switch {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin: 0 auto 32px;
    max-width: 360px;
  }

  .mode-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .mode-btn.active {
    background: white;
    color: black;
    box-shadow: 0 4px 16px rgba(255,255,255,0.35);
  }

  /* Cards */
  .card {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);

    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 28px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
  }

  .card:hover { border-color: rgba(255,255,255,0.3); }

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

  .card-title {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sem-badge {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 3px 10px;
    border-radius: 100px;
    font-weight: 500;
  }

  /* Selects & Inputs */
  .select-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
  }

  @media(max-width:500px) { .select-row { grid-template-columns: 1fr; } }

  label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 7px;
    font-family: 'DM Mono', monospace;
  }

  select, input[type="number"], input[type="text"] {
    width: 100%;
    max-width: 100%;
    background: rgba(30, 35, 45, 0.6);
    border: 1px solid rgba(100, 120, 150, 0.3);
    border-radius: 12px;
    color: #e0e6ed;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    padding: 11px 14px;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238899aa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
  }

  select:hover, input:hover {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(45, 30, 30, 0.7);
  }

  select:focus, input:focus {
    border-color: #ef4444;
    background: rgba(55, 35, 35, 0.8);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25), inset 0 2px 4px rgba(0,0,0,0.1);
  }

  select option { background: #1a1f26; color: #e0e6ed; }

  /* Subject table */
  .subjects-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
  }

  .subjects-table th {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 12px 12px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
  }

  .subjects-table th:last-child { text-align: center; }

  .subjects-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(51,51,51,0.6);
    vertical-align: middle;
  }

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

  .subject-name {
    font-size: 13.5px;
    font-weight: 500;
    color: white;
    line-height: 1.4;
  }

  .subject-code {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
  }

  #subjects-container {
    width: 100%;
    overflow-x: auto;
  }

  .credit-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(50,50,50,0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    width: 40px;
    height: 32px;
  }

  .edit-input {
    width: 100%;
    background: rgba(30, 40, 50, 0.4);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-main);
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
  }
  .edit-input:focus {
    border-color: #ef4444;
    outline: none;
    background: rgba(40, 50, 60, 0.6);
  }

  .action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
  }
  .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
  }
  .action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
  }
  .action-btn.save-btn {
    color: #34d399; /* Green for save */
  }
  .action-btn.save-btn:hover {
    background: rgba(52, 211, 153, 0.15);
  }

  .grade-select {
    min-width: 100px;
    padding: 8px 32px 8px 12px;
    font-size: 13px;
  }

  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-primary {
    background: linear-gradient(135deg, #ffffff 0%, #e60000 100%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #111;
    font-weight: 700;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(230, 0, 0, 0.4);
}

  .btn-primary:hover {
    background: linear-gradient(135deg, #ffffff 0%, #ff3333 100%);
    color: #000;
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 8px 25px rgba(230, 0, 0, 0.6);
    transform: translateY(-2px);
}

  .btn-ghost {
    background: rgba(40,40,40,0.5);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
  }

  .btn-ghost:hover { border-color: white; color: white; }

  .btn-danger {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--neon-red);
    padding: 8px 14px;
    font-size: 13px;
  }

  .btn-danger:hover { background: rgba(255,255,255,0.2); }

  .btn-add {
    background: rgba(230, 0, 0, 0.1);
    border: 1px solid rgba(230, 0, 0, 0.4);
    color: #ff6666;
    padding: 10px 20px;
    font-size: 13px;
  }

  .btn-add:hover { 
    background: rgba(230, 0, 0, 0.2);
    border-color: #ff3333;
    color: #ffffff;
  }

  .actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .actions-left { display: flex; gap: 10px; flex-wrap: wrap; }

  /* Result display */
  .result-box {
    background: linear-gradient(135deg, rgba(40,40,40,0.5), rgba(50,50,50,0.5));
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 24px;
    padding: 28px;
    margin-top: 24px;
    display: none;
  }

  .result-box.visible { display: block; animation: fadeUp 0.4s ease; }

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

  .result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
  }

  .result-item {
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 18px 20px;
    text-align: center;
  }

  .result-label {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
  }

  .result-value {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
  }

  .result-value.blue { color: white; }
  .result-value.green { color: #3ecf8e; }
  .result-value.gold { color: #f0c040; }

  .grade-bar {
    margin-top: 16px;
    background: transparent;
    border-radius: 100px;
    height: 6px;
    overflow: hidden;
  }

  .grade-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    background: linear-gradient(90deg, #ffffff 0%, #e60000 100%);
    box-shadow: 0 0 10px rgba(230, 0, 0, 0.5);
  }

  /* CGPA Mode */
  .sem-entry {
    background: rgba(40,40,40,0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: auto 1fr 1fr auto;
    gap: 14px;
    align-items: center;
  }

  .sem-num {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: var(--text-muted);
    min-width: 60px;
    font-weight: 500;
  }

  /* Standing tag */
  .standing {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Mono', monospace;
    letter-spacing: 0.5px;
    margin-top: 10px;
  }

  .standing-ex { background: rgba(255,255,255,0.15); color: #f0c040; border: 1px solid rgba(255,255,255,0.3); }
  .standing-good { background: rgba(255,255,255,0.12); color: #3ecf8e; border: 1px solid rgba(255,255,255,0.25); }
  .standing-avg { background: rgba(255,255,255,0.12); color: white; border: 1px solid rgba(255,255,255,0.25); }
  .standing-low { background: rgba(255,255,255,0.12); color: var(--neon-red); border: 1px solid rgba(255,255,255,0.25); }

  /* Info strip */
  .info-strip {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .info-strip svg { flex-shrink: 0; color: white; }

  /* Grade table */
  .grade-ref {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
  }

  .grade-chip {
    background: rgba(40,40,40,0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
  }

  .grade-chip .gname { color: white; font-weight: 500; font-size: 14px; }
  .grade-chip .gpoint { color: var(--text-muted); }



/* Make body a flex container to push footer down */
html, body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

  /* Utility */
  .hidden { display: none !important; }
  .mt12 { margin-top: 12px; }
  .mb0 { margin-bottom: 0; }

  /* Animated pulse on calc button */
  .btn-primary:active { transform: scale(0.97); }

  /* No subjects state */
  .empty-state {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 13px;
  }

  /* Semester tag colors */
  .sem-s1 { background: rgba(255,255,255,0.15); color: #ffffff; }
  .sem-s2 { background: rgba(204,204,204,0.15); color: #cccccc; }
  .sem-s3 { background: rgba(255,255,255,0.15); color: #ffffff; }
  .sem-s4 { background: rgba(255,255,255,0.15); color: #ffffff; }
  .sem-s5 { background: rgba(255,255,255,0.15); color: #ffffff; }
  .sem-s6 { background: rgba(255,255,255,0.15); color: #ffffff; }
  .sem-s7 { background: rgba(204,204,204,0.15); color: #cccccc; }
  .sem-s8 { background: rgba(255,255,255,0.15); color: #ffffff; }

  @media (max-width: 600px) {
    .sem-entry {
      grid-template-columns: auto 1fr;
      grid-template-rows: auto auto;
    }
    .sem-entry .btn-danger { grid-column: 2; }
    
    /* Convert table to cards on mobile */
    .subjects-table thead {
      display: none;
    }
    .subjects-table tbody, .subjects-table tr {
      display: block;
      width: 100%;
    }
    .subjects-table tr {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      padding: 16px;
      margin-bottom: 16px;
      position: relative;
    }
    .subjects-table td {
      display: block;
      width: 100% !important;
      border: none;
      padding: 6px 0;
      text-align: left !important;
    }
    /* Cell 1: Subject Name */
    .subjects-table td:nth-child(1) {
      padding-right: 55px; /* space for credit chip */
      margin-bottom: 8px;
    }
    /* Cell 2: Credits */
    .subjects-table td:nth-child(2) {
      position: absolute;
      top: 16px;
      right: 16px;
      width: auto !important;
      padding: 0;
    }
    /* Cell 3: Grade Select */
    .subjects-table td:nth-child(3) {
      margin-bottom: 4px;
    }
    /* Cell 4: Actions */
    .subjects-table td:nth-child(4) {
      text-align: right !important;
      padding-top: 8px;
      border-top: 1px dashed rgba(255, 255, 255, 0.1);
    }
    
    .card {
      padding: 20px 16px;
    }
    
    .select-row {
      grid-template-columns: 1fr;
    }
  }