body:has(.lgs-page) { background: #f1f1f1; }
.lgs-page { max-width: 900px; margin: auto; padding: 0 24px 48px; }
.lgs-page h1 { font-size: 36px; font-weight: 400; text-align: center; margin: 0 0 12px; }
.lgs-intro { text-align: center; color: #555; }
.lgs-model-note { background: #e8f1f9; border-radius: 8px; padding: 14px 18px; font-size: 14px; line-height: 1.7; }
.lgs-year { display: flex; gap: 16px; align-items: center; margin-top: 24px; }
.lgs-year label { margin: 0; }
.lgs-year select { width: 160px; min-height: 44px; font-size: 16px; }
.lgs-year-note { color: #666; font-size: 13px; line-height: 1.7; margin: 12px 0; }
#lgs-input-help { color: #666; font-size: 14px; margin: 24px 0 12px; }
.lgs-columns, .lgs-subject { display: grid; grid-template-columns: minmax(0, 1fr) 100px 100px 75px; gap: 14px; align-items: center; padding: 14px 20px; background: white; border: 1px solid #e2e2e2; border-top: 0; }
.lgs-columns { border-top: 1px solid #e2e2e2; border-radius: 8px 8px 0 0; color: #666; font-size: 13px; }
.lgs-columns span:last-child { text-align: right; }
.lgs-subject-name { font-size: 15px; overflow-wrap: anywhere; }
.lgs-subject-name small { display: block; font-size: 12px; color: #666; margin-top: 4px; }
.lgs-answer label { display: none; }
.lgs-answer input { height: 44px; font-size: 16px; }
.lgs-net { text-align: right; font-weight: 600; }
.lgs-row-error { grid-column: 1 / -1; color: #a52121; font-size: 13px; margin: 0; }
.lgs-answer input[aria-invalid="true"] { border-color: #a52121; }
.lgs-total { margin: 0; padding: 16px 20px; background: white; border: 1px solid #e2e2e2; border-top: 0; border-radius: 0 0 8px 8px; }
.lgs-total output { font-weight: 600; }
.lgs-total .lgs-total-value { margin-left: 12px; font-size: inherit; color: inherit; }
.lgs-total span { color: #666; font-size: 13px; }
.lgs-actions { display: flex; gap: 12px; justify-content: center; margin: 24px 0; }
.lgs-actions .btn { min-height: 44px; padding: 10px 28px; }
#lgs-error { color: #a52121; margin: 16px 0; }
.lgs-result { background: white; border: 1px solid #337ab7; border-radius: 8px; padding: 24px; margin: 28px 0; text-align: center; scroll-margin-top: 110px; }
.lgs-result h2 { font-size: 20px; margin: 0 0 12px; }
.lgs-score { margin: 0 0 20px; }
/* Safari can place inline-block output text above neighboring inline text. */
.lgs-total output, .lgs-score output { display: inline; vertical-align: baseline; }
.lgs-score output { color: #337ab7; font-size: 44px; font-weight: 600; }
.lgs-score span { margin-left: 8px; color: #666; }
.lgs-result-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 20px; }
.lgs-result-summary dt { font-size: 13px; color: #666; font-weight: 400; }
.lgs-result-summary dd { font-size: 20px; margin: 4px 0 0; }
.lgs-result > p:last-child { font-size: 13px; color: #666; margin: 0; }
.lgs-explanation { margin-top: 40px; line-height: 1.8; }
.lgs-explanation h2 { font-size: 21px; margin: 28px 0 12px; }
.lgs-sources { font-size: 13px; }
.lgs-page [hidden] { display: none !important; }
@media (max-width: 600px) {
  .lgs-page { padding: 0 16px 36px; }
  .lgs-page h1 { font-size: 28px; }
  .lgs-columns, .lgs-subject { grid-template-columns: minmax(0, 1fr) 64px 64px 48px; gap: 8px; padding: 12px; }
  .lgs-subject-name, .lgs-net { font-size: 13px; }
  .lgs-answer input { padding: 8px; }
  .lgs-answer label { display: block; font-size: 11px; color: #666; margin-bottom: 4px; }
  .lgs-columns { display: none; }
  .lgs-columns + .lgs-subject { border-top: 1px solid #e2e2e2; border-radius: 8px 8px 0 0; }
  .lgs-result { padding: 20px 12px; }
  .lgs-result-summary { gap: 6px; }
}
