/* Soroban Academy R58 — mobile-first navigation / scroll / refined feature icons. */
html.r57-shell body.r57-app-mode{overflow-y:auto!important;overflow-x:hidden!important;touch-action:pan-y!important}
body.r57-app-mode #app{height:auto!important;min-height:100dvh!important;max-height:none!important;overflow:visible!important}
body.r57-app-mode #app>main:not(.hidden),body.r57-app-mode #app>section:not(.hidden){
  display:block!important;height:auto!important;min-height:calc(100dvh - 62px)!important;max-height:none!important;
  overflow-y:visible!important;overflow-x:clip!important;touch-action:pan-y!important;overscroll-behavior-y:auto!important;
  -webkit-overflow-scrolling:touch!important;scroll-behavior:auto!important;box-sizing:border-box!important
}
body.r57-app-mode #app>main.hidden,body.r57-app-mode #app>section.hidden{display:none!important}
.r55GamePage,.r56Page,.r46GamePage{min-height:100%!important;height:auto!important;box-sizing:border-box!important}
#r46DinoCanvas,#r56MazeCanvas,#r55PuzzleBoard,#r55PuzzleBoard *,#r58BallCanvas{touch-action:none!important}
#r46DuelPage button,#r56ArenaPage button,#r55NumberPage button,#r55FlashPage button{touch-action:manipulation}

/* Premium compact feature marks on home cards. */
.r58FeatureIcon{position:relative;width:92px;height:92px;border-radius:28px;display:grid;place-items:center;isolation:isolate;
  background:linear-gradient(145deg,#fff,#eaf3ee);border:1px solid rgba(31,84,67,.10);box-shadow:0 14px 28px rgba(31,75,59,.15),inset 0 1px 0 #fff;overflow:hidden}
.r58FeatureIcon:before,.r58FeatureIcon:after{content:"";position:absolute;border-radius:999px;z-index:-1}.r58FeatureIcon:before{width:70px;height:70px;right:-22px;top:-24px;background:rgba(255,255,255,.55)}.r58FeatureIcon:after{width:58px;height:58px;left:-20px;bottom:-23px;background:rgba(255,255,255,.28)}
.r58FeatureIcon i{font-style:normal;font-weight:1000;font-size:31px;letter-spacing:-2px;text-shadow:0 2px 0 rgba(255,255,255,.5)}.r58FeatureIcon b{position:absolute;width:26px;height:7px;border-radius:99px;bottom:14px;background:rgba(255,255,255,.72);box-shadow:0 0 0 1px rgba(0,0,0,.03)}
.r58-numbers{background:linear-gradient(145deg,#edf9f1,#bfe5d0);color:#1b674f}.r58-cards{background:linear-gradient(145deg,#f5effd,#dac8f3);color:#654797}.r58-maze{background:linear-gradient(145deg,#fff4dc,#f5c77b);color:#8c5c13}.r58-arena{background:linear-gradient(145deg,#e7f7f1,#9fd8c3);color:#155d49}.r58-ball{background:linear-gradient(145deg,#f7fbf8,#cfe5d6);color:#233b32}.r58-puzzle{background:linear-gradient(145deg,#fff5dc,#efd290);color:#845c17}.r58-dino{background:linear-gradient(145deg,#eef8e9,#bcdca8);color:#356a27}.r58-hearts{background:linear-gradient(145deg,#fff0f2,#efbdc6);color:#a83d52}.r58-adventure{background:linear-gradient(145deg,#edf6ff,#bddbf4);color:#336b96}

/* Dinosaur: three explicit levels, cleaner compact shell. */
.r58DinoDifficulty{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;max-width:540px;margin:0 auto 9px;padding:5px;background:#eef4ef;border:1px solid #d9e4dc;border-radius:16px}
.r58DinoDifficulty button{border:0;border-radius:11px;background:transparent;color:#547067;font-weight:950;padding:9px 6px;cursor:pointer}
.r58DinoDifficulty button.on{background:#fff;color:#1d674f;box-shadow:0 4px 12px rgba(28,83,64,.11)}
#r46DinoPage .r46DinoCanvasWrap{height:min(54vh,480px)!important;min-height:300px!important}
#r46DinoPage .r46DinoShell{max-width:900px;margin:auto;background:#fff!important}

/* Vertical ball challenge — no ruler, no start button, tap the ball itself. */
.r58GamePage{padding:14px clamp(10px,3vw,22px) 26px;background:linear-gradient(180deg,#f7f5ed,#eef5f0);direction:rtl}
.r58PageHead{max-width:820px;margin:0 auto 12px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.r58PageHead h2{margin:2px 0;color:#173f34;font-size:clamp(24px,5vw,34px)}.r58PageHead small{font-weight:950;color:#a27125}.r58PageHead p{margin:0;color:#6d7a73;font-weight:750}.r58Back{border:0;border-radius:13px;padding:10px 13px;background:#1f6d57;color:white;font-weight:950}
.r58BallShell{max-width:650px;margin:auto;background:#fff;border:1px solid #dce6df;border-radius:25px;padding:10px;box-shadow:0 17px 42px rgba(31,74,58,.10)}
.r58BallTop{display:grid;grid-template-columns:auto auto 1fr;gap:8px;align-items:center;margin-bottom:8px}.r58BallTop>div:not(.r58BallTools){background:#f6f8f4;border:1px solid #e1e6df;border-radius:14px;padding:7px 12px;text-align:center;min-width:78px}.r58BallTop span{display:block;font-size:19px;font-weight:1000;color:#1b5c48}.r58BallTop small{font-size:10px;color:#748079}.r58BallTools{justify-self:end;display:flex;gap:6px}.r58BallTools button{width:42px;height:42px;border-radius:13px;border:1px solid #dde5df;background:#f7f9f6;font-size:17px}.r58BallTools button:disabled{opacity:.4}
.r58BallStage{position:relative;height:min(70vh,650px);min-height:430px;border-radius:21px;overflow:hidden;background:#edf6f0}.r58BallStage canvas{display:block;width:100%;height:100%}.r58BallHint{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);width:max-content;max-width:88%;padding:9px 14px;border-radius:999px;background:rgba(21,73,56,.82);color:#fff;font-weight:900;font-size:12px;text-align:center;pointer-events:none;backdrop-filter:blur(6px)}.r58BallHint.hidden{display:none!important}
.r55PuzzleEmpty{display:grid;gap:7px;place-items:center}.r55PuzzleEmpty b{font-size:18px;color:#315b4d}.r55PuzzleEmpty span{font-size:13px;color:#718078}

@media(max-width:700px){
  .r58FeatureIcon{width:78px;height:78px;border-radius:23px}.r58FeatureIcon i{font-size:27px}
  .r58PageHead{align-items:flex-start}.r58PageHead p{font-size:12px}.r58BallStage{height:65dvh;min-height:400px}
  .r58BallTop{grid-template-columns:auto auto 1fr}.r58BallTop>div:not(.r58BallTools){min-width:65px;padding:6px 8px}
  .r58DinoDifficulty{margin-bottom:7px}.r58DinoDifficulty button{font-size:12px;padding:8px 3px}
  #r46DinoPage .r53DinoControls{grid-template-columns:1fr 48px 48px!important}
}


/* R58 final scroll contract — one open page, one vertical scroller. */
body.r57-app-mode #app>main:not(.hidden),body.r57-app-mode #app>section:not(.hidden){
  position:relative!important;inset:auto!important;max-width:none!important;
  padding-top:clamp(10px,2vw,18px)!important;padding-bottom:max(30px,env(safe-area-inset-bottom))!important;
  scrollbar-gutter:stable;contain:layout style;
}
body.r57-app-mode #app>main:not(.hidden) .wrap,body.r57-app-mode #app>section:not(.hidden) .wrap{max-width:100%!important}
#r46DuelPage,#r46DinoPage,#r55PuzzlePage,#r55NumberPage,#r55FlashPage,#r56MazePage,#r56ArenaPage,#r58BallPage{
  overflow-y:visible!important;overflow-x:clip!important;touch-action:pan-y!important;
}
#r46DuelPage .r46Arena,#r46DuelPage .r46Setup,#r56ArenaPage .r56Panel,#r56MazePage .r56Panel{min-width:0!important;max-width:100%!important}
@media(max-width:700px){
 body.r57-app-mode #app>main:not(.hidden),body.r57-app-mode #app>section:not(.hidden){padding-inline:9px!important}
 #r46DuelPage .r46GameBody,#r46DinoPage .r46GameBody{padding-inline:0!important}
 #r46DuelPage .r46Answers{min-width:0!important;overflow:visible!important}
}

/* R58 final home visual system — one refined icon language for every feature. */
#modules.r46HomeGrid.r58PolishedGrid{
  display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;
  align-items:stretch!important;padding-inline:0!important
}
#modules.r46HomeGrid.r58PolishedGrid>.r46GroupTitle{grid-column:1/-1!important;margin:18px 2px 3px!important;padding:0!important;font-size:20px!important;font-weight:1000!important;color:#1c5f4d!important;line-height:1.2!important}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard,
#modules.r46HomeGrid.r58PolishedGrid>.safeR25Card.r58PolishedCard{
  height:158px!important;min-height:158px!important;max-height:158px!important;aspect-ratio:auto!important;
  border-radius:21px!important;border:1px solid rgba(31,83,66,.10)!important;background:linear-gradient(180deg,#fff,#fbfaf5)!important;
  box-shadow:0 8px 19px rgba(31,75,59,.085)!important;overflow:hidden!important;display:flex!important;flex-direction:column!important;
  contain:layout paint!important;isolation:isolate!important
}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard:active{filter:none!important;transform:scale(.985)!important}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .safeR25Visual,
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .r36WheelVisual{
  order:1!important;height:auto!important;min-height:0!important;flex:1 1 auto!important;display:grid!important;place-items:center!important;
  padding:10px 8px 4px!important;margin:0!important;background:linear-gradient(180deg,rgba(246,249,246,.96),rgba(249,247,239,.72))!important;overflow:hidden!important
}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .safeR25Visual:after{display:none!important;content:none!important}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .safeR25Title{
  order:2!important;height:38px!important;min-height:38px!important;max-height:38px!important;box-sizing:border-box!important;display:flex!important;align-items:center!important;justify-content:center!important;
  padding:4px 7px 6px!important;background:#fffaf3!important;border-top:1px solid rgba(108,91,52,.10)!important;color:#153f35!important;
  font-size:13.2px!important;line-height:1.15!important;font-weight:1000!important;text-align:center!important;white-space:normal!important;overflow:hidden!important
}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .r58FeatureIcon{width:78px!important;height:78px!important;border-radius:23px!important;box-shadow:0 10px 22px rgba(31,75,59,.12),inset 0 1px 0 rgba(255,255,255,.95)!important}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .r58FeatureIcon i{font-size:25px!important;letter-spacing:-1px!important}
#modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .r58FeatureIcon b{bottom:12px!important;width:24px!important;height:6px!important}
.r58-study{background:linear-gradient(145deg,#fff5dc,#f0d598)!important;color:#775316!important}.r58-abacus{background:linear-gradient(145deg,#eaf7ef,#b9ddc8)!important;color:#1c654f!important}
.r58-path{background:linear-gradient(145deg,#edf9f4,#c8e7d9)!important;color:#1d6250!important}.r58-today{background:linear-gradient(145deg,#fff2df,#f2cb94)!important;color:#81521b!important}
.r58-fun{background:linear-gradient(145deg,#fff0e2,#f3c19b)!important;color:#8c4e20!important}.r58-teacher{background:linear-gradient(145deg,#f1edfb,#d2c5ee)!important;color:#60458e!important}
.r58-cup{background:linear-gradient(145deg,#fff6d8,#f0d17a)!important;color:#795810!important}.r58-performance{background:linear-gradient(145deg,#e9f7ef,#bee0cb)!important;color:#1e684f!important}
.r58-reports{background:linear-gradient(145deg,#eaf7f2,#bfe0d3)!important;color:#175e4a!important}.r58-notify{background:linear-gradient(145deg,#f7f1e6,#e5d3ad)!important;color:#725924!important}
.r58-students{background:linear-gradient(145deg,#edf6ff,#c9ddf1)!important;color:#35688c!important}.r58-wheel{background:linear-gradient(145deg,#fff6dd,#efd18d)!important;color:#7b591a!important}
.r58-qr{background:linear-gradient(145deg,#f7f2e8,#dfd2b9)!important;color:#5e5545!important}.r58-assign{background:linear-gradient(145deg,#f4effc,#d9cdef)!important;color:#654b90!important}
.r58-library{background:linear-gradient(145deg,#edf6ff,#c6dcef)!important;color:#315f85!important}.r58-generator{background:linear-gradient(145deg,#fff0e5,#efc4a5)!important;color:#8a4c20!important}
.r58-generic{background:linear-gradient(145deg,#f4f7f4,#dce6df)!important;color:#405b51!important}
@media(max-width:430px){
 #modules.r46HomeGrid.r58PolishedGrid{gap:9px!important}
 #modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard,#modules.r46HomeGrid.r58PolishedGrid>.safeR25Card.r58PolishedCard{height:150px!important;min-height:150px!important;max-height:150px!important;border-radius:19px!important}
 #modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .r58FeatureIcon{width:72px!important;height:72px!important;border-radius:21px!important}
 #modules.r46HomeGrid.r58PolishedGrid>.r58PolishedCard .safeR25Title{height:36px!important;min-height:36px!important;max-height:36px!important;box-sizing:border-box!important;font-size:12.5px!important}
 #modules.r46HomeGrid.r58PolishedGrid>.r46GroupTitle{font-size:19px!important;margin-top:16px!important}
}

/* R64 mobile polish: ball arrows visible and accessible above the app navigation. */
.r58BallStage{position:relative;max-height:min(58dvh,520px)!important;min-height:270px!important}
.r64fBallArrows{position:absolute;bottom:12px;left:9px;right:9px;z-index:12;display:flex;justify-content:space-between;gap:14px;pointer-events:none}
.r64fBallArrows button{pointer-events:auto;min-width:92px;min-height:52px;padding:9px 13px;border-radius:16px;border:2px solid rgba(255,255,255,.88);background:linear-gradient(145deg,#147b72,#0b4d47);color:white;font-weight:950;box-shadow:0 4px 14px #17473855;touch-action:none;user-select:none}
.r64fBallArrows button:active{transform:scale(.96);background:#0d6559}
@media(max-width:600px){.r58BallShell{padding-bottom:8px!important}.r58BallStage{height:min(53dvh,425px)!important;min-height:270px!important}.r58BallHint{max-width:88%;text-align:center;line-height:1.5}}
