/* rechenrahmen.css - Styles for the 100-er Rechenrahmen math game */

:root {
  --wood-outer: #8d5b30;
  --wood-inner: #c59363;
  --wood-light: #dfb288;
  --wood-shadow: #5c3818;
  --bead-red: radial-gradient(circle at 35% 35%, #ff8585 0%, #ee3a3a 55%, #b31e1e 100%);
  --bead-blue: radial-gradient(circle at 35% 35%, #7ec6ff 0%, #1e88e5 55%, #0d47a1 100%);
  --bead-highlight: 0 0 12px 3px rgba(255, 230, 0, 0.85);
  --bead-new-highlight: 0 0 12px 3px rgba(46, 213, 115, 0.9);
  --bead-size: 26px;
  --bead-size-mobile: 20px;
}

/* ---------- Game Header & Tabs ---------- */
.rr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  gap: 16px;
}

.rr-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
}

.rr-score-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--purple, #6c5ce7);
  font-weight: bold;
  font-size: 1.05rem;
  color: var(--ink, #2d3436);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.15);
}

.rr-sound-btn {
  background: #fff;
  border: 2px solid var(--line, #dfe6e9);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.rr-sound-btn:hover {
  border-color: var(--purple, #6c5ce7);
  transform: scale(1.05);
}

/* Navigation Tabs */
.rr-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.rr-tab-btn {
  font: inherit;
  font-weight: bold;
  font-size: 0.95rem;
  padding: 10px 16px;
  border: 2.5px solid var(--line, #dfe6e9);
  border-radius: 14px;
  background: #fff;
  color: var(--muted, #636e72);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rr-tab-btn:hover {
  border-color: var(--purple-2, #a29bfe);
  color: var(--purple, #6c5ce7);
  transform: translateY(-2px);
}

.rr-tab-btn.active {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

/* Mascot Dragon banner */
.rr-mascot-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f7f6ff;
  border: 3px solid #e1dcff;
  border-radius: 18px;
  padding: 12px 18px;
  width: 100%;
  box-sizing: border-box;
}

.rr-dragon-icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  animation: dragonBounce 2s ease-in-out infinite alternate;
}

@keyframes dragonBounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

.rr-mascot-speech {
  font-size: 1.15rem;
  font-weight: bold;
  color: #2d3436;
  line-height: 1.4;
}

.rr-mascot-speech em {
  color: #6c5ce7;
  font-style: normal;
}

/* ---------- The Rechenrahmen (Abacus) Component ---------- */
.rr-frame-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.rr-frame {
  position: relative;
  background: linear-gradient(135deg, var(--wood-inner) 0%, var(--wood-light) 100%);
  border: 10px solid var(--wood-outer);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(92, 56, 24, 0.35), inset 0 2px 8px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 680px;
  padding: 12px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}

/* Curtain for Blitz-Sehen or Verdeckt */
.rr-curtain {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2d3436, #636e72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 20;
  border-radius: 6px;
  transition: opacity 0.35s ease, transform 0.35s ease;
  font-weight: bold;
  font-size: 1.3rem;
  gap: 10px;
}
.rr-curtain.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* Rows & Wires */
.rr-row {
  position: relative;
  height: 32px;
  width: 100%;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

/* Middle separator bar between row 5 (up to 50) and row 6 (51-100) to emphasize the 50 split */
.rr-row[data-row="4"] {
  margin-bottom: 8px;
  border-bottom: 2px dashed rgba(141, 91, 48, 0.7);
  padding-bottom: 8px;
}

.rr-wire {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(to bottom, #dcdde1, #718093);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  border-radius: 2px;
  z-index: 1;
}

/* Row bead track */
.rr-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  cursor: pointer;
}

.rr-left-beads, .rr-right-beads {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 1.5px;
  transition: width 0.25s ease-out;
}

.rr-bead {
  width: var(--bead-size);
  height: var(--bead-size);
  border-radius: 50%;
  box-sizing: border-box;
  box-shadow: 0 3px 6px rgba(0,0,0,0.35), inset 0 1px 2px rgba(255,255,255,0.4);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
  position: relative;
}

.rr-bead:hover {
  transform: scale(1.12);
}

.rr-bead.red {
  background: var(--bead-red);
}

.rr-bead.blue {
  background: var(--bead-blue);
}

.rr-bead.highlight-step1 {
  box-shadow: var(--bead-highlight);
  animation: pulseHighlight 1.5s infinite;
}

.rr-bead.highlight-step2 {
  box-shadow: var(--bead-new-highlight);
  animation: pulseHighlight 1.5s infinite;
}

@keyframes pulseHighlight {
  0%, 100% { filter: brightness(1.05); }
  50% { filter: brightness(1.35); }
}

/* Abacus bottom bar & quick controls */
.rr-frame-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 680px;
  margin-top: 8px;
  padding: 0 6px;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--ink, #2d3436);
  flex-wrap: wrap;
  gap: 8px;
}

.rr-count-pill {
  background: #fff;
  border: 2px solid var(--purple, #6c5ce7);
  padding: 4px 14px;
  border-radius: 16px;
  color: var(--purple, #6c5ce7);
  font-size: 1.1rem;
}

.rr-frame-actions {
  display: flex;
  gap: 6px;
}

.rr-mini-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 4px 10px;
  border: 2px solid var(--line, #dfe6e9);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.rr-mini-btn:hover {
  border-color: var(--purple, #6c5ce7);
  background: #f7f6ff;
}

/* ---------- Mode Panels ---------- */
.rr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.rr-panel.gone {
  display: none !important;
}

/* Sub tabs for mode 1 */
.rr-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.rr-subtab-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: bold;
  padding: 6px 14px;
  border-radius: 12px;
  border: 2px solid var(--line, #dfe6e9);
  background: #fff;
  color: var(--muted, #636e72);
  cursor: pointer;
}
.rr-subtab-btn.active {
  background: #fff4e6;
  border-color: var(--orange, #e17055);
  color: #b35900;
}

/* Step-by-Step Breakdown Cards */
.rr-step-card {
  background: #fff;
  border: 3px solid #e1dcff;
  border-radius: 18px;
  padding: 16px 20px;
  width: 100%;
  max-width: 680px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.08);
}

.rr-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: var(--purple, #6c5ce7);
  font-size: 1.15rem;
}

.rr-split-math {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 1.4rem;
  font-weight: bold;
  padding: 10px;
  background: #fdfdfd;
  border-radius: 14px;
  border: 2px dashed #dcdde1;
}

.rr-number-bubble {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.rr-split-arrows {
  display: flex;
  gap: 14px;
  margin-top: 4px;
  font-size: 0.95rem;
  color: #e17055;
}

.rr-split-badge {
  background: #fff0eb;
  border: 2px solid #e17055;
  border-radius: 12px;
  padding: 2px 8px;
  font-weight: bold;
}

/* Step formula lines */
.rr-step-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: bold;
  width: 100%;
}

.rr-step-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #f7f6ff;
  transition: all 0.25s ease;
}

.rr-step-line.active {
  background: #fff9e6;
  border: 2px solid #f1c40f;
  transform: scale(1.02);
}

.rr-input-box {
  width: 58px;
  height: 44px;
  font: inherit;
  font-size: 1.3rem;
  font-weight: bold;
  text-align: center;
  border: 3px solid var(--purple, #6c5ce7);
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: var(--ink, #2d3436);
  transition: all 0.2s;
}

.rr-input-box:focus {
  border-color: #0984e3;
  box-shadow: 0 0 0 4px rgba(9, 132, 227, 0.2);
}

.rr-input-box.ok {
  border-color: var(--green, #00b894);
  background: #e6fbf3;
}

.rr-input-box.err {
  border-color: var(--red, #d63031);
  background: #fff3f0;
}

/* Controls row */
.rr-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 6px;
}

.rr-action-btn {
  font: inherit;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 10px 24px;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rr-btn-primary {
  background: linear-gradient(135deg, #6c5ce7, #8e44ad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}
.rr-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.4);
}

.rr-btn-secondary {
  background: #fff;
  color: var(--purple, #6c5ce7);
  border: 2px solid var(--purple, #6c5ce7);
}
.rr-btn-secondary:hover {
  background: #f7f6ff;
  transform: translateY(-2px);
}

.rr-btn-green {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #fff;
}

/* Solution bank (Ex 5) */
.rr-pool-card {
  background: #fff;
  border: 3px solid #dfe6e9;
  border-radius: 16px;
  padding: 14px 18px;
  width: 100%;
  max-width: 680px;
  box-sizing: border-box;
  text-align: center;
}

.rr-pool-title {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--muted, #636e72);
  margin-bottom: 8px;
}

.rr-pool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.rr-pool-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #edf2f7;
  color: #2d3436;
  font-weight: bold;
  font-size: 1.1rem;
  border: 2px solid #cbd5e0;
  transition: all 0.2s;
}

.rr-pool-chip.used {
  background: #e2e8f0;
  color: #a0aec0;
  text-decoration: line-through;
  opacity: 0.6;
}

/* Kleine Schwester & Päckchen Grid */
.rr-sister-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 680px;
}

.rr-sister-card {
  background: #fff;
  border: 3px solid #dfe6e9;
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.rr-sister-card.base {
  border-color: #f39c12;
  background: #fffaf0;
}

.rr-sister-card .sister-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: #e67e22;
}

.rr-sister-card .sister-expr {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--ink, #2d3436);
}

/* Nachbarzehner Dragons display */
.rr-dragons-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 680px;
  margin-bottom: -6px;
  padding: 0 10px;
  box-sizing: border-box;
}

.rr-dragon-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 6px 14px;
  border-radius: 16px;
  font-weight: bold;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.rr-dragon-badge.green { border: 2px solid #00b894; color: #00795f; }
.rr-dragon-badge.red { border: 2px solid #ff7675; color: #d63031; }

/* Book exercises page selector */
.rr-book-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 10px;
}

.rr-book-tab {
  font: inherit;
  font-size: 0.88rem;
  font-weight: bold;
  padding: 6px 12px;
  border: 2px solid var(--line, #dfe6e9);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.rr-book-tab.active {
  background: #6c5ce7;
  color: #fff;
  border-color: #6c5ce7;
}

/* Feedback banner */
.rr-feedback {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
  text-align: center;
  width: 100%;
  padding: 4px;
  border-radius: 12px;
  transition: all 0.3s;
}

.rr-feedback.correct {
  color: #00b894;
  animation: popIn 0.3s ease;
}

.rr-feedback.wrong {
  color: #e17055;
  animation: shake 0.4s ease;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Responsive design */
@media (max-width: 680px) {
  :root {
    --bead-size: 20px;
  }
  .rr-frame {
    padding: 8px 10px;
    border-width: 7px;
  }
  .rr-row {
    height: 26px;
  }
  .rr-tab-btn {
    font-size: 0.85rem;
    padding: 8px 12px;
  }
  .rr-split-math {
    font-size: 1.15rem;
    gap: 8px;
  }
  .rr-step-line {
    font-size: 1.05rem;
  }
  .rr-input-box {
    width: 48px;
    height: 38px;
    font-size: 1.1rem;
  }
}
