/* ============================================================
   MorgantiOS — desktop shell for matthewmorganti.com
   Theme: "Hot Supply / Cold Return" — orange + cyan on deep navy
   ============================================================ */

:root {
  --night: #05080f;
  --navy: #0a1220;
  --brand: #101927;
  --ink: #eaf2fb;
  --muted: #8fa2b8;
  --hot: #ff7a3d;
  --hot-soft: #ffb35c;
  --cold: #4dd8ff;
  --cold-soft: #9be9ff;
  --glass: rgba(14, 22, 36, 0.72);
  --glass-strong: rgba(12, 19, 32, 0.88);
  --glass-line: rgba(255, 255, 255, 0.12);
  --glass-line-soft: rgba(255, 255, 255, 0.07);
  --shadow-win: 0 24px 70px rgba(0, 0, 0, 0.55), 0 4px 18px rgba(0, 0, 0, 0.35);
  --tb-h: 56px;
  --tb-gap: 12px;
  --font-ui: "General Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --font-display: "Clash Display", "General Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection { background: rgba(77, 216, 255, 0.35); }

/* ---------------- Wallpaper ---------------- */

.wall {
  position: fixed;
  inset: -4%;
  width: 108%;
  height: 108%;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.wall-base {
  z-index: 0;
  background:
    radial-gradient(120% 90% at 78% 12%, rgba(19, 48, 82, 0.85) 0%, rgba(10, 18, 32, 0) 55%),
    radial-gradient(110% 100% at 12% 92%, rgba(1, 3, 7, 0.8) 0%, rgba(10, 18, 32, 0) 60%),
    radial-gradient(70% 60% at 50% 50%, #101c30 0%, #0a1220 58%, #05080f 100%);
}

.wall-grid {
  z-index: 1;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(110, 160, 210, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 160, 210, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(110, 160, 210, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 160, 210, 0.09) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px, 140px 140px, 140px 140px;
  -webkit-mask-image: radial-gradient(85% 80% at 50% 45%, #000 30%, transparent 100%);
  mask-image: radial-gradient(85% 80% at 50% 45%, #000 30%, transparent 100%);
}

.wall-vignette {
  z-index: 3;
  background: radial-gradient(115% 105% at 50% 42%, transparent 55%, rgba(2, 4, 9, 0.55) 100%);
}

/* subtle film grain over the wallpaper for depth (sits above wallpaper, below tiles) */
.wall::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

/* rain */
.wall-rain { z-index: 2; overflow: hidden; }

.rn {
  position: absolute;
  top: -170px;
  opacity: var(--o, 0.12);
  animation-name: rainfall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  will-change: transform;
}

.rn-streak {
  width: 1.5px;
  border-radius: 99px;
  background: linear-gradient(180deg, transparent, rgba(155, 233, 255, 0.85) 55%, transparent);
}

/* manufacturer logos, ghosted into the rain — pre-processed white silhouettes,
   auto-cropped to their artwork so a uniform height renders uniformly */
.rn-logo {
  --logo-h: 38px;
  height: var(--logo-h);
  width: auto;
  max-width: 230px;
  object-fit: contain;
  opacity: calc(var(--o, 0.12) * 1.55);
  filter: brightness(1.22) drop-shadow(0 0 10px rgba(111, 211, 255, 0.12));
}

/* Compact or stacked marks need more height to match the visual weight of
   wide marks such as Unilux, Riello and Raychem. */
.rn-logo[src*="/amtrol.png"] { --logo-h: 50px; }
.rn-logo[src*="/ebara.png"] { --logo-h: 68px; }
.rn-logo[src*="/syncroflo.png"] { --logo-h: 58px; }
.rn-logo[src*="/titan-flow-control.png"] { --logo-h: 58px; }
.rn-logo[src*="/nyle-water-heating-systems.png"] { --logo-h: 54px; }

@keyframes rainfall {
  to { transform: translateY(calc(100vh + 340px)); }
}

/* ---------------- Boot screen ---------------- */

.boot {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background:
    radial-gradient(60% 50% at 50% 42%, #0d1626 0%, #05080f 70%);
  isolation: isolate;
  overflow: hidden;
  transition: opacity 0.55s ease;
}

.boot-cinema {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #05080f url("/assets/morgantios-boot-higgsfield-poster.webp") center / cover no-repeat;
}

.boot-cinema::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(5, 8, 15, 0.12) 0%, rgba(5, 8, 15, 0.58) 62%, rgba(5, 8, 15, 0.88) 100%),
    linear-gradient(180deg, rgba(5, 8, 15, 0.22), rgba(5, 8, 15, 0.5));
}

.boot-cinema-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  opacity: 0.72;
  filter: saturate(0.88) brightness(0.74) contrast(1.08);
}

.boot > :not(.boot-cinema) {
  position: relative;
  z-index: 1;
}

.boot.hidden { opacity: 0; pointer-events: none; }
.boot.gone { display: none; }

.boot-orb {
  position: relative;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-line);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 44px rgba(77, 216, 255, 0.22),
    0 0 80px rgba(255, 122, 61, 0.14);
  /* materialize into existence, then breathe */
  animation:
    boot-materialize 1.05s cubic-bezier(0.19, 1, 0.22, 1) both,
    bootglow 3.2s ease-in-out 1.1s infinite;
}
/* expanding light-ring bloom as the mark appears */
.boot-orb::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 30px;
  border: 1.5px solid rgba(77, 216, 255, 0.55);
  opacity: 0;
  animation: boot-ring 1.5s ease-out 0.3s 2;
}

.boot-orb svg {
  width: 54px;
  height: 54px;
  animation: boot-drop-in 1.1s cubic-bezier(0.19, 1, 0.22, 1) 0.18s both;
  filter: drop-shadow(0 4px 16px rgba(63, 211, 255, 0.5));
}

@keyframes boot-materialize {
  0%   { opacity: 0; transform: scale(0.45); filter: blur(10px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
@keyframes boot-drop-in {
  0%   { opacity: 0; transform: translateY(6px) scale(0.6); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes boot-ring {
  0%   { opacity: 0.7; transform: scale(0.7); }
  100% { opacity: 0; transform: scale(1.9); }
}
@keyframes bootglow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 40px rgba(77,216,255,0.20), 0 0 80px rgba(255,122,61,0.12); transform: scale(1); }
  50%      { box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 0 62px rgba(77,216,255,0.34), 0 0 112px rgba(255,122,61,0.18); transform: scale(1.045); }
}

.boot-word {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  animation: boot-word-in 0.9s cubic-bezier(0.19, 1, 0.22, 1) 0.5s both;
}
@keyframes boot-word-in {
  0%   { opacity: 0; transform: translateY(10px); filter: blur(8px); letter-spacing: 0.6em; }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); letter-spacing: 0.28em; }
}
.boot-bar { animation: boot-fade-up 0.8s ease 0.75s both; }
.boot-msg { animation: boot-fade-up 0.8s ease 0.85s both; }
@keyframes boot-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.boot-word .hot { color: var(--hot-soft); }
.boot-word .cold { color: var(--cold); }

.boot-bar {
  width: 240px;
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.boot-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--cold), var(--hot));
  transition: width 0.3s ease;
}

.boot-msg {
  min-height: 18px;
  font-size: 13px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ---------------- Desktop tile grid ---------------- */

.desktop {
  position: fixed;
  inset: 0 0 calc(var(--tb-h) + var(--tb-gap) * 2) 0;
  z-index: 10;
}

.tile-grid {
  position: absolute;
  inset: 26px 26px 12px;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
  transition: opacity 0.45s ease;
}

/* Nine tools form a balanced 3 x 3 desktop with no orphaned empty zone. */
.tile-app { grid-column: span 3; }
.ta-calc      { grid-column: 1 / 4; grid-row: 1; }
.ta-diy       { grid-column: 4 / 7; grid-row: 1; }
.ta-sheets    { grid-column: 7 / 10; grid-row: 1; }
.ta-manuals   { grid-column: 1 / 4; grid-row: 2; }
.ta-products  { grid-column: 4 / 7; grid-row: 2; }
.ta-about     { grid-column: 7 / 10; grid-row: 2; }
.ta-contact   { grid-column: 1 / 4; grid-row: 3; }
.ta-assistant { grid-column: 4 / 7; grid-row: 3; }
.ta-bored     { grid-column: 7 / 10; grid-row: 3; }

.tile-app {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  column-gap: 18px;
  row-gap: 8px;
  padding: 22px 24px;
  border-radius: 24px;
  text-align: left;
  overflow: hidden;
  outline: none;
  /* translucent — the rain, logos and watermark stay visible through the tiles */
  background: linear-gradient(165deg, rgba(16, 27, 46, 0.58), rgba(9, 15, 27, 0.44));
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.3),
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
  opacity: 0;
  transform: translateY(14px);
}

body.ready .tile-app {
  animation: icon-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards;
  animation-delay: calc(var(--i) * 55ms);
}

@keyframes icon-in {
  to { opacity: 1; transform: translateY(0); }
}

.tile-app .ta-ico {
  width: 118px;
  height: 118px;
  grid-row: 1 / span 2;
  grid-column: 1;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.55));
  transition: filter 0.18s ease, transform 0.18s ease;
}

.tile-app .ta-appico {
  border-radius: 28px;
  /* generated icons already include plate + sheen; keep them crisp */
  image-rendering: auto;
}

.tile-app .ta-face {
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(84, 232, 143, 0.45);
  box-shadow: 0 0 18px rgba(84, 232, 143, 0.22), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tile-app .ta-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  min-width: 0;
  max-width: 100%;
}

.tile-app .ta-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.12;
}

.tile-app .ta-desc {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 26ch;
}

.tile-app .badge-ext {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: #cfe6ff;
  background: rgba(10, 18, 32, 0.8);
  border: 1px solid var(--glass-line);
}

.tile-app:hover,
.tile-app:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 60%, rgba(255, 255, 255, 0.18));
  background: linear-gradient(165deg,
    color-mix(in srgb, var(--accent) 13%, rgba(18, 30, 50, 0.55)),
    rgba(10, 17, 30, 0.42));
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.4),
    0 0 30px color-mix(in srgb, var(--accent) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 34px color-mix(in srgb, var(--accent) 7%, transparent);
}

.tile-app:hover .ta-ico,
.tile-app:focus-visible .ta-ico {
  transform: scale(1.05);
  filter:
    drop-shadow(0 16px 30px rgba(0, 0, 0, 0.55))
    drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 55%, transparent));
}

.tile-app:hover .ta-name { color: #fff; }
.tile-app:active { transform: translateY(0) scale(0.965); transition-duration: 0.07s; }

/* click ripple (tactile launch feedback, tinted to each tile's accent) */
.tile-app .ripple {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 42%, transparent), transparent 68%);
  animation: ripple 0.62s ease-out forwards;
}
@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* cursor-tracked glare: a soft accent light rakes across the hovered tile's glass
   (clipped to the card by overflow:hidden — no free-floating shape) */
.tile-app::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(240px circle at var(--gx, 50%) var(--gy, 50%),
    color-mix(in srgb, var(--accent) 20%, transparent), transparent 62%);
  z-index: 0;
}
.tile-app:hover::after, .tile-app:focus-visible::after { opacity: 1; }
/* keep icon + text above the glare */
.tile-app > * { position: relative; z-index: 1; }

/* magnetic tilt: 3D depth on the tiles + icon parallax */
.tile-app { transform-style: preserve-3d; }
.tile-app .ta-ico { transition: transform 0.16s ease, filter 0.18s ease; }

/* taskbar: running-app dot + dock launch bounce */
.tb-app { position: relative; }
.tb-app.running::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 2px;
  width: 4px; height: 4px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--accent, #4a9bff) 92%, #fff);
  box-shadow: 0 0 7px color-mix(in srgb, var(--accent, #4a9bff) 80%, transparent);
}
.tb-app.launching { animation: tb-bounce 0.52s cubic-bezier(0.2, 0.9, 0.3, 1.35); }
@keyframes tb-bounce {
  0% { transform: translateY(0); }
  35% { transform: translateY(-11px); }
  70% { transform: translateY(0); }
  85% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

/* first-run nudge */
.firstrun {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tb-h) + var(--tb-gap) * 2 + 16px);
  transform: translateX(-50%) translateY(12px);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 99px;
  font-size: 13px;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.firstrun.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.firstrun .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(180deg, #7be0b0, #2fd3a0);
  animation: fr-pulse 1.4s ease-in-out infinite;
}
@keyframes fr-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* sound toggle in the taskbar */
.tb-sfx {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}
.tb-sfx:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.tb-sfx svg { width: 17px; height: 17px; }
.tb-sfx .off-slash {
  display: none;
  position: absolute;
  width: 22px; height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: rotate(-42deg);
}
.tb-sfx.muted { color: rgba(143, 162, 184, 0.62); }
.tb-sfx.muted .off-slash { display: block; }

/* ---------------- Windows ---------------- */

.window {
  position: fixed;
  min-width: 360px;
  min-height: 240px;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line-soft);
  box-shadow: var(--shadow-win);
  backdrop-filter: blur(22px) saturate(1.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* open/close is FLIP-animated from the launch point in JS (transform + opacity only;
     left/top/size stay untransitioned so drag + resize track the pointer 1:1) */
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.2), opacity 0.3s ease;
}

@keyframes win-open {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.window.focused {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.62),
    0 0 34px color-mix(in srgb, var(--accent, #4dd8ff) 13%, transparent),
    0 4px 18px rgba(0, 0, 0, 0.4);
}

.window:not(.focused) { filter: saturate(0.85) brightness(0.92); }

.window.maximized {
  left: var(--tb-gap) !important;
  top: var(--tb-gap) !important;
  width: calc(100vw - var(--tb-gap) * 2) !important;
  height: calc(100vh - var(--tb-h) - var(--tb-gap) * 3) !important;
  border-radius: 14px;
}

/* MEPCalc is the primary engineering workspace. Open it as an immersive app,
   using the taskbar's former space instead of leaving a decorative dock below. */
body.calc-immersive .taskbar,
body.calc-immersive .fs-toggle { display: none; }
body.calc-immersive .window.maximized {
  left: 0 !important;
  top: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.window.closing { animation: win-close 0.16s ease forwards; }
@keyframes win-close {
  to { opacity: 0; transform: scale(0.94) translateY(10px); }
}

.window.minimizing { animation: win-min 0.2s ease forwards; }
@keyframes win-min {
  to { opacity: 0; transform: scale(0.88) translateY(46px); }
}

.window.restoring { animation: win-open 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.18); }

.win-titlebar {
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.015));
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: default;
  touch-action: none;
}

.win-titlebar .win-ico {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent, #4dd8ff) 55%, transparent));
}

.win-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-btns {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.win-btn {
  width: 34px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition: background 0.12s ease, color 0.12s ease;
}

.win-btn svg { width: 11px; height: 11px; }
.win-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--ink); }
.win-btn.close:hover { background: #e2453a; color: #fff; }

.win-body {
  flex: 1;
  min-height: 0;
  position: relative;
  background: transparent;
}

.win-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #f5f7fa;
}

.win-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0c1422;
  color: var(--muted);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.win-loading.done { opacity: 0; }

.win-loading .spin {
  width: 26px;
  height: 26px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--cold);
  border-right-color: var(--hot);
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* resize handles */
.rz { position: absolute; z-index: 5; }
.rz-e { top: 0; right: -3px; width: 7px; height: 100%; cursor: ew-resize; }
.rz-s { left: 0; bottom: -3px; height: 7px; width: 100%; cursor: ns-resize; }
.rz-se { right: -3px; bottom: -3px; width: 16px; height: 16px; cursor: nwse-resize; }
.window.maximized .rz { display: none; }

/* shield while dragging (iframes eat pointer events) */
.drag-shield {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
}
body.dragging .drag-shield { display: block; }
body.dragging { cursor: grabbing; }

/* ---------------- Taskbar ---------------- */

.taskbar {
  position: fixed;
  left: 50%;
  bottom: var(--tb-gap);
  transform: translateX(-50%);
  z-index: 1000;
  height: var(--tb-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(22px) saturate(1.3);
}

.tb-home {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.tb-home svg { width: 26px; height: 26px; }
.tb-home:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.06); }

.tb-sep {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

.tb-apps { display: flex; align-items: center; gap: 4px; }

.tb-app {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.tb-app svg { width: 24px; height: 24px; }
.tb-app:hover { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }

.tb-app::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 14px;
  height: 3px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent, #4dd8ff) 85%, white 10%);
  transition: transform 0.18s ease;
}

.tb-app.running::after { transform: translateX(-50%) scaleX(0.45); }
.tb-app.active { background: rgba(255, 255, 255, 0.12); }
.tb-app.active::after { transform: translateX(-50%) scaleX(1); }

.tb-app .tip,
.tb-home .tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--ink);
  background: rgba(8, 13, 22, 0.95);
  border: 1px solid var(--glass-line);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tb-app:hover .tip,
.tb-home:hover .tip { opacity: 1; transform: translateX(-50%) translateY(0); }

.tb-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}

.tb-status {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  cursor: default;
}

.tb-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 8px rgba(61, 220, 132, 0.9);
  animation: statpulse 2.4s ease-in-out infinite;
}

@keyframes statpulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.tb-status .stat { transition: opacity 0.4s ease; min-width: 64px; text-align: center; }
.tb-status .stat.fade { opacity: 0; }

.tb-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.25;
  padding: 0 6px 0 2px;
  cursor: default;
}

.tb-clock .t { font-size: 13px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.tb-clock .d { font-size: 10.5px; color: var(--muted); white-space: nowrap; }

/* ---------------- Start menu ---------------- */

.startmenu {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tb-h) + var(--tb-gap) * 2);
  transform: translateX(-50%) translateY(14px) scale(0.97);
  transform-origin: bottom center;
  z-index: 1001;
  width: 480px;
  max-width: calc(100vw - 24px);
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(26px) saturate(1.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  overflow: hidden;
}

.startmenu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}

.sm-user {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px 14px;
  background:
    radial-gradient(90% 160% at 85% 0%, rgba(255, 122, 61, 0.14) 0%, transparent 60%),
    radial-gradient(90% 160% at 10% 0%, rgba(77, 216, 255, 0.14) 0%, transparent 60%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sm-user img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 3px rgba(77, 216, 255, 0.16), 0 4px 14px rgba(0, 0, 0, 0.4);
}

.sm-user .n { font-size: 15.5px; font-weight: 700; }
.sm-user .r { font-size: 12px; color: var(--muted); margin-top: 2px; }

.sm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 14px;
}

.sm-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 13px 4px 11px;
  border-radius: 13px;
  transition: background 0.14s ease, transform 0.14s ease;
}

.sm-app svg { width: 30px; height: 30px; }
.sm-app span { font-size: 11px; color: #c9d6e5; text-align: center; line-height: 1.2; }
.sm-app:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-2px); }

.sm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.18);
}

.sm-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 9px;
  transition: background 0.14s ease, color 0.14s ease;
}

.sm-link:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.sm-link svg { width: 14px; height: 14px; }

/* ---------------- Context menu ---------------- */

.ctx {
  position: fixed;
  z-index: 1200;
  min-width: 218px;
  padding: 6px;
  border-radius: 13px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px);
  display: none;
  animation: win-open 0.14s ease;
}

.ctx.open { display: block; }

.ctx button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  text-align: left;
  color: #d7e2ef;
}

.ctx button:hover { background: rgba(255, 255, 255, 0.09); }
.ctx button svg { width: 15px; height: 15px; opacity: 0.8; }
.ctx .ctx-sep { height: 1px; margin: 5px 8px; background: rgba(255, 255, 255, 0.09); }
.ctx .k { margin-left: auto; font-size: 10.5px; color: var(--muted); font-family: var(--font-mono); }

/* ---------------- Toast ---------------- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tb-h) + var(--tb-gap) * 2);
  z-index: 1300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 340px;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  font-size: 12.5px;
  line-height: 1.45;
  color: #d7e2ef;
  animation: toast-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast svg { width: 20px; height: 20px; flex: 0 0 20px; }
.toast.out { animation: toast-out 0.3s ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(30px); }
}

/* ---------------- App: Terminal ---------------- */

.term {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #070c15;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  cursor: text;
}

.term-out {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 4px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #b9e8c9;
}

.term-out .dim { color: #5f7387; }
.term-out .hot { color: var(--hot-soft); }
.term-out .cold { color: var(--cold); }
.term-out .ok { color: #3ddc84; }
.term-out .err { color: #ff7369; }
.term-out a { color: var(--cold); }

.term-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 16px 12px;
}

.term-ps { color: var(--hot-soft); white-space: nowrap; }
.term-ps .at { color: var(--cold); }

.term-in {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  color: #eaf6ff;
  font: inherit;
  caret-color: var(--cold);
}

.term ::-webkit-scrollbar { width: 9px; }
.term ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); border-radius: 99px; }

/* ---------------- App: Explorer ---------------- */

.explorer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #0b1322;
}

.exp-bar {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--muted);
}

.exp-bar .crumb { display: flex; align-items: center; gap: 7px; }
.exp-bar .crumb b { color: #d7e2ef; font-weight: 600; }
.exp-bar svg { width: 13px; height: 13px; opacity: 0.6; }

.exp-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 6px;
  padding: 14px;
  align-content: start;
}

.exp-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 8px 13px;
  border-radius: 13px;
  transition: background 0.13s ease;
}

.exp-item svg { width: 42px; height: 42px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4)); }
.exp-item span { font-size: 11.5px; color: #cdd9e7; text-align: center; line-height: 1.3; }
.exp-item:hover { background: rgba(255, 255, 255, 0.06); }
.exp-item:active { background: rgba(255, 255, 255, 0.1); }

.exp-status {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted);
}

/* ---------------- App: About / README ---------------- */

.pane {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(255, 122, 61, 0.09) 0%, transparent 55%),
    radial-gradient(120% 70% at 0% -10%, rgba(77, 216, 255, 0.1) 0%, transparent 55%),
    #0b1322;
  padding: 28px;
  user-select: text;
}

.pane::-webkit-scrollbar { width: 9px; }
.pane::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.13); border-radius: 99px; }

.about-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }

.about-head img {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(77, 216, 255, 0.14), 0 0 30px rgba(255, 122, 61, 0.16), 0 10px 26px rgba(0, 0, 0, 0.45);
}

.about-head h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: 0.01em; }
.about-head p { margin: 0; font-size: 12.5px; color: var(--muted); }

.pane .bio { font-size: 13.5px; line-height: 1.7; color: #cdd9e7; margin: 0 0 18px; }
.pane .bio b { color: var(--ink); }

.spec {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.spec div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.025);
}

.spec div:nth-child(even) { background: rgba(255, 255, 255, 0.055); }
.spec span { color: var(--muted); }
.spec b { color: #d9e6f4; font-weight: 500; text-align: right; }
.spec.steps div { justify-content: flex-start; }
.spec.steps b { text-align: left; }

.pane-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.pbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  transition: background 0.14s ease, transform 0.14s ease;
}

.pbtn svg { width: 15px; height: 15px; flex: 0 0 15px; }
.pbtn:hover { background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }

.pbtn.hot {
  background: linear-gradient(135deg, #ff8a4d, #ff5c39);
  border-color: transparent;
  color: #1a0c05;
  box-shadow: 0 6px 20px rgba(255, 110, 60, 0.35);
}

.pbtn.hot:hover { background: linear-gradient(135deg, #ff9a63, #ff6a47); }

/* library panes (datasheets / manuals) */
.lib h2 { margin: 0 0 4px; font-size: 19px; }
.lib .sub { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-bottom: 16px; }
.lib p { font-size: 13px; line-height: 1.7; color: #cdd9e7; margin: 0 0 16px; }
.lib p b { color: var(--ink); }

/* search bar */
.lib-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.lib-search input {
  flex: 1;
  padding: 11px 15px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.lib-search input:focus {
  border-color: color-mix(in srgb, var(--accent, #6ea8ff) 65%, transparent);
  background: rgba(255, 255, 255, 0.08);
}

.lib-search input::placeholder { color: rgba(143, 162, 184, 0.6); }

.lib-hits {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* dropdown groups */
.lib-acc {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 8px;
  overflow: hidden;
}

.lib-acc.hide { display: none; }

.lib-acc-head {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px 16px;
  text-align: left;
  transition: background 0.13s ease;
}

.lib-acc-head:hover { background: rgba(255, 255, 255, 0.05); }

.lib-chev {
  flex: 0 0 auto;
  font-size: 12px;
  color: color-mix(in srgb, var(--accent, #6ea8ff) 80%, #fff 10%);
  transition: transform 0.18s ease;
}

.lib-acc.open .lib-chev { transform: rotate(90deg); }

.lib-acc-title {
  flex: 1;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #e2ecf7;
}

.lib-acc-count {
  flex: 0 0 auto;
  min-width: 30px;
  padding: 3px 9px;
  border-radius: 99px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.lib-acc-body {
  display: none;
  padding: 4px 14px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.lib-acc.open .lib-acc-body { display: block; }

.lib-makerblock { margin-top: 12px; }
.lib-makerblock.hide { display: none; }

.lib-makername {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent, #6ea8ff) 75%, #fff 12%);
}

.lib-docs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lib-doc {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  color: #c9d6e5;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.lib-doc.hide { display: none; }

.lib-doc:hover {
  background: color-mix(in srgb, var(--accent, #6ea8ff) 12%, rgba(255, 255, 255, 0.05));
  border-color: color-mix(in srgb, var(--accent, #6ea8ff) 50%, transparent);
  color: #fff;
}

.lib-doc-name { flex: 1; }

.lib-doc i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  flex: 0 0 auto;
}

.lib-doc:hover i { color: inherit; }

.lib-badge {
  flex: 0 0 52px;
  text-align: center;
  padding: 3px 0;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.b-data  { color: #9be9ff; background: rgba(77, 216, 255, 0.12);  border: 1px solid rgba(77, 216, 255, 0.3); }
.b-spec  { color: #b9ccff; background: rgba(110, 168, 255, 0.12); border: 1px solid rgba(110, 168, 255, 0.3); }
.b-bro   { color: #d8c2ff; background: rgba(166, 120, 255, 0.12); border: 1px solid rgba(166, 120, 255, 0.3); }
.b-guide { color: #a4f2c5; background: rgba(84, 232, 143, 0.12);  border: 1px solid rgba(84, 232, 143, 0.3); }
.b-page  { color: #b9c6d6; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); }
.b-iom   { color: #ffd9a1; background: rgba(255, 184, 77, 0.12);  border: 1px solid rgba(255, 184, 77, 0.32); }
.b-svc   { color: #ffc4ae; background: rgba(255, 122, 61, 0.13);  border: 1px solid rgba(255, 122, 61, 0.32); }
.b-wire  { color: #ffb9d2; background: rgba(255, 109, 157, 0.12); border: 1px solid rgba(255, 109, 157, 0.3); }

.lib-note {
  margin-top: 18px;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.readme h2 { margin: 0 0 4px; font-size: 18px; }
.readme .sub { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-bottom: 18px; }
.readme p, .readme li { font-size: 13px; line-height: 1.7; color: #cdd9e7; }
.readme ul { padding-left: 20px; margin: 0 0 16px; }
.readme li { margin-bottom: 7px; }
.readme code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.5px 6px;
  border-radius: 6px;
  color: var(--cold-soft);
}
.readme .hr { height: 1px; background: rgba(255, 255, 255, 0.09); margin: 16px 0; }

/* ---------------- Native documents (site pages restyled as OS content) ---------------- */

.os-doc { padding: 34px 42px 50px; }
.os-doc > *:first-child { margin-top: 0; }

.os-doc h1 {
  margin: 0 0 12px;
  font-size: 31px;
  letter-spacing: 0.01em;
}

.os-doc h2 {
  margin: 34px 0 14px;
  padding-bottom: 10px;
  font-size: 23px;
  color: var(--cold-soft);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.os-doc h3 { margin: 24px 0 9px; font-size: 18.5px; }

.os-doc p, .os-doc li {
  font-size: 16px;
  line-height: 1.75;
  color: #c6d4e3;
}

.os-doc p { margin: 0 0 14px; }
.os-doc b, .os-doc strong { color: var(--ink); }
.os-doc ul, .os-doc ol { padding-left: 22px; margin: 0 0 16px; }
.os-doc li { margin-bottom: 6px; }

.os-doc a {
  color: var(--cold);
  text-decoration: none;
  border-bottom: 1px dashed rgba(77, 216, 255, 0.4);
  transition: color 0.13s ease, border-color 0.13s ease;
}

.os-doc a:hover { color: #fff; border-color: rgba(255, 255, 255, 0.6); }

.os-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 26px;
  font-size: 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.os-doc th {
  text-align: left;
  padding: 12px 15px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cold);
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.os-doc td {
  padding: 12px 15px;
  vertical-align: top;
  color: #c6d4e3;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.os-doc tr:nth-child(even) td { background: rgba(255, 255, 255, 0.022); }

/* real photos (people etc.) — normalized */
.os-doc img.doc-photo {
  display: block;
  max-width: 100%;
  max-height: 340px;
  height: auto;
  margin: 12px auto 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Preserve the paired family-photo composition from the About page. */
.os-doc [data-doc-photo-grid] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: clamp(16px, 3vw, 36px);
  width: min(100%, 680px);
  margin: 12px auto 20px;
}

.os-doc [data-doc-photo-grid] > * {
  min-width: 0;
  display: grid;
  place-items: end center;
}

.os-doc [data-doc-photo-grid] img.doc-photo {
  width: 100%;
  height: clamp(220px, 31vw, 340px);
  margin: 0;
  object-fit: contain;
  object-position: center bottom;
}

/* vector equipment illustrations */
.doc-art {
  display: grid;
  place-items: center;
  padding: 24px 12px 18px;
  background:
    radial-gradient(90% 120% at 50% 0%, color-mix(in srgb, var(--accent, #4dd8ff) 10%, transparent) 0%, transparent 70%),
    rgba(255, 255, 255, 0.025);
}

.doc-art svg {
  width: 118px;
  height: 98px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.45));
}

.doc-art.solo {
  width: 100%;
  margin: 12px 0 22px;
  padding: 30px 0 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    radial-gradient(80% 130% at 50% 0%, color-mix(in srgb, var(--accent, #4dd8ff) 9%, transparent) 0%, transparent 70%),
    linear-gradient(165deg, #0d1626, #0a111e);
}

.doc-art.solo svg { width: 168px; height: 140px; }

/* equipment card grids rebuilt natively */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 13px;
  margin: 20px 0 28px;
}

.os-doc a.doc-card {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.025);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.os-doc a.doc-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent, #4dd8ff) 55%, rgba(255, 255, 255, 0.15));
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35), 0 0 24px color-mix(in srgb, var(--accent, #4dd8ff) 18%, transparent);
}

.doc-card-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 17px 17px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.doc-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent, #4dd8ff) 80%, #fff 12%);
}

.doc-card-text b { font-size: 17px; color: var(--ink); }
.doc-desc { font-size: 13.5px; line-height: 1.55; color: var(--muted); }

.os-doc hr {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 24px 0;
}

.os-doc blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent, var(--cold));
  background: rgba(255, 255, 255, 0.035);
  border-radius: 0 10px 10px 0;
}

/* single equipment-section windows: headline above, compact inline art */
.doc-sec h1 { margin-bottom: 18px; }

.sec-lead {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 20px;
}

.sec-lead p { flex: 1; margin: 0; }

.doc-art.sec-art {
  flex: 0 0 150px;
  padding: 16px 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

.doc-art.sec-art svg { width: 126px; height: 104px; }

.sec-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.sec-col {
  padding: 16px 19px 17px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}

.sec-col h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cold);
}

.sec-col p, .sec-col li { font-size: 14.5px; line-height: 1.65; }
.sec-col p { margin: 0; }
.sec-col ul { margin: 0; padding-left: 19px; }

@media (max-width: 760px) {
  .sec-cols { grid-template-columns: 1fr; }
  .sec-lead { flex-direction: column; }
}

/* ---------------- Native inquiry form ---------------- */

.os-form h2 { margin: 0 0 4px; font-size: 20px; }
.os-form .sub { color: var(--muted); font-size: 12px; font-family: var(--font-mono); margin-bottom: 20px; }
.os-form .of-hp { position: absolute; left: -9999px; top: -9999px; }

.of-intent {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.of-intent legend {
  margin-bottom: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-intent legend i { color: var(--hot-soft); font-style: normal; }

.of-intent-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.of-intent-grid label { cursor: pointer; }
.of-intent-grid input { position: absolute; opacity: 0; pointer-events: none; }

.of-intent-grid span {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #c9d6e5;
  font-size: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.of-intent-grid input:checked + span {
  border-color: rgba(47, 211, 160, 0.7);
  background: rgba(47, 211, 160, 0.12);
  color: #fff;
  box-shadow: inset 0 0 18px rgba(47, 211, 160, 0.05);
}

.of-intent-grid input:focus-visible + span {
  outline: 2px solid var(--cold);
  outline-offset: 2px;
}

.of-context[hidden] { display: none; }

.of-callout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(47, 211, 160, 0.22);
  border-radius: 12px;
  background: rgba(47, 211, 160, 0.07);
  font-size: 12px;
  line-height: 1.55;
}

.of-callout b { color: #d9fff2; }
.of-callout span { color: var(--muted); }

.of-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.of-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }

.of-group label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.of-group label i { color: var(--hot-soft); font-style: normal; }

.of-group input,
.of-group select,
.of-group textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.of-group input:focus,
.of-group select:focus,
.of-group textarea:focus {
  border-color: var(--cold);
  background: rgba(255, 255, 255, 0.08);
}

.of-group select { appearance: auto; }
.of-group select option { background: #101927; color: var(--ink); }
.of-group textarea { resize: vertical; min-height: 90px; }
.of-group input::placeholder, .of-group textarea::placeholder { color: rgba(143, 162, 184, 0.55); }
.of-group input[type="date"] { color-scheme: dark; }

.of-files input[type="file"] {
  padding: 8px;
  color: var(--muted);
  cursor: pointer;
}

.of-files input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: rgba(77, 216, 255, 0.14);
  color: #d8f6ff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.of-file-note, .of-file-list {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.of-file-list { color: #cfe7f5; }

.of-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.of-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12.5px;
  color: #c9d6e5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background 0.13s ease, border-color 0.13s ease;
}

.of-check:hover { background: rgba(255, 255, 255, 0.07); }
.of-check:has(input:checked) {
  border-color: rgba(77, 216, 255, 0.55);
  background: rgba(77, 216, 255, 0.09);
  color: #fff;
}

.of-check input { accent-color: #4dd8ff; width: 14px; height: 14px; }

.of-submit { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.of-status { font-size: 12px; font-family: var(--font-mono); color: var(--muted); }
.of-submit button:disabled { opacity: 0.55; cursor: wait; }

@media (max-width: 620px) {
  .of-intent-grid { grid-template-columns: 1fr 1fr; }
  .of-row { grid-template-columns: 1fr; gap: 0; }
}

.of-done { display: none; text-align: center; padding: 60px 20px; }
.of-done.show { display: block; animation: win-open 0.3s ease; }
.of-done svg { width: 54px; height: 54px; margin-bottom: 14px; }
.of-done h3 { margin: 0 0 8px; font-size: 20px; }
.of-done p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0; }

/* ---------------- Snake (Bored?) ---------------- */

body.gaming .tile-grid { opacity: 0.04; }
body.gaming .desktop { pointer-events: none; }
.window { pointer-events: auto; }
body.gaming .toasts { display: none; }

.snake-ui {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  font-family: var(--font-mono);
}

.snake-ui.on { display: block; animation: shut-in 0.5s ease; }

.snake-ui canvas { position: absolute; inset: 0; }

.sk-top {
  position: absolute;
  top: 18px;
  left: 26px;
  right: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.sk-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
  pointer-events: auto;
}

.sk-chip b { color: var(--cold); font-size: 15px; }

.sk-exit {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sk-exit:hover { background: rgba(226, 69, 58, 0.18); border-color: rgba(226, 69, 58, 0.5); color: #ffd7d3; }

.sk-board {
  position: absolute;
  top: 76px;
  right: 26px;
  width: 240px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(8, 13, 22, 0.72);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px);
}

.sk-board h3 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--cold);
}

.sk-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 12px;
}

.sk-tab {
  appearance: none;
  border: 1px solid rgba(155, 233, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 8px;
  font: inherit;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sk-tab:hover {
  color: #dce8f5;
  border-color: rgba(155, 233, 255, 0.28);
}

.sk-tab.on {
  color: #071018;
  background: linear-gradient(180deg, #9be9ff, #4db8ff);
  border-color: transparent;
  font-weight: 700;
}

.sk-board ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sk-board li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4.5px 0;
  font-size: 12.5px;
  color: #c9d6e5;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.sk-board li:last-child { border-bottom: 0; }
.sk-board li .rank { color: var(--muted); margin-right: 7px; }
.sk-board li .pts { color: var(--hot-soft); }
.sk-board li.me { color: #fff; }
.sk-board li.me .pts { color: var(--cold); }

.sk-note {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.sk-hint {
  position: absolute;
  bottom: calc(var(--tb-h) + var(--tb-gap) * 2 + 10px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: rgba(143, 162, 184, 0.7);
  text-transform: uppercase;
}

.sk-over {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(3, 6, 12, 0.45);
}

.sk-over.show { display: grid; animation: shut-in 0.3s ease; }

.sk-card {
  width: 360px;
  padding: 28px 30px 24px;
  border-radius: 20px;
  text-align: center;
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(22px);
}

.sk-card .t {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--hot-soft);
}

.sk-card .s { margin: 10px 0 18px; font-size: 14px; color: var(--muted); }
.sk-card .s b { color: var(--cold); font-size: 20px; }

.sk-row { display: flex; gap: 8px; margin-bottom: 14px; }

.sk-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  outline: none;
}

.sk-row input:focus { border-color: var(--cold); }

.sk-row button {
  padding: 10px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  background: linear-gradient(135deg, #59e3ff, #2f8fff);
  color: #06121f;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.sk-row button:hover { transform: translateY(-1px); }
.sk-row button:disabled { opacity: 0.45; transform: none; cursor: default; }

.sk-name-warning {
  display: none;
  margin: -3px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 157, 61, 0.42);
  border-radius: 10px;
  background: rgba(255, 157, 61, 0.09);
  color: #e8d8c7;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: left;
}

.sk-name-warning.show {
  display: grid;
  gap: 2px;
  animation: shut-in 0.18s ease;
}

.sk-name-warning b {
  color: var(--hot-soft);
  font-size: 10.5px;
  letter-spacing: 0.12em;
}

.sk-card .hint { font-size: 11px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }

/* ---------------- Shutdown ---------------- */

.shutdown {
  position: fixed;
  inset: 0;
  z-index: 1900;
  background: #010204;
  display: none;
  place-items: center;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}

.shutdown.open { display: grid; animation: shut-in 1s ease; }
@keyframes shut-in { from { opacity: 0; } to { opacity: 1; } }
.shutdown .big { font-size: 15px; color: #d7e2ef; margin-bottom: 10px; }

/* ---------------- Mobile close pill ---------------- */

.mob-close {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tb-h) + var(--tb-gap) * 2 + 10px);
  z-index: 4000;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffd7d3;
  background: rgba(160, 42, 34, 0.55);
  border: 1px solid rgba(226, 69, 58, 0.65);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
}

.mob-close svg { width: 13px; height: 13px; }

@media (max-width: 620px) {
  body.has-win .mob-close, body.gaming .mob-close { display: flex; }
}

/* ---------------- Fullscreen toggle ---------------- */

.fs-toggle {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 15px 10px 12px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.fs-toggle:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(77, 216, 255, 0.4);
  color: var(--ink);
  transform: translateY(-2px);
}

.fs-toggle svg { width: 18px; height: 18px; flex: 0 0 18px; }

.fs-toggle .fs-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.3;
  text-align: left;
}

.fs-toggle .fs-text b { font-size: 12.5px; font-weight: 600; letter-spacing: 0.03em; color: inherit; }

.fs-toggle.unsupported { display: none; }

body.gaming .fs-toggle { display: none; }

/* ---------------- Snake: tap-to-start + immersive mobile HUD ---------------- */

.sk-start {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  place-items: center;
  padding: 24px;
  /* light scrim so the actual board + starting snake preview through behind the card */
  background: rgba(6, 10, 20, 0.34);
  backdrop-filter: blur(2.5px);
}
.sk-start.show { display: grid; animation: shut-in 0.3s ease; }
.sk-start-card {
  width: min(440px, 90vw);
  text-align: center;
  padding: 30px 30px 26px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(20, 33, 56, 0.94), rgba(9, 15, 27, 0.96));
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow-win);
}
.sk-start-badge svg { width: 60px; height: 60px; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5)); }
.sk-start-card .t {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 10px 0 18px;
}
.sk-rules {
  list-style: none;
  text-align: left;
  margin: 0 auto 22px;
  max-width: 300px;
  display: grid;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}
.sk-rules b { color: var(--ink); font-weight: 600; }
.sk-rules li { position: relative; padding-left: 20px; }
.sk-rules li::before {
  content: "";
  position: absolute;
  left: 1px; top: 6px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, #7be0b0, #2fd3a0);
}
.sk-start-btn {
  font-family: var(--font-display);
  width: 100%;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #04121f;
  background: linear-gradient(180deg, #7be0b0, #2fd3a0);
  border: 0;
  border-radius: 13px;
  padding: 15px 28px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(47, 211, 160, 0.32);
}
.sk-start-btn:active { transform: translateY(1px); }

.sk-again {
  font-family: var(--font-display);
  width: 100%;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #04121f;
  background: linear-gradient(180deg, #7be0b0, #2fd3a0);
  border: 0;
  border-radius: 12px;
  padding: 13px 24px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(47, 211, 160, 0.3);
}
.sk-again:active { transform: translateY(1px); }

.sk-esc-mob {
  display: none;
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 4200;
  width: 46px; height: 46px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: #ffd7d3;
  background: rgba(160, 42, 34, 0.6);
  border: 1px solid rgba(226, 69, 58, 0.7);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(14px);
}
.sk-esc-mob svg { width: 16px; height: 16px; }
body.sk-mobile .sk-esc-mob { display: flex; }
/* during snake, the round esc is the only exit — hide the generic close pill */
body.sk-mobile .mob-close { display: none !important; }
/* leaderboard clutters the play area on phones — hide during play, reveal on game over */
body.sk-mobile .sk-board { display: none; }
body.sk-mobile.sk-ended .sk-board { display: block; }

/* immersive (landscape) mobile snake HUD: compact overlays over the board corners */
body.sk-mobile .sk-exit { display: none; }
body.sk-mobile .sk-top { top: 12px; left: 12px; right: auto; }
body.sk-mobile .sk-chip { padding: 7px 12px; font-size: 11px; letter-spacing: 0.04em; }
body.sk-mobile .sk-chip b { font-size: 13px; }
body.sk-mobile .sk-board {
  top: 12px; right: 12px; left: auto; bottom: auto;
  width: 172px;
  padding: 9px 13px 8px;
  background: rgba(8, 14, 26, 0.62);
  backdrop-filter: blur(12px);
}
body.sk-mobile .sk-board ol { display: block; grid-template-columns: none; }
body.sk-mobile .sk-board h3 { margin-bottom: 5px; font-size: 9.5px; }
body.sk-mobile .sk-board li { padding: 2.5px 0; font-size: 11px; }
body.sk-mobile .sk-board li:nth-child(n + 11) { display: none; }
body.sk-mobile .sk-note { margin-top: 5px; font-size: 9px; }
body.sk-mobile .sk-hint { bottom: 12px; left: 0; right: 0; text-align: center; font-size: 11px; }
body.sk-mobile .taskbar { display: none; }

/* short landscape screens: compact the tap-to-start card so nothing clips */
@media (max-height: 470px) {
  .sk-start { align-items: center; overflow-y: auto; padding: 14px; }
  .sk-start-card { padding: 16px 22px; }
  .sk-start-badge svg { width: 40px; height: 40px; }
  .sk-start-card .t { font-size: 22px; margin: 6px 0 11px; }
  .sk-rules { gap: 6px; margin-bottom: 14px; font-size: 12.5px; max-width: 360px; }
  .sk-start-btn { padding: 11px 24px; font-size: 15px; }
}

/* faux fullscreen for platforms without the Fullscreen API (e.g. iOS Safari) */
body.faux-fs .taskbar { display: none; }
body.faux-fs .fs-toggle { bottom: 14px; }

/* ---------------- Misc ---------------- */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

noscript.fallback {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--navy);
  color: var(--ink);
  padding: 40px;
  display: block;
  font-size: 15px;
  line-height: 2;
}

noscript.fallback a { color: var(--cold); }

@media (prefers-reduced-motion: reduce) {
  .flow-core { animation: none; }
  .wall { transition: none; }
  .boot-orb { animation: none; }
  .boot-cinema-video { display: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}

/* Small screens: not the priority, but degrade gracefully —
   icons stay tappable, windows open effectively full-screen. */
@media (max-width: 900px) {
  .rn-logo {
    height: calc(var(--logo-h) * 0.72);
    opacity: calc(var(--o, 0.12) * 1.25);
  }
  .desktop { overflow-y: auto; }
  .tile-grid {
    position: relative;
    inset: auto;
    margin: 20px 16px 12px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-auto-rows: minmax(128px, auto);
    gap: 10px;
  }
  .tile-grid .tile-app { grid-column: auto; grid-row: auto; min-height: 132px; }
  .tile-app {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 16px 16px 14px;
    gap: 12px;
    border-radius: 18px;
  }
  .tile-app .ta-ico {
    width: 72px;
    height: 72px;
    grid-row: auto;
    grid-column: auto;
  }
  .tile-app .ta-text {
    grid-column: auto;
    grid-row: auto;
    margin-top: 0;
  }
  .tile-app .ta-appico { border-radius: 18px; }
  .tile-app .ta-name { font-size: 16px; }
  .tile-app .ta-desc { font-size: 12px; max-width: none; }
}

@media (max-width: 620px) {
  .window {
    left: 8px !important;
    top: 8px !important;
    width: calc(100vw - 16px) !important;
    height: calc(100vh - var(--tb-h) - var(--tb-gap) * 2 - 16px) !important;
  }
  /* phone-sized touch targets on the window chrome; no drag/resize on phones */
  .rz { display: none; }
  .win-titlebar { height: 52px; flex-basis: 52px; touch-action: auto; padding-right: 14px; }
  .win-btn { width: 48px; height: 42px; border-radius: 10px; }
  .win-btn svg { width: 15px; height: 15px; }
  .win-btn.close { background: rgba(226, 69, 58, 0.16); color: #ffb4ae; }
  .win-btn.min, .win-btn.max { display: none; }
  .tb-status { display: none; }
  .startmenu { width: calc(100vw - 24px); }
  .fs-toggle { bottom: calc(var(--tb-h) + var(--tb-gap) * 2 + 8px); right: 12px; }

  /* snake, portrait: score/exit chips on top, leaderboard strip under them,
     board fills the rest; steering is swipe-based */
  .sk-top { top: 10px; left: 12px; right: 12px; }
  .sk-chip { padding: 8px 11px; font-size: 10.5px; gap: 6px; letter-spacing: 0.04em; }
  .sk-chip b { font-size: 13px; }
  .sk-board {
    top: 58px;
    left: 12px;
    right: 12px;
    width: auto;
    padding: 11px 14px 10px;
  }
  .sk-board h3 { margin-bottom: 7px; font-size: 10px; }
  .sk-board ol { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .sk-board li { padding: 3px 0; font-size: 11.5px; }
  .sk-board li:nth-child(n + 11) { display: none; }
  .sk-note { margin-top: 7px; font-size: 9.5px; }
  .sk-hint {
    bottom: calc(var(--tb-h) + var(--tb-gap) * 2 + 66px);
    width: 100%;
    text-align: center;
    font-size: 10.5px;
  }
  .sk-card { width: calc(100vw - 36px); padding: 24px 20px 20px; }
}

@media (max-width: 520px) {
  .tb-app[data-app="manuals"] { display: none; }
}

/* ---------------- Keyboard a11y: visible focus (mouse users unaffected) ---------------- */
.tile-app:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--night),
    0 0 0 4px color-mix(in srgb, var(--accent) 78%, #fff),
    0 14px 36px rgba(0, 0, 0, 0.4);
  transform: translateY(-3px);
}
.tb-app:focus-visible, .tb-home:focus-visible, .tb-sfx:focus-visible, .win-btn:focus-visible,
.sm-app:focus-visible, .fs-toggle:focus-visible, .sk-start-btn:focus-visible,
.sk-again:focus-visible, .sk-esc-mob:focus-visible, .sk-row button:focus-visible, .os-form button:focus-visible, .pbtn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cold) 82%, #fff);
  outline-offset: 2px;
  border-radius: 10px;
}
