.avg-topic .gt-nav,
.avg-topic-layout .gt-nav {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.avg-lab {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.avg-select-label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-weight: 900;
}

.avg-select-label select {
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  border-radius: 12px;
  padding: 0 10px;
  color: #0f172a;
  font-weight: 900;
  background: #fff;
}

.avg-model-visual,
.avg-exp-visual {
  display: grid;
  place-items: center;
  min-height: 330px;
  padding: 16px;
  border: 1px solid rgba(190, 202, 222, 0.82);
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(0deg, rgba(37, 99, 235, 0.055) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, rgba(20, 184, 166, 0.055) 0 1px, transparent 1px 30px);
  overflow: hidden;
}

.avg-exp-workbench {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
  gap: 16px;
}

.avg-exp-story {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(190, 202, 222, 0.82);
  border-radius: 16px;
  background: #fff;
}

.avg-exp-story span {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-weight: 950;
}

.avg-exp-story strong {
  color: #0f172a;
  font-size: 1.15rem;
  line-height: 1.24;
}

.avg-exp-story p {
  margin: 0;
  color: #475569;
  line-height: 1.55;
}

.avg-exp-board {
  display: grid;
  gap: 12px;
}

.avg-exp-svg,
.avg-level-chart {
  width: min(100%, 560px);
}

.avg-exp-svg .axis,
.avg-level-chart .axis {
  stroke: rgba(51, 65, 85, 0.58);
  stroke-width: 2;
}

.avg-exp-svg rect,
.avg-level-chart rect {
  fill: #38bdf8;
  stroke: #0369a1;
  stroke-width: 2;
}

.avg-exp-svg .below rect,
.avg-level-chart .below rect {
  fill: #fbbf24;
  stroke: #b45309;
}

.avg-exp-svg .avg-line,
.avg-level-chart .avg-line {
  opacity: 0.18;
  stroke: #db2777;
  stroke-width: 4;
  stroke-dasharray: 8 7;
}

.avg-exp-svg .avg-line.is-on,
.avg-level-chart .avg-line {
  opacity: 1;
}

.avg-exp-svg .fair-bar {
  fill: rgba(16, 185, 129, 0.25);
  stroke: #059669;
  stroke-dasharray: 5 5;
}

.avg-exp-svg .diff-line {
  stroke: #7c3aed;
  stroke-width: 3;
  stroke-dasharray: 4 5;
}

.avg-exp-svg text,
.avg-level-chart text {
  fill: #334155;
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
}

.avg-exp-svg .caption,
.avg-level-chart .avg-label {
  text-anchor: start;
}

.avg-case-grid {
  grid-template-columns: repeat(3, minmax(270px, 1fr));
}

.avg-case {
  display: grid;
  gap: 12px;
  min-height: 580px;
  padding: 14px;
  border: 1px solid rgba(190, 202, 222, 0.76);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.05);
}

.avg-case-head {
  display: grid;
  gap: 4px;
}

.avg-case-head span {
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 950;
}

.avg-case-head strong {
  color: #0f172a;
  font-size: 1.14rem;
  line-height: 1.2;
}

.avg-case p {
  margin: 0;
  color: #64748b;
  line-height: 1.55;
}

.avg-case-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.avg-case-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #334155;
  font-weight: 900;
}

.avg-case-controls input {
  width: 100%;
}

.avg-case-scene {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 250px;
  padding: 12px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(248, 250, 252, 0.96), rgba(240, 253, 250, 0.9)),
    repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.035) 0 1px, transparent 1px 24px);
  overflow: hidden;
}

.avg-case-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.avg-case-metrics span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 12px;
  color: #64748b;
  background: #f8fafc;
  font-size: 0.74rem;
  font-weight: 900;
}

.avg-case-metrics b {
  color: #0f172a;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.avg-case-result {
  min-height: 92px;
  padding: 12px;
  border-radius: 14px;
  color: #254155;
  background: rgba(236, 253, 245, 0.9);
  font-weight: 850;
  line-height: 1.45;
}

.avg-scene-object {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 292px);
  min-height: 230px;
}

.avg-object {
  position: absolute;
  inset: 4px 6px 46px;
  z-index: 1;
}

.avg-object em {
  position: absolute;
  left: 50%;
  bottom: -34px;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 92%;
  padding: 6px 10px;
  border-radius: 999px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 950;
  text-align: center;
}

.avg-level-chart {
  position: absolute;
  inset: auto 0 8px;
  z-index: 2;
  height: 170px;
  opacity: 0.88;
  pointer-events: none;
}

.avg-pencils,
.avg-cookies,
.avg-water {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: end;
  padding: 4px 8px;
}

.avg-pencils b,
.avg-water b {
  position: relative;
  display: block;
  min-height: 88px;
  border: 4px solid #0f766e;
  border-top: 0;
  border-radius: 0 0 16px 16px;
  background: rgba(204, 251, 241, 0.72);
}

.avg-pencils b::after,
.avg-water b::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 5px;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.22);
}

.avg-pencils i,
.avg-water i {
  position: absolute;
  left: var(--dot-left);
  bottom: var(--dot-bottom);
  width: 5px;
  height: 24px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: inset 0 4px 0 #fef3c7;
}

.avg-water i {
  width: 7px;
  height: 18px;
  background: #38bdf8;
  box-shadow: inset 0 4px 0 #bae6fd;
}

.avg-cookies b {
  position: relative;
  min-height: 92px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: inset 0 -8px 0 rgba(71, 85, 105, 0.12);
}

.avg-cookies i {
  position: absolute;
  left: var(--cookie-left);
  bottom: var(--cookie-bottom);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b45309;
  box-shadow: 0 0 0 3px #fbbf24;
}

.avg-reading,
.avg-steps,
.avg-plants,
.avg-temperature {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  padding: 8px 4px;
}

.avg-reading b,
.avg-steps b,
.avg-plants b,
.avg-temperature b {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: end;
  min-width: 28px;
  min-height: 128px;
}

.avg-reading b {
  border-radius: 8px 8px 4px 4px;
  background: #dbeafe;
  box-shadow: inset 0 -8px 0 #93c5fd;
}

.avg-reading i {
  width: 16px;
  border-radius: 999px 999px 0 0;
  background: #2563eb;
}

.avg-reading span,
.avg-steps span,
.avg-plants span,
.avg-temperature span {
  color: #334155;
  font-size: 0.66rem;
  font-weight: 950;
}

.avg-scores,
.avg-basketball {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.avg-scores b {
  display: grid;
  place-items: center;
  min-height: 104px;
  border: 3px solid #cbd5e1;
  border-radius: 10px;
  background:
    linear-gradient(#fff 0 18%, #e0f2fe 18% 20%, #fff 20% 38%, #e0f2fe 38% 40%, #fff 40%);
}

.avg-scores span,
.avg-basketball span {
  color: #0f172a;
  font-size: 1.02rem;
  font-weight: 950;
}

.avg-steps b::before {
  content: "";
  width: 18px;
  height: var(--h);
  min-height: 24px;
  border-radius: 999px 999px 6px 6px;
  background: #22c55e;
}

.avg-steps i {
  position: absolute;
  bottom: 12px;
  width: 22px;
  height: 11px;
  border-radius: 999px 999px 4px 4px;
  background: #0f172a;
}

.avg-temperature b {
  width: 30px;
  border-radius: 999px;
  background: rgba(219, 234, 254, 0.78);
  border: 3px solid #93c5fd;
}

.avg-temperature i {
  width: 12px;
  border-radius: 999px;
  background: linear-gradient(#f97316, #ef4444);
}

.avg-plants b {
  min-width: 40px;
}

.avg-plants b::after {
  content: "";
  width: 34px;
  height: 20px;
  border-radius: 6px 6px 12px 12px;
  background: #92400e;
}

.avg-plants i {
  width: 10px;
  border-radius: 999px 999px 0 0;
  background: #16a34a;
  box-shadow: -9px -8px 0 -3px #86efac, 10px -16px 0 -3px #bbf7d0;
}

.avg-basketball b {
  display: grid;
  place-items: center;
  min-height: 78px;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, #7c2d12 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, #7c2d12 47% 53%, transparent 53%),
    #fb923c;
  border: 3px solid #7c2d12;
}

.avg-allowance {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: end;
  padding: 8px;
}

.avg-allowance b {
  display: grid;
  place-items: center;
  min-height: 100px;
  border: 4px solid #64748b;
  border-radius: 14px 14px 8px 8px;
  background:
    radial-gradient(circle at 35% 74%, #facc15 0 9px, transparent 10px),
    radial-gradient(circle at 62% 62%, #facc15 0 9px, transparent 10px),
    radial-gradient(circle at 48% 45%, #facc15 0 9px, transparent 10px),
    #f8fafc;
}

.avg-bus {
  display: grid;
  gap: 8px;
  align-content: center;
  padding: 8px;
}

.avg-bus b {
  display: flex;
  align-items: center;
  gap: 6px;
}

.avg-bus i {
  display: block;
  width: var(--bus-len);
  height: 24px;
  max-width: 170px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, #facc15 0 20%, #0ea5e9 20% 28%, #facc15 28% 48%, #0ea5e9 48% 56%, #facc15 56%);
  border: 3px solid #92400e;
}

.avg-bus span {
  color: #0f172a;
  font-weight: 950;
}

.avg-delivery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
}

.avg-delivery b {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 94px;
  border-radius: 10px;
  background: #fed7aa;
  border: 3px solid #c2410c;
}

.avg-delivery b::before {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff7ed;
  border: 3px solid #9a3412;
}

.avg-delivery i {
  position: absolute;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: #9a3412;
  transform-origin: center bottom;
}

.avg-delivery span {
  position: absolute;
  bottom: 5px;
  color: #7c2d12;
  font-size: 0.8rem;
  font-weight: 950;
}

.avg-model-card {
  display: grid;
  gap: 12px;
  place-items: center;
}

.avg-fair-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(100%, 560px);
}

.avg-fair-row span {
  display: grid;
  gap: 3px;
  padding: 8px;
  border-radius: 12px;
  color: #64748b;
  background: #f8fafc;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.avg-fair-row b {
  color: #0f172a;
}

html[lang="en"] .avg-case {
  min-height: 640px;
}

html[lang="en"] .avg-case-head strong {
  font-size: 1.02rem;
}

html[lang="en"] .avg-case-controls,
html[lang="en"] .avg-case-metrics {
  grid-template-columns: 1fr;
}

html[lang="en"] .avg-lab,
html[lang="en"] .avg-exp-workbench {
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
}

@media (max-width: 980px) {
  .avg-case-grid {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }

  .avg-lab,
  .avg-exp-workbench,
  html[lang="en"] .avg-lab,
  html[lang="en"] .avg-exp-workbench {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .avg-topic .gt-nav,
  .avg-topic-layout .gt-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .avg-case-grid {
    grid-template-columns: 1fr;
  }

  .avg-case-controls,
  .avg-case-metrics {
    grid-template-columns: 1fr;
  }
}
