/* v2.8 — Layout only. Game rules, score storage, audio and settings remain intact.
   - Landscape: a taller viewport enlarges the macro pad; settings settle to the bottom.
   - Portrait: game first, records and settings below. The page may scroll, never crush the keys.
   Geometry is expressed in design pixels and scaled uniformly by js/stage.js. */

.app:not(.layout-vertical) .dashboard {
  grid-template-columns: var(--game-panel-width,532px) 300px;
  justify-content:center;
  align-items:stretch;
}
.app:not(.layout-vertical) .screen-panel {
  width:var(--game-panel-width,532px);
  max-width:none;
}
.app:not(.layout-vertical) .sidebar {
  min-height:var(--game-panel-height,563px);
  display:flex;
  flex-direction:column;
}
.app:not(.layout-vertical) .sidebar .settings-card {
  margin-top:auto;
}

/* Shared dynamic game surface — no stretched keycaps or excess dark canvas. */
.app .screen-panel .screen-frame {
  width:100%;
  max-width:100%;
  margin:0 auto;
  box-sizing:border-box;
}
.app .screen-panel .screen-viewport {
  height:var(--macro-stage-height,492px);
}
.app .scene-macro .macro-board-shell,
.app .scene-macro .board-shell:has(>.board.keycap-board) {
  width:100%;
  max-width:none;
}

/* A taller / narrower viewport changes the composition, not the visuals.
   Exterior colors, record widgets, settings buttons and audio controls stay unchanged. */
body.layout-vertical {
  align-items:flex-start;
  justify-content:center;
  padding:12px 0 26px;
  overflow-x:hidden;
  overflow-y:auto;
}
.app.layout-vertical {
  width:var(--design-width,780px);
}
.app.layout-vertical .masthead {
  margin-bottom:14px;
}
.app.layout-vertical .dashboard {
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:18px;
}
.app.layout-vertical .screen-panel {
  width:100%;
  max-width:100%;
  align-self:center;
}
.app.layout-vertical .sidebar {
  width:100%;
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:start;
  column-gap:16px;
  row-gap:12px;
}
.app.layout-vertical .measurement-head {
  grid-column:1/-1;
}
.app.layout-vertical .record-chassis,
.app.layout-vertical .settings-card { margin:0; }
.app.layout-vertical .sidebar-foot {
  grid-column:1/-1;
}
.app.layout-vertical .app-footer {
  margin-top:16px;
}

/* On a phone the record module and settings module are stacked after gameplay. */
.app.layout-vertical.layout-phone {
  padding:17px 20px 13px;
}
.app.layout-phone .masthead {
  min-height:52px;
  margin:0 4px 13px;
  padding-bottom:7px;
}
.app.layout-phone .brand-name {font-size:30px;}
.app.layout-phone .edition-code {display:none;}
.app.layout-phone .dashboard {gap:15px;}
.app.layout-phone .screen-panel {padding:11px 12px 10px;}
.app.layout-phone .panel-heading {height:23px;padding:0 4px 8px;}
.app.layout-phone .panel-tools {font-size:8px;}
.app.layout-phone .screen-panel .screen-frame {border-width:7px;}
.app.layout-phone .sidebar {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:10px;
}
.app.layout-phone .sidebar > * {width:100%;}
.app.layout-phone .sidebar-foot {display:flex;}
.app.layout-phone .settings-card {margin:0;}
.app.layout-phone .numeric-reading strong {font-size:29px;}
.app.layout-phone .app-footer {margin-top:12px;}
