/* Portrait phones: a complete, centered 4:3 Windows 98 desktop inside the CRT.
   Desktop, tablet and landscape layouts are intentionally left unchanged. */
@media (max-width:650px) and (orientation:portrait){
  body{padding:8px 7px;min-height:100svh;gap:0;overflow-x:hidden}
  .monitor{width:100%;padding:16px 7px 0;border-radius:14px 14px 18px 18px}
  .bezel{padding:8px 5px;border-radius:9px}
  .screen{height:auto;min-height:0;max-height:none;aspect-ratio:4/3;border-width:2px;border-radius:10px;box-shadow:0 0 0 1px #6a6454,0 0 0 3px #151814,0 0 0 4px #857f6a,0 0 18px #9fcfc61a,0 8px 16px #00000047,inset 0 0 26px #000a,inset 0 0 3px #000}
  .hardware{height:52px;padding:0 7px}
  .brand{font-size:14px;gap:4px;letter-spacing:.5px}
  .brand span{font-size:10px}
  .brandmark{width:17px;height:11px}
  .hwright{gap:7px}
  .vents{width:30px;height:6px}
  .ctrlpanel{gap:4px;padding:2px 4px;border-radius:6px}
  .osd{gap:4px}
  .osd i{width:11px;height:6px}
  #led{width:7px;height:6px;margin-left:0}
  .power{width:27px;height:23px;border-radius:6px;font-size:14px}

  .shortcuts{top:6px;left:5px;right:auto;width:auto;display:grid;grid-template-columns:repeat(4,76px);grid-template-rows:repeat(3,auto);grid-auto-flow:row;justify-content:start;align-content:start;gap:2px 0}
  .shortcut{width:76px;min-height:47px;padding:1px 0;gap:1px;font-size:9px;line-height:1.15}
  .shortcut img{width:26px;height:26px}
  .shortcut span{padding:0 3px;line-height:1.15}

  /* PC window geometry: nearly the whole desktop, centered above the taskbar. */
  .window{width:calc(100% - 10px);left:50%;top:50%;max-height:calc(100% - 8px)}
  .window[data-window=music],.window[data-window=browser]{width:calc(100% - 10px);height:calc(100% - 8px);max-height:calc(100% - 8px);top:50%;left:50%}
  .window[data-window=calc]{width:286px;max-width:calc(100% - 16px);top:50%;left:50%;max-height:calc(100% - 8px)}
  .window[data-window=solitaire],.window[data-window=freecell],.window[data-window=hearts]{width:calc(100% - 10px);left:50%;top:50%;max-height:calc(100% - 8px)}
  .window[data-window=mine]{width:308px;max-width:calc(100% - 10px);left:50%;top:50%;max-height:calc(100% - 8px)}

  .titlebar{height:23px;font-size:10px;gap:3px;padding:2px 3px}
  .titlebar img{width:13px;height:13px}
  .controls{gap:1px}
  .controls button{width:21px;height:20px;font-size:14px}
  .menubar{padding:0;gap:0}
  .menubar button{font-size:9px;padding:1px 5px}
  .status{font-size:8px;gap:2px;margin-top:1px}
  .status span{padding:1px 3px}

  .taskbar{height:28px;gap:2px;padding:1px 2px}
  .bevel{height:24px;font-size:10px;padding:1px 5px;gap:3px}
  .bevel img{width:16px;height:15px}
  .divider{height:20px}
  .quick-launch{height:24px;font-size:14px;padding:0 2px}
  .tasklist{gap:2px}
  .task{height:24px;flex:0 1 76px;font-size:9px;padding:1px 3px;gap:2px}
  .task img{width:13px;height:13px}
  .tray{height:23px;gap:2px;padding:1px 3px;font-size:9px}
  .tray img{width:14px;height:14px}
  .tray #clock-button{font-size:9px;min-width:34px;padding:1px 2px}

  .startmenu{bottom:27px;max-height:calc(100% - 30px)}
  #startitems{width:min(264px,calc(100vw - 88px));display:grid;grid-template-columns:1fr 1fr;align-content:start;overflow:auto;scrollbar-width:thin}
  #startitems>button{min-height:26px;padding:2px 4px;font-size:9px;gap:4px}
  #startitems img{width:16px;height:16px}
  .startbrand{font-size:15px;padding:6px 3px}
  .start-search{grid-column:1/-1;width:calc(100% - 8px);margin:4px;padding:3px 5px;font-size:16px}
  .start-footer{font-size:7px;padding:4px 6px;line-height:1.4}
  .calendar{bottom:28px;right:2px;width:206px;padding:7px}
  .calendar header{font-size:10px;padding:2px 0 7px}
  .calendar-grid{font-size:9px;gap:2px;padding:4px}
  .calendar-grid>*{padding:1px 0}
  .calendar-grid b{font-size:8px}
  .calendar footer{font-size:8px;padding-top:6px}
  .toast{bottom:31px;right:5px;max-width:calc(100% - 10px);padding:7px 9px;font-size:9px}
  .desktop-menu{min-width:160px}
  .desktop-menu button{font-size:10px;padding:5px 8px}
  .drop{top:36px;left:2px}
  .popup button{font-size:10px;padding:4px 7px;gap:5px}

  /* Explorer: drop the sidebar so all nine objects stay on one screen. */
  .classic-explorer{grid-template-columns:1fr;min-height:0}
  .classic-explorer aside{display:none}
  .explorer-path{padding:2px 4px;gap:3px;font-size:8px;min-height:17px}
  .explorer-path img{width:11px;height:11px}
  .explorer-path>div{font-size:8px;padding:1px 3px}
  .classic-explorer .app-grid{grid-template-columns:repeat(3,minmax(0,1fr));padding:3px;gap:3px 2px}
  .explorer-app{min-height:36px;font-size:8px;gap:1px;padding:1px}
  .explorer-app img{width:22px;height:22px}

  /* Calculator: the menu bar yields to the keypad on the miniature screen. */
  .window[data-window=calc] .menubar{display:none}
  .classic-calculator{padding:4px 6px 5px;gap:4px}
  .calc-display{height:22px;font-size:12px;padding:1px 4px}
  .calc-top{gap:3px}
  .calc-memory{min-height:23px;width:24px;font-size:9px}
  .calc-key{min-height:23px;font-size:11px;padding:1px}
  .calc-top .calc-key{font-size:9px}
  .calc-keys{gap:3px}
  .classic-calculator .calc-keys button{min-height:23px;font-size:11px;padding:1px}

  /* Winamp: transport deck on top, the fourteen-song playlist below. The EQ and deck cover art are desktop-only. */
  .window[data-window=music] .content{overflow:hidden}
  .winamp{height:100%;display:flex;flex-direction:column;gap:2px;padding:2px}
  .wa-deck{flex:none;padding:3px;margin:0}
  .wa-deck>.wa-title,.wa-equalizer,.wa-playlist>.wa-title,.wa-list-footer,.wa-message{display:none}
  .wa-main{display:grid;grid-template-columns:72px minmax(0,1fr);gap:3px;margin:0;align-items:stretch}
  .wa-clock{padding:2px 3px;border-width:1px}
  .wa-clock>div:first-child{gap:2px;justify-content:flex-start}
  .wa-clock output{font:16px/1 "Courier New",monospace}
  .wa-led{font-size:8px}
  .wa-spectrum{display:none}
  .wa-track{display:flex;flex-direction:row;align-items:center;gap:3px;min-width:0}
  .wa-art{display:none}
  .wa-marquee{flex:1;height:16px;line-height:16px;font-size:9px;border-width:1px;padding:0 2px}
  .wa-format,.wa-balance{display:none}
  .wa-volume-row{flex:none;width:84px;gap:0}
  .wa-volume-row .wa-volume{width:100%;height:10px}
  .wa-seek{height:9px;margin:2px 1px 0;width:calc(100% - 2px)}
  .wa-buttons{gap:2px;justify-content:space-between}
  .wa-buttons button{height:23px;min-height:23px;min-width:24px;font-size:9px;padding:1px 2px}
  .wa-buttons .wa-small{font-size:7px;padding:1px 3px}
  .wa-attribution{padding:2px 3px 0;font-size:8px;gap:6px}
  .wa-playlist{flex:1;min-height:0;display:flex;flex-direction:column;padding:2px;margin:0;overflow:hidden}
  .wa-track-list{flex:1;height:auto;min-height:0;overflow:auto;padding:1px 0}
  .wa-song{min-height:17px;padding:1px 3px;font-size:9px;line-height:1.15;gap:3px}
  .wa-thumb{width:14px;height:14px}
  .wa-song>span:last-child{font-size:8px}
  .ie-toolbar>img{width:22px;height:22px}
  .terminal{font-size:10px;min-height:0;padding:7px}
  .terminal input{font-size:16px}
  .paintboard{max-height:none}
  .paper{font-size:16px;min-height:130px}

  /* Card tables keep seven columns across the 4:3 desktop. */
  .card-table{padding:5px 4px;min-height:0;--card-w:calc((100vw - 100px)/7)}
  .freecell-table{--card-w:calc((100vw - 108px)/8)}
  .card-top,.card-columns{gap:3px}
  .card-top{margin-bottom:12px}
  .card-pip{font-size:17px}
  .card-corner{font-size:9px;left:2px;top:1px}
  .card-instruction{font-size:9px;padding:5px 6px}
  .card-toolbar{padding:3px;gap:3px}
  .card-toolbar .action{font-size:9px;padding:3px 6px}
  .card-toolbar output{font-size:8px}
  .hearts-table{padding:8px 4px;--card-w:36px;--card-h:51px;min-height:0}
  .hearts-score{font-size:9px;padding-bottom:8px}
  .hearts-opponents{font-size:8px}
  .hearts-trick{gap:10px;min-height:95px}
  .hearts-hand{min-height:60px;padding-left:4px;padding-right:14px}
  .hearts-hand .playing-card{margin-right:calc((100vw - 104px)/13 - 36px)}
  .mines-classic{padding:4px}
  .mines-grid .cell{width:20px;height:20px;font-size:14px}
  .mines-counterbar{padding:3px 4px;margin-bottom:5px}
  .mines-counterbar output{font-size:20px}
  .mine-face.action{height:28px;width:30px;font-size:21px}

  .settings-panel{padding:6px;gap:5px}
  .settings-panel .preview-screen{height:48px}
  .wallpaper-option{font-size:8px;padding:2px}
  .wallpaper-option>span{height:22px}

  /* POST and splash stay fully visible on the landscape-shaped screen. */
  .boot-bios{padding:10px;font-size:9px;line-height:1.5}
  .boot-bios p{margin:5px 0}
  .boot-bios p:nth-of-type(3){margin-top:10px}
  .boot-bios>span{margin-top:12px}
  .boot-sound{font-size:9px;padding:4px 7px;bottom:26px;min-height:0;max-width:calc(100% - 16px)}
  .boot-skip{font-size:8px;padding:2px 5px;bottom:8px;right:5px}
  .boot-progress{height:11px}
  .boot-logo>img{object-fit:contain}
}

/* Compact keypad on narrower phones so the whole calculator stays visible. */
@media (max-width:380px) and (orientation:portrait){
  .classic-calculator{gap:3px;padding:3px 5px 4px}
  .calc-display{height:20px;font-size:11px}
  .calc-top .calc-key,.classic-calculator .calc-keys button{min-height:21px;font-size:10px}
  .calc-memory{min-height:21px}
}

/* Very narrow phones: three icon columns and a denser Explorer keep all objects visible. */
@media (max-width:340px) and (orientation:portrait){
  #startitems>button{min-height:24px}
  .start-search{display:none}
  .shortcuts{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(3,auto);width:calc(100% - 10px);gap:2px 0}
  .shortcut{width:auto;min-width:0;min-height:35px;font-size:8px}
  .shortcut img{width:21px;height:21px}
  .explorer-path{display:none}
  .classic-explorer .app-grid{padding:3px;gap:2px}
  .explorer-app{min-height:32px;font-size:7.5px}
  .explorer-app img{width:18px;height:18px}
  .classic-calculator{gap:3px;padding:3px 5px 4px}
  .calc-display{height:19px;font-size:11px}
  .calc-top .calc-key,.classic-calculator .calc-keys button{min-height:19px;font-size:9px}
  .calc-memory{min-height:19px}
  /* The board is smaller than the Snake dialog here; pin the overlay to the whole panel. */
  .window[data-window=snake] .snake-screen{position:static}
  .window[data-window=snake] .snake-overlay{inset:0;padding:0}
}

/* Portrait games: compact chrome, larger tap targets and period-accurate boards. */
@media (max-width:650px) and (orientation:portrait){
  .window[data-window=mine]{width:calc(100% - 10px)}
  .window[data-window=ski],.window[data-window=reversi],.window[data-window=snake]{width:calc(100% - 10px)}
  .window[data-window=mine] .gamepanel,.window[data-window=memory] .gamepanel,.window[data-window=snake] .gamepanel,.window[data-window=ski] .gamepanel,.window[data-window=reversi] .gamepanel{padding:2px;gap:3px}
  .window[data-window=mine] .gamepanel>.row .action,.window[data-window=memory] .gamepanel>.row .action,.window[data-window=snake] .gamepanel>.row .action,.window[data-window=ski] .gamepanel>.row .action,.window[data-window=reversi] .gamepanel>.row .action{font-size:8px;padding:1px 4px;min-height:18px}
  .mines-classic{--mine-cell:19px;padding:3px}
  .mines-classic[data-level=intermediate]{--mine-cell:17px}
  .mines-classic[data-level=expert]{--mine-cell:15px}
  .mines-options{font-size:8px;gap:2px;margin-bottom:3px}
  .mine-level{font-size:8px;padding:0 2px}
  .mine-flag-toggle{font-size:10px;min-height:16px;padding:0 2px}
  .mines-best{font-size:8px}
  .mines-counterbar{padding:2px 3px;margin-bottom:4px}
  .mines-counterbar output{font-size:18px}
  .mine-face.action{height:26px;width:28px;font-size:18px}
  .window[data-window=memory] .gamepanel>.row{display:none}
  .memory-classic{padding:1px;gap:1px}
  .memory-bar{font-size:8px;line-height:1.1}
  .memory-best{display:none}
  .memory-new{display:inline-block;font:8px Tahoma,Arial,sans-serif;padding:0 4px;min-height:16px}
  .memory-board .memory-card{width:44px;height:38px;font-size:15px}
  .memory-board .memory-card img{width:21px;height:21px}
  .memory-hint{display:none}
  .memory-best{font-size:8px}
  .window[data-window=snake]{width:min(calc(100% - 10px),280px)}
  .window[data-window=snake] .gamepanel>.row{display:none}
  .window[data-window=snake] .gamepanel{padding:0;gap:0}
  .snake-classic{padding:0;gap:2px}
  .snake-screen{width:min(100%,136px,calc(65vw - 122px));border-width:2px}
  .snake-canvas{width:100%}
  .snake-bar{font-size:8px;gap:3px}
  .snake-counter{padding:0 2px;gap:2px;border-width:1px}
  .snake-counter b{font-size:11px;line-height:13px;min-width:28px;letter-spacing:0}
  .snake-level{font-size:7px;padding:0 2px;min-height:14px}
  .snake-playbar{display:inline-block;font:9px Tahoma,Arial,sans-serif;min-height:17px;padding:0 5px;min-width:40px}
  .snake-controls{display:none}
  .snake-overlay{padding:0}
  .snake-dialog{font-size:9px;width:190px;max-width:calc(100vw - 80px)}
  .snake-dialog header{font-size:9px}
  .snake-dialog-body{padding:5px 8px 1px;font-size:9px}
  .snake-dialog-body small{font-size:8px;margin-top:2px}
  .snake-dialog footer{padding:4px 8px 5px}
  .snake-dialog footer .action{font-size:9px;min-height:18px;padding:1px 10px;min-width:56px}
  .snake-hint{display:none}
  .card-stats{font-size:8px;gap:4px}
  .card-toolbar{gap:2px;padding:3px}
  .card-toolbar .action{font-size:9px;padding:2px 4px}
  .card-column{--stack:16px}
  .classic-dialog .dialog-body{font-size:10px;padding:8px 10px}
  .classic-dialog footer .action{font-size:9px;padding:2px 9px}
  .window[data-window=ski] .gamepanel>.row{display:none}
  .ski-classic{padding:2px;gap:2px}
  .ski-hud{font-size:9px}
  .ski-canvas{width:min(100%,200px)}
  .ski-controls{gap:6px}
  .ski-controls button{min-width:40px;min-height:20px;font-size:9px;padding:0 4px}
  .ski-controls .ski-start{min-width:64px}
  .ski-hint{display:none}
  .reversi-classic{padding:2px;gap:2px}
  .reversi-level{font-size:7px;padding:0 2px;min-height:16px}
  .reversi-score{font-size:8px}
  .reversi-board{width:min(100%,200px)}
  .reversi-status{font-size:8px}
}

/* ── CRT cabinet ─────────────────────────────────────────────────────────────
   The glass is a 4:3 tube seated in a deep dark recess; the beige moulding,
   tall chin and power strip carry the late-90s monitor silhouette. */

@media (min-width:651px) and (min-height:560px){
  body{align-items:center;padding-block:16px}
  .monitor{width:fit-content;max-width:100%}
  .bezel{display:flex;justify-content:center;align-items:center}
  .monitor .screen{flex:0 1 auto;width:auto;max-width:100%;aspect-ratio:4/3;margin:0}
}
@media (min-width:900px) and (min-height:560px){.window{left:calc(50% + 60px)}}

/* The Games folder drops its sidebar when height is scarce, so the whole grid fits. */
@media (min-width:651px) and (max-height:590px){
  body{padding-block:8px}
  .monitor{padding:12px 14px 0;border-radius:18px 18px 22px 22px}
  .monitor:after{display:none}
  .bezel{padding:8px 12px;border-radius:10px}
  .screen{border-width:7px;border-radius:16px}
  .hardware{height:38px;padding:0 18px}
  .brand{font-size:16px;gap:6px}
  .brandmark{width:20px;height:13px}
  .model-label{display:none}
  .vents{width:58px;height:9px}
  .hwright{gap:8px}
  #led{margin-left:2px}
  .power{width:32px;height:24px;border-radius:7px;font-size:15px}
  .window[data-window=arcade] .classic-explorer{grid-template-columns:1fr;min-height:0}
  .window[data-window=arcade] .classic-explorer aside{display:none}
}

/* 768-class laptops: a shorter shell keeps the whole cabinet on screen. */
@media (min-width:651px) and (min-height:560px) and (max-height:820px){
  body{padding:8px 12px}
  .monitor{padding:28px 46px 0;border-radius:22px 22px 26px 26px}
  .bezel{padding:12px 14px;border-radius:12px}
  .monitor .screen{height:clamp(340px,calc(100svh - 177px),591px);border-width:8px;border-radius:18px}
  .hardware{height:68px;padding:0 24px}
  .brand{font-size:20px;gap:7px}
  .brandmark{width:24px;height:16px}
  .model-label{display:none}
  .vents{width:56px;height:10px}
  .hwright{gap:9px}
  .osd i{width:14px;height:8px}
  .power{width:38px;height:28px;border-radius:8px;font-size:17px}
}

/* Every one of the eight games has to be reachable without scrolling. */
@media (max-width:650px) and (orientation:portrait){
  .window[data-window=arcade] .classic-explorer .app-grid{grid-template-columns:repeat(4,minmax(0,1fr));padding:4px 3px;gap:4px 2px}
  .window[data-window=arcade] .explorer-app{min-height:40px;gap:1px;padding:1px;font-size:8px}
  .window[data-window=arcade] .explorer-app img{width:22px;height:22px}
}
@media (max-width:340px) and (orientation:portrait){
  .window[data-window=arcade] .classic-explorer .app-grid{padding:3px;gap:2px}
  .window[data-window=arcade] .explorer-app{min-height:32px;font-size:7.5px}
  .window[data-window=arcade] .explorer-app img{width:18px;height:18px}
}
@media (max-width:650px) and (orientation:landscape){
  .window[data-window=arcade] .classic-explorer{grid-template-columns:1fr;min-height:0}
  .window[data-window=arcade] .classic-explorer aside{display:none}
  .window[data-window=arcade] .classic-explorer .app-grid{grid-template-columns:repeat(4,minmax(0,1fr));padding:3px;gap:3px 2px}
  .window[data-window=arcade] .explorer-app{min-height:36px;gap:1px;padding:1px;font-size:8px}
  .window[data-window=arcade] .explorer-app img{width:22px;height:22px}
}
@media (min-width:651px) and (max-height:590px){
  .window[data-window=arcade] .classic-explorer .app-grid{grid-template-columns:repeat(4,minmax(0,1fr));padding:6px 5px;gap:5px 3px}
  .window[data-window=arcade] .explorer-app{min-height:42px;gap:2px;padding:2px;font-size:9px}
  .window[data-window=arcade] .explorer-app img{width:24px;height:24px}
}

/* Portrait tablets: size the tube from the available width so it stays 4:3. */
@media (min-width:651px) and (max-width:850px) and (orientation:portrait){
  .monitor{width:min(760px,100%)}
  .monitor .screen{width:100%;height:auto;aspect-ratio:4/3;flex:0 0 auto}
}

/* ── Fluid app windows ──────────────────────────────────────────────────────
   Windows keep their period proportions but size themselves from the desktop
   they are opened in, so laptops, tablets and phones never clip app content. */

/* Winamp: the deck and equalizer keep the skin; the playlist takes whatever
   vertical room the window has and scrolls through the fourteen songs. */
@media (min-width:651px){
  .window[data-window=music]{height:min(660px,calc(100% - 10px));max-height:calc(100% - 10px)}
  .window[data-window=music] .content{display:flex;min-height:0}
  .window[data-window=music] .winamp{flex:1;min-height:0;display:flex;flex-direction:column;gap:4px;padding:4px}
  .window[data-window=music] .wa-deck,.window[data-window=music] .wa-equalizer,.window[data-window=music] .wa-playlist{margin-bottom:0;flex:none}
  .window[data-window=music] .wa-playlist{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
  .window[data-window=music] .wa-track-list{flex:1;height:auto;min-height:0}
}

/* Short screens (landscape phones, very small laptops): the compact deck,
   like the portrait-phone skin, and the playlist fills the rest. */
@media (max-height:560px){
  .window[data-window=music] .wa-equalizer,
  .window[data-window=music] .wa-art,
  .window[data-window=music] .wa-deck>.wa-title,
  .window[data-window=music] .wa-format,
  .window[data-window=music] .wa-balance,
  .window[data-window=music] .wa-message,
  .window[data-window=music] .wa-playlist>.wa-title,
  .window[data-window=music] .wa-list-footer{display:none}
  .window[data-window=music] .wa-main{display:grid;grid-template-columns:72px minmax(0,1fr);gap:3px;margin:0;align-items:stretch}
  .window[data-window=music] .wa-clock{padding:2px 3px;border-width:1px}
  .window[data-window=music] .wa-clock>div:first-child{gap:2px;justify-content:flex-start}
  .window[data-window=music] .wa-clock output{font:16px/1 "Courier New",monospace}
  .window[data-window=music] .wa-spectrum{display:none}
  .window[data-window=music] .wa-track{display:flex;flex-direction:row;align-items:center;gap:3px;min-width:0}
  .window[data-window=music] .wa-marquee{flex:1;height:16px;line-height:16px;font-size:9px;border-width:1px;padding:0 2px}
  .window[data-window=music] .wa-volume-row{flex:none;width:84px;gap:0}
  .window[data-window=music] .wa-volume-row .wa-volume{width:100%;height:10px}
  .window[data-window=music] .wa-seek{height:9px;margin:2px 1px 0;width:calc(100% - 2px)}
  .window[data-window=music] .wa-buttons{gap:2px;justify-content:space-between}
  .window[data-window=music] .wa-buttons button{height:23px;min-height:23px;min-width:24px;font-size:9px;padding:1px 2px}
  .window[data-window=music] .wa-buttons .wa-small{font-size:7px;padding:1px 3px}
  .window[data-window=music] .wa-attribution{padding:2px 3px 0;font-size:8px;gap:6px}
  .window[data-window=music] .wa-deck{padding:3px;margin:0}
  .window[data-window=music] .wa-playlist{flex:1;min-height:0;padding:2px;margin:0;display:flex;flex-direction:column;overflow:hidden}
  .window[data-window=music] .wa-track-list{flex:1;height:auto;min-height:0;padding:1px 0}
  .window[data-window=music] .wa-song{min-height:17px;padding:1px 3px;font-size:9px;line-height:1.15;gap:3px}
  .window[data-window=music] .wa-thumb{width:14px;height:14px}
  .window[data-window=music] .wa-song>span:last-child{font-size:8px}
}

/* Phones in portrait: drop the generic game command row (File ▸ New Game
   still resets) and scale the boards to the smaller glass. */
@media (max-width:650px) and (orientation:portrait){
  .window[data-window=mine] .gamepanel>.row,
  .window[data-window=reversi] .gamepanel>.row{display:none}
  .window[data-window=mine] .gamepanel,
  .window[data-window=reversi] .gamepanel{padding:2px}
  .window[data-window=mine] .status,
  .window[data-window=snake] .status,
  .window[data-window=memory] .status,
  .window[data-window=ski] .status,
  .window[data-window=reversi] .status,
  .window[data-window=solitaire] .status,
  .window[data-window=freecell] .status,
  .window[data-window=hearts] .status{display:none}
  .mines-classic{--mine-cell:12px;padding:2px}
  .mines-classic[data-level=intermediate]{--mine-cell:11px}
  .mines-classic[data-level=expert]{--mine-cell:9px}
  .mines-options{font-size:9px;margin-bottom:0}
  .mine-level{font-size:8px;min-height:14px;padding:0 2px}
  .mines-counterbar{padding:1px 3px;margin-bottom:2px}
  .mines-counterbar output{font-size:14px}
  .mine-face.action{height:18px;width:20px;font-size:13px}
  .reversi-classic{gap:0;padding:1px}
  .reversi-score{font-size:9px;margin:0}
  .reversi-board{width:min(100%,126px)}
  .reversi-status{font-size:8px;line-height:11px;margin:0}
  .window[data-window=solitaire] .card-instruction,
  .window[data-window=freecell] .card-instruction,
  .window[data-window=hearts] .card-instruction{display:none}

  /* Paint keeps its canvas in view; the palette and actions share one row. */
  .window[data-window=paint] .studio{display:flex;flex-direction:column;padding:4px;gap:3px}
  .window[data-window=paint] .studio>.row{gap:4px}
  .window[data-window=paint] .paintboard{height:100px;width:auto;max-width:100%;align-self:center;max-height:none}
  .window[data-window=paint] .swatches button{width:17px;height:17px}

  /* Notepad fills the window with writing space instead of a fixed page. */
  .window[data-window=note] .content{display:flex;min-height:0}
  .window[data-window=note] .panel{flex:1;display:flex;flex-direction:column;min-height:0}
  .window[data-window=note] .paper{flex:1;min-height:60px}

  /* Internet Explorer: the page viewport takes the leftover height instead of
     pushing the whole toolbar out of the window. */
  .window[data-window=browser] .content{display:flex;min-height:0;overflow:hidden}
  .window[data-window=browser] .internet-explorer{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
  .window[data-window=browser] .ie-document{flex:1;min-height:0}

  /* IE chrome is compact on the 4:3 glass so the page keeps a readable
     viewport: no menu or status bar, one tighter toolbar row. */
  .window[data-window=browser] .menubar,.window[data-window=browser] .status{display:none}
  .window[data-window=browser] .ie-toolbar{padding:2px 3px;gap:1px}
  .window[data-window=browser] .ie-toolbar button{min-width:31px;font-size:7px;padding:1px 2px;gap:0}
  .window[data-window=browser] .ie-toolbar button b{font-size:17px;min-height:17px}
  .window[data-window=browser] .ie-toolbar>img{width:20px;height:20px;margin-right:1px}
  .window[data-window=browser] .ie-address{padding:2px 4px;gap:3px;font-size:9px}
  .window[data-window=browser] .ie-address input{font-size:16px;padding:2px 3px;border-width:1px}
  .window[data-window=browser] .ie-address button{font-size:10px;padding:2px 6px}
  .window[data-window=browser] .ie-links{padding:2px 4px;gap:5px}
  .window[data-window=browser] .ie-links b,.window[data-window=browser] .ie-links button{font-size:8px}
  .window[data-window=browser] .ie-document{border-width:1px;min-height:60px}
  .window[data-window=browser] .ie-home-header{padding:8px 10px;gap:8px;border-bottom-width:2px}
  .window[data-window=browser] .ie-home-header img{height:26px;width:26px}
  .window[data-window=browser] .ie-home-header b{font-size:13px}
  .window[data-window=browser] .ie-home-header span{font-size:8px}
  .window[data-window=browser] .ie-home-body{padding:9px 10px}
  .window[data-window=browser] .ie-home-body h1{font-size:14px;margin:0 0 6px}
  .window[data-window=browser] .ie-home-body p{font-size:9px;line-height:1.45;margin:0 0 8px}
  .window[data-window=browser] .ie-search{padding:6px;margin:8px 0 11px}
  .window[data-window=browser] .ie-search label{font-size:9px;margin-bottom:4px}
  .window[data-window=browser] .ie-search input{font-size:16px;padding:2px}
  .window[data-window=browser] .ie-home-body h2{font-size:11px;padding-bottom:4px;margin:8px 0 6px}
  .window[data-window=browser] .ie-directory{gap:6px 8px;margin-bottom:8px}
  .window[data-window=browser] .ie-directory button{font-size:9px;gap:2px}
  .window[data-window=browser] .ie-directory span{font-size:8px;line-height:1.3}
  .window[data-window=browser] .ie-home-body .ie-home-small{font-size:8px}
}
@media (max-width:380px) and (orientation:portrait){
  .window[data-window=paint] .paintboard{height:82px}
  .window[data-window=paint] .studio{padding:3px}
  .window[data-window=paint] .swatches button{width:15px;height:15px}
}

/* Laptops and tablets with limited height: compact card tables, smaller
   game boards and no helper strip, so every control stays reachable. */
@media (min-width:651px) and (max-height:820px){
  .card-table{--card-w:clamp(28px,5.6vw,60px);padding:8px;min-height:0}
  .card-column{--stack:18px}
  .card-top{margin-bottom:12px}
  .card-instruction{display:none}
  .card-toolbar{padding:4px;gap:4px}
  .hearts-table{--card-w:42px;--card-h:60px;padding:10px;min-height:0}
  .hearts-trick{min-height:118px;gap:13px}
  .hearts-hand{min-height:72px}
  .window[data-window=snake] .snake-screen{width:min(100%,240px)}
  .window[data-window=reversi] .reversi-board{width:min(100%,250px)}
  .window[data-window=mine] .gamepanel>.row{display:none}
  .mines-classic{--mine-cell:23px}
  .settings-panel{padding:10px 17px;gap:7px}
  .settings-panel .preview-screen{height:58px}
  .wallpaper-options{gap:5px;margin:3px 0}
  .wallpaper-option>span{height:30px}
  .settings-panel .row{padding-top:6px}
}
@media (min-width:651px) and (max-width:900px) and (orientation:portrait){
  .window[data-window=snake] .snake-screen{width:min(100%,205px)}
  .window[data-window=reversi] .reversi-board{width:min(100%,235px)}
  .window[data-window=mine] .gamepanel>.row,
  .window[data-window=snake] .gamepanel>.row,
  .window[data-window=reversi] .gamepanel>.row{display:none}
  .mines-classic{--mine-cell:21px}
  .card-table{--card-w:clamp(26px,5.4vw,52px);padding:8px;min-height:0}
  .card-column{--stack:16px}
  .card-top{margin-bottom:10px}
  .card-instruction{display:none}
  .card-toolbar{padding:4px}
  .hearts-table{--card-w:40px;--card-h:57px;padding:8px;min-height:0}
  .hearts-trick{min-height:105px;gap:11px}
  .hearts-hand{min-height:64px}
}

/* Phones on their side: a wide but very short desktop. The same compact
   period controls, with boards sized to the ~250px glass. */
@media (max-height:560px) and (orientation:landscape){
  /* Dense period chrome: title, menu and a hidden status bar leave the
     maximum room for the game itself. */
  .window .titlebar{height:22px;font-size:10px;gap:3px;padding:1px 3px}
  .window .titlebar img{width:13px;height:13px}
  .window .controls button{width:20px;height:18px;font-size:13px}
  .window .menubar{padding:0}
  .window .menubar button{font-size:9px;padding:1px 5px}
  .window .status{display:none}
  .window[data-window=mine]{width:min(calc(100% - 10px),420px)}
  .window[data-window=mine].mine-intermediate{width:min(calc(100% - 10px),480px)}
  .window[data-window=mine].mine-expert{width:calc(100% - 10px)}
  .window[data-window=snake],.window[data-window=ski],.window[data-window=reversi]{width:min(calc(100% - 10px),300px)}
  .window[data-window=mine] .gamepanel,
  .window[data-window=snake] .gamepanel,
  .window[data-window=memory] .gamepanel,
  .window[data-window=ski] .gamepanel,
  .window[data-window=reversi] .gamepanel{padding:2px}
  .window[data-window=mine] .gamepanel>.row,
  .window[data-window=snake] .gamepanel>.row,
  .window[data-window=memory] .gamepanel>.row,
  .window[data-window=ski] .gamepanel>.row,
  .window[data-window=reversi] .gamepanel>.row,
  .window[data-window=solitaire] .gamepanel>.row,
  .window[data-window=freecell] .gamepanel>.row,
  .window[data-window=hearts] .gamepanel>.row{display:none}
  .mines-classic{--mine-cell:13px;padding:3px}
  .mines-classic[data-level=intermediate]{--mine-cell:12px}
  .mines-classic[data-level=expert]{--mine-cell:10px}
  .mines-options{font-size:8px;margin-bottom:2px}
  .mine-level{font-size:8px;padding:0 2px}
  .mine-flag-toggle{font-size:10px;min-height:16px}
  .mines-best{display:none}
  .mines-counterbar{padding:2px 3px;margin-bottom:3px}
  .mines-counterbar output{font-size:16px}
  .mine-face.action{height:24px;width:26px;font-size:16px}
  .memory-classic{padding:1px;gap:2px}
  .memory-bar{font-size:8px}
  .memory-board .memory-card{width:38px;height:32px;font-size:12px}
  .memory-board .memory-card img{width:18px;height:18px}
  .memory-hint,.memory-best{display:none}
  .snake-classic,.ski-classic,.reversi-classic{padding:2px;gap:2px}
  .snake-bar,.ski-hud,.reversi-score{font-size:8px}
  .snake-counter{padding:0 2px}
  .snake-counter b{font-size:10px;line-height:13px;min-width:24px;letter-spacing:0}
  .snake-level{font-size:7px;padding:0 2px;min-height:14px}
  .window[data-window=snake] .snake-screen{width:min(100%,140px);border-width:2px}
  .snake-controls{gap:4px}
  .snake-controls .pad button{min-width:28px;min-height:19px;font-size:9px}
  .snake-controls .action{min-height:19px;font-size:8px;min-width:44px;padding:0 6px}
  .snake-hint,.ski-hint{display:none}
  .snake-dialog{width:180px;font-size:9px}
  .snake-dialog header{font-size:9px}
  .snake-dialog-body{padding:4px 6px 0;font-size:8px}
  .snake-dialog footer{padding:3px 6px 4px}
  .snake-dialog footer .action{min-height:17px;font-size:8px}
  .ski-canvas{width:min(100%,240px)}
  .ski-controls{gap:5px}
  .ski-controls button{min-width:38px;min-height:19px;font-size:9px}
  .ski-controls .ski-start{min-width:60px}
  .reversi-level{font-size:7px;padding:0 2px;min-height:16px}
  .window[data-window=reversi] .reversi-board{width:min(100%,140px)}
  .reversi-status{font-size:8px}
  .window[data-window=paint] .studio{display:flex;flex-direction:column;padding:3px;gap:2px}
  .window[data-window=paint] .studio>.row{gap:4px}
  .window[data-window=paint] .paintboard{height:88px;width:auto;max-width:100%;align-self:center;max-height:none}
  .window[data-window=paint] .swatches button{width:14px;height:14px}
  .window[data-window=note] .content{display:flex;min-height:0}
  .window[data-window=note] .panel{flex:1;display:flex;flex-direction:column;min-height:0}
  .window[data-window=note] .paper{flex:1;min-height:50px}
  .window[data-window=browser] .content{display:flex;min-height:0;overflow:hidden}
  .window[data-window=browser] .internet-explorer{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
  .window[data-window=browser] .ie-document{flex:1;min-height:0}
  .window[data-window=browser] .menubar{display:none}
  .window[data-window=browser] .ie-toolbar{padding:3px 4px;gap:2px}
  .window[data-window=browser] .ie-toolbar button{min-width:36px;font-size:8px;padding:1px 3px;gap:1px}
  .window[data-window=browser] .ie-toolbar button b{font-size:19px;min-height:19px}
  .window[data-window=browser] .ie-toolbar>img{width:24px;height:24px}
  .window[data-window=browser] .ie-address{padding:3px 4px;gap:4px}
  .window[data-window=browser] .ie-address input{font-size:16px;padding:2px 3px}
  .window[data-window=browser] .ie-links{padding:3px 5px;font-size:9px}
  .window[data-window=browser] .ie-links b,.window[data-window=browser] .ie-links button{font-size:9px}
  .window[data-window=browser] .ie-document{border-width:1px}
  .window[data-window=browser] .ie-home-header{padding:10px 12px;gap:9px}
  .window[data-window=browser] .ie-home-header img{height:30px;width:30px}
  .window[data-window=browser] .ie-home-header b{font-size:15px}
  .window[data-window=browser] .ie-home-body{padding:10px 12px}
  .window[data-window=browser] .ie-home-body h1{font-size:16px;margin:0 0 7px}
  .window[data-window=browser] .ie-home-body p{font-size:10px;margin:0 0 9px}
  .window[data-window=browser] .ie-search{padding:7px;margin:8px 0 12px}
  .window[data-window=browser] .ie-home-body h2{font-size:12px;margin:9px 0 7px}
  .window[data-window=browser] .ie-directory{gap:8px 12px;margin-bottom:9px}
  .window[data-window=browser] .ie-directory button{font-size:10px}
  .window[data-window=browser] .ie-directory span{font-size:9px}
  .card-table{padding:5px 4px;--card-w:clamp(20px,3vw,26px);min-height:0}
  .freecell-table{--card-w:clamp(18px,2.7vw,23px)}
  .card-column{--stack:10px}
  .card-top{margin-bottom:7px}
  .card-instruction,.card-stats{display:none}
  .card-toolbar{padding:2px 4px;gap:3px}
  .card-toolbar .action{font-size:8px;padding:1px 4px}
  .card-toolbar output{font-size:8px}
  .hearts-table{--card-w:26px;--card-h:36px;padding:4px;min-height:0}
  .hearts-score{font-size:8px;padding-bottom:2px}
  .hearts-opponents{font-size:7px;line-height:1.3}
  .hearts-trick{min-height:66px;gap:8px}
  .hearts-hand{min-height:44px;padding-right:12px}
  .hearts-hand .playing-card{margin-right:-30px}

  /* Explorer folders switch to a five-column grid; the DOS prompt fills
     the window and scrolls its own output. */
  .window[data-window=computer] .classic-explorer,
  .window[data-window=folder] .classic-explorer{grid-template-columns:1fr;min-height:0}
  .window[data-window=computer] .classic-explorer aside,
  .window[data-window=folder] .classic-explorer aside{display:none}
  .window[data-window=computer] .app-grid,
  .window[data-window=folder] .app-grid{grid-template-columns:repeat(5,minmax(0,1fr));padding:4px;gap:3px}
  .window[data-window=computer] .explorer-app,
  .window[data-window=folder] .explorer-app{min-height:34px;font-size:8px;gap:1px;padding:1px}
  .window[data-window=computer] .explorer-app img,
  .window[data-window=folder] .explorer-app img{width:20px;height:20px}
  .window[data-window=computer] .explorer-path,
  .window[data-window=folder] .explorer-path{display:none}
  .window[data-window=terminal] .content{display:flex;min-height:0}
  .window[data-window=terminal] .terminal{flex:1;min-height:0;font-size:10px;padding:6px}
}

/* Eleven desktop icons: four short columns on medium-height screens and portrait tablets,
   two columns of six only where there is room for them. */
@media (min-width:651px) and (max-height:700px){
  .shortcuts{grid-template-columns:repeat(4,54px);width:216px;gap:2px 0;top:8px}
  .shortcut{min-height:46px;font-size:9px}
  .shortcut img{width:25px;height:25px}
}
@media (min-width:651px) and (max-width:850px) and (orientation:portrait){
  .shortcuts{grid-template-columns:repeat(4,54px);width:216px;gap:2px 0;top:8px}
  .shortcut{min-height:46px;font-size:9px}
  .shortcut img{width:25px;height:25px}
}
