/* Grundlagen und Farben */
:root {
  font-family: Inter, Segoe UI, Arial, sans-serif;
  color: #172740;
  background: #f0f4f8;
  font-size: 16px;
  line-height: 1.55;
  --navy: #142540;
  --green: #126d56;
  --muted: #57657a;
  --line: #dce3eb
}

* {
  box-sizing: border-box
}

body {
  margin: 0
}

button,
input,
select {
  font: inherit
}

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent
}

button {
  cursor: pointer
}

a {
  color: var(--green)
}

/* Seitennavigation */
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 256px;
  background: var(--navy);
  color: #fff;
  padding: 32px 22px;
  display: flex;
  flex-direction: column
}

.brand {
  font-weight: 800;
  font-size: 25px;
  text-decoration: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px
}

.mark {
  background: #60e0ba;
  color: #142540;
  border-radius: 10px;
  padding: 2px 9px;
  font-size: 24px
}

.side-label {
  font-size: 11px;
  letter-spacing: 1.8px;
  color: #a9bdd6;
  margin: 38px 0 14px
}

nav {
  display: grid;
  gap: 5px
}

nav button {
  background: transparent;
  border: 0;
  color: #c3cee0;
  text-align: left;
  padding: 11px 12px;
  border-radius: 7px;
  font-size: 14px
}

nav button span {
  display: inline-block;
  width: 27px;
  color: #8ea5c3;
  font-size: 12px
}

nav button:hover {
  background: #223956
}

nav button[aria-current] {
  background: #60e0ba;
  color: #122f2a;
  font-weight: 700
}

nav button[aria-current] span {
  color: #205d4e
}

.side-note {
  margin-top: auto;
  padding-top: 26px;
  color: #a9bdd6;
  font-size: 12px
}

.side-note strong {
  color: #dfe8f5;
  line-height: 2
}

/* Seitenlayout und Überschriften */
main {
  margin-left: 256px;
  max-width: 1500px;
  padding: 30px 48px 24px
}

header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11px;
  letter-spacing: 1.6px;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line)
}

.badge {
  letter-spacing: 0;
  font-weight: 500
}

.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 28px 0 25px
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--green);
  margin: 0 0 7px
}

h1 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: -1px;
  margin: 0 0 12px
}

#intro {
  color: var(--muted);
  margin: 0;
  max-width: 700px
}

.chapter-icon {
  font-family: Georgia, serif;
  font-size: 60px;
  color: #126d56;
  margin-left: 24px
}

/* Rechner und Eingabefelder */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 22px;
  align-items: start
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 25px;
  box-shadow: 0 3px 10px #14254004
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px
}

h2 {
  font-size: 18px;
  margin: 0
}

.quiet {
  background: #fff;
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 14px
}

.quiet:hover {
  background: #edf8f4
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

.field label,
#exercise label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px
}

.field small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 12px
}

input,
select {
  width: 100%;
  border: 1px solid #b8c6d5;
  background: #fbfcfe;
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--navy);
  min-height: 45px
}

input:focus,
select:focus {
  outline: 3px solid #60e0ba80;
  border-color: var(--green)
}

:focus-visible {
  outline: 3px solid #23a985;
  outline-offset: 3px
}

.primary {
  border: 0;
  border-radius: 7px;
  padding: 12px 18px;
  background: var(--green);
  color: white;
  font-weight: 650;
  font-size: 14px
}

.primary:hover {
  background: #0c5845
}

#calculator>.primary {
  width: 100%;
  display: flex;
  justify-content: space-between;
  margin-top: 16px
}

.error {
  color: #a12727;
  font-size: 14px;
  margin: 12px 0 0
}

.error:empty {
  display: none
}

/* Ergebnisse und Rechenweg */
.tag {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted)
}

.result {
  border-top: 4px solid #126d56
}

.metric {
  background: var(--navy);
  color: #fff;
  border-radius: 9px;
  padding: 21px;
  margin-bottom: 16px
}

.metric span {
  color: #b6c7df;
  font-size: 13px
}

.metric strong {
  display: block;
  font-size: 30px;
  letter-spacing: -.7px;
  margin-top: 5px
}

.result-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #e9eef3;
  font-size: 14px
}

.result-row strong {
  white-space: nowrap
}

.result-row small {
  display: block;
  color: var(--muted);
  font-size: 12px
}

.notice {
  color: #805409;
  background: #fff5de;
  padding: 12px;
  border-radius: 7px;
  font-size: 14px
}

/* Erklärungen und Übungen */
.explanation {
  margin-top: 22px
}

.explanation h2 {
  margin-bottom: 12px
}

.formula {
  font-family: Consolas, monospace;
  background: #f2f6fa;
  border-left: 3px solid #60c5a6;
  padding: 12px 16px;
  margin: 10px 0;
  font-size: 14px
}

.assumption {
  font-size: 14px;
  color: var(--muted);
  margin-top: 16px
}

.practice {
  margin-top: 22px;
  background: #eaf6f1;
  border-color: #c6e4d7
}

.practice .eyebrow {
  margin-bottom: 2px
}

.answer-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.answer-row input {
  max-width: 240px;
  background: white
}

.small,
footer {
  font-size: 12px;
  color: var(--muted)
}

footer {
  margin-top: 28px;
  line-height: 1.8
}

footer details {
  margin-top: 10px
}

#feedback {
  font-weight: 650
}

#solution {
  background: #fff;
  padding: 14px;
  border-radius: 8px
}

.success {
  color: #126447
}

.failure {
  color: #a12727
}

.skip {
  position: fixed;
  left: 10px;
  top: -80px;
  z-index: 10;
  background: white;
  padding: 12px
}

.skip:focus {
  top: 10px
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

th,
td {
  text-align: right;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line)
}

th:first-child,
td:first-child {
  text-align: left
}

.table-wrap {
  overflow: auto;
  margin-top: 16px
}

/* Responsive Darstellung */
@media(min-width:1550px) {
  main {
    margin-right: auto
  }
}

@media(max-width:1100px) {
  aside {
    width: 216px;
    padding: 25px 16px
  }

  main {
    margin-left: 216px;
    padding: 26px
  }

  .fields {
    grid-template-columns: 1fr
  }

  .workspace {
    grid-template-columns: 1fr 1fr
  }

  .tag {
    display: none
  }
}

@media(max-width:760px) {
  aside {
    position: static;
    width: 100%;
    padding: 20px
  }

  .side-label,
  .side-note {
    display: none
  }

  nav {
    display: flex;
    overflow-x: auto;
    margin-top: 18px;
    padding-bottom: 5px
  }

  nav button {
    flex: 0 0 auto;
    border: 1px solid #3c526e
  }

  main {
    margin: 0;
    padding: 20px 16px
  }

  header {
    font-size: 10px
  }

  .badge {
    display: none
  }

  .workspace {
    grid-template-columns: 1fr
  }

  .fields {
    grid-template-columns: 1fr 1fr
  }

  .panel {
    padding: 20px
  }

  .chapter-icon {
    display: none
  }

  .title-row {
    margin: 23px 0
  }

  h1 {
    letter-spacing: -.5px
  }
}

@media(max-width:390px) {
  .fields {
    grid-template-columns: 1fr
  }

  .panel-head {
    flex-wrap: wrap
  }

  .metric strong {
    font-size: 25px
  }
}

@media print {

  aside,
  header,
  button,
  footer {
    display: none
  }

  main {
    margin: 0;
    padding: 0
  }

  .workspace {
    display: block
  }

  .panel {
    break-inside: avoid;
    margin: 10px 0;
    box-shadow: none
  }

  .practice {
    display: none
  }
}

/* Lange Werte und kurze Bildschirme */
aside {
  overflow-y: auto
}

.fields,
.field,
.workspace>*,
.result-row>div {
  min-width: 0
}

.metric strong {
  overflow-wrap: anywhere
}

.result-row strong {
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: right;
  min-width: 0
}

aside {
  overflow-x: hidden
}

.brand {
  font-size: 22px;
  gap: 8px;
  white-space: nowrap
}

.mark {
  flex-shrink: 0
}

@media(max-width:1100px) and (min-width:761px) {
  .brand {
    font-size: 19px
  }

  .mark {
    font-size: 21px;
    padding: 2px 7px
  }
}
