/* Terra OS — a desktop in the browser. Windows-like, not Windows: green "terra" accent, soft
   glass only where it's cheap (taskbar, Start, flyouts), solid windows, transforms for motion. */

:root {
  --accent: #22c55e;
  --accent-2: #14b8a6;
  --accent-ink: #052e16;
  --glow: rgba(34, 197, 94, 0.45);
  --text: #eef4f1;
  --text-2: #a7b4ae;
  --text-3: #74827c;
  --win: #161b19;
  --win-2: #1d2421;
  --win-3: #252e2a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --glass: rgba(18, 24, 21, 0.78);
  --glass-solid: #141a17;
  --hover: rgba(255, 255, 255, 0.07);
  --press: rgba(255, 255, 255, 0.04);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  --radius: 10px;
  --taskbar: 50px;
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, sans-serif;
  --mono: 'Cascadia Mono', 'Cascadia Code', ui-monospace, 'SF Mono', Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

:root[data-theme='light'] {
  --text: #0f1a15;
  --text-2: #4a5852;
  --text-3: #7a8882;
  --win: #f7faf8;
  --win-2: #eef3f0;
  --win-3: #e2eae6;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --glass: rgba(240, 246, 243, 0.8);
  --glass-solid: #eef3f0;
  --hover: rgba(0, 0, 0, 0.06);
  --press: rgba(0, 0, 0, 0.03);
  --accent-ink: #f0fdf4;
  --shadow: 0 18px 50px rgba(15, 40, 30, 0.22), 0 2px 8px rgba(15, 40, 30, 0.12);
  color-scheme: light;
}
:root[data-theme='light'] {
  --accent: #16a34a;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #07100c;
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: default;
  background: none;
  border: 0;
  padding: 0;
}
a {
  color: var(--accent);
}
svg {
  width: 100%;
  height: 100%;
  display: block;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Wallpapers: gradients only, nothing to download ---------- */
.desktop {
  position: fixed;
  inset: 0 0 var(--taskbar) 0;
  background:
    radial-gradient(1100px 620px at 78% 18%, rgba(20, 184, 166, 0.28), transparent 60%),
    radial-gradient(900px 640px at 12% 88%, rgba(34, 197, 94, 0.22), transparent 62%),
    radial-gradient(700px 420px at 50% 120%, rgba(16, 120, 80, 0.35), transparent 70%),
    linear-gradient(160deg, #06120d 0%, #0a1813 45%, #04100b 100%);
}
.desktop::after {
  /* Faint contour lines: "terra". */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400' viewBox='0 0 600 400'%3E%3Cg fill='none' stroke='%2334d399' stroke-opacity='.07' stroke-width='1'%3E%3Cpath d='M0 300c80-40 160-60 240-30s170 40 250 0 90-60 110-60'/%3E%3Cpath d='M0 330c90-40 170-50 250-20s160 40 240 5 90-50 110-55'/%3E%3Cpath d='M0 270c70-45 150-70 230-45s180 30 260-10 90-70 110-70'/%3E%3Cpath d='M0 240c80-50 150-80 230-60s170 20 250-20 100-80 120-80'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 900px 600px;
  background-position: center bottom;
}
:root[data-wallpaper='midnight'] .desktop {
  background:
    radial-gradient(900px 600px at 70% 20%, rgba(59, 130, 246, 0.25), transparent 60%),
    radial-gradient(800px 600px at 15% 85%, rgba(124, 58, 237, 0.22), transparent 60%),
    linear-gradient(160deg, #070a14 0%, #0b1020 55%, #05070e 100%);
}
:root[data-wallpaper='ember'] .desktop {
  background:
    radial-gradient(900px 600px at 75% 15%, rgba(249, 115, 22, 0.25), transparent 60%),
    radial-gradient(900px 640px at 10% 90%, rgba(220, 38, 38, 0.2), transparent 62%),
    linear-gradient(160deg, #130906 0%, #1a0d08 50%, #0c0504 100%);
}
:root[data-wallpaper='mist'] .desktop,
:root[data-theme='light']:not([data-wallpaper]) .desktop {
  background:
    radial-gradient(1000px 640px at 78% 15%, rgba(20, 184, 166, 0.35), transparent 60%),
    radial-gradient(900px 640px at 10% 90%, rgba(34, 197, 94, 0.3), transparent 62%),
    linear-gradient(160deg, #d9efe6 0%, #c9e7da 50%, #b9dccd 100%);
}

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: radial-gradient(600px 400px at 50% 45%, #0b2418 0%, #030806 70%);
  color: #e9fff3;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}
.boot.done {
  opacity: 0;
  visibility: hidden;
}
.booted .boot {
  display: none;
}
.boot-mark {
  width: 76px;
  height: 76px;
  filter: drop-shadow(0 0 22px var(--glow));
  animation: breathe 2.2s ease-in-out infinite;
}
.boot-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.boot-bar {
  width: min(320px, 70vw);
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.boot-bar span,
.bar > span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #15803d, #22c55e 60%, #86efac);
  box-shadow: 0 0 14px var(--glow);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  transition: transform 0.25s linear;
}
.boot-line {
  font: 12px var(--mono);
  color: #86efac;
  opacity: 0.85;
  min-height: 1.4em;
}
.boot-foot {
  position: fixed;
  bottom: 28px;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(233, 255, 243, 0.35);
}
@keyframes breathe {
  50% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 30px rgba(34, 197, 94, 0.6));
  }
}

/* ---------- Desktop icons ---------- */
.desktop-icons {
  position: absolute;
  inset: 10px auto 10px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 96px);
  grid-auto-columns: 86px;
  gap: 4px 6px;
  z-index: 1;
}
.desktop-icons li {
  display: flex;
}
.dicon {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 4px 5px;
  border-radius: 6px;
  border: 1px solid transparent;
  text-align: center;
  color: #fff;
  user-select: none;
}
.dicon:hover {
  background: rgba(255, 255, 255, 0.08);
}
.dicon[aria-selected='true'] {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(134, 239, 172, 0.35);
}
.dicon .ico {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}
.dicon .lbl {
  font-size: 12px;
  line-height: 1.25;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.8),
    0 0 6px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
:root[data-theme='light'] .dicon {
  color: #0f1a15;
}
:root[data-theme='light'] .dicon .lbl {
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
}

/* App icons: an image, or letters on a coloured tile, sized by the box they sit in. */
.ico,
.tb-ico {
  container-type: size;
}
.app-ico {
  width: 100%;
  height: 100%;
  border-radius: 22%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, hsl(var(--h, 150) 65% 52%), hsl(var(--h, 150) 70% 30%));
  color: #fff;
  font-weight: 700;
  font-size: 40cqmin;
  line-height: 1;
  letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.app-ico.dark {
  background: radial-gradient(circle at 50% 35%, hsl(var(--h) 70% 30%), #020604 75%);
  color: #86efac;
}
.app-ico img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Desktop widget ---------- */
.widget {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  width: 300px;
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(10, 20, 16, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #eef4f1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
:root[data-theme='light'] .widget {
  background: rgba(255, 255, 255, 0.6);
  color: #0f1a15;
}
.widget small {
  display: block;
  font-size: 12px;
  opacity: 0.7;
}
.widget .stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  text-align: center;
}
.widget .stats div {
  padding: 8px 4px;
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.1);
}
.widget .stats b {
  font-size: 20px;
  color: var(--accent);
}
.widget .btn {
  flex: 1;
}
.compact .widget {
  display: none;
}

/* ---------- Windows ---------- */
.windows {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.win {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  min-height: 200px;
  background: var(--win);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  pointer-events: auto;
  contain: layout paint;
  animation: open 0.2s var(--ease);
}
.win:not(.active) {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
}
.win.max {
  border-radius: 0;
  border-width: 0;
  transform: none !important;
  width: 100% !important;
  height: 100% !important;
}
.win.min {
  visibility: hidden;
  pointer-events: none;
  animation: none;
}
.win.closing {
  animation: close 0.14s ease-in forwards;
  pointer-events: none;
}
.win.minimizing {
  animation: tomin 0.18s ease-in forwards;
}
@keyframes open {
  from {
    opacity: 0;
    scale: 0.94;
  }
}
@keyframes close {
  to {
    opacity: 0;
    scale: 0.94;
  }
}
@keyframes tomin {
  to {
    opacity: 0;
    translate: 0 40px;
    scale: 0.8;
  }
}
.win-bar {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  background: var(--win-2);
  border-bottom: 1px solid var(--line);
  user-select: none;
  touch-action: none;
}
.win:not(.active) .win-bar {
  color: var(--text-2);
}
.win-bar .ico {
  width: 18px;
  height: 18px;
  flex: none;
}
.win-title {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.win-ctrl {
  display: flex;
  height: 100%;
}
.win-ctrl button {
  width: 46px;
  height: 100%;
  display: grid;
  place-items: center;
}
.win-ctrl button:hover {
  background: var(--hover);
}
.win-ctrl button.x:hover {
  background: #e81123;
  color: #fff;
}
.win-ctrl svg {
  width: 15px;
  height: 15px;
}
.win-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.win-body.flush {
  overflow: hidden;
}
.grip {
  position: absolute;
  z-index: 3;
  touch-action: none;
}
.grip.e {
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: ew-resize;
}
.grip.s {
  left: 0;
  bottom: -3px;
  height: 7px;
  width: 100%;
  cursor: ns-resize;
}
.grip.se {
  right: -2px;
  bottom: -2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}
.win.max .grip {
  display: none;
}
.dragging iframe,
.dragging .win-body {
  pointer-events: none;
}
.dragging {
  cursor: grabbing;
}
.snap {
  position: absolute;
  z-index: 1;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.14);
  border: 2px solid rgba(134, 239, 172, 0.55);
  transition: all 0.15s var(--ease);
  pointer-events: none;
}
.frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

/* ---------- Phones: sideways only; every window full size ---------- */
.rotate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 22px;
  padding: 30px;
  text-align: center;
  background: radial-gradient(500px 400px at 50% 40%, #0b2418, #030806);
  color: #e9fff3;
}
.rotate p {
  margin: 0;
  font-size: 15px;
  color: rgba(233, 255, 243, 0.75);
}
.rotate strong {
  color: #fff;
  font-size: 18px;
}
.rotate-phone {
  width: 54px;
  height: 92px;
  border: 3px solid #86efac;
  border-radius: 12px;
  box-shadow: 0 0 24px var(--glow);
  animation: turn 2s var(--ease) infinite;
}
@keyframes turn {
  0%,
  20% {
    transform: rotate(0);
  }
  60%,
  100% {
    transform: rotate(-90deg);
  }
}
@media (orientation: portrait) and (max-width: 820px) {
  .rotate {
    display: grid;
  }
}
/* Compact: a phone on its side (or a small window). */
.compact {
  --taskbar: 42px;
}
.compact .desktop-icons {
  grid-template-rows: repeat(auto-fill, 78px);
  grid-auto-columns: 74px;
  inset: 6px auto 6px 6px;
}
.compact .dicon .ico {
  width: 34px;
  height: 34px;
}
.compact .dicon .lbl {
  font-size: 11px;
}
.compact .tb-btn {
  width: 38px;
  height: 36px;
}
.compact .tb-ico {
  width: 22px;
  height: 22px;
}
.compact .tb-left {
  display: none;
}
.compact .win-bar {
  height: 32px;
}
.compact .win-ctrl button {
  width: 40px;
}
.compact .fx-main {
  grid-template-columns: 150px 1fr;
}
.compact .fx-find {
  width: 120px;
}
.compact .pins {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.compact .start-search {
  margin: 12px 16px 4px;
}
.compact .start-body {
  padding: 6px 16px 10px;
}
.compact .recs,
.compact .start-recs {
  display: none;
}
.compact .cols,
.compact .cards {
  grid-template-columns: 1fr;
}
.compact .tdm-main {
  grid-template-columns: 1fr;
}
.compact .tdm-cats {
  display: none;
}
.compact .proj-hero {
  height: 120px;
}
.compact .quick {
  width: 300px;
}

/* ---------- Still: no animation, no blur ---------- */
.still *,
.still *::before,
.still *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
.lite .taskbar,
.lite .flyout,
.lite .menu {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: var(--glass-solid);
}

.off {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
  background: #000;
  color: #6b7280;
  font-size: 14px;
}
.power-on {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #22c55e;
  box-shadow: 0 0 22px var(--glow);
  background: radial-gradient(circle, rgba(34, 197, 94, 0.25), transparent 70%);
  position: relative;
}
.power-on::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 3px solid #86efac;
  border-top-color: transparent;
  border-radius: 50%;
}
.power-on::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 14px;
  width: 3px;
  height: 18px;
  margin-left: -1.5px;
  background: #86efac;
  border-radius: 2px;
}
.noscript {
  position: fixed;
  inset: 0;
  overflow: auto;
  padding: 40px;
  background: #07100c;
  z-index: 300;
}
