/* Interactive retro desktop (homepage hero). Colors match the site: screen #0b0805, panel #1e1710, rim #4a3719, gold #e6b25a, hot #f2a93b, cream #f1e4c9, dim #c4b08a */
.dsk { position: relative; width: 100%; max-width: 640px; margin-inline: auto; }
.dsk-stage { position: relative; width: 100%; aspect-ratio: 1100 / 880; }
.dsk-bezel { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 24px 30px rgba(0,0,0,.65)); }
.dsk-led { position: absolute; z-index: 4; left: 71.64%; top: 96.48%; width: 1.6%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #3a2a10; transition: background .2s, box-shadow .2s; }
.dsk[data-state="booting"] .dsk-led, .dsk[data-state="on"] .dsk-led { background: #f2a93b; box-shadow: 0 0 8px 2px rgba(242,169,59,.8); }
.dsk-screen { position: absolute; z-index: 1; left: 9.00%; top: 10.45%; width: 82.09%; height: 74.43%; container-type: inline-size; overflow: hidden; background: #050403; box-shadow: inset 0 0 50px rgba(0,0,0,.9); border-radius: 3% / 4%; font-family: "IBM Plex Sans", system-ui, sans-serif; color: #f1e4c9; }
.dsk-screen * { box-sizing: border-box; }

/* Off screen: one big button */
.dsk-off { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; border: 0; background: radial-gradient(ellipse at center, #14100a 0%, #050403 75%); color: #e6b25a; cursor: pointer; font: inherit; }
.dsk-off span { font-size: clamp(13px, 3.1cqw, 18px); font-weight: 600; border: 2px solid #4a3719; padding: .55em 1em; background: #0b0805; box-shadow: 4px 4px 0 #5c370b; }
.dsk-off:hover span, .dsk-off:focus-visible span { border-color: #e6b25a; }
@media (prefers-reduced-motion: no-preference) { .dsk-off span { animation: dsk-pulse 2.4s ease-in-out infinite; } }
@keyframes dsk-pulse { 50% { box-shadow: 4px 4px 0 #5c370b, 0 0 22px rgba(242,169,59,.35); } }
.dsk:not([data-state="off"]) .dsk-off { display: none; }

/* Boot text */
.dsk-boot { position: absolute; inset: 0; background: #050403; overflow: hidden; }
.dsk[data-state="off"] .dsk-boot, .dsk[data-state="on"] .dsk-boot { display: none; }
.dsk-bt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: "IBM Plex Mono", ui-monospace, monospace; color: #dba357; text-shadow: 0 0 5px rgba(242,169,59,.45); background: radial-gradient(ellipse at center, #3a2a12 0%, #1c1308 70%); }
.dsk-btitle { padding: 4cqw 5cqw; text-align: center; font-size: 8.4cqw; font-weight: 500; letter-spacing: .02em; line-height: 1.2; border: .5cqw dashed #dba357; outline: .4cqw dashed #dba357; outline-offset: .8cqw; }
.dsk-half { position: absolute; left: 0; right: 0; height: 50.5%; background: #000; }
.dsk-half.t { top: 0; animation: dsk-open-t .7s cubic-bezier(.7,0,.3,1) .6s forwards; }
.dsk-half.b { bottom: 0; animation: dsk-open-b .7s cubic-bezier(.7,0,.3,1) .6s forwards; }
.dsk-beam { position: absolute; left: 0; right: 0; top: calc(50% - 2px); height: 4px; background: #ffe6b0; box-shadow: 0 0 18px 6px rgba(242,169,59,.8); transform: scaleX(0); opacity: 0; animation: dsk-beam 1s linear forwards; }
.dsk-flash { position: absolute; inset: 0; z-index: 2; background: #f2a93b; opacity: 0; mix-blend-mode: screen; animation: dsk-flash .9s ease-out .6s; pointer-events: none; }
@keyframes dsk-open-t { to { transform: translateY(-101%); } }
@keyframes dsk-open-b { to { transform: translateY(101%); } }
@keyframes dsk-beam { 0% { opacity: 1; transform: scaleX(0); } 45% { opacity: 1; transform: scaleX(1); } 80% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; transform: scaleX(1); } }
@keyframes dsk-flash { 0% { opacity: .55; } 100% { opacity: 0; } }

/* The desktop */
.os { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; font-size: clamp(12px, 2.7cqw, 15.5px); line-height: 1.4; background: #000; }
.os[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .os { animation: os-on .45s ease-out both; }
  .os.os-off { animation: os-off .45s ease-in forwards; }
}
@keyframes os-on { from { opacity: 0; transform: scaleY(.04); filter: brightness(3); } 60% { opacity: 1; transform: scaleY(1); } to { filter: none; } }
@keyframes os-off { to { opacity: 0; transform: scaleY(.02); filter: brightness(3); } }

.os-desk { position: relative; overflow: hidden; background: #000; }
.os-wall { position: absolute; left: 50%; top: 50%; width: 62%; max-width: 360px; transform: translate(-50%, -50%); opacity: .14; pointer-events: none; }
.os-icons { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: min-content; gap: .5em .25em; padding: 7% 8% 0; align-content: start; justify-items: center; }
.os-icon { display: flex; flex-direction: column; align-items: center; gap: .3em; width: 100%; max-width: 6.8em; padding: .45em .2em; border: 2px solid transparent; background: transparent; color: #f1e4c9; font: inherit; font-size: .92em; font-weight: 500; text-align: center; text-decoration: none; cursor: pointer; }
.os-icon svg { width: 2.5em; height: 2.5em; color: #e6b25a; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.os-icon:hover { border-color: #4a3719; background: rgba(230,178,90,.08); }
.os-icon:focus-visible { border-color: #f2a93b; background: rgba(230,178,90,.12); outline: none; }

/* Windows */
.os-wins { position: absolute; inset: 0; pointer-events: none; }
.os-win { position: absolute; display: flex; flex-direction: column; pointer-events: auto; min-height: 0; background: #1e1710; border: 2px solid #4a3719; box-shadow: 5px 5px 0 rgba(0,0,0,.55); outline: none; }
.os-win.active { border-color: #e6b25a; }
.os-wtitle { display: flex; align-items: center; justify-content: space-between; gap: .5em; padding: .25em .3em .25em .7em; background: #2a2012; border-bottom: 2px solid #4a3719; cursor: grab; touch-action: none; user-select: none; }
.os-win.active .os-wtitle { background: #4a3719; }
.os-wh2 { margin: 0; font-size: 1em; font-weight: 600; color: #f1e4c9; letter-spacing: .01em; }
.os-close { flex: none; width: 1.9em; height: 1.9em; display: grid; place-items: center; border: 2px solid #4a3719; background: #14100a; color: #f1e4c9; font: inherit; font-weight: 700; line-height: 1; cursor: pointer; }
.os-close:hover { border-color: #f2a93b; color: #f2a93b; }
.os-wbody { flex: 1; min-height: 0; overflow: auto; padding: .8em .9em; scrollbar-width: thin; scrollbar-color: #e6b25a #1e1710; overscroll-behavior: contain; }
.os-wbody:focus-visible { outline: 2px solid #f2a93b; outline-offset: -4px; }
.os-p { margin: 0 0 .7em; color: #c4b08a; }
.os-list { list-style: none; margin: 0; padding: 0; }
.os-list li { padding: .55em 0; border-top: 1px solid #4a3719; }
.os-list li:first-child { border-top: 0; }
.os-li-name { display: block; font-weight: 600; color: #f1e4c9; }
.os-li-desc { display: block; color: #c4b08a; font-size: .95em; }
.os a { color: #f2a93b; text-underline-offset: 2px; }
.os a:hover { color: #f1e4c9; }
.os-btn { display: inline-block; padding: .45em .9em; border: 2px solid #e6b25a; background: #14100a; color: #e6b25a; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; box-shadow: 3px 3px 0 #5c370b; }
.os-btn:hover { background: #e6b25a; color: #14100a; }
.os-btn.solid { background: #e6b25a; color: #14100a; }
.os-btn.solid:hover { background: #f2a93b; }
.os a.os-btn { color: #e6b25a; }
.os a.os-btn.solid { color: #14100a; }
.os-btn:disabled { opacity: .5; cursor: default; }
.os-btns { display: flex; flex-wrap: wrap; gap: .6em; margin-top: .8em; }
.os-phone { display: block; margin: .1em 0 .5em; font-size: 1.7em; font-weight: 600; letter-spacing: -.01em; color: #e6b25a; text-decoration: none; }

/* Taskbar */
.os-task { position: relative; display: flex; align-items: center; gap: .4em; padding: .3em .45em; background: #1e1710; border-top: 2px solid #4a3719; min-height: 2.7em; }
.os-start, .os-tbtn { padding: .3em .7em; border: 2px solid #4a3719; background: #14100a; color: #f1e4c9; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.os-start { color: #e6b25a; border-color: #e6b25a; }
.os-start[aria-expanded="true"], .os-tbtn.active { background: #4a3719; }
.os-tasks { display: flex; gap: .3em; flex: 1; min-width: 0; overflow: hidden; }
.os-tbtn { overflow: hidden; text-overflow: ellipsis; max-width: 8em; font-weight: 500; }
.os-clock { margin-left: auto; padding: 0 .3em; color: #c4b08a; font-variant-numeric: tabular-nums; }
.os-menu { position: absolute; left: .4em; bottom: 100%; z-index: 50; min-width: 11em; margin: 0 0 .3em; padding: .3em; list-style: none; background: #1e1710; border: 2px solid #e6b25a; box-shadow: 5px 5px 0 rgba(0,0,0,.55); }
.os-menu[hidden] { display: none; }
.os-menu button, .os-menu a { display: block; width: 100%; padding: .5em .7em; border: 0; background: transparent; color: #f1e4c9; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.os-menu button:hover, .os-menu a:hover, .os-menu button:focus-visible, .os-menu a:focus-visible { background: #4a3719; color: #f1e4c9; }
.os-menu li + li.sep { margin-top: .3em; padding-top: .3em; border-top: 1px solid #4a3719; }

/* Games */
.g-menu { display: grid; gap: .6em; }
.g-pick { display: block; width: 100%; padding: .7em .9em; border: 2px solid #4a3719; background: #14100a; color: #f1e4c9; font: inherit; text-align: left; cursor: pointer; }
.g-pick:hover { border-color: #e6b25a; }
.g-pick .os-li-name { color: #e6b25a; }
.g-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6em; margin-bottom: .6em; }
.g-back { padding: .25em .6em; border: 2px solid #4a3719; background: #14100a; color: #f1e4c9; font: inherit; cursor: pointer; }
.g-back:hover { border-color: #e6b25a; }
.g-score { margin: 0; color: #c4b08a; font-variant-numeric: tabular-nums; }
.g-status { min-height: 1.4em; margin: .5em 0 0; color: #f1e4c9; }
.g-canvas { display: block; width: 100%; height: auto; max-height: 100%; border: 2px solid #4a3719; background: #0b0805; image-rendering: pixelated; touch-action: none; }
.g-canvas:focus-visible { outline: 3px solid #f2a93b; outline-offset: 2px; }
.g-pad { display: flex; flex-wrap: wrap; gap: .4em; margin-top: .6em; }
.g-pad button { min-width: 2.4em; min-height: 2.4em; padding: .2em .6em; border: 2px solid #4a3719; background: #14100a; color: #f1e4c9; font: inherit; font-weight: 600; cursor: pointer; }
.g-pad button:hover { border-color: #e6b25a; }
.vb-grid, .mm-grid { display: grid; gap: .45em; }
.vb-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vb-cell { position: relative; aspect-ratio: 1.15; border: 2px solid #4a3719; background: #0b0805; color: #f2a93b; cursor: pointer; padding: 0; }
.vb-cell svg { width: 60%; height: 60%; margin: auto; display: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vb-cell.on { background: #2a2012; border-color: #f2a93b; }
.vb-cell.on svg { display: block; }
.vb-cell.hit { background: #e6b25a; }
.vb-cell:hover { border-color: #e6b25a; }
.mm-card { aspect-ratio: 1.3; border: 2px solid #4a3719; background: #14100a; color: #e6b25a; font: inherit; font-weight: 600; font-size: .95em; padding: .1em; cursor: pointer; }
.mm-card:hover { border-color: #e6b25a; }
.mm-card.up { background: #2a2012; color: #f1e4c9; border-color: #f2a93b; }
.mm-card.done { background: #4a3719; color: #f1e4c9; border-color: #4a3719; cursor: default; }

/* Terminal */
.t-out { margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: .95em; color: #f1e4c9; white-space: pre-wrap; word-break: break-word; }
.t-out div { margin: 0; }
.t-out .cmd { color: #e6b25a; }
.t-form { display: flex; align-items: center; gap: .4em; margin-top: .4em; font-family: ui-monospace, Consolas, monospace; }
.t-form label { color: #e6b25a; white-space: nowrap; }
.t-input { flex: 1; min-width: 0; padding: .2em .3em; border: 0; border-bottom: 2px solid #4a3719; background: transparent; color: #f1e4c9; font: inherit; }
.t-input:focus-visible { outline: none; border-bottom-color: #f2a93b; }
.dsk-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem 1rem; margin-top: 1rem; }
.dsk-hint { margin: 0; color: #c4b08a; font-size: .9rem; text-align: center; }
.dsk-power { padding: .5rem 1rem; border: 2px solid #e6b25a; background: #14100a; color: #e6b25a; font: inherit; font-weight: 600; box-shadow: 4px 4px 0 #5c370b; cursor: pointer; }
.dsk-power:hover { background: #e6b25a; color: #14100a; }
.dsk-power:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #5c370b; }
.dsk-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 520px) { .os-icons { padding: 5% 4% 0; } .os-tbtn { max-width: 5.5em; } }
@media (prefers-reduced-motion: reduce) { .os-win, .os-icon, .os-btn { transition: none; } }
@container (max-width: 430px) { .os-win { left: 2% !important; top: 2% !important; width: 96% !important; height: 96% !important; } .os-wtitle { cursor: default; } }

.dsk-pwr { position: absolute; z-index: 4; left: 77%; top: 96.48%; width: 4.4%; aspect-ratio: 1; min-width: 24px; min-height: 24px; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #1a140c; background: radial-gradient(circle at 35% 30%, #cdbb97, #7a6a4c 70%); box-shadow: 0 2px 3px rgba(0,0,0,.7), inset 0 -2px 3px rgba(0,0,0,.35); cursor: pointer; padding: 0; }
.dsk-pwr:hover { background: radial-gradient(circle at 35% 30%, #f1e4c9, #9a8559 70%); }
.dsk-pwr:active, .dsk-pwr[aria-pressed="true"] { box-shadow: inset 0 2px 4px rgba(0,0,0,.6); transform: translate(-50%, -46%); }
.dsk-pwr:focus-visible { outline: 3px solid #f2a93b; outline-offset: 3px; }

.g-snake { width: auto; max-width: 100%; max-height: 10.5em; margin-inline: auto; }
.g-row { margin-top: .5em; align-items: center; }
.g-row .g-pad { margin-top: 0; margin-left: auto; flex-wrap: nowrap; }
.g-row .g-pad button { min-width: 2em; min-height: 2em; padding: .1em .4em; }
.g-row .os-btn { padding: .3em .7em; box-shadow: 2px 2px 0 #5c370b; }
@container (max-width: 430px) { .g-snake { width: 100%; max-height: none; } }
/* Taskbar curved to follow the bottom of the CRT glass */
.os-task { border-radius: 0 0 50% 50% / 0 0 70% 70%; padding-left: 2.2em; padding-right: 2.2em; min-height: 3em; border-bottom: 2px solid #4a3719; }
.os-menu { left: 1.6em; }
@container (max-width: 430px) { .os-task { padding-left: 1.6em; padding-right: 1.6em; } }
/* Taskbar runs edge to edge; the monitor's glass shapes it */
.os-task { border-radius: 0; border-bottom: 0; padding: .3em 3.4em .9em 3.4em; min-height: 3.6em; align-items: center; }
.os-menu { left: 2.8em; }
@container (max-width: 430px) { .os-task { padding: .25em 2.4em .8em 2.4em; } .os-menu { left: 2em; } }
