/* The shell: starfield, header, three columns, fake browser, widgets, overlays. */
html, body { background: var(--night); }
body { overflow-x: hidden; }

#sky {
  position: fixed; top: -256px; left: -256px; right: 0; bottom: 0; z-index: -1;
  background: url(../img/stars.gif);
  animation: drift 50s linear infinite;
}
@keyframes drift { to { transform: translate3d(256px, 256px, 0); } }
html.calm #sky { background-image: url(../img/stars-still.png); }

#wrap { max-width: 1120px; margin: 0 auto; padding: 8px 10px 40px; }

/* ---------- header ---------- */
#top { display: grid; grid-template-columns: 170px minmax(0, 1fr) 170px; gap: 8px; align-items: start; }
.toggles { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.toggles button {
  width: 100%; padding: 4px 6px; text-align: left;
  font: 14px/1.1 "Silkscreen", monospace; color: var(--gold);
  background: #1a0a3a; border: 2px outset var(--gold);
}
.toggles button:hover { background: #7a2a9a; color: #fff; }
.toggles button:active { border-style: inset; }
.toggles button[aria-pressed="true"] { color: #7fff9a; }

#title { text-align: center; min-width: 0; padding-top: 22px; }
#logo-wrap { position: relative; display: inline-block; max-width: 100%; }
#fire {
  position: absolute; left: 0; bottom: 0; width: 544px; height: 108px;
  image-rendering: pixelated; pointer-events: none;
}
#logo { position: relative; display: block; width: 544px; }
#logo-link { display: block; background: none; }
#site-title { margin: 0; font-size: inherit; line-height: 0; }
html.calm #fire { display: none; }
#tagline { font: 12px "Silkscreen", monospace; color: var(--pink); margin: 0; }
marquee.ticker {
  display: block; position: relative;
  font: 12px/1.6 "Press Start 2P", monospace; color: var(--gold);
  text-shadow: 2px 2px #7a2a08;
}

#clock { text-align: center; padding: 5px 4px; background: #000; border: 3px inset var(--gray); color: #7fff9a; }
#clock b { display: block; font: 30px/1 "VT323", monospace; }
#clock span { font: 12px/1.2 "Silkscreen", monospace; color: var(--gold); }

/* ---------- nav ---------- */
#nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  margin: 6px 0 10px; padding: 5px;
  background: rgba(14, 6, 40, .93); border: 4px ridge var(--gold);
}
#nav a {
  padding: 6px 10px; text-decoration: none;
  font: 10px/1.2 "Press Start 2P", monospace; color: var(--cream);
  background: var(--panel2); border: 2px outset var(--orange);
}
#nav a:visited { color: var(--cream); }
#nav a:hover { color: #1a0a3a; background: var(--gold); animation: wiggle .4s steps(4) infinite; }
#nav a[aria-current="page"] { color: #1a0a3a; background: var(--orange); border-style: inset; }

/* ---------- columns ---------- */
#cols { display: grid; grid-template-columns: 216px minmax(0, 1fr) 216px; gap: 10px; align-items: start; }

/* ---------- fake browser ---------- */
#browser { background: var(--gray); border: 2px outset #fff; color: #000; margin-bottom: 10px; }
#bar {
  display: flex; align-items: center; gap: 6px; padding: 3px 4px;
  color: #fff; font: 14px/1 "Silkscreen", monospace;
  background: linear-gradient(90deg, #4a1a8a, #c2285a 60%, var(--orange));
}
#bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bar button {
  width: 18px; height: 16px; padding: 0; font: bold 12px/1 "Silkscreen", monospace; color: #000;
  background: var(--gray); border: 2px outset #fff;
}
#bar button:active { border-style: inset; }
#tools { display: flex; align-items: center; gap: 3px; padding: 3px 4px; border-bottom: 2px groove #fff; }
#tools button {
  padding: 3px 7px; font: 13px/1 "Silkscreen", monospace; color: #000;
  background: var(--gray); border: 2px outset #fff;
}
#tools button:hover { color: #7a2a9a; }
#tools button:active { border-style: inset; }
#throb { width: 32px; height: 32px; margin-left: auto; border: 2px inset #fff; flex: none; box-sizing: content-box; }
#addr { display: flex; align-items: center; gap: 4px; padding: 3px 4px; font: 13px/1 "Silkscreen", monospace; }
#addr input {
  flex: 1; min-width: 0; padding: 2px 4px; color: #000; background: #fff;
  font: 18px/1 "VT323", monospace; border: 2px inset #fff; cursor: text;
}
#view { display: block; width: 100%; height: 760px; border: 2px inset #fff; background: #0e0628; }
#status {
  display: flex; align-items: center; gap: 6px; padding: 2px 4px;
  font: 13px/1.2 "Silkscreen", monospace;
}
#status-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px inset #fff; padding: 1px 4px; }
#progress { width: 100px; height: 12px; border: 1px inset #fff; padding: 1px; flex: none; }
#progress i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, #000080 0 7px, transparent 7px 9px); }

/* ---------- widgets ---------- */
.side-center { text-align: center; }
.sidepad { padding: 8px; text-align: center; }

#away { display: flex; gap: 6px; align-items: center; text-align: left; }
#away img { width: 68px; height: 68px; border: 2px inset var(--gray); flex: none; }
#away p { margin: 0; font-size: 18px; line-height: 1; color: #ffe680; min-height: 54px; }
#away b { display: block; font: 12px "Silkscreen", monospace; color: #7fff9a; }

/* Live Discord box */
.dc-top { display: flex; gap: 8px; align-items: center; }
#dc-avatar { width: 56px; height: 56px; flex: none; border: 2px inset var(--gray); background: #000; }
#dc-name { display: block; color: var(--gold); font-weight: normal; font-size: 20px; line-height: 1; overflow-wrap: anywhere; }
#dc-status { display: inline-block; margin-top: 3px; font: 12px/1.2 "Silkscreen", monospace; color: #c8b8e8; }
#dc-status::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 5px; background: #6a6a7a; border: 1px solid #000; }
#dc-status[data-status="online"]::before { background: #7fff9a; }
#dc-status[data-status="idle"]::before { background: var(--gold); }
#dc-status[data-status="dnd"]::before { background: #ff5a5a; }
#dc-activity { margin: 6px 0 0; font-size: 18px; line-height: 1; overflow-wrap: anywhere; }
#dc-devices:empty { display: none; }

/* Live Spotify box */
#sp-now { display: flex; gap: 7px; align-items: center; color: var(--cream); text-decoration: none; }
#sp-now:visited { color: var(--cream); }
#sp-art { width: 60px; height: 60px; flex: none; border: 2px inset var(--gray); }
#sp-art[hidden] { display: none; }
#sp-label { display: block; font: 11px/1.2 "Silkscreen", monospace; color: #7fff9a; }
#sp-title { display: block; color: var(--gold); font-weight: normal; font-size: 19px; line-height: 1; overflow-wrap: anywhere; }
#sp-artist { display: block; font-size: 17px; line-height: 1; color: #d0c0ee; overflow-wrap: anywhere; }
#sp-list { list-style: none; margin: 7px 0 0; padding: 0; }
#sp-list li { border-top: 1px dotted #3a2a6a; }
#sp-list a { display: flex; gap: 6px; align-items: center; padding: 3px 0; color: var(--cream); text-decoration: none; }
#sp-list a:visited { color: var(--cream); }
#sp-list img { width: 28px; height: 28px; flex: none; }
#sp-list span { min-width: 0; }
#sp-list b, #sp-list i { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-style: normal; font-weight: normal; line-height: 1; }
#sp-list b { font-size: 17px; }
#sp-list i { font-size: 15px; color: #c8b8e8; }

/* Takes up what is left of a column, so the three columns end level. */
.filler { background: url(../img/sammy-nap.gif) center no-repeat, url(../img/bg-paws.png); }
#fill-right { background-image: url(../img/spinstar.gif), url(../img/bg-paws.png); }
html.calm .filler { background-image: url(../img/bg-paws.png); }

.buddy { margin: 0; }
.buddy summary {
  padding: 3px 6px; list-style: none; font: 13px "Silkscreen", monospace; color: var(--gold); background: var(--panel2);
  border-top: 1px solid #3a2a6a;
}
.buddy summary::-webkit-details-marker { display: none; }
.buddy summary::before { content: "\25B6 "; font-size: 10px; color: var(--orange); }
.buddy[open] summary::before { content: "\25BC "; }
.buddy ul { list-style: none; margin: 0; padding: 3px 6px 6px; }
.buddy li { padding: 1px 0; font-size: 19px; }
.buddy li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: #7fff9a; border: 1px solid #0a3a1a; }
.buddy a { text-decoration: none; }

.odo { display: flex; justify-content: center; gap: 2px; margin: 4px 0; }
.odo b {
  width: 20px; height: 28px; display: block; overflow: hidden; color: #fff;
  font: 26px/28px "VT323", monospace; text-align: center;
  background: linear-gradient(#000, #444 50%, #000); border: 1px solid #777;
}
.odo b span { display: block; animation: roll .5s steps(5) both; }
@keyframes roll { from { transform: translateY(-100%); } }
.tiny { font: 12px/1.3 "Silkscreen", monospace; color: #c8b8e8; margin: 4px 0 0; }

#todo { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow-y: auto; font-size: 19px; }
#todo li { padding: 2px 0 2px 18px; background: url(../img/bullet.gif) no-repeat 0 3px; }
#todo li.done { text-decoration: line-through; color: #8a7aa8; }

#mood { text-align: center; padding: 6px; font-size: 22px; color: #7fff9a; }
#mood b { color: var(--pink); font-weight: normal; }

#moon { display: block; margin: 0 auto; width: 64px; height: 64px; image-rendering: pixelated; }

/* FoxAmp */
#amp { background: linear-gradient(#3a3a5a, #1a1a2e); border: 3px outset #8a8ab0; color: #7fff9a; margin-bottom: 10px; padding: 4px; }
#amp .amp-head { display: flex; justify-content: space-between; font: 12px "Silkscreen", monospace; color: var(--gold); padding: 0 2px 3px; }
#amp .lcd { display: grid; grid-template-columns: 1fr 74px; gap: 3px; background: #000; border: 2px inset #8a8ab0; padding: 3px; align-items: center; }
#amptime { font: 26px/1 "VT323", monospace; }
#ampviz { width: 74px; height: 30px; image-rendering: pixelated; }
#ampname { grid-column: 1 / -1; overflow: hidden; white-space: nowrap; font: 16px/1 "VT323", monospace; color: var(--gold); }
#ampname span { display: inline-block; padding-left: 100%; animation: amp-scroll 9s linear infinite; }
@keyframes amp-scroll { to { transform: translateX(-100%); } }
html.calm #ampname span { padding-left: 0; }
#amp .ctrl { display: flex; gap: 2px; margin-top: 4px; }
#amp .ctrl button {
  flex: 1; padding: 3px 0; color: #000; font: 13px/1 "Silkscreen", monospace; background: var(--gray); border: 2px outset #fff;
}
#amp .ctrl button:active, #amp .ctrl button[aria-pressed="true"] { border-style: inset; background: var(--gold); }
#amp label { display: flex; align-items: center; gap: 4px; margin-top: 4px; font: 12px "Silkscreen", monospace; color: var(--gold); }
#amp input[type=range] { flex: 1; min-width: 0; height: 14px; accent-color: var(--orange); }

/* Pocket Sammy */
#pet { padding: 8px; background: linear-gradient(135deg, #ff8f1f, #c94a10); border: 3px outset #ffd23f; margin-bottom: 10px; border-radius: 12px 12px 30px 30px; }
#pet .brand { font: 10px "Press Start 2P", monospace; color: #fff6c2; text-align: center; margin: 0 0 5px; text-shadow: 1px 1px #7a2a08; }
#petlcd { display: block; width: 100%; aspect-ratio: 5 / 3; image-rendering: pixelated; background: #c4d88c; border: 4px inset #7a2a08; }
#pet .row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin-top: 6px; }
#pet .row button {
  padding: 4px 0; color: #1a0a3a; font: 11px "Silkscreen", monospace; background: #fff0dc; border: 2px outset #fff; border-radius: 8px;
}
#pet .row button:active { border-style: inset; background: var(--gold); }

.buttons { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; }
.buttons a { display: block; line-height: 0; background: none; }
.buttons a:hover { transform: translateY(-2px); }
.buttons img { display: block; width: 88px; height: 31px; }

/* ---------- footer ---------- */
#foot { margin-top: 4px; text-align: center; }
#flames { height: 20px; background: url(../img/flames.gif) repeat-x bottom; }
html.calm #flames { background: none; border-bottom: 2px solid var(--orange); }
#foot p { margin: 6px 0; font-size: 18px; color: #d0c0ee; }
#foot #blurb { max-width: 760px; margin: 8px auto; line-height: 1.1; }
#foot .blinkies { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 6px 0; }
#foot .blinkies img { display: block; width: 150px; height: 20px; }
#secretpaw { opacity: .22; background: none; }
#secretpaw:hover { opacity: 1; background: none; }

/* ---------- overlays ---------- */
#fx { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 40; }
.faller { position: absolute; top: -32px; animation: fall linear infinite; }
.faller i { display: block; width: 16px; height: 16px; background: center no-repeat; image-rendering: pixelated; animation: sway ease-in-out infinite alternate; }
@keyframes fall { to { transform: translateY(calc(100vh + 64px)); } }
@keyframes sway { from { transform: translateX(-22px); } to { transform: translateX(22px); } }

#ufo { position: fixed; left: 0; top: 0; width: 72px; height: 52px; z-index: 45; transition: transform 5s ease-in-out; }
#ufo img { display: block; width: 72px; height: 52px; }
#ufo button { display: block; padding: 0; background: none; border: 0; }
#beam {
  position: absolute; left: 12px; top: 42px; width: 48px; height: 0; pointer-events: none;
  background: linear-gradient(rgba(255, 246, 194, .6), rgba(255, 246, 194, 0));
  clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%);
  transition: height .3s steps(5);
}
#ufo.on #beam { height: 180px; }

.trail { position: fixed; z-index: 60; width: 9px; height: 9px; pointer-events: none; animation: trail .7s linear forwards; }
@keyframes trail { to { transform: translateY(26px) scale(.3); opacity: 0; } }

#chaser { position: fixed; left: 0; top: 0; width: 40px; height: 32px; z-index: 50; pointer-events: none; background: url(../img/sheet-sammy.png) 0 0 no-repeat; image-rendering: pixelated; }

.runner { position: fixed; bottom: 2px; left: -60px; width: 40px; height: 32px; z-index: 46; pointer-events: none; background: center no-repeat; image-rendering: pixelated; animation: dash 7s linear forwards; }
@keyframes dash { to { left: calc(100vw + 60px); } }

#buddy { position: fixed; right: 6px; bottom: 0; z-index: 48; }
#buddy > button { display: block; padding: 0; background: none; border: 0; }
#buddy img { display: block; width: 96px; height: 116px; }
#bubble {
  position: absolute; right: 88px; bottom: 74px; width: 210px; padding: 7px 9px;
  color: #000; background: #ffffcc; border: 2px solid #000; border-radius: 10px;
  font: 18px/1 "VT323", monospace; box-shadow: 3px 3px 0 rgba(0, 0, 0, .55);
}
#bubble::after { content: ""; position: absolute; right: -12px; bottom: 16px; border: 6px solid transparent; border-left-color: #000; }
#bubble[hidden] { display: none; }
#bubble .x { float: right; margin: -2px -3px 0 4px; padding: 0 3px; font: 12px "Silkscreen", monospace; background: var(--gray); border: 1px outset #fff; color: #000; }

/* Win9x dialog */
.dlg {
  position: fixed; left: 50%; top: 22%; width: min(330px, 92vw); margin-left: min(-165px, -46vw); z-index: 70;
  color: #000; background: var(--gray); border: 2px outset #fff; box-shadow: 4px 4px 0 rgba(0, 0, 0, .6);
}
.dlg header {
  display: flex; align-items: center; justify-content: space-between; padding: 3px 4px; color: #fff;
  font: 13px "Silkscreen", monospace; background: linear-gradient(90deg, #4a1a8a, var(--orange)); touch-action: none;
}
.dlg header button { padding: 0 4px; font: 12px "Silkscreen", monospace; background: var(--gray); border: 2px outset #fff; color: #000; }
.dlg .body { display: flex; gap: 10px; align-items: center; padding: 10px; }
.dlg .body img { width: 64px; flex: none; }
.dlg .body p { margin: 0; font-size: 20px; line-height: 1; }
.dlg footer { display: flex; justify-content: center; gap: 8px; padding: 0 10px 10px; }

/* Splash: FoxNet dial-up */
#splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: auto; padding: 12px;
  background: #000 url(../img/stars.gif);
  transition: opacity .5s steps(5);
}
#splash.gone { opacity: 0; pointer-events: none; }
html.calm #splash { background-image: url(../img/stars-still.png); }
#dial {
  width: min(620px, 100%); padding: 14px; text-align: center;
  background: rgba(8, 3, 28, .92); border: 4px ridge var(--gold);
}
#dial img.logo { width: 100%; max-width: 544px; }
#dial .row { display: flex; gap: 12px; align-items: flex-end; justify-content: center; text-align: left; }
#dial .row > img { width: 192px; height: 232px; flex: none; margin-right: -20px; }
#term {
  flex: 1; min-width: 0; height: 208px; padding: 8px; overflow: hidden; color: #7fff9a; background: #001a08;
  border: 3px inset var(--gray); font: 19px/1.05 "VT323", monospace; white-space: pre-wrap;
}
#enter { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 6px; }
#enter button {
  padding: 10px 14px; font: 11px/1.2 "Press Start 2P", monospace; color: #1a0a3a;
  background: var(--gold); border: 3px outset #fff6c2;
}
#enter button:hover { background: var(--orange); }
#enter button:active { border-style: inset; }
#enter button.alt { background: var(--gray); }
#dial small { font: 12px/1.3 "Silkscreen", monospace; color: #c8b8e8; display: block; }

/* Party mode (Konami) */
html.party body { animation: party 4s linear infinite; }
@keyframes party { to { filter: hue-rotate(360deg); } }

#howl {
  position: fixed; left: 50%; top: 18%; z-index: 65; transform: translateX(-50%); pointer-events: none;
  font: 24px/1.2 "Press Start 2P", monospace; color: var(--gold); text-shadow: 3px 3px #7a2a08; white-space: nowrap;
  animation: howl 3s steps(12) forwards;
}
@keyframes howl { from { opacity: 1; letter-spacing: 0; } to { opacity: 0; letter-spacing: 8px; } }

html.calm #fx, html.calm #ufo, html.calm .trail, html.calm #chaser, html.calm .runner { display: none; }
/* keep the arcade playfield readable */
body.playing #fx, body.playing #ufo, body.playing #chaser, body.playing .trail { display: none; }

/* ---------- smaller screens ---------- */
@media (max-width: 1040px) {
  #cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #center { grid-column: 1 / -1; grid-row: 1; }
}
@media (max-width: 760px) {
  #top { grid-template-columns: 1fr 1fr; }
  #title { grid-column: 1 / -1; grid-row: 1; }
  .toggles { flex-direction: row; flex-wrap: wrap; }
  .toggles button { width: auto; flex: 1; }
  #logo { width: 100%; }
  #fire { display: none; }
}
@media (max-width: 560px) {
  #wrap { padding: 6px 6px 40px; }
  #cols { grid-template-columns: minmax(0, 1fr); }
  #nav a { padding: 6px 7px; font-size: 9px; }
  #tools button:nth-child(n+4) { display: none; }
  #progress { display: none; }
  #dial .row { flex-direction: column; align-items: center; }
  #dial .row > img { width: 96px; height: 116px; margin: 0; }
  #term { width: 100%; height: 150px; flex: none; }
  #bubble { right: 60px; }
}
@media (hover: none) {
  #chaser { display: none; }
  #buddy img { width: 72px; height: 87px; }
}
