:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #233044;
  background: #f4f6f8;
  font-synthesis: none;
  --blue: #2563eb;
  --green: #16804a;
  --orange: #b66108;
  --red: #d33438;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
main { max-width: 1192px; margin: 0 auto; padding: 64px 32px 28px; }
.page-header { margin: 0 0 32px; }
.eyebrow { margin: 0 0 12px; color: #627184; font-size: 12px; font-weight: 650; letter-spacing: 1.65px; line-height: 1.6; }
.page-header .eyebrow { color: #526a85; }
h1 { margin: 0; font-size: clamp(30px, 3.4vw, 44px); font-weight: 650; letter-spacing: -1.3px; line-height: 1.18; }
h2 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -0.45px; line-height: 1.3; }
.calculator { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(285px, 1fr); background: #fff; border: 1px solid #dce3eb; border-radius: 20px; overflow: hidden; box-shadow: 0 9px 35px #23304405; }
.input-panel { padding: 34px; min-width: 0; }
.form-note { margin: 10px 0 30px; color: #657183; font-size: 16px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 1.3fr) minmax(0, 1fr); gap: 25px 20px; }
.field { min-width: 0; }
label { display: block; margin: 0 0 9px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.unit { color: #627184; font-weight: 400; }
input, select {
  display: block; width: 100%; height: 54px; padding: 0 36px 0 14px;
  border: 1px solid #cbd5df; border-radius: 9px; background-color: #fff; color: #253247;
  font-size: 18px;
}
input { padding-right: 14px; }
input::placeholder { color: #8290a1; }
select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%2367778b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
option { font-size: 18px; }
input:hover, select:hover { border-color: #889aaf; }
:focus-visible { outline: 3px solid #90b6ff; outline-offset: 3px; }
input:focus-visible, select:focus-visible { border-color: #2563eb; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
.field-error { color: #b42b32; font-size: 14px; line-height: 1.4; margin: 7px 0 0; }
.field-error:empty { display: none; }
.form-alert { color: #a3232b; background: #fff1f1; border-radius: 8px; font-size: 15px; line-height: 1.5; padding: 12px 14px; margin: 24px 0 0; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 34px; }
button { border: 0; border-radius: 9px; cursor: pointer; font-size: 17px; font-weight: 600; line-height: 1.2; min-height: 52px; }
.primary-button { display: flex; align-items: center; justify-content: center; gap: 30px; padding: 0 22px; color: #fff; background: #263f5d; }
.primary-button:hover { background: #19304c; }
.primary-button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary-button span { font-size: 22px; font-weight: 400; }
.reset-button { padding: 0 14px; color: #5c6b7d; background: transparent; }
.reset-button:hover { background: #eff3f7; color: #233044; }
.result-panel { display: flex; align-items: center; justify-content: center; text-align: center; padding: 35px 30px; background: #fafbfd; border-left: 1px solid #e3e8ef; min-width: 0; }
.result-content { width: 100%; }
.result-panel .eyebrow { margin-bottom: 8px; }
.result-panel h2 { font-size: 23px; }
.empty-symbol { margin: 33px 0 22px; color: #bac5d2; font-size: 68px; font-weight: 300; line-height: 1; }
.result-help { margin: 0 auto; color: #617083; font-size: 16px; line-height: 1.65; max-width: 270px; }
.stage-output { margin: 34px 0 24px; display: flex; align-items: baseline; justify-content: center; gap: 14px; color: var(--stage); }
.stage-output span { font-size: 26px; font-weight: 500; }
.stage-output strong { font-size: 86px; font-weight: 650; line-height: 1; letter-spacing: -3px; }
.stage-A { --stage: var(--blue); --tint: #eaf1ff; }
.stage-B { --stage: var(--green); --tint: #e7f5ee; }
.stage-C { --stage: var(--orange); --tint: #fff1df; }
.stage-D { --stage: var(--red); --tint: #ffebec; }
.possible-label { color: #617083; font-size: 16px; margin: 30px 0 14px; }
.stage-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 24px; }
.stage-chip { padding: 10px 15px; border-radius: 8px; background: var(--tint); color: var(--stage); font-size: 20px; font-weight: 650; line-height: 1.4; white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -100px; padding: 12px; background: white; color: #233044; border-radius: 6px; z-index: 2; }
.skip:focus { top: 12px; }
@media (max-width: 1000px) {
  main { padding: 45px 24px 24px; }
  .calculator { grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr); }
  .input-panel { padding: 28px; }
  .result-panel { padding: 30px 24px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-psa, .field-grade { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  main { padding: 30px 20px 22px; }
  .page-header { margin-bottom: 24px; }
  .page-header .eyebrow { max-width: 310px; font-size: 11px; letter-spacing: 1.1px; }
  h1 { max-width: 440px; font-size: 34px; letter-spacing: -1px; }
  .calculator { grid-template-columns: 1fr; border-radius: 15px; }
  .input-panel { padding: 25px 22px 28px; }
  h2 { font-size: 23px; }
  .form-note { margin-bottom: 26px; }
  .form-grid { gap: 23px 16px; }
  .form-actions { gap: 10px; margin-top: 29px; }
  .primary-button { gap: 20px; padding: 0 17px; }
  .result-panel { padding: 28px 24px; border-left: 0; border-top: 1px solid #e3e8ef; min-height: 253px; }
  .empty-symbol { margin-top: 25px; }
  .stage-output { margin: 25px 0 19px; }
  .stage-output strong { font-size: 76px; }
  .result-help { max-width: 100%; }
  .stage-chips { gap: 9px; }
  .stage-chip { padding: 9px 13px; }
}
@media (max-width: 360px) {
  main { padding-left: 14px; padding-right: 14px; }
  .input-panel { padding: 24px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { gap: 8px; }
  .primary-button { gap: 8px; padding: 0 12px; white-space: nowrap; }
  .reset-button { padding: 0 6px; }
}
@media print {
  :root { background: #fff; }
  main { padding: 0; }
  .calculator { box-shadow: none; }
  .form-actions, .skip { display: none; }
}
