/* SudoSketch Logic Theatre */

.learn-arena-card {
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(75,134,255,0.18), transparent 38%),
    rgba(15,27,56,0.9);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--shadow-soft);
}

.learn-arena-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.learn-arena-head h3 {
  margin: 4px 0;
  font-size: clamp(26px, 3vw, 40px);
}

.learn-meta {
  margin: 0;
  color: rgba(238,242,255,0.76);
  font-weight: 750;
}

.learn-mode-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.learn-mode-tabs button,
.learn-controls button,
.learn-input-toggle button,
.learn-digit-pad button {
  border: 0;
  border-radius: 999px;
  font-weight: 950;
  cursor: pointer;
  background: rgba(255,255,255,0.11);
  color: rgba(238,242,255,0.94);
}

.learn-mode-tabs button {
  padding: 10px 14px;
}

.learn-mode-tabs button.active,
.learn-input-toggle button.active {
  background: linear-gradient(135deg, #facc15, #fed766);
  color: #111827;
}

.learn-arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(260px, 1fr);
  gap: 22px;
  align-items: start;
}

.learn-board-shell {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)),
    rgba(255,255,255,0.05);
  box-shadow: var(--shadow-board);
}

.learn-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 17px;
  background: var(--paper);
  border: 3px solid var(--paper-line-strong);
}

.learn-cell {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  border-radius: 0;
  background: var(--cell-a);
  cursor: pointer;
}

.learn-cell:nth-child(3n) {
  border-right: 3px solid var(--paper-line-strong);
}

.learn-cell:nth-child(9n) {
  border-right: 0;
}

.learn-cell:nth-child(n + 19):nth-child(-n + 27),
.learn-cell:nth-child(n + 46):nth-child(-n + 54) {
  border-bottom: 3px solid var(--paper-line-strong);
}

.learn-cell:nth-child(n + 73) {
  border-bottom: 0;
}

.learn-cell.given {
  background: var(--fixed);
}

.learn-cell.selected {
  background: linear-gradient(180deg, #dceaff, #cfe1ff) !important;
  box-shadow: inset 0 0 0 3px rgba(37,99,235,0.72) !important;
}

.learn-value {
  color: var(--ink);
  font-size: clamp(20px, 3vw, 38px);
  font-weight: 900;
  line-height: 1;
}

.learn-candidate {
  position: absolute;
  inset: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  color: rgba(21,21,21,0.74);
  font-size: clamp(8px, 0.8vw, 11px);
  font-weight: 850;
}

.learn-candidate span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.learn-arena-card[data-target-digit] .learn-candidate span {
  opacity: 0.54;
}

.learn-arena-card[data-target-digit] .learn-candidate span.learn-target-candidate {
  opacity: 1;
  color: #111827;
  font-weight: 950;
}

.learn-focus {
  background: #fff1a8 !important;
  box-shadow: inset 0 0 0 3px rgba(234,179,8,0.82) !important;
}

.learn-placement {
  background: #bbf7d0 !important;
  box-shadow: inset 0 0 0 3px rgba(22,163,74,0.86) !important;
}

.learn-elimination {
  background: var(--cell-a) !important;
}

.learn-chain-start {
  background: rgba(37,99,235,0.32) !important;
  box-shadow: inset 0 0 0 3px rgba(37,99,235,0.95) !important;
}

.learn-chain-link {
  background: rgba(126,34,206,0.25) !important;
  box-shadow: inset 0 0 0 2px rgba(126,34,206,0.86) !important;
}

.learn-chain-end {
  background: rgba(22,163,74,0.32) !important;
  box-shadow: inset 0 0 0 3px rgba(22,163,74,0.94) !important;
}

.learn-conflict {
  background: #fee2e2 !important;
  box-shadow: inset 0 0 0 3px rgba(220,38,38,0.9) !important;
}

.learn-candidate-focus {
  color: #111827;
  background: rgba(250,204,21,0.62);
  border-radius: 999px;
  font-weight: 950;
}

.learn-candidate-keep {
  color: #14532d;
  background: rgba(34,197,94,0.38);
  border-radius: 999px;
  font-weight: 950;
}

.learn-candidate-remove {
  color: #7f1d1d;
  background: rgba(239,68,68,0.34);
  border-radius: 999px;
  text-decoration: line-through;
  font-weight: 950;
  animation: learnRemovePulse 0.85s ease-in-out infinite alternate;
}

.learn-candidate-chain-start {
  color: #1d4ed8;
  background: rgba(59,130,246,0.32);
  border-radius: 999px;
  font-weight: 950;
}

.learn-candidate-chain-link {
  color: #7e22ce;
  background: rgba(168,85,247,0.27);
  border-radius: 999px;
  font-weight: 950;
}

.learn-candidate-chain-end {
  color: #15803d;
  background: rgba(34,197,94,0.32);
  border-radius: 999px;
  font-weight: 950;
}

@keyframes learnRemovePulse {
  from {
    transform: scale(1);
    filter: brightness(1);
  }

  to {
    transform: scale(1.18);
    filter: brightness(1.22);
  }
}

.learn-side-panel,
.learn-input-panel {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.065);
  border: 1px solid rgba(255,255,255,0.11);
}

.learn-input-panel {
  margin-top: 14px;
  padding: 14px;
}

.learn-side-panel p {
  color: rgba(238,242,255,0.88);
  line-height: 1.45;
}

.learn-step-badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(250,204,21,0.16);
  border: 1px solid rgba(250,204,21,0.34);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.learn-step-badge.hidden {
  display: none;
}

.learn-action-text {
  font-weight: 900;
  color: #fde68a !important;
}

.learn-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.learn-controls button {
  min-height: 42px;
  padding: 8px 10px;
}

.learn-controls button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

#learnResetBtn {
  grid-column: 1 / -1;
}

.learn-input-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.learn-input-toggle button,
.learn-digit-pad button {
  min-height: 42px;
  border-radius: 14px;
}

.learn-digit-pad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
}

.learn-digit-pad button {
  min-height: 46px;
  font-size: 1.1rem;
}

.learn-status {
  margin-top: 12px;
  font-size: 0.82rem;
  color: rgba(238,242,255,0.72);
}

.learn-status[data-tone="bad"] {
  color: #fecaca;
}

.learn-status[data-tone="good"] {
  color: #bbf7d0;
}

.learn-visual-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 850;
  color: rgba(238,242,255,0.88);
}

.learn-visual-legend.hidden {
  display: none;
}

.learn-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}

.learn-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.learn-legend-swatch.legend-focus { background: #facc15; }
.learn-legend-swatch.legend-keep { background: #22c55e; }
.learn-legend-swatch.legend-remove { background: #ef4444; }
.learn-legend-swatch.legend-pivot { background: #3b82f6; }
.learn-legend-swatch.legend-wing { background: #a855f7; }
.learn-legend-swatch.legend-start { background: #3b82f6; }
.learn-legend-swatch.legend-link { background: #a855f7; }
.learn-legend-swatch.legend-end { background: #22c55e; }

.theatre-caption {
  min-height: 56px;
  transition: opacity 180ms ease, transform 180ms ease;
}

.theatre-caption.is-changing {
  opacity: 0;
  transform: translateY(5px);
}

@media (max-width: 860px) {
  .learn-arena-head,
  .learn-arena-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .learn-mode-tabs {
    width: 100%;
  }

  .learn-mode-tabs button {
    flex: 1;
  }
}

@media (max-width: 760px) {
  .learn-digit-pad {
    grid-template-columns: repeat(3, 1fr);
  }

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

.theatre-hidden {
  display: none !important;
}

.learn-board-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.learn-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 20;
}

.learn-overlay-line {
  stroke: rgba(37,99,235,0.95);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(37,99,235,0.65));
  animation: theatreLineDraw 800ms ease-out both;
}

.learn-overlay-line.gold {
  stroke: rgba(245,158,11,0.98);
  filter: drop-shadow(0 0 7px rgba(245,158,11,0.7));
}

.learn-overlay-line.red {
  stroke: rgba(225,29,72,0.96);
  filter: drop-shadow(0 0 7px rgba(225,29,72,0.72));
}

.learn-overlay-arrow {
  fill: rgba(37,99,235,0.95);
  filter: drop-shadow(0 0 5px rgba(37,99,235,0.55));
}

.learn-overlay-arrow.gold {
  fill: rgba(245,158,11,0.98);
}

.learn-overlay-arrow.red {
  fill: rgba(225,29,72,0.96);
}

@keyframes theatreLineDraw {
  from {
    opacity: 0;
    stroke-dasharray: 18 18;
    stroke-dashoffset: 80;
  }

  to {
    opacity: 1;
    stroke-dasharray: 18 0;
    stroke-dashoffset: 0;
  }
}