/* Felles visuell standard for verktøy i videregående skole */
.tool-page {
  min-height: 60vh;
}

.tool-width {
  max-width: 980px;
}

.support-solution-width {
  max-width: 860px;
}

.tool-intro {
  padding: 42px 0 24px;
}

.tool-intro h1 {
  margin-bottom: 10px;
  letter-spacing: -.025em;
}

.tool-intro p {
  max-width: 760px;
  line-height: 1.6;
}

.calculator-section {
  padding: 10px 0 34px;
}

.calculator-card {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.input-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(150px, .8fr));
  gap: 14px 16px;
  align-items: end;
}

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

.input-grid label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.input-grid input,
.input-grid select,
.input-grid textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.input-grid textarea {
  min-height: 90px;
  resize: vertical;
}

.field-help,
.help-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.calculate-button {
  margin-top: 18px;
}

.error-message {
  margin-top: 12px;
}

.solution-section {
  padding: 8px 0 58px;
}

.solution-heading {
  margin-bottom: 12px;
}

#solution-content {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.solution-card {
  margin: 0;
  padding: 20px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.solution-card:last-child {
  border-bottom: 0;
}

.solution-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  letter-spacing: -.01em;
}

.solution-card p {
  max-width: 760px;
  margin: 7px 0;
  line-height: 1.6;
}

.math-line {
  margin: 12px 0 !important;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.55;
  text-align: left;
  overflow-wrap: anywhere;
}

.final-answer {
  padding-top: 22px;
  padding-bottom: 22px;
}

.final-answer h3 {
  color: var(--accent);
}

.final-answer p {
  font-size: 17px;
}

.visual-box {
  position: sticky;
  top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.visual-box h3 {
  margin-top: 0;
}

.numberline {
  position: relative;
  height: 90px;
  margin: 24px 8px 8px;
}

.numberline-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 42px;
  height: 3px;
  background: var(--text);
}

.numberline-zero {
  position: absolute;
  top: 30px;
  width: 2px;
  height: 28px;
  background: var(--muted);
}

.numberline-point {
  position: absolute;
  top: 34px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

.numberline-label {
  position: absolute;
  top: 58px;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr auto;
  gap: 8px;
  align-items: center;
}

.bar-track {
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-soft);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  font-weight: 750;
}

.code-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

.simple-data-table {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.simple-data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, .45fr);
}

.simple-data-row > span {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
}

.simple-data-row > span + span {
  border-left: 1px solid var(--line);
  font-weight: 750;
}

.simple-data-row:last-child > span {
  border-bottom: 0;
}

.simple-data-head {
  background: var(--surface-soft);
  font-weight: 800;
}

.function-data-table .simple-data-row {
  grid-template-columns: minmax(58px, .35fr) minmax(0, 1.4fr) minmax(58px, .35fr);
}

@media (max-width: 900px) {
  .input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .support-solution-layout {
    grid-template-columns: 1fr;
  }

  .visual-box {
    position: static;
  }
}

@media (max-width: 620px) {
  .tool-intro {
    padding-top: 30px;
  }

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

  .calculator-card {
    padding: 16px;
  }

  .solution-card {
    padding: 18px 0;
  }

  .math-line {
    font-size: 16px;
  }

  .function-data-table {
    overflow-x: auto;
  }

  .function-data-table .simple-data-row {
    min-width: 390px;
  }
}
