:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --navy: #17324d;
  --navy-deep: #10273d;
  --teal: #0a7d78;
  --teal-soft: #dff4f0;
  --amber: #e8a12d;
  --amber-soft: #fff2d8;
  --ink: #17212b;
  --muted: #617081;
  --line: #d9e1e8;
  --paper: #ffffff;
  --canvas: #f2f5f7;
  --danger: #a6382f;
  --shadow: 0 18px 48px rgb(23 50 77 / 10%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgb(10 125 120 / 12%), transparent 28rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding:
    max(28px, env(safe-area-inset-top))
    max(0px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(0px, env(safe-area-inset-left));
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 26px 8px 30px;
}

.eyebrow,
.step-label,
.score-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 8px 0 6px;
  color: var(--navy);
  font-size: clamp(2.1rem, 5vw, 4.35rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 650;
}

.privacy-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  color: var(--teal);
  border: 1px solid rgb(10 125 120 / 25%);
  border-radius: 999px;
  background: var(--teal-soft);
  font-weight: 750;
}

.privacy-badge span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--teal);
}

.calculator-card,
.result-card {
  margin-bottom: 18px;
  border: 1px solid rgb(23 50 77 / 8%);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.calculator-card {
  padding: clamp(22px, 4vw, 38px);
  background: var(--paper);
}

.section-heading,
.result-topline,
.score-header,
.result-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

h2 {
  margin: 4px 0 0;
  color: var(--navy);
  font-size: clamp(1.35rem, 2.8vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.limit-copy {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 26px;
}

.course-button,
.choice-button {
  display: flex;
  min-height: 88px;
  padding: 18px 22px;
  color: var(--navy);
  border: 2px solid var(--line);
  border-radius: 20px;
  background: white;
  cursor: pointer;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.course-button span,
.choice-button span {
  font-size: 1.25rem;
  font-weight: 850;
}

.course-button small,
.choice-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.92rem;
}

.course-button:hover,
.choice-button:hover {
  transform: translateY(-2px);
  border-color: rgb(10 125 120 / 40%);
}

.course-button.is-active,
.choice-button.is-active {
  color: white;
  border-color: var(--navy);
  background: var(--navy);
}

.course-button.is-active small,
.choice-button.is-active small {
  color: rgb(255 255 255 / 72%);
}

.course-button:focus-visible,
.choice-button:focus-visible,
.compact-button:focus-visible,
.known-button:focus-visible,
.select-field select:focus-visible,
.text-button:focus-visible,
.stepper button:focus-visible,
.stepper input:focus-visible {
  outline: 4px solid rgb(232 161 45 / 45%);
  outline-offset: 3px;
}

.text-button {
  min-height: 48px;
  padding: 8px 12px;
  color: var(--teal);
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.text-button:hover {
  background: var(--teal-soft);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.score-input-card {
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fbfcfd;
}

.score-header label {
  display: block;
  margin-top: 3px;
  color: var(--navy);
  font-size: 1.25rem;
  font-weight: 850;
}

.score-kicker {
  font-size: 0.72rem;
}

.weight-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.weight-dot--oral {
  background: var(--teal);
  box-shadow: 0 0 0 8px var(--teal-soft);
}

.weight-dot--written {
  background: var(--amber);
  box-shadow: 0 0 0 8px var(--amber-soft);
}

.stepper {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  gap: 10px;
  margin-top: 22px;
}

.stepper button,
.stepper input {
  min-height: 66px;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stepper button {
  color: var(--navy);
  background: white;
  cursor: pointer;
  font-size: 1.75rem;
  font-weight: 500;
}

.stepper button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.stepper input {
  width: 100%;
  padding: 8px 10px;
  color: var(--navy);
  background: white;
  text-align: center;
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 850;
}

.stepper input::placeholder {
  color: #9ba8b4;
}

.stepper input[aria-invalid="true"] {
  color: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgb(166 56 47 / 12%);
}

.input-help,
.input-message {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.input-message {
  min-height: 24px;
  margin-top: 18px;
  font-weight: 700;
}

.input-message.is-error {
  color: var(--danger);
}

[hidden] {
  display: none !important;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.option-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.option-group legend,
.select-field span,
.combination-area h3 {
  display: block;
  margin: 0 0 9px;
  color: var(--navy);
  font-size: 0.92rem;
  font-weight: 800;
}

.compact-segmented,
.known-options {
  display: grid;
  gap: 8px;
}

.compact-segmented {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.known-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-button,
.known-button {
  min-height: 54px;
  padding: 10px 12px;
  color: var(--navy);
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  font-weight: 800;
}

.compact-button:hover,
.known-button:hover {
  border-color: rgb(10 125 120 / 48%);
}

.compact-button.is-active,
.known-button.is-active {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

.select-field {
  display: block;
}

.select-field select {
  width: 100%;
  min-height: 54px;
  padding: 10px 40px 10px 14px;
  color: var(--navy);
  border: 2px solid var(--line);
  border-radius: 14px;
  background: white;
  font-weight: 800;
}

.known-group {
  margin-top: 24px;
}

.target-known-card {
  width: min(100%, 520px);
  margin-top: 18px;
}

.target-result-card {
  background:
    linear-gradient(135deg, rgb(255 255 255 / 7%), transparent 45%),
    var(--navy-deep);
}

.target-result-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: clamp(26px, 5vw, 42px) 0;
}

.target-headline {
  max-width: 760px;
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 3.35rem);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.target-total {
  display: flex;
  flex: 0 0 auto;
  min-width: 170px;
  min-height: 140px;
  padding: 18px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 24px;
  background: rgb(255 255 255 / 9%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.target-total strong {
  font-size: clamp(2.7rem, 7vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.target-total span {
  margin-top: 6px;
  color: rgb(255 255 255 / 68%);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.target-details {
  display: grid;
  gap: 8px;
}

#target-formula {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  font-weight: 760;
}

#target-raw-value,
#target-range {
  color: rgb(255 255 255 / 76%);
  font-size: 0.92rem;
}

.combination-area,
.grade-disclaimer {
  position: relative;
  z-index: 1;
}

.combination-area {
  margin-top: 26px;
}

.combination-area h3 {
  color: white;
  font-size: 1.05rem;
}

.combination-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.combination-list li {
  padding: 13px 15px;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 14px;
  background: rgb(255 255 255 / 8%);
  font-weight: 700;
}

.combination-area details {
  margin-top: 14px;
}

.combination-area summary {
  width: fit-content;
  min-height: 48px;
  padding: 13px 2px;
  color: #8cddd5;
  cursor: pointer;
  font-weight: 800;
}

.combination-list--all {
  max-height: 320px;
  margin-top: 8px;
  padding-right: 4px;
  overflow-y: auto;
}

.grade-disclaimer {
  margin: 24px 0 0;
  color: rgb(255 255 255 / 66%);
  font-size: 0.86rem;
  line-height: 1.5;
}

.result-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 46px);
  color: white;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 7%), transparent 45%),
    var(--navy);
}

.result-card::after {
  position: absolute;
  right: -70px;
  bottom: -110px;
  width: 280px;
  height: 280px;
  border: 42px solid rgb(10 125 120 / 28%);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.result-topline,
.result-content,
.calculation-strip {
  position: relative;
  z-index: 1;
}

.step-label--light {
  color: #8cddd5;
}

.result-card h2 {
  color: white;
}

.result-course {
  padding: 8px 13px;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  font-weight: 800;
}

.result-content {
  margin: clamp(26px, 5vw, 42px) 0;
}

.result-primary {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.result-number {
  font-size: clamp(4.5rem, 14vw, 8.5rem);
  font-weight: 900;
  line-height: 0.8;
  letter-spacing: -0.075em;
}

.result-unit {
  color: rgb(255 255 255 / 72%);
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  font-weight: 750;
}

.result-grade-wrap {
  display: flex;
  min-width: 140px;
  min-height: 140px;
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 50%;
  background: rgb(255 255 255 / 9%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.result-grade-label {
  color: rgb(255 255 255 / 68%);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-grade {
  margin-top: -2px;
  font-size: 4rem;
  line-height: 1;
}

.calculation-strip {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgb(0 0 0 / 16%);
}

.calculation-strip p {
  margin: 0;
}

#result-formula {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 750;
}

#rounding-note {
  margin-top: 6px;
  color: rgb(255 255 255 / 68%);
  font-size: 0.88rem;
}

.result-card.is-empty .result-content,
.result-card.is-empty .calculation-strip {
  opacity: 0.52;
}

footer {
  padding: 14px 8px 0;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
  font-weight: 650;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1120px);
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .privacy-badge {
    align-self: stretch;
    justify-content: center;
  }

  .input-grid {
    grid-template-columns: 1fr;
  }

  .target-grid {
    grid-template-columns: 1fr;
  }

  .result-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .target-result-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .target-total {
    min-width: 150px;
    min-height: 120px;
  }

  .combination-list {
    grid-template-columns: 1fr;
  }

  .result-grade-wrap {
    min-width: 110px;
    min-height: 110px;
  }

  .section-heading {
    align-items: flex-start;
  }
}

@media (orientation: landscape) and (max-height: 820px) {
  .app-shell {
    width: min(1180px, calc(100% - 24px));
    padding-top: max(14px, env(safe-area-inset-top));
  }

  .hero {
    padding-top: 12px;
    padding-bottom: 18px;
  }

  h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
  }

  .calculator-card {
    padding-top: 22px;
    padding-bottom: 22px;
  }
}

@media (max-width: 470px) {
  .segmented-control {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
  }

  .known-options {
    grid-template-columns: 1fr;
  }

  .text-button {
    align-self: flex-start;
    margin-left: -12px;
  }

  .result-topline {
    align-items: flex-start;
  }

  .result-number {
    font-size: 4.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: white;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .privacy-badge,
  .text-button,
  .stepper button,
  footer {
    display: none;
  }

  .calculator-card,
  .result-card {
    box-shadow: none;
  }
}

.ausberlinos-backlink { margin: 0 0 18px; font: 500 14px/1.5 system-ui, sans-serif; }
.ausberlinos-backlink a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-underline-offset: 4px; }
.ausberlinos-backlink a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
