/* Sheet-Style Place-Value Grid with LEGO Green Divider */

.grid-section-container {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .grid-section-container {
    flex-direction: column;
  }
}

/* Main Worksheet Board */
.place-value-worksheet {
  flex: 1;
  background: var(--bg-card-surface);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.worksheet-header {
  width: 100%;
  max-width: 520px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  text-align: center;
  margin-bottom: 8px;
  position: relative;
}

.col-heading {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 0;
}

.col-heading.tens-col {
  color: var(--accent-cyan);
}

.col-heading.ones-col {
  color: var(--lego-yellow);
}

/* The Spreadsheet Grid Table */
.sheet-grid {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  position: relative;
  background: rgba(0, 0, 0, 0.7);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.15);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* LEGO Green Central Dividing Line */
.sheet-grid::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 6px;
  background: var(--lego-green);
  transform: translateX(-50%);
  z-index: 2;
  box-shadow: 0 0 12px var(--lego-green-glow), 0 0 4px var(--lego-green);
}

/* Grid Row Styling */
.sheet-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 80px;
  position: relative;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18);
  /* Spreadsheet horizontal grid line */
}

.sheet-row:last-child {
  border-bottom: none;
}

/* Individual Grid Cell - Perfectly Centered in each column */
.sheet-grid .grid-cell,
.grid-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 80px !important;
  padding: 8px !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

/* Watermark / Placeholder Text (TENS / ONES) - Centered in Cell */
.sheet-grid .cell-placeholder,
.cell-placeholder {
  font-family: var(--font-main);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: rgba(255, 255, 255, 0.22);
  text-transform: uppercase;
  text-align: center !important;
  pointer-events: none;
  user-select: none;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  margin: auto !important;
}

.tens-cell .cell-placeholder {
  color: rgba(0, 210, 255, 0.25);
}

.ones-cell .cell-placeholder {
  color: rgba(255, 213, 0, 0.25);
}

/* Placed LEGO Bricks Inside Cells - Perfectly Centered */
.sheet-grid .grid-cell .lego-tile-brick,
.sheet-grid .grid-cell .locked-digit {
  margin: auto !important;
}

.sheet-row.operator-row {
  position: relative;
}

.sheet-row.operator-row .grid-operator-badge {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent-cyan);
  background: rgba(0, 85, 191, 0.3);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--lego-blue-bright);
  z-index: 5;
}

/* Multi-Step Calculation Rows */
.sheet-row.calculation-step-row {
  background: rgba(0, 0, 0, 0.4);
  position: relative;
  transition: all 0.3s ease;
}

.sheet-row.calculation-step-row.active-step {
  background: rgba(0, 85, 191, 0.12);
  box-shadow: inset 0 0 20px rgba(0, 85, 191, 0.25);
}

.step-label-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--lego-blue);
  color: var(--text-white);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 2px 10px;
  border-radius: 12px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--accent-cyan);
}

.step-label-badge.step-active {
  background: var(--lego-yellow);
  color: #000000;
  border-color: #ffffff;
  animation: badgePulse 1.2s infinite alternate;
}

@keyframes badgePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(255, 213, 0, 0.5);
  }

  100% {
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(255, 213, 0, 0.9);
  }
}

/* Slot Hint Text & Box (Tens / Ones) - Centered */
.result-input-slot {
  width: 58px;
  height: 66px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 auto;
}

.result-input-slot .slot-hint {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-align: center;
}

/* Static carried Ones Slot - Centered */
.static-ones-slot {
  width: 58px;
  height: 66px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dim);
  margin: 0 auto;
}

/* Final Golden Result Row */
.sheet-row.golden-result-row {
  background: linear-gradient(90deg, rgba(255, 213, 0, 0.08) 0%, rgba(255, 170, 0, 0.15) 50%, rgba(255, 213, 0, 0.08) 100%);
  border-top: 4px double var(--lego-yellow);
  border-bottom: 2px solid var(--lego-yellow);
  position: relative;
  min-height: 90px;
}

.golden-banner {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #FFD500, #FF9900);
  color: #000000;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 3px 14px;
  border-radius: 14px;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(255, 213, 0, 0.5);
}

.golden-digit-slot {
  width: 64px;
  height: 72px;
  background: linear-gradient(180deg, #2a2000 0%, #151000 100%);
  border: 3px solid var(--lego-yellow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 2.6rem;
  font-weight: 900;
  color: #FFE500;
  box-shadow: 0 0 20px rgba(255, 213, 0, 0.4), inset 0 0 10px rgba(255, 213, 0, 0.2);
  transition: all 0.3s ease;
  margin: 0 auto;
}

.golden-digit-slot.filled {
  background: linear-gradient(180deg, #FFD500 0%, #E69500 100%);
  color: #000000;
  box-shadow: 0 0 35px rgba(255, 213, 0, 0.9), 0 4px 15px rgba(0, 0, 0, 0.8);
  animation: goldDropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes goldDropIn {
  0% {
    transform: translateY(-30px) scale(0.4);
    opacity: 0;
  }

  70% {
    transform: translateY(4px) scale(1.15);
  }

  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Carry Motion Effect Indicator */
.carry-merge-flow {
  animation: carryFlowPulse 1.2s infinite alternate;
}

@keyframes carryFlowPulse {
  0% {
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
    border-color: var(--accent-cyan);
  }

  100% {
    box-shadow: 0 0 30px rgba(255, 213, 0, 0.9);
    border-color: var(--lego-yellow);
    transform: scale(1.06);
  }
}

/* Number Pad for Result Row Solving */
.result-keypad-panel {
  width: 100%;
  max-width: 520px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.result-keypad-panel.hidden {
  display: none;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: 100%;
}

.keypad-btn {
  height: 48px;
  font-size: 1.4rem;
  font-family: var(--font-mono);
}

/* Animal Companion Side Stage & Helper Box */
.companion-sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 900px) {
  .companion-sidebar {
    width: 100%;
  }
}

.companion-stage-card {
  background: var(--bg-card-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-subtle);
  position: relative;
  overflow: hidden;
}

.companion-display-avatar {
  width: 130px;
  height: 130px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.companion-speech-bubble {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-white);
  font-size: 0.95rem;
  line-height: 1.4;
  text-align: center;
  position: relative;
  width: 100%;
}

.companion-speech-bubble::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 8px 8px 8px;
  border-style: solid;
  border-color: transparent transparent rgba(255, 255, 255, 0.15) transparent;
}

/* Floating Dynamic Pointing Arrow for Hints */
.floating-pointer-arrow {
  position: absolute;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pointer-arrow-icon {
  font-size: 2.2rem;
  color: var(--lego-yellow);
  filter: drop-shadow(0 0 10px rgba(255, 213, 0, 0.8));
  animation: pointerHop 0.8s infinite alternate;
}

.pointer-badge {
  background: var(--lego-yellow);
  color: #000000;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

@keyframes pointerHop {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(-8px) scale(1.15);
  }
}