/* Shared quiz styles */
* { box-sizing: border-box; }

body.app-page {
  font-family: "Segoe UI", system-ui, sans-serif;
  margin: 0;
  background: #fff;
  color: #1a2332;
  font-size: 1.05rem;
}

.app-page .page-main {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 2rem 2rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: normal;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.15rem;
  font-weight: bold;
}

/* Language bar */
.lang-bar {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.lang-bar button {
  padding: 3px 10px;
  margin-right: 4px;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}

.lang-bar button.active {
  font-weight: bold;
  background: #ddd;
}

/* Exam badges */
.exam-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.exam-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #fff;
}

.exam-badge.ccna { background: #0d6efd; }
.exam-badge.comptia { background: #198754; }
.exam-badge.ihk { background: #fd7e14; }
.exam-badge.general { background: #7c3aed; }

.exam-badge .level {
  opacity: 0.9;
  font-weight: normal;
}

/* Quiz index list */
.quiz-list,
.quiz-index {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.quiz-list li,
.quiz-index li {
  margin-bottom: 1rem;
  list-style: none;
}

.quiz-list .quiz-desc,
.quiz-index .desc {
  font-size: 0.9rem;
  color: #555;
  margin: 0.25rem 0 0 0;
}

.quiz-list a,
.quiz-index a {
  color: #0645ad;
  text-decoration: none;
}

.quiz-index a:hover {
  text-decoration: underline;
}

.quiz-index .desc {
  font-size: 0.9rem;
  color: #555;
  margin-left: 0.25rem;
}

/* Forms */
form.quiz-form,
.quiz-form {
  margin: 1rem 0;
}

.subnet-row,
.form-row {
  margin-bottom: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

.subnet-row label,
.form-row label {
  min-width: 6.5rem;
}

input.hex {
  width: 4.2rem;
  text-align: center;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid #888;
  padding: 2px 4px;
}

input.prefix {
  width: 2.5rem;
  text-align: center;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid #888;
  padding: 2px 4px;
}

input.answer-short,
input.ipv4 {
  width: 10rem;
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid #888;
  padding: 2px 6px;
}

input.correct {
  background: #d4edda;
  border-color: #28a745;
}

input.wrong {
  background: #f8d7da;
  border-color: #dc3545;
}

input.autofilled {
  background: #eef6ff;
  color: #333;
}

/* Buttons & feedback */
.buttons {
  margin-top: 1.25rem;
}

button {
  font-family: inherit;
  font-size: 1rem;
  padding: 4px 14px;
  margin-right: 0.5rem;
  cursor: pointer;
}

#feedback,
.feedback {
  margin-top: 1rem;
  min-height: 1.4rem;
}

.feedback.ok { color: #155724; }
.feedback.warn { color: #856404; }
.feedback.err { color: #c00; }

.hint {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: #444;
}

.hidden { display: none !important; }

/* Hilfe section */
.hilfe-section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ccc;
  max-width: 48rem;
}

.hilfe-section h2 {
  margin: 0 0 0.5rem 0;
}

.hilfe-section p {
  margin: 0.4rem 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.hilfe-section a {
  color: #0645ad;
  cursor: pointer;
}

/* Solution panel */
#loesungsweg,
.loesungsweg {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #ddd;
  font-size: 0.95rem;
  line-height: 1.5;
}

#loesungsweg.visible,
.loesungsweg.visible {
  display: block;
}

#loesungsweg ol,
.loesungsweg ol {
  margin: 0.5rem 0 0 1.2rem;
  padding: 0;
}

#loesungsweg li,
.loesungsweg li {
  margin-bottom: 0.35rem;
}

/* Tables */
.bit-table,
.subnet-bits-table,
.hextet-breakdown,
.quiz-table {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  margin: 0.5rem 0;
  border-collapse: collapse;
}

.bit-table td,
.bit-table th,
.subnet-bits-table td,
.subnet-bits-table th,
.hextet-breakdown td,
.hextet-breakdown th,
.quiz-table td,
.quiz-table th {
  border: 1px solid #bbb;
  padding: 2px 6px;
  text-align: center;
}

.bit-relevant { background: #fff3cd; }

.hextet-breakdown td,
.hextet-breakdown th {
  border-color: #333;
  padding: 8px 14px;
  min-width: 5.5rem;
}

.hextet-breakdown .hex-title {
  font-size: 1.15rem;
  font-weight: bold;
  background: #f0f0f0;
}

.hextet-breakdown .hex-digit {
  font-size: 1.1rem;
  font-weight: bold;
}

.hextet-breakdown .bit-pos {
  font-size: 0.8rem;
  color: #444;
  line-height: 1.35;
}

.hextet-breakdown .bit-change {
  background: #fff3cd;
  font-weight: bold;
  color: #b45309;
}

.visual-block {
  margin: 1rem 0 1.25rem 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #ddd;
}

.hex-explain {
  margin-top: 0.85rem;
  padding: 0.55rem 0.65rem;
  background: #f8f9fa;
  border-left: 3px solid #b45309;
  font-size: 0.95rem;
}

/* Back link */
.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #0645ad;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link::before {
  content: "← ";
}

/* PHP app: nav, auth, leaderboard */
.top-nav {
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.top-nav a {
  color: #0645ad;
  margin-right: 0.75rem;
}

.user-nick {
  font-weight: bold;
}

.btn-primary,
.exam-btn {
  display: inline-block;
  padding: 0.45rem 1rem;
  margin: 0.25rem 0.35rem 0.25rem 0;
  border: 1px solid #333;
  background: #f5f5f5;
  color: #000;
  text-decoration: none;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.exam-btn.ccna { border-color: #0d6efd; }
.exam-btn.comptia { border-color: #198754; }
.exam-btn.ihk { border-color: #fd7e14; }

.exam-hero {
  margin: 1.25rem 0;
  padding: 1rem;
  border: 1px solid #ddd;
  background: #fafafa;
}

.exam-hero h2 {
  margin-top: 0;
  font-size: 1.2rem;
}

.hero-note,
.guest-hint,
.auth-hint {
  font-size: 0.92rem;
  color: #444;
}

.auth-optional {
  margin-top: 0.5rem;
}

.exam-section {
  margin: 2rem 0 1.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e5e5e5;
}

.exam-section h2 {
  margin-bottom: 0.75rem;
}

.exam-section h3 {
  font-size: 1rem;
  margin: 1rem 0 0.35rem;
}

.auth-page .auth-links {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
}

.auth-page .auth-links a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.auth-page .auth-links a:hover {
  text-decoration: underline;
}

.auth-dev-link-note {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 1rem;
}

.auth-dev-link {
  word-break: break-all;
  font-size: 0.88rem;
}

.auth-dev-link a {
  color: #7c3aed;
}

.auth-form input {
  width: 100%;
  max-width: 22rem;
  padding: 0.35rem;
  font-family: inherit;
}

.quiz-table.leaderboard {
  width: 100%;
  max-width: 32rem;
}

.user-score {
  font-size: 1.05rem;
}

.buttons-top {
  margin: 1rem 0 1.25rem;
}

.buttons-actions {
  margin-top: 1.25rem;
}

.hilfe-bottom {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.vlsm-box {
  margin: 1rem 0;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.vlsm-box ul {
  margin: 0.5rem 0 0 1.2rem;
}

.vlsm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.75rem;
}

.vlsm-row-label {
  min-width: 11rem;
  font-weight: 600;
}

.mask-octets-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.mask-octets-row input.octet {
  width: 2.75rem;
  text-align: center;
  font-family: Consolas, monospace;
}

.vlsm-row input.octet {
  width: 2.75rem;
  text-align: center;
  font-family: Consolas, monospace;
}

.vlsm-row input.prefix {
  width: 2.25rem;
  text-align: center;
  font-family: Consolas, monospace;
}

.vlsm-tip {
  font-size: 0.9rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.answer-compare {
  margin: 1rem 0;
  padding: 1rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
}

.answer-compare-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #14532d;
}

.answer-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.answer-compare-table th,
.answer-compare-table td {
  border: 1px solid #bbf7d0;
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.answer-compare-table th {
  background: #dcfce7;
  font-weight: 600;
}

.answer-compare-table .compare-mismatch {
  background: #fee2e2;
}

.answer-compare-table .compare-match {
  background: #ecfdf5;
}

.answer-compare-table .compare-correct {
  background: #fff;
  font-weight: 600;
}

.btn-generate {
  font-weight: 600;
}

.feedback {
  margin-top: 1rem;
  padding: 0.5rem 0.75rem;
}

.feedback.ok { background: #d1e7dd; }
.feedback.warn { background: #fff3cd; }
.feedback.err { background: #f8d7da; }

input.correct { background: #d1e7dd; }
input.wrong { background: #f8d7da; }

.weight-badge {
  font-size: 0.8rem;
  font-weight: bold;
  margin-left: 0.35rem;
}

.pts-hint {
  font-size: 0.85rem;
  color: #555;
  margin-left: 0.5rem;
}

.legacy-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid #ccc;
}

.legacy-note {
  font-size: 0.9rem;
  color: #555;
}

.quiz-meta {
  color: #444;
  font-size: 0.95rem;
}

#answerArea .subnet-row,
#answerArea .form-row {
  margin: 0.5rem 0;
}

#answerArea input.hex {
  width: 3.5rem;
  font-family: Consolas, monospace;
}

#answerArea input.prefix {
  width: 2.5rem;
}

#answerArea input.ipv4 {
  width: 10rem;
  font-family: Consolas, monospace;
}

.answer-short {
  width: 6rem;
}

.loesungsweg {
  display: none;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #ddd;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 48rem;
}

.loesungsweg.visible {
  display: block;
}

.radio-opt {
  display: inline-block;
  margin-right: 1rem;
  margin-bottom: 0.35rem;
}

/* Route summarization diagram */
.acl-hint {
  margin: 0 0 0.75rem;
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}

.acl-field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #78350f;
}

.answer-acl-line {
  width: min(100%, 32rem);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
}

.route-summary-diagram {
  margin: 1rem 0 1.25rem;
  padding: 1.25rem 1rem 1rem;
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
}

.route-summary-diagram .rs-caption {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #166534;
  font-weight: 500;
}

.route-summary-diagram .rs-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.route-summary-diagram .rs-wan-segment {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 6rem;
  min-width: 4rem;
  max-width: 12rem;
}

.route-summary-diagram .rs-wan-tag {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a16207;
  white-space: nowrap;
}

.route-summary-diagram .rs-wan-segment .rs-line-h {
  flex: 1;
  min-width: 2rem;
  height: 3px;
}

.route-summary-diagram .rs-lan-zone {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0;
  padding-top: 0;
  max-width: 100%;
}

.route-summary-diagram .rs-stub {
  width: 3px;
  height: 1rem;
  background: #facc15;
  border-radius: 2px;
  margin-left: 2.75rem;
}

.route-summary-diagram .rs-lan-bar {
  height: 3px;
  background: #facc15;
  border-radius: 2px;
  margin-left: 1.25rem;
  align-self: stretch;
  min-width: 12rem;
}

.route-summary-diagram .rs-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.route-summary-diagram .rs-node {
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  text-align: center;
}

.route-summary-diagram .rs-router {
  background: #22c55e;
  color: #fff;
  min-width: 5.5rem;
}

.route-summary-diagram .rs-switch {
  background: #3b82f6;
  color: #fff;
  font-weight: 500;
  font-size: 0.8rem;
}

.route-summary-diagram .rs-switch code {
  color: inherit;
  font-size: 0.78rem;
}

.route-summary-diagram .rs-line-h {
  width: 2.5rem;
  height: 3px;
  background: #facc15;
  border-radius: 2px;
}

.route-summary-diagram .rs-fan {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.75rem 1.25rem;
  padding-top: 0.35rem;
  margin-left: 0.5rem;
  border-top: none;
}

.route-summary-diagram .rs-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 8.5rem;
}

.route-summary-diagram .rs-line-v {
  width: 3px;
  height: 1.25rem;
  background: #facc15;
  border-radius: 2px;
}

/* Topology subnet-count diagram */
.topology-diagram {
  margin: 0.75rem 0 1.25rem;
  padding: 1rem 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  max-width: 100%;
  overflow-x: auto;
}

.topology-diagram .topo-inner {
  display: flex;
  justify-content: center;
}

.topology-diagram .topo-svg {
  display: block;
  max-width: 580px;
  min-width: 320px;
  height: auto;
}

/* Network diagram quizzes (D01–D08) */
.network-diagram {
  margin: 0.75rem 0 1rem;
  padding: 1rem;
  background: linear-gradient(165deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.network-diagram .nd-svg {
  max-height: 340px;
  display: block;
  min-width: 280px;
}

.network-diagram .nd-inner {
  display: flex;
  justify-content: center;
}

.diagram-extras {
  margin: 0.5rem 0 1rem;
}

.diagram-cli {
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.82rem;
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.45;
}

.diagram-scenario {
  font-size: 0.95rem;
  color: #334155;
  margin-bottom: 0.5rem;
}

.diagram-hints {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.diagram-hints code {
  background: #e2e8f0;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.diagram-radio .radio-opt {
  display: block;
  margin: 0.35rem 0;
}

input.diagram-answer.answer-wide {
  width: min(100%, 22rem);
}

.quiz-tag-diagram {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: #6366f1;
  color: #fff;
  margin-right: 0.35rem;
}
