/* Unfolded phones and small tablets: use available CSS width, never a device name. */
@media (min-width:600px) and (max-width:1100px){
  :root{--app-nav-height:76px}
  body>.calculator-tabs :is(button,a),.bankroll-nav a{font-size:16px;gap:5px}
  body>.calculator-tabs :is(button,a) svg,.bankroll-nav a svg{width:24px;height:24px}
  body>.calculator-tabs :is(button,a) span,.bankroll-nav a span{white-space:nowrap}
  .bankroll-nav{height:calc(76px + env(safe-area-inset-bottom,0px))}
  body.bankroll-page{padding-bottom:calc(76px + env(safe-area-inset-bottom,0px))}
  #equity-screen,#icm-screen,#replay-screen{padding-inline:20px}
  input,select,textarea{scroll-margin-block:80px}

  /* A single page scroll keeps long questions and explanations reachable. */
  body.study-active{overflow:auto}
  #study-screen,#study-screen:not(.quotes-active),#study-screen.quotes-active{
    height:auto;min-height:calc(100dvh - var(--app-nav-space));padding:16px 20px;gap:12px;
  }
  #study-screen>.home-account-line{min-height:64px;padding-bottom:10px}
  #study-screen .home-profile .mascot-frame{width:54px;height:60px}
  .study-header h1{font-size:24px}
  .study-modes{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .study-modes button{font-size:16px;min-height:50px;padding:10px 8px}
  .study-prompt{padding:16px;gap:12px}
  .study-prompt h2{font-size:20px;line-height:1.6}
  #study-screen .study-content{
    display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);
    gap:14px;flex:none;overflow:visible;align-items:start;
  }
  .study-hand,.study-question{width:auto;padding:14px;min-width:0}
  .study-hand-title h2{font-size:17px}
  .study-table{padding:12px;gap:10px}
  .study-villain,.study-hero{flex-direction:column;gap:7px;font-size:15px}
  .study-villain>span,.study-hero strong{max-width:100%;font-size:15px;text-align:center}
  .study-card{width:36px;height:49px}
  .study-board-row{flex-wrap:wrap;gap:8px}
  .study-board .study-card{width:36px;height:49px}
  .study-facts dd{font-size:17px}
  .study-actions{font-size:16px;line-height:1.65}
  .study-option{font-size:17px;min-height:52px;padding:12px}
  #study-explanation{font-size:18px;line-height:1.75}
  #study-submit,.study-random-nav button,.study-practice-nav button{min-height:48px;font-size:17px}

  /* Two readable player cards instead of an oversized single column. */
  #equity-screen #player-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin-top:16px}
  #equity-screen .player,#equity-screen .dense-grid .player{
    grid-template-columns:72px minmax(0,1fr);grid-template-rows:auto auto auto;
    gap:8px 10px;padding:20px 12px 14px;min-width:0;min-height:0;
    border:1px solid #99845b66;border-radius:12px;background:#1c1923;
  }
  #equity-screen .player h2{grid-column:1;grid-row:1;margin:0}
  #equity-screen .player .name-button{font-size:18px;min-height:44px}
  #equity-screen .player .range-side{grid-column:1;grid-row:2;width:72px;min-height:44px;font-size:16px;align-self:start}
  #equity-screen .player .hole-cards{grid-column:2;grid-row:1/3;min-height:94px;gap:8px;align-self:center}
  #equity-screen .player .playing-card{width:56px;height:80px}
  #equity-screen .player .player-stats{grid-column:1/-1;grid-row:3;gap:8px;padding-top:10px;border-top:1px solid #99845b33}
  #equity-screen .player-stats span{font-size:16px}
  #equity-screen .player-stats strong{font-size:27px}
  #equity-screen .player-stats .equity-value{font-size:29px}
  #equity-screen .remove-player{right:2px;top:0}
  #equity-screen .range-preview-text{font-size:19px}
  .icm-input-panels{grid-template-columns:repeat(2,minmax(0,1fr))}
  .icm-stack-row{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)}

  /* Hand summaries and notes stay readable without widening the poker table. */
  .rp-heading h1{font-size:26px}
  .rp-home-actions button,.rp-library-tabs button{min-height:48px;font-size:17px}
  .rp-saved-item{padding:20px;margin-bottom:14px}
  .rp-saved-item h3{font-size:21px}
  .rp-saved-item p,.rp-saved-note>p,#rp-public-list .rp-public-memo p{font-size:17px}
  .rp-saved-buttons button{min-height:48px;font-size:16px}
  .rp-saved-content.has-note{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:20px}
  .rp-saved-note{padding:0 0 0 18px;border-top:0;border-left:1px solid #68573c}
  .rp-public-cardsets{gap:20px 32px}
  .rp-public-cards .rp-card{width:44px;height:62px}
  #rp-setup{max-width:760px}
  .rp-setup-table{max-width:660px;min-height:390px}
  .rp-setup-seat strong{font-size:16px}
  .rp-setup-stack{font-size:20px}
  #rp-setup-form .rp-setup-bottom .primary{min-height:48px;font-size:18px}
  :is(#rp-settings-dialog,#rp-player-dialog,#rp-card-dialog,#rp-save-dialog,#rp-share-dialog,#rp-social-dialog){
    width:calc(100vw - 48px);max-width:600px;max-height:calc(100dvh - 32px);padding:22px;
  }
  :is(#rp-settings-dialog,#rp-player-dialog) .rp-field,
  :is(#rp-settings-dialog,#rp-player-dialog) .rp-field :is(input,select){font-size:17px}
  #rp-ranks button{min-height:50px;font-size:21px}
  #rp-suits button{min-height:52px}
  #rp-social-form textarea{font-size:18px;min-height:110px}

  /* Overview first, then two columns of records with room for amounts. */
  .bankroll-page main{max-width:1000px;padding-inline:24px}
  .bankroll-page .totals{grid-template-columns:minmax(0,1.5fr) repeat(2,minmax(0,1fr));gap:12px}
  .bankroll-page .totals .balance{grid-column:auto}
  .bankroll-page .totals>div{padding:18px 14px}
  .bankroll-page .totals span{font-size:16px}
  .bankroll-page .totals strong{font-size:25px}
  .bankroll-page .balance strong{font-size:30px}
  .bankroll-page #entries{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
  .bankroll-page .entry{grid-template-columns:minmax(0,1fr);padding:16px;border:1px solid var(--line);border-radius:12px;background:#1c1923}
  .bankroll-page .entry h3{font-size:18px}
  .bankroll-page .entry-right{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left}
  .bankroll-page .entry-right .result{font-size:20px;white-space:normal;overflow-wrap:anywhere;margin:0}
  .bankroll-page .entry button{min-height:44px;font-size:16px;flex:none}
  .bankroll-page #entries>.empty{grid-column:1/-1}
  .bankroll-page #chart text{font-size:13px}
  .bankroll-page dialog{width:calc(100vw - 48px);max-width:600px;max-height:calc(100dvh - 32px)}
  .bankroll-page :is(button,.button){font-size:16px;min-height:46px}
}

/* The unfolded screen is close to square: keep replay controls below the table. */
@media (min-width:600px) and (max-width:1100px) and (min-height:560px) and (max-aspect-ratio:4/3){
  body.replay-focus #replay-screen{padding-left:max(14px,env(safe-area-inset-left,0px));padding-right:max(14px,env(safe-area-inset-right,0px));padding-bottom:max(8px,env(safe-area-inset-bottom,0px))}
  body.replay-focus #rp-workspace{max-width:860px}
  body.replay-focus .rp-workbar{min-height:52px;gap:10px;padding-block:5px}
  body.replay-focus .rp-workbar>strong{font-size:17px}
  body.replay-focus .rp-workbar button,body.replay-focus .rp-unit-label select{font-size:16px;min-height:44px}
  body.replay-focus .rp-work-layout{display:flex;flex-direction:column;gap:0;flex:1 0 auto}
  body.replay-focus .rp-table-column{flex:1 0 auto;min-height:auto}
  body.replay-focus #rp-workspace .rp-table{max-width:700px;min-height:480px;margin:8px auto 4px}
  body.replay-focus .rp-side-column{flex:none;padding:4px 0;gap:6px}
  body.replay-focus .rp-seat{width:clamp(92px,14vw,110px);gap:2px}
  body.replay-focus .rp-seat-pos{font-size:15px;line-height:1.15}
  body.replay-focus .rp-seat-name{font-size:13px}
  body.replay-focus .rp-seat.hero{width:clamp(116px,16vw,128px)}
  body.replay-focus .rp-seat.hero .rp-seat-name{font-size:18px}
  body.replay-focus .rp-seat.hero .rp-seat-box:has(.rp-seat-name:not([hidden])) .rp-seat-pos{font-size:13px}
  body.replay-focus .rp-seat-stack{font-size:17px;line-height:1.2}
  body.replay-focus .rp-seat-box,body.replay-focus .rp-seat.active .rp-seat-box{padding:2px 4px}
  body.replay-focus .rp-seat-cards .rp-card{width:35px;height:46px}
  body.replay-focus .rp-seat-last{min-height:22px;font-size:14px;padding:2px 5px}
  body.replay-focus .rp-table-center .rp-card{width:44px;height:61px}
  body.replay-focus .rp-blinds{font-size:15px}
  body.replay-focus .rp-pot{font-size:23px}
  body.replay-focus .rp-tournament{font-size:15px;max-width:90%}
  body.replay-focus .rp-seat-bet{font-size:13px}
  body.replay-focus .rp-bet-amount{line-height:1.25;padding:2px 6px}
  body.replay-focus .rp-table-options label{min-height:34px;font-size:16px}
  body.replay-focus .rp-playback{grid-template-columns:48px 48px minmax(90px,1fr) 48px 76px;gap:7px}
  body.replay-focus .rp-playback button,body.replay-focus .rp-playback select{min-height:46px;font-size:18px}
  body.replay-focus .rp-progress{min-height:28px;height:28px}
  body.replay-focus .rp-actions button{min-height:48px;font-size:18px}
  body.replay-focus .rp-record-actions{gap:8px;flex-wrap:wrap}
  body.replay-focus .rp-record-actions button{min-height:46px;font-size:16px;flex:1 1 110px;padding:8px}
}
