:root {
    --primary-color: #2a9d8f;
    --secondary-color: #e9c46a;
    --bg-color: #f8f9fa;
    --card-bg-color: #ffffff;
    --text-color: #343a40;
    --light-text-color: #6c757d;
    --border-color: #dee2e6;
    --success-color: #2a9d8f;
    --warning-color: #f4a261;
    --danger-color: #e76f51;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ap-bio-calculator-container {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
    margin: 2rem auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.ap-bio-form fieldset {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.ap-bio-form legend {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    padding: 0 0.5rem;
    margin-left: 1rem;
}

.fieldset-description {
    font-size: 0.9rem;
    color: var(--light-text-color);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.input-wrapper {
    display: flex;
    align-items: center;
}

.input-wrapper input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.2);
}

.input-wrapper .max-value {
    margin-left: 0.75rem;
    font-size: 0.9rem;
    color: var(--light-text-color);
    white-space: nowrap;
}

.tooltip {
    display: inline-block;
    cursor: help;
    color: var(--light-text-color);
    font-weight: normal;
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 125%;
    background-color: var(--text-color);
    color: white;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    width: 200px;
    text-align: center;
    z-index: 10;
}

.frq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-calculate, .btn-reset {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-calculate {
    flex-grow: 1;
    background-color: var(--primary-color);
    color: white;
}

.btn-calculate:hover {
    background-color: #248b7f;
}

.btn-reset {
    background-color: transparent;
    color: var(--light-text-color);
    border: 1px solid var(--border-color);
}

.btn-reset:hover {
    background-color: #e9ecef;
}

.results-container {
    margin-top: 2.5rem;
    animation: fadeIn 0.5s ease-in-out;
}

.results-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2rem;
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.final-score-container {
    text-align: center;
}

.final-score-container p {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.final-score {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-color);
}

.composite-score-details {
    flex-grow: 1;
}

.composite-score-details p {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--warning-color), var(--success-color));
    border-radius: 10px;
    transition: width 1s ease-out;
}

.score-key {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--light-text-color);
    padding: 0 5px;
    margin-top: 0.25rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.result-card {
    background-color: var(--card-bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.result-card.full-width {
    grid-column: 1 / -1;
}

.result-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.chart-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.doughnut-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(var(--secondary-color) 0% 50%, var(--primary-color) 50% 100%);
    transition: background 1s ease-in-out;
    flex-shrink: 0;
}

.doughnut-chart::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    background: var(--card-bg-color);
    border-radius: 50%;
}

.doughnut-legend {
    font-size: 0.9rem;
}

.doughnut-legend div {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.doughnut-legend span {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 0.5rem;
}

.points-details p {
    margin: 0.8rem 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
}

.points-details strong {
    color: var(--text-color);
}

#insightsText {
    margin: 0;
    line-height: 1.6;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .ap-bio-calculator-container {
        padding: 1rem;
    }
    .frq-grid, .results-grid {
        grid-template-columns: 1fr;
    }
    .results-summary {
        flex-direction: column;
        text-align: center;
    }
    .chart-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .points-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 0.8rem;
    }
    .points-details p:last-child {
        border-bottom: none;
    }
}








  /* MOBILE STYLES (DEFAULT) */
  .score-table-container {
    margin: 1rem 0;
    font-family: Arial, sans-serif;
    max-width: 100%;
    overflow-x: auto;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
  }

  /* Card-like layout for mobile */
  @media (max-width: 767px) {
    table, thead, tbody, th, td, tr {
      display: block;
    }

    thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }

    tr {
      margin-bottom: 1rem;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
      padding: 0.75rem;
      background-color: #f8f9fa;
    }

    td {
      border: none;
      border-bottom: 1px solid #e9ecef;
      position: relative;
      padding-left: 45%;
      text-align: right;
      padding-top: 0.5rem;
      padding-bottom: 0.5rem;
    }

    td:before {
      content: attr(data-label);
      position: absolute;
      left: 0.75rem;
      width: 40%;
      font-weight: 600;
      color: #495057;
      text-align: left;
    }

    td:last-child {
      border-bottom: none;
    }
  }

  /* DESKTOP STYLES */
  @media (min-width: 768px) {
    table {
      box-shadow: 0 0 12px rgba(0, 0, 0, 0.08);
      border-radius: 8px;
      overflow: hidden;
    }

    th {
      background-color: #2c3e50;
      color: white;
      padding: 12px 16px;
      text-align: center;
      font-weight: 600;
    }

    td {
      padding: 10px 16px;
      text-align: center;
      border-bottom: 1px solid #dee2e6;
    }

    tr:nth-child(even) {
      background-color: #f8f9fa;
    }

    tr:hover {
      background-color: #e9ecef;
    }

    tr:last-child td {
      border-bottom: none;
    }
  }

  /* FOOTNOTE STYLES */
  .table-footnote {
    display: block;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
    line-height: 1.5;
  }