/* ============================================================
   Ubuntu 8.04 on HP Pavilion — room + laptop presentation
   Scene adapted from ubuntu-hardy-public; screen runs real v86.
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --lidw: min(88vw, 84vh, 1020px);
  --human-orange: #dd4814;
}

html, body { height: 100%; }
body {
  font-family: "DejaVu Sans", "Bitstream Vera Sans", Verdana, sans-serif;
  background: #1a1410;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
}

#stage { position: fixed; inset: 0; overflow: hidden; }
#scene {
  position: absolute; inset: 0;
  transition: transform .65s cubic-bezier(.4,.1,.2,1);
  will-change: transform;
}

/* ---------- the room ---------- */
#wall {
  position: absolute; left: 0; right: 0; top: 0; height: 62%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,235,200,.10), transparent 60%),
    radial-gradient(circle at 30px 26px, rgba(214,196,164,.07) 1.4px, transparent 2px),
    radial-gradient(circle at 0 0, rgba(214,196,164,.07) 1.4px, transparent 2px),
    repeating-linear-gradient(90deg, rgba(225,210,180,.045) 0 2px, transparent 2px 30px),
    linear-gradient(#4a4038, #38302a 70%, #2b251f);
  background-size: auto, 60px 52px, 60px 52px, auto, auto;
}
#desk {
  position: absolute; left: 0; right: 0; top: 62%; bottom: 0;
  background:
    linear-gradient(rgba(255,255,255,.06), rgba(0,0,0,.25)),
    repeating-linear-gradient(94deg,
      #7a5230 0 90px, #71492a 90px 170px, #80572f 170px 260px);
  box-shadow: 0 -4px 14px rgba(0,0,0,.45);
}

#postit {
  position: absolute; left: 4%; top: 67%;
  width: 165px; padding: 10px 12px;
  background: linear-gradient(#fff79a, #f5e96a);
  color: #5a4a12; font-size: 12.5px; line-height: 1.55;
  transform: rotate(-4deg);
  box-shadow: 2px 4px 8px rgba(0,0,0,.45);
  font-family: "Comic Sans MS", "Segoe Print", cursive;
  pointer-events: none;
}
#postit b { font-size: 13px; }

#mug { position: absolute; right: 6%; top: 71%; width: 80px; pointer-events: none; }
#mug .body {
  width: 78px; height: 86px; border-radius: 6px 6px 14px 14px;
  background: linear-gradient(100deg, #efe7da, #cdc2af 70%, #b3a791);
  box-shadow: inset 0 6px 4px -4px #6b3215, 2px 8px 12px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
}
#mug .body span {
  font-size: 9.5px; color: #8a4012; font-weight: bold; text-align: center;
  transform: rotate(-2deg); padding: 0 6px;
}
#mug .handle {
  position: absolute; right: -22px; top: 18px; width: 30px; height: 42px;
  border: 9px solid #d9cfbd; border-left: none;
  border-radius: 0 22px 22px 0;
}
#mug .steam {
  position: absolute; top: -34px; left: 26px; color: rgba(255,255,255,.35);
  font-size: 16px; line-height: .8; animation: steam 3s infinite ease-in-out;
}
@keyframes steam { 0%,100% { opacity:.15; transform: translateY(0);} 50% { opacity:.5; transform: translateY(-6px);} }

/* ---------- wall posters (2008) ---------- */
.poster {
  position: absolute; top: 5%;
  pointer-events: none;
  box-shadow: 3px 9px 18px rgba(0,0,0,.55);
  border: 5px solid #efe9dd;
  padding: 9px 9px 7px;
  text-align: center; overflow: hidden;
}
.poster .tape {
  position: absolute; top: -9px; width: 34px; height: 16px;
  background: rgba(226,220,198,.45); border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.poster .tape.tl { left: 8px; transform: rotate(-24deg); }
.poster .tape.tr { right: 8px; transform: rotate(22deg); }

.poster img {
  display: block; width: 100%; height: auto;
  user-select: none; -webkit-user-drag: none;
}

#poster-tdk {
  left: 3%; width: 188px;
  transform: rotate(-2.6deg);
  background: #0c0f14; padding: 7px;
}

#poster-ferrari {
  right: 3%; width: 244px;
  transform: rotate(2.2deg);
  background: #111; padding: 7px 7px 0;
}
#poster-ferrari .fer-sub {
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  text-align: center; padding: 5px 0 6px;
  background: #b00009;
  text-shadow: 0 0 1px rgba(0,0,0,.5);
}

/* ---------- thermo textbook ---------- */
#thermobook {
  position: absolute; left: 3%; top: 77%;
  width: 100px; height: 140px;
  pointer-events: none;
  transform: rotate(-9deg);
  filter: drop-shadow(3px 7px 7px rgba(0,0,0,.5));
}
#thermobook .tb-side {
  position: absolute; left: -6px; top: 5px; width: 11px; height: 130px;
  background: repeating-linear-gradient(#efe7d2 0 2px, #d8cdae 2px 4px);
  transform: skewY(34deg); border-radius: 2px 0 0 2px;
}
#thermobook .tb-cover {
  position: absolute; inset: 0;
  border-radius: 2px 4px 4px 2px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2), inset -9px 0 14px rgba(0,0,0,.28);
}
#thermobook .tb-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  user-select: none; -webkit-user-drag: none;
}
#thermobook .tb-boring {
  position: absolute; right: -4px; bottom: 30px;
  color: #ff2d2d; font-size: 26px; font-weight: 800;
  font-family: "Comic Sans MS", "Segoe Print", "Marker Felt", cursive;
  transform: rotate(-13deg);
  text-shadow: 0 0 1px #ff2d2d, 1px 1px 0 rgba(120,0,0,.5);
}
#thermobook .tb-boring::after {
  content: ""; position: absolute; left: -2px; bottom: -3px; width: 102%; height: 3px;
  background: #ff2d2d; border-radius: 2px; transform: rotate(1.5deg);
}

/* ---------- wall clock ---------- */
#wallclock {
  position: absolute; left: 5.5%; top: 42%;
  width: 118px; height: 118px; border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 38% 32%, #fdfbf4, #ece4d2 70%, #d8cdb6);
  border: 6px solid #2b2b2b;
  box-shadow: 0 0 0 2px #6a6a6a, 4px 8px 14px rgba(0,0,0,.5), inset 0 2px 6px rgba(255,255,255,.6);
}
#wallclock .wc-tick {
  position: absolute; left: 50%; top: 6px; width: 2px; height: 8px;
  background: #3a3a3a; transform-origin: 50% 53px; margin-left: -1px;
}
#wallclock .wc-tick.maj { height: 12px; width: 3px; margin-left: -1.5px; background: #1c1c1c; }
#wallclock .wc-hand {
  position: absolute; left: 50%; bottom: 50%; transform-origin: 50% 100%;
  border-radius: 3px; background: #1c1c1c;
}
#wallclock .wc-hour { width: 5px; height: 30px; margin-left: -2.5px; }
#wallclock .wc-min  { width: 3.5px; height: 44px; margin-left: -1.75px; }
#wallclock .wc-sec  { width: 1.5px; height: 48px; margin-left: -.75px; background: #c0392b; }
#wallclock .wc-cap  {
  position: absolute; left: 50%; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: #c0392b;
  box-shadow: 0 0 0 2px #1c1c1c;
}

/* ---------- wall calendar (April 2008) ---------- */
#wallcal {
  position: absolute; right: 4.5%; top: 25%;
  width: 168px; pointer-events: none;
  background: #fbf7ee; border: 1px solid #cfc4ad;
  transform: rotate(1.5deg);
  box-shadow: 3px 7px 14px rgba(0,0,0,.45);
  font-family: "DejaVu Sans", Arial, sans-serif;
}
#wallcal .cal-top {
  position: relative; background: linear-gradient(#c64a1e, #e35a26);
  color: #fff; text-align: center; padding: 7px 0 6px;
  font-weight: 800; letter-spacing: 3px; font-size: 13px;
}
#wallcal .cal-top::before {
  content: ""; position: absolute; left: 22px; top: -7px; width: 7px; height: 12px;
  background: #d8cdb6; border-radius: 3px; box-shadow: 116px 0 0 #d8cdb6;
}
#wallcal .cal-month { text-align: center; color: #b0381a; font-weight: 700;
  font-size: 12px; letter-spacing: 1px; padding: 5px 0 2px; }
#wallcal .cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 1px; padding: 4px 6px 8px; font-size: 9.5px; color: #4a4438;
}
#wallcal .cal-dow { text-align: center; font-weight: 700; color: #9a9082; padding-bottom: 2px; }
#wallcal .cal-d { text-align: center; padding: 2.5px 0; line-height: 1; }
#wallcal .cal-d.sun { color: #c0392b; }
#wallcal .cal-d.circ {
  position: relative; color: #b0381a; font-weight: 800;
}
#wallcal .cal-d.circ::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 15px;
  margin: -8px 0 0 -9px; border: 2px solid #c0392b; border-radius: 50%;
  transform: rotate(-12deg);
}

/* ---------- the laptop ---------- */
#laptop {
  position: absolute; left: 50%; top: 7%;
  width: var(--lidw);
  transform: translateX(-50%);
  transform-style: preserve-3d;
  perspective: 1900px; perspective-origin: 50% 20%;
}
#lid {
  position: relative; width: 100%; aspect-ratio: 1.49;
  background: linear-gradient(160deg, #3c3f45, #23252a 60%, #1b1d21);
  border-radius: 14px 14px 4px 4px;
  border: 1px solid #0c0d10;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 2px 10px rgba(0,0,0,.4);
  padding: 0;
}
#bezel { position: absolute; inset: 0; }
#cam {
  position: absolute; top: 2.2%; left: 50%; width: 7px; height: 7px;
  transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #5a7a8a, #0a0f14 70%);
  box-shadow: 0 0 0 2px #111;
}
#screen {
  position: absolute; left: 3.4%; right: 3.4%; top: 5.2%; bottom: 6.6%;
  background: #000; overflow: hidden; border-radius: 2px;
  box-shadow: inset 0 0 0 1px #000, inset 0 0 26px rgba(0,0,0,.85);
}
.hp-mark {
  position: absolute; bottom: 1.4%; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.hp-circle {
  display: inline-block; width: 20px; height: 20px; line-height: 19px;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4aa0d8, #14507e);
  color: #fff; font-size: 9.5px; font-weight: bold; font-style: italic;
  text-align: center;
}
.hp-model { color: #9aa0a8; font-size: 11px; letter-spacing: 2px; }

#base {
  position: relative; width: 100%; height: calc(var(--lidw) * .62);
  transform-origin: top center;
  transform: rotateX(72deg);
  margin-top: -2px;
  /* keep the deck above the lid for hit-testing near the hinge */
  z-index: 3;
  pointer-events: auto;
}
#deck {
  position: absolute; inset: 0;
  background: linear-gradient(#d6d3cc, #b9b5ac 60%, #a09b90);
  border-radius: 6px 6px 22px 22px;
  border: 1px solid #6f6a60;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.5), 0 18px 28px rgba(0,0,0,.5);
  padding: 2.2% 3.4%;
  display: flex; flex-direction: column;
}
#hinge {
  position: absolute; top: 0; left: 6%; right: 6%; height: 12px;
  background: linear-gradient(#55524b, #84817a 50%, #44423c);
  border-radius: 0 0 6px 6px;
}
#powerbtn {
  position: absolute; top: 2.4%; right: 4%;
  width: 42px; height: 18px; border-radius: 9px;
  background: linear-gradient(#e8e5de, #c4c0b6);
  border: 1px solid #8a857a; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 5;
  pointer-events: auto;
  /* larger hit target — the 3D-rotated base is easy to miss */
}
#powerbtn::before {
  content: "";
  position: absolute;
  inset: -14px -18px;
}
#powerled {
  width: 8px; height: 8px; border-radius: 50%;
  background: #5d6258; transition: background .3s, box-shadow .3s;
  pointer-events: none;
}
#powerbtn.on #powerled { background: #7fd24a; box-shadow: 0 0 8px #7fd24a; }
#powerbtn:hover { filter: brightness(1.06); }
#powerbtn:active { transform: scale(0.96); }

#kbd {
  margin-top: 26px; flex: 1;
  display: flex; flex-direction: column; gap: 4px;
  background: #2a2925; border-radius: 6px; padding: 6px;
  border: 1px solid #1a1916;
}
.krow { display: flex; gap: 4px; flex: 1; }
.key {
  flex: 1; border-radius: 3px;
  background: linear-gradient(#3b3a36, #262522);
  border: 1px solid #14130f;
  color: #cfccc2; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.key.w15 { flex: 1.5; } .key.w2 { flex: 2; } .key.w25 { flex: 2.5; }
.key.w6 { flex: 6; } .key.half { font-size: 8px; }

#palmrest { display: flex; align-items: center; margin-top: 8px; height: 26%; }
#pad {
  width: 26%; height: 100%; margin: 0 auto;
  background: linear-gradient(#c8c4bb, #aaa69c);
  border: 1px solid #7c776c; border-radius: 4px;
  display: flex; flex-direction: column; justify-content: flex-end;
}
#padbtns { display: flex; height: 30%; border-top: 1px solid #7c776c; }
#padbtns span { flex: 1; }
#padbtns span:first-child { border-right: 1px solid #7c776c; }
.sticker {
  font-size: 10px; line-height: 1.1; padding: 5px 9px; border-radius: 3px;
  box-shadow: 1px 2px 3px rgba(0,0,0,.3); transform: rotate(-2deg);
}
.sticker-ubuntu { background: var(--human-orange); color: #fff; font-weight: bold; }
.sticker-hp { background: #dfe7ee; color: #2a5b86; transform: rotate(2deg); margin-left: auto; }
.sticker small { font-weight: normal; font-size: 8px; }

#lapshadow {
  position: absolute; left: -4%; right: -4%; bottom: -10%;
  height: 30px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%);
  transform: translateZ(-50px);
}

/* ---------- v86 screen fill ---------- */
#screen_container {
  position: absolute; inset: 0;
  background: #000;
  line-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
#screen_container > div {
  white-space: pre;
  font: 14px monospace;
  line-height: 14px;
  color: #ccc;
  /* text mode: fill the bezel when canvas is hidden */
  max-width: 100%;
  max-height: 100%;
  overflow: hidden;
}
#screen_container canvas {
  /* scale guest framebuffer into the laptop bezel without stretching */
  max-width: 100%;
  max-height: 100%;
  width: auto !important;
  height: auto !important;
  object-fit: contain;
  image-rendering: auto;
}

/* status overlay while loading / before power-on */
#status-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: #050505;
  color: #6a6a6a;
  font-size: 15px;
  pointer-events: none;
  transition: opacity .35s;
}
/* clickable when idle so "click to power on" works even before zoom */
#status-overlay.idle {
  pointer-events: auto;
  cursor: pointer;
}
#status-overlay.running {
  opacity: 0;
  pointer-events: none;
}
#status-overlay .off-hint {
  color: #2e2e2e; font-size: 16px; margin-top: 8px;
}
#status-overlay.idle:hover .off-hint { color: #4a4a4a; }
#status-text {
  color: #ffd9b3;
  font-size: 13px;
  max-width: 80%;
  text-align: center;
  line-height: 1.45;
  min-height: 1.45em;
}
#status-overlay.idle #status-text { display: none; }
#status-overlay.idle .off-hint { display: block; }
#status-overlay:not(.idle) .off-hint { display: none; }

/* toolbar — always clickable (was pointer-events:none + opacity:0, so never hoverable) */
#toolbar {
  position: fixed; top: 12px; right: 12px; z-index: 100;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  opacity: 0.92;
  pointer-events: auto;
}
body:not(.powered):not(.zoomed) #toolbar { opacity: 0.85; }

#toolbar button {
  background: rgba(0,0,0,.55);
  color: #e8dcc8;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 14px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
#toolbar button:hover { background: rgba(0,0,0,.72); color: #fff; }
#toolbar button:disabled { opacity: .4; cursor: default; }
#toolbar button.primary {
  background: rgba(221,72,20,.85);
  border-color: rgba(255,180,120,.4);
  color: #fff;
}
#toolbar button.primary:hover { background: rgba(221,72,20,1); }

#hint {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  color: #cbbfae; font-size: 13px; background: rgba(0,0,0,.45);
  padding: 6px 14px; border-radius: 14px; pointer-events: none;
  transition: opacity .4s;
  z-index: 90;
  text-align: center;
  max-width: min(90vw, 520px);
}
#hint.faded { opacity: 0; }
#hint a { color: #ffd9b3; }

/* zoom affordance */
body:not(.zoomed) #screen { cursor: zoom-in; }
body.zoomed #screen { cursor: default; }
body:not(.powered):not(.zoomed) #screen { cursor: pointer; }

/* when not zoomed, block interaction with guest until zoomed (like hardy) */
body:not(.zoomed) #screen_container {
  pointer-events: none;
}
body.zoomed #screen_container {
  pointer-events: auto;
}
/* idle overlay sits above screen_container and is clickable (see .idle) */
#screen { cursor: inherit; }

/* real fullscreen on the guest surface */
#screen_container:fullscreen,
#screen_container:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
#screen_container:fullscreen canvas,
#screen_container:-webkit-full-screen canvas {
  max-width: 100vw;
  max-height: 100vh;
}
