* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --scaleFactor: 1;
  --base-width: 1920px;
  --base-height: 1080px;
  --color-correct-base: #219150;
  --color-wrong-base: #ff6f61;
  --color-active: #ff9f1a;
  --color-inactive: #6b7280;
  --color-white-base: #ffffff;
  --color-gold: #f1c40f;
  --color-blue-base: #3498db;
  --color-blue-light: #5eb2e7;
  --place-tens: #1a6b3a;
  --place-ones: #6b3a7e;
  --place-tenths: #8b5a2b;
  --place-hundredths: #8b2d3a;
  --place-thousandths: #1e4a8c;
  --panel-bg: rgba(20, 30, 55, 0.92);
  --font-family-primary: Arial, sans-serif;
  --padding-medium: 8px;
}

html,
body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-family-primary);
  background: #000;
}

.interactive-text {
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.responsive-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.responsive-wrapper {
  width: var(--base-width);
  height: var(--base-height);
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: top left;
  transform: scale(var(--scaleFactor)) translate(-50%, -50%);
  background: linear-gradient(165deg, #0a1628 0%, #1a2a4a 40%, #0d1830 100%);
}

.decimal-applet {
  width: 1920px;
  height: 1080px;
  position: relative;
  padding: 36px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Intro: 10% header / 80% body / 10% footer (1080px base) */
.intro-shell {
  width: 1920px;
  height: 1080px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
}

.intro-header {
  flex: 0 0 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  box-sizing: border-box;
}

.intro-header-text {
  text-align: center;
  font-size: 44px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.intro-mid {
  flex: 0 0 864px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 40px;
  box-sizing: border-box;
}

.intro-footer {
  flex: 0 0 108px;
  min-height: 0;
  box-sizing: border-box;
}

.intro-mid-inner--step1 {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  min-height: 0;
  gap: 8px;
}

.intro-mid-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--panel-bg);
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  padding: 56px 64px;
  gap: 40px;
}

.intro-stage-card--hero {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comparison-strip--hero {
  gap: 48px;
}

.comparison-strip--hero .number-box {
  font-size: 96px;
  min-width: 320px;
  padding: 40px 52px;
  border-radius: 22px;
}

.comparison-strip--hero .operator-slot {
  width: 120px;
  height: 120px;
  font-size: 80px;
  border-radius: 18px;
}

.intro-begin-wrap {
  flex: 0 0 200px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.gesture-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.gesture-hint-img {
  display: block;
  width: 96px;
  height: auto;
  user-select: none;
}

.gesture-hint--begin {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(calc(-50% + 30px));
  z-index: 2;
}

.gesture-hint--drag-strip {
  margin: -8px 0 0;
}

.gesture-hint--drag-strip .gesture-hint-img {
  width: 120px;
}

.gesture-flight {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 25;
  opacity: 0;
}

.gesture-flight-img {
  display: block;
  width: 104px;
  height: auto;
  user-select: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

.gesture-hint--compare,
.gesture-hint--scroll {
  margin-bottom: 8px;
}

.gesture-hint--scroll {
  animation: gestureHintScroll 1.4s ease-in-out infinite;
}

.gesture-hint--operator {
  position: absolute;
  left: 50%;
  top: calc(100% - 88px);
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
}

.gesture-hint--compare {
  position: absolute;
  left: 50%;
  top: calc(100% - 88px);
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
}

@keyframes gestureHintScroll {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.95;
  }
  50% {
    transform: translateY(-30px);
    opacity: 1;
  }
}

.intro-begin-wrap .next-chevron {
  position: static;
  transform: none;
  width: 144px;
  height: 240px;
  font-size: 192px;
}

.intro-begin-wrap .next-chevron:hover {
  transform: scale(1.08);
}

.intro-begin-wrap .next-chevron:active {
  transform: scale(0.95);
}

.intro-begin-wrap .next-chevron--pulse {
  animation: chevronPulseInline 1s ease-in-out infinite;
}

.intro-arrow-column {
  flex: 0 0 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left 40% (strip) / right 60% (grid) of row */
.intro-mid-inner--split {
  flex: 1;
  display: grid;
  grid-template-columns: 40fr 60fr;
  gap: 28px;
  align-items: stretch;
  min-height: 0;
  min-width: 0;
}

.intro-split-grid {
  min-width: 0;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.intro-split-grid .grid-wrap {
  flex: 0 0 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.intro-split-grid .intro-compare-zone {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 0;
}

.intro-right-zone {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 20px;
  position: relative;
}

.intro-strip-column {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  gap: 20px;
}

.intro-right-zone .intro-arrow-column {
  flex: 0 0 120px;
}

.intro-arrow-column .next-chevron {
  position: static;
  transform: none;
  width: 200px;
  height: 400px;
  font-size: 256px;
}

.intro-arrow-column .next-chevron:hover {
  transform: scale(1.08);
}

.intro-arrow-column .next-chevron:active {
  transform: scale(0.95);
}

.intro-arrow-column .next-chevron--pulse {
  animation: chevronPulseInline 1s ease-in-out infinite;
}

@keyframes chevronPulseInline {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.12);
  }
}

.intro-arrow-overlay {
  position: absolute;
  right: -46px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  pointer-events: auto;
}

.intro-arrow-overlay .next-chevron {
  position: static;
  transform: none;
  width: 200px;
  height: 400px;
  font-size: 256px;
}

.intro-arrow-overlay .next-chevron:hover {
  transform: scale(1.08);
}

.intro-arrow-overlay .next-chevron:active {
  transform: scale(0.95);
}

.intro-arrow-overlay .next-chevron--pulse {
  animation: chevronPulseInline 1s ease-in-out infinite;
}

.flying-op-ghost {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 52px;
  font-weight: 800;
  color: var(--color-correct-base);
  text-shadow: 0 0 24px rgba(33, 145, 80, 0.9);
  pointer-events: none;
  z-index: 9999;
  opacity: 1;
}

.flying-op-ghost--go {
  animation: flyFromBtn 0.6s ease-in-out forwards;
}

@keyframes flyFromBtn {
  0% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 1;
  }
  80% {
    transform: translate(
      calc(-50% + var(--fly-dx)),
      calc(-50% + var(--fly-dy))
    ) scale(1);
    opacity: 0.9;
  }
  100% {
    transform: translate(
      calc(-50% + var(--fly-dx)),
      calc(-50% + var(--fly-dy))
    ) scale(0.8);
    opacity: 0;
  }
}

.instruction-banner {
  text-align: center;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  min-height: 56px;
  padding: 0 200px;
}

.main-row {
  flex: 1;
  display: flex;
  gap: 32px;
  min-height: 0;
}

.panel {
  background: var(--panel-bg);
  border-radius: 24px;
  border: 2px solid rgba(100, 140, 200, 0.35);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel--left {
  flex: 1.15;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 520px;
}

.panel--right {
  flex: 1;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
}

.panel--picker {
  width: 420px;
  flex: none;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.comparison-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

.number-box {
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  padding: 22px 36px;
  border-radius: 18px;
  border: 3px solid var(--color-active);
  background: rgba(0, 0, 0, 0.25);
  min-width: 220px;
  text-align: center;
}

.number-box--draggable {
  cursor: grab;
  animation: boxPulse 1.2s ease-in-out infinite;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.number-box--draggable:active {
  cursor: grabbing;
  animation: none;
}

@keyframes boxPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 26, 0.5); }
  50% { box-shadow: 0 0 16px 4px rgba(255, 159, 26, 0.6); }
}

.drag-ghost {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  padding: 18px 32px;
  border-radius: 16px;
  border: 3px solid var(--color-active);
  background: rgba(40, 30, 20, 0.92);
  box-shadow: 0 8px 32px rgba(255, 159, 26, 0.5);
  opacity: 0.9;
}

.number-box span {
  pointer-events: none;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.operator-slot {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 3px solid var(--color-blue-light);
  background: rgba(0, 40, 80, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  font-weight: 800;
  color: var(--color-blue-light);
}

.operator-slot--result {
  font-size: 52px;
}

.operator-slot--filled {
  animation: operatorSlotFill 0.45s ease-out;
}

@keyframes operatorSlotFill {
  0% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.intro-compare-zone {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.digit-compare-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.digit-compare-cell {
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  border-radius: 14px;
  border: 2px solid rgba(100, 180, 100, 0.6);
}

.digit-compare-op {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--color-blue-light);
  border-radius: 12px;
  border: 2px solid var(--color-blue-light);
  background: rgba(0, 40, 80, 0.5);
}

.operator-picker {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.operator-picker-overlay-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 110px;
}

.compare-button-overlay-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 110px;
}

.operator-choice {
  min-width: 88px;
  min-height: 88px;
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 50, 100, 0.65);
  cursor: pointer;
  font-size: 48px;
  font-weight: 800;
  color: var(--color-blue-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: var(--font-family-primary);
}

.operator-choice:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.operator-choice span {
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.operator-choice--wrong {
  animation: wrongBtnShake 0.5s ease;
  border-color: var(--color-wrong-base);
  background: rgba(255, 80, 60, 0.35);
}

@keyframes wrongBtnShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-8px) rotate(-3deg); }
  30% { transform: translateX(8px) rotate(3deg); }
  45% { transform: translateX(-6px) rotate(-2deg); }
  60% { transform: translateX(6px) rotate(2deg); }
  75% { transform: translateX(-3px); }
}

.operator-choice--correct {
  border-color: var(--color-correct-base);
  background: rgba(33, 145, 80, 0.5);
}

.operator-picker--teeter {
  animation: teeterShake 0.5s ease;
}

@keyframes teeterShake {
  0%,
  100% {
    transform: translateX(0);
  }
  15% {
    transform: translateX(-14px) rotate(-2deg);
  }
  30% {
    transform: translateX(12px) rotate(2deg);
  }
  45% {
    transform: translateX(-10px) rotate(-1deg);
  }
  60% {
    transform: translateX(8px) rotate(1deg);
  }
  75% {
    transform: translateX(-4px);
  }
}

.practice-operator-zone {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.decimal-point-char {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.35em;
  margin: 0 0.04em;
  vertical-align: middle;
  transform: translateY(10px);
}

.decimal-point-dot {
  display: inline-block;
  width: 0.22em;
  height: 0.22em;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0.18em currentColor;
  flex: 0 0 auto;
}

.decimal-point-char--pulse {
  animation: decimalCharPulse 0.85s ease-in-out infinite;
  color: var(--color-gold);
  text-shadow: 0 0 12px rgba(241, 196, 15, 0.9);
}

@keyframes decimalCharPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.85;
  }
}

.extended-slide,
.summary-slide {
  width: 1920px;
  height: 1080px;
  padding: 48px 80px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
}

.extended-slide h1,
.summary-slide h1 {
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  text-align: center;
}

.extended-digit-rows {
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-size: 56px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
}

.extended-digit-rows .row-line {
  padding: 16px 32px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.summary-card {
  padding: 40px 60px;
  border-radius: 24px;
  max-width: 1100px;
}

.summary-card .summary-list,
.summary-slide .summary-list {
  list-style: disc;
  padding-left: 40px;
  max-width: 900px;
  font-size: 36px;
  font-weight: 600;
  color: #fff;
  line-height: 1.6;
}

.summary-card .summary-list li,
.summary-slide .summary-list li {
  margin-bottom: 20px;
}

.summary-actions {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 32px;
}

.worked-continue-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.drag-layer {
  position: relative;
  width: 100%;
  min-height: 140px;
  margin-top: 32px;
}

.draggable-chip {
  position: absolute;
  left: 80px;
  top: 10px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 10;
  font-size: 48px;
  font-weight: 800;
  color: #fff;
  padding: 18px 32px;
  border-radius: 16px;
  border: 3px solid var(--color-active);
  background: rgba(40, 30, 20, 0.95);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.draggable-chip:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.draggable-chip--second {
  left: auto;
  right: 80px;
  top: 10px;
}

.draggable-chip--hidden {
  visibility: hidden;
  pointer-events: none;
}

.drop-zone-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: -8px;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.grid-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.place-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid-row {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
}

.grid-row--headers .grid-cell--header {
  width: 100px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  border-radius: 12px;
  background: rgba(80, 90, 110, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.grid-row--headers .grid-cell--header.grid-cell--tens {
  background: rgba(80, 90, 110, 0.9);
  color: #58d98b;
}
.grid-row--headers .grid-cell--header.grid-cell--ones {
  background: rgba(80, 90, 110, 0.9);
  color: #c9a0dc;
}
.grid-row--headers .grid-cell--header.grid-cell--tenths {
  background: rgba(80, 90, 110, 0.9);
  color: #daa06d;
}
.grid-row--headers .grid-cell--header.grid-cell--hundredths {
  background: rgba(80, 90, 110, 0.9);
  color: #e07080;
}
.grid-row--headers .grid-cell--header.grid-cell--thousandths {
  background: rgba(80, 90, 110, 0.9);
  color: #6eb3ff;
}

.grid-row--headers .grid-cell--dot-header {
  width: 40px;
  background: transparent;
  border: none;
}

.grid-cell {
  width: 100px;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 800;
  color: #fff;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  position: relative;
}

.grid-cell--dot {
  width: 40px;
  min-width: 40px;
  background: transparent;
  border: none;
}

.decimal-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--color-gold);
  box-shadow: 0 0 12px rgba(241, 196, 15, 0.8);
}

.grid-cell--tens {
  background: var(--place-tens);
}
.grid-cell--ones {
  background: var(--place-ones);
}
.grid-cell--tenths {
  background: var(--place-tenths);
}
.grid-cell--hundredths {
  background: var(--place-hundredths);
}
.grid-cell--thousandths {
  background: var(--place-thousandths);
}

.grid-cell span {
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.column-highlight::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 4px solid var(--color-active);
  border-radius: 16px;
  pointer-events: none;
  z-index: 2;
}

.pulse-row {
  animation: rowPulse 1.2s ease-in-out infinite;
}

.pulse-decimal .decimal-dot {
  animation: dotPulse 0.9s ease-in-out infinite;
}

.pulse-cell {
  animation: cellPulse 1s ease-in-out infinite;
}

@keyframes rowPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 159, 26, 0.5);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 159, 26, 0);
  }
}

@keyframes dotPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.85;
  }
}

@keyframes cellPulse {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.06);
    filter: brightness(1.25);
  }
}

.compare-results {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.result-chip {
  background: rgba(70, 80, 100, 0.95);
  border-radius: 14px;
  padding: 14px 28px;
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.35s ease;
}

.result-chip--small {
  transform: scale(0.82);
  opacity: 0.75;
}

.result-chip .op {
  color: var(--color-blue-light);
  margin: 0 8px;
}

.rule-bubble {
  max-width: 520px;
  padding: 18px 24px;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  font-size: 32px;
  font-weight: 600;
  color: #fff;
  line-height: 1.35;
  text-align: center;
}

.next-chevron {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 96px;
  font-weight: 300;
  color: var(--color-gold);
  cursor: pointer;
  user-select: none;
  line-height: 1;
  text-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
  transition: transform 0.2s ease;
}

.next-chevron:hover {
  transform: translateY(-50%) scale(1.08);
}

.next-chevron:active {
  transform: translateY(-50%) scale(0.95);
}

.next-chevron--pulse {
  animation: chevronPulse 1s ease-in-out infinite;
}

@keyframes chevronPulse {
  0%,
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
  50% {
    opacity: 0.75;
    transform: translateY(-50%) scale(1.12);
  }
}

.pair-picker {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px 0;
  width: 100%;
}

.pair-picker-window {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

/* --- Pair item base --- */
.pair-item {
  width: 92%;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(50, 55, 70, 0.55);
  border: 2px solid transparent;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  transition: all 0.3s ease;
  cursor: pointer;
}

/* Active item — outline box around numbers */
.pair-item--active {
  width: 100%;
  background: rgba(70, 85, 110, 0.95);
  border-color: rgba(255, 255, 255, 0.85);
  color: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  z-index: 2;
  font-size: 44px;
  padding: 18px 24px;
  cursor: default;
}

/* Active row wrapper — arrows + outlined box */
.pair-item-active-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.pair-item--near { cursor: pointer; }

.pair-item--dist-1 {
  opacity: 0.55;
  font-size: 27px;
  width: 88%;
}
.pair-item--dist-2 {
  opacity: 0.3;
  font-size: 24px;
  width: 80%;
}
.pair-item--dist-3 {
  opacity: 0.18;
  font-size: 21px;
  width: 72%;
}

/* --- Inner layout: numA | opBox | numB --- */
.pair-item-inner {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

/* Operator input box in every item */
.pair-item-op {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(100, 140, 200, 0.4);
  background: rgba(0, 30, 60, 0.4);
  font-size: 18px;
  font-weight: 800;
  color: rgba(150, 180, 220, 0.6);
  padding: 2px 4px;
  position: relative;
  top: -1px;
}

.pair-item-op--active {
  min-width: 40px;
  min-height: 40px;
  border-radius: 8px;
  border-color: var(--color-blue-light);
  background: rgba(0, 40, 80, 0.55);
  font-size: 32px;
  color: var(--color-blue-light);
  padding: 4px 6px;
  position: relative;
  top: -2px;
}

.pair-item-op--done {
  border-color: var(--color-correct-base);
  background: rgba(33, 145, 80, 0.3);
  color: #fff;
}

/* Completed pair — green outline */
.pair-item--done {
  border-color: var(--color-correct-base);
}

.pair-item--done.pair-item--active {
  border-color: var(--color-correct-base);
  box-shadow: 0 0 16px rgba(33, 145, 80, 0.3), 0 8px 28px rgba(0, 0, 0, 0.45);
}

/* --- Side arrows (green chevrons) --- */
.pair-side-arrow {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--color-correct-base);
  font-size: 52px;
  font-weight: 300;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.pair-side-arrow:hover:not(:disabled) { transform: scale(1.15); }
.pair-side-arrow:active:not(:disabled) { transform: scale(0.9); }
.pair-side-arrow--disabled { opacity: 0.15; cursor: default; }

/* --- Colored digits --- */
.digit--tens { color: #58d98b; font-weight: 800; }
.digit--ones { color: #c9a0dc; font-weight: 800; }
.digit--tenths { color: #daa06d; font-weight: 800; }
.digit--hundredths { color: #e07080; font-weight: 800; }
.digit--thousandths { color: #6eb3ff; font-weight: 800; }

.pair-item--active .digit--tens,
.pair-item--active .digit--ones,
.pair-item--active .digit--tenths,
.pair-item--active .digit--hundredths,
.pair-item--active .digit--thousandths {
  font-size: 44px;
}

.scroll-hint {
  text-align: center;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 12px;
  padding-bottom: 4px;
}

.footer-actions {
  display: flex;
  justify-content: center;
  padding-top: 12px;
}

/* Applet button (subset) */
.applet-button {
  min-width: 220px;
  min-height: 72px;
  border-radius: 16px;
  padding: var(--padding-medium);
  box-sizing: border-box;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  border: none;
  font-family: var(--font-family-primary);
}

.applet-button-frame {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 30%,
    rgba(0, 0, 0, 0.1) 70%,
    rgba(0, 0, 0, 0.2) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.55);
}

.applet-button-content {
  padding: 12px 24px;
}

.applet-button-text {
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.applet-button--active {
  background: var(--color-active);
  box-shadow: 0 4px 16px rgba(255, 159, 26, 0.45);
}

.applet-button--inactive {
  background: var(--color-inactive);
  cursor: not-allowed;
  opacity: 0.55;
}

.applet-button--clickNext {
  animation: accentGlow 1s ease-in-out infinite;
}

.applet-button--clickNext .applet-button-frame {
  border-width: 3px;
  animation: borderPulse 0.8s ease-in-out infinite;
}

@keyframes accentGlow {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 159, 26, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 159, 26, 0.65);
  }
}

@keyframes borderPulse {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.6);
  }
  50% {
    border-color: rgba(255, 255, 255, 1);
  }
}

.action-button:active:not(:disabled) {
  transform: scale(0.95);
}

.aria-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-row,
  .pulse-decimal .decimal-dot,
  .pulse-cell,
  .next-chevron--pulse,
  .intro-arrow-column .next-chevron--pulse,
  .applet-button--clickNext,
  .operator-picker--teeter,
  .decimal-point-char--pulse,
  .operator-slot--filled,
  .operator-choice--wrong,
  .flying-op-ghost--go,
  .intro-arrow-overlay .next-chevron--pulse {
    animation: none !important;
  }
}

@media (width: 960px) and (height: 540px) {
  .instruction-banner {
    font-size: 36px;
  }
}

@media (width: 1920px) and (height: 1080px) {
  .instruction-banner {
    font-size: 42px;
  }
}

@media (width: 3840px) and (height: 2160px) {
  .instruction-banner {
    font-size: 42px;
  }
}
