:root { --green: #176f6b; --dark: #173d3d; --coral: #e8765d; --yellow: #f7ca58; --cream: #fffdf7; --paper: #f4f1e8; --muted: #78908a; }
* { box-sizing: border-box; }
html { overflow-x: hidden; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--paper); color: var(--dark); font-family: "Nunito", sans-serif; }
button { font: inherit; cursor: pointer; }
.page { width: min(620px, calc(100% - 28px)); margin: auto; padding: 28px 0 42px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }.logo { display: flex; align-items: center; gap: 9px; color: var(--dark); font: 800 17px "Baloo 2", sans-serif; }.logo-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; background: var(--mint, #e7f5e8); font-size: 16px; box-shadow: 0 2px 0 rgba(23, 111, 107, .14); }.logo em { color: var(--coral); font-style: normal; }.score { color: var(--muted); font-size: 14px; }.score b { color: var(--dark); }
.game-card { padding: 30px 24px 27px; border: 1px solid #e1e5d9; border-radius: 12px; background: var(--cream); text-align: center; box-shadow: 0 15px 35px rgba(35, 74, 68, .08); }.question-label, .small-label { color: var(--coral); font-size: 11px; font-weight: 900; letter-spacing: 2px; }.turn-banner { display: block; width: fit-content; margin: 0 auto 12px; padding: 9px 18px; border-radius: 999px; background: var(--coral); color: #fff; font: 800 15px "Baloo 2", sans-serif; box-shadow: 0 4px 0 rgba(0, 0, 0, .08); }.turn-banner b { color: #fff; }.brand-footer { display: flex; justify-content: center; margin: 34px auto 0; padding: 0 4px; }.brand-footer-link { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 22px; max-width: 780px; width: 100%; padding: 32px 40px; border: 1px solid #cfe9f7; border-radius: 24px; background: linear-gradient(135deg, #eaf7fd 0%, #fbfdf7 100%); color: var(--dark); font-size: 17px; font-weight: 800; line-height: 1.4; text-align: center; text-decoration: none; box-shadow: 0 20px 45px rgba(31, 83, 72, .10); transition: transform .15s ease, box-shadow .15s ease; }.brand-footer-link:hover { transform: translateY(-3px); box-shadow: 0 26px 55px rgba(31, 83, 72, .14); }.brand-footer-link img { height: 72px; width: auto; display: block; flex-shrink: 0; }
@media (max-width: 560px) { .brand-footer-link { flex-direction: column; gap: 14px; padding: 26px 22px; font-size: 15px; } .brand-footer-link img { height: 56px; } }
.turn-popup { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(23, 61, 61, .32); pointer-events: none; padding: 20px; }.turn-popup-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 48px; border-radius: 28px; background: var(--coral); color: #fff; text-align: center; box-shadow: 0 25px 55px rgba(0, 0, 0, .28); animation: turnPopIn .45s cubic-bezier(.22, 1.4, .4, 1) both; }.turn-popup-icon { font-size: 48px; }.turn-popup-text { font: 800 clamp(26px, 6vw, 36px)/1.2 "Baloo 2", sans-serif; }.turn-popup-text b { font-size: 1.15em; }@keyframes turnPopIn { from { opacity: 0; transform: scale(.7) translateY(14px); } 60% { opacity: 1; } to { opacity: 1; transform: scale(1) translateY(0); } }.game-card h1 { margin: 8px 0 0; color: var(--green); font: 800 clamp(58px, 13vw, 86px)/1 "Baloo 2", sans-serif; }.question-mark { color: var(--coral); }.question-help { margin: 3px 0 23px; color: var(--muted); font-size: 16px; font-weight: 800; }
.abacus { min-height: 218px; display: flex; justify-content: center; align-items: flex-end; gap: 9px; padding: 0 8px 0; border-bottom: 7px solid var(--green); }.rod-wrap { display: flex; flex-direction: column; align-items: center; flex: 1 1 0; max-width: 52px; }.rod { position: relative; width: 52px; height: 174px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; padding: 7px 5px; border: 2px solid #aac4b8; border-bottom: 0; border-radius: 9px 9px 0 0; background: #f7f8ef; }.rod::before { content: ""; position: absolute; inset: 0; z-index: 0; margin: auto; width: 4px; background: #cbdad0; }.rod-label { margin-top: 6px; color: var(--green); font: 800 12px "Baloo 2", sans-serif; }.bead { z-index: 1; width: 38px; height: 27px; border: 2px solid #d39c3b; border-radius: 50%; background: var(--yellow); box-shadow: inset 0 -3px rgba(180, 125, 28, .12); }.bead.empty { opacity: .25; border-style: dashed; border-color: var(--green); background: transparent; box-shadow: none; }.bead:hover { transform: scale(1.08); }.count-help { margin: 13px 0 19px; color: var(--muted); font-size: 13px; font-weight: 700; }.count-help b { color: var(--coral); }
.answers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; max-width: 380px; margin: 0 auto; }.answer { min-height: 53px; border: 2px solid #dce5da; border-radius: 7px; background: white; color: var(--dark); font: 800 27px "Baloo 2", sans-serif; transition: .2s; }.answer:hover { border-color: var(--green); transform: translateY(-2px); }.answer:disabled { opacity: .4; cursor: not-allowed; transform: none; }.answer.correct { border-color: #66aa7c; background: #e7f4e6; color: #34764d; }.answer.wrong { border-color: #e39a84; background: #fff0eb; color: #c45a42; }.feedback { min-height: 23px; margin: 13px 0 5px; color: var(--green); font-size: 13px; font-weight: 900; }.next-button { border: 0; border-radius: 6px; padding: 11px 17px; background: var(--coral); color: white; font-size: 13px; font-weight: 900; }.next-button:disabled { opacity: .35; cursor: not-allowed; }.next-button span, .learn-button span { margin-left: 9px; font-size: 17px; }
.learn-button { display: block; margin: 18px auto 0; border: 0; border-bottom: 2px solid #bdd2c4; padding: 7px 3px; background: transparent; color: var(--green); font-size: 14px; font-weight: 900; }.learn-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; margin-top: 14px; padding: 24px; border: 1px solid #e1e5d9; border-radius: 10px; background: #e4f0e7; }.learn-card h2 { margin: 5px 0 0; font: 800 25px "Baloo 2", sans-serif; }.learn-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }.number-picker { grid-column: 1 / -1; display: flex; gap: 6px; }.number-picker button { width: 31px; height: 31px; border: 1px solid #c6dbce; border-radius: 4px; background: white; color: var(--green); font-weight: 900; }.number-picker button.active { background: var(--green); color: white; }.learn-equation { color: var(--green); font: 800 23px "Baloo 2", sans-serif; }.learn-equation strong { color: var(--coral); font-size: 32px; }.learn-abacus { grid-column: 1 / -1; display: flex; justify-content: center; gap: 8px; border-bottom: 5px solid var(--green); }.learn-abacus .rod { width: 36px; height: 130px; }.learn-abacus .bead { width: 29px; height: 20px; }.hidden { display: none !important; }
@media (max-width: 500px) { .page { padding-top: 17px; }.game-card { padding: 26px 14px 23px; }.abacus { gap: 3px; padding-left: 0; padding-right: 0; }.rod-wrap { max-width: 33px; }.rod { width: 33px; padding-left: 1px; padding-right: 1px; }.bead { width: 29px; height: 22px; }.rod-label { font-size: 10px; }.answers { gap: 6px; }.learn-card { grid-template-columns: 1fr; }.learn-equation { grid-row: 3; }.learn-abacus { grid-row: 4; overflow-x: auto; justify-content: flex-start; padding-left: 6px; } }

body { background-color: var(--paper); background-image: radial-gradient(#dce9dc 1px, transparent 1px); background-size: 20px 20px; }
.page { width: min(760px, calc(100% - 28px)); }.topbar { max-width: 660px; margin: 0 auto 18px; }.logo { font-size: 19px; }.logo-icon { width: 36px; height: 36px; font-size: 18px; }
.score { display: flex; gap: 6px; }.score-pill { padding: 7px 11px; border-radius: 18px; background: #fff4c9; color: #9b711d; font-size: 12px; font-weight: 800; opacity: .5; white-space: nowrap; transition: opacity .2s ease, box-shadow .2s ease; }.score-pill b { color: #d66a50; font-size: 15px; }.score-pill.active { opacity: 1; box-shadow: 0 3px 0 rgba(214, 106, 80, .18); }
.welcome { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; max-width: 660px; margin: 0 auto 18px; padding: 10px 18px; border-radius: 999px; background: #dff0e3; }.welcome-badge { display: inline-block; padding: 6px 12px; border-radius: 20px; background: #fff4c9; color: #a26e1c; font-size: 11px; font-weight: 900; letter-spacing: .3px; white-space: nowrap; }.sparkle { position: absolute; color: var(--coral); font-size: 25px; }.sparkle-one { left: 9%; top: 21%; }.sparkle-two { right: 14%; bottom: 20%; color: var(--yellow); }.sparkle-three { left: 16%; bottom: 16%; color: var(--green); font-size: 18px; }.mode-buttons { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .6); }.mode-button { display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 7px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 900; white-space: nowrap; transition: transform .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease; }.mode-button:hover { color: var(--green); }.mode-button.active { background: var(--cream); color: var(--coral); box-shadow: 0 3px 0 rgba(233, 118, 93, .14); }.mode-icon { font-size: 15px; }
.game-card { max-width: 660px; margin: auto; }.learn-card { max-width: 660px; display: flex; flex-direction: column; gap: 0; margin: 18px auto 0; padding: 26px; border: 1px solid #e1e5d9; border-radius: 14px; background: var(--cream); box-shadow: 0 15px 35px rgba(35, 74, 68, .08); }.play-heading { text-align: center; }.play-heading h2 { margin: 5px 0 2px; color: var(--dark); font: 800 29px/1 "Baloo 2", sans-serif; }.play-heading p { margin: 5px 0 18px; }.play-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 15px 0 6px; border-top: 1px dashed #d7e2d5; }.play-controls > div > b { display: block; margin-bottom: 7px; color: var(--green); font-size: 12px; }.number-picker, .bead-picker { display: flex; flex-wrap: wrap; gap: 5px; }.number-picker button, .bead-picker button { width: 28px; height: 28px; border: 1px solid #c6dbce; border-radius: 5px; background: white; color: var(--green); font-size: 12px; font-weight: 900; }.number-picker button.active, .bead-picker button.active { border-color: var(--coral); background: var(--coral); color: white; }.learn-equation { align-self: center; margin: 8px 0 4px; }.learning-explanation { flex: 0 0 auto; order: 5; min-height: 48px; text-align: center; }.learning-explanation p { margin: 2px 0; color: var(--muted); font-size: 13px; font-weight: 800; }.learning-explanation p:first-child { color: var(--coral); }.learning-explanation p:last-child { color: var(--green); font: 800 18px "Baloo 2", sans-serif; }.learn-abacus { order: 4; width: 100%; min-height: 370px; padding-top: 0; }.learn-abacus .rod-wrap { max-width: 52px; }.learn-abacus .rod { width: 52px; height: 339px; }.learn-abacus .bead { width: 38px; height: 28px; }
.rod-wrap, .bead { flex-shrink: 0; }
@media (max-width: 500px) { .welcome { padding: 8px 12px; }.mode-button { padding: 6px 10px; font-size: 11px; }.mode-icon { font-size: 14px; }.play-controls { grid-template-columns: 1fr; gap: 12px; }.learn-card { padding: 22px 14px; }.learn-abacus { overflow-x: auto; justify-content: flex-start; padding-left: 0; }.learn-abacus .rod-wrap { flex: 0 0 33px; }.learn-abacus .rod { width: 33px; height: 279px; padding-left: 1px; padding-right: 1px; }.learn-abacus .bead { width: 29px; height: 22px; } }

/* ---- Ekran geçişleri & oyun-hissi mikro animasyonlar ---- */
.screen-enter { animation: screenPopIn .5s cubic-bezier(.22, 1.36, .4, 1) both; }
.screen-exit { animation: screenPopOut .2s ease-in both; }
@keyframes screenPopIn { 0% { opacity: 0; transform: scale(.92) translateY(16px); } 60% { opacity: 1; } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes screenPopOut { to { opacity: 0; transform: scale(.96) translateY(-10px); } }

.rod-pop { animation: rodPop .32s cubic-bezier(.22, 1.36, .4, 1) both; }
@keyframes rodPop { from { opacity: 0; transform: translateY(10px) scale(.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

.answer-pop { animation: answerPop .32s cubic-bezier(.22, 1.36, .4, 1) both; }
@keyframes answerPop { from { opacity: 0; transform: translateY(8px) scale(.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

.question-pop { animation: popBounce .4s ease both; }
@keyframes popBounce { 0% { transform: scale(1); } 35% { transform: scale(1.14); } 60% { transform: scale(.95); } 100% { transform: scale(1); } }

.answer.correct { animation: popBounce .45s ease; }
@keyframes shakeX { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.answer.wrong { animation: shakeX .4s ease; }

.score-bump { animation: popBounce .4s ease; }

.start-icon { display: inline-block; animation: floatY 2.4s ease-in-out infinite; }
.finish-icon { display: inline-block; animation: popBounce .6s ease .1s both, floatY 2.4s ease-in-out .7s infinite; }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

button { transition: transform .12s ease; }
button:active { transform: scale(.95); }
.answer:active { transform: translateY(-1px) scale(.95); }
.mode-button:active, .start-mode-button:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  .screen-enter, .screen-exit, .rod-pop, .answer-pop, .question-pop, .answer.correct, .answer.wrong,
  .score-bump, .start-icon, .finish-icon, button, .answer, .mode-button, .start-mode-button, .turn-popup-card {
    animation: none !important;
    transition: none !important;
  }
}

/* ---- Mobil taşma düzeltmeleri ---- */
/* Uzun oyuncu adları .score rozetini genişletip tüm sayfayı yatayda taşırıyordu (flex öğeleri
   varsayılan olarak min-width:auto ile küçülmeyi reddediyor). Küçülmelerine izin verip gerekirse
   kısaltıyoruz, topbar da son çare olarak alt satıra sarabiliyor. */
.topbar, .welcome { flex-wrap: wrap; row-gap: 8px; }
.score, .score-pill, .mode-buttons, .mode-button { min-width: 0; }
.score-pill { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 600px) {
  .game-card h1 { font-size: clamp(32px, 12vw, 58px); }
  .score-pill { max-width: 40vw; font-size: 11px; padding: 6px 9px; }
}

/* ---- Sırasına göre renkli boncuklar + solda sıra numaraları (Montessori boncuk merdiveni renkleri) ---- */
/* row-numbers-wrap, altındaki gizli "rod-label" boşluğu sayesinde asıl çubukların altındaki
   "1x, 2x..." etiketiyle aynı toplam yüksekliğe sahip oluyor; aksi halde align-items:flex-end
   sayıları çubuğun değil, etiketin altına hizalıyor ve ilk boncukla "1" örtüşmüyordu. */
.row-numbers-wrap { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.row-numbers { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: 5px; padding: 7px 6px 7px 0; }
.row-numbers span { display: flex; align-items: center; height: 28px; font: 800 12px "Baloo 2", sans-serif; line-height: 1; }

.rod .bead:nth-child(1):not(.empty) { background: #e6564a; border-color: #c23f35; }
.rod .bead:nth-child(2):not(.empty) { background: #4caf6b; border-color: #358a51; }
.rod .bead:nth-child(3):not(.empty) { background: #f2a0c4; border-color: #d97ba3; }
.rod .bead:nth-child(4):not(.empty) { background: #f7ca58; border-color: #d3a53a; }
.rod .bead:nth-child(5):not(.empty) { background: #6ec3e0; border-color: #3f9dbd; }
.rod .bead:nth-child(6):not(.empty) { background: #9b7fd4; border-color: #7a5cb5; }
.rod .bead:nth-child(7):not(.empty) { background: #fbf8ef; border-color: #c9c2ac; }
.rod .bead:nth-child(8):not(.empty) { background: #b07c4f; border-color: #8a5c34; }
.rod .bead:nth-child(9):not(.empty) { background: #3d5a8c; border-color: #2a3f66; }
.rod .bead:nth-child(10):not(.empty) { background: #f0933f; border-color: #cc7326; }

.row-numbers span:nth-child(1) { color: #c23f35; }
.row-numbers span:nth-child(2) { color: #2f7a48; }
.row-numbers span:nth-child(3) { color: #c15a86; }
.row-numbers span:nth-child(4) { color: #a9791b; }
.row-numbers span:nth-child(5) { color: #2c7f9c; }
.row-numbers span:nth-child(6) { color: #6a4fae; }
.row-numbers span:nth-child(7) { color: #8f886f; }
.row-numbers span:nth-child(8) { color: #74502c; }
.row-numbers span:nth-child(9) { color: #1f3358; }
.row-numbers span:nth-child(10) { color: #b85f1e; }

@media (max-width: 600px) {
  .row-numbers span { height: 22px; font-size: 10px; }
  .row-numbers { padding-right: 4px; }
}

