* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.desktop-shell {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 34px 1fr 46px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 18%, rgba(143, 191, 168, 0.14), transparent 28rem),
    radial-gradient(circle at 24% 80%, rgba(214, 181, 109, 0.1), transparent 24rem),
    linear-gradient(135deg, #090b0d 0%, var(--bg) 55%, #14130f 100%);
}

.desktop-topbar,
.taskbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-color: var(--line);
  background: rgba(8, 10, 12, 0.74);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  backdrop-filter: blur(16px);
}

.desktop-topbar {
  justify-content: space-between;
  padding: 0 0.9rem;
  border-bottom: 1px solid var(--line);
}

.desktop-topbar button,
.taskbar button,
.taskbar a {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(242, 239, 231, 0.06);
  color: var(--text);
  padding: 0.35rem 0.62rem;
  text-decoration: none;
  cursor: pointer;
}

.desktop-topbar button:hover,
.taskbar button:hover,
.taskbar a:hover {
  border-color: rgba(214, 181, 109, 0.6);
}

.desktop {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(242, 239, 231, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 239, 231, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
}

.desktop::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.38));
}

.desktop-icons {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 94px);
  gap: 0.5rem 0.85rem;
}

.app-icon {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  width: 94px;
  min-height: 72px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.app-icon:hover,
.app-icon:focus-visible {
  border-color: var(--line);
  background: rgba(242, 239, 231, 0.08);
}

.app-icon__glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 42px;
  border: 1px solid rgba(214, 181, 109, 0.48);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(214, 181, 109, 0.22), rgba(143, 191, 168, 0.12)),
    var(--panel-solid);
  box-shadow: 0 12px 24px var(--shadow);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
}

.app-icon__label {
  max-width: 92px;
  border-radius: 4px;
  background: rgba(11, 13, 15, 0.72);
  padding: 0.16rem 0.3rem;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.2;
  text-align: center;
}

.widgets {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 1;
  display: grid;
  gap: 0.75rem;
  width: min(28vw, 360px);
}

.widget {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(22, 25, 29, 0.62);
  box-shadow: 0 16px 42px var(--shadow);
  padding: 0.85rem;
  backdrop-filter: blur(14px);
}

.widget h2 {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.widget p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.taskbar {
  z-index: 90;
  padding: 0.35rem 0.6rem;
  border-top: 1px solid var(--line);
}

.taskbar__start {
  font-weight: 800;
}

.taskbar__windows {
  display: flex;
  flex: 1;
  gap: 0.4rem;
  overflow-x: auto;
}

.taskbar__windows button {
  min-width: max-content;
}

.taskbar__windows button.minimised {
  color: var(--faint);
}

.taskbar__control {
  margin-left: auto;
}

.os-window {
  position: absolute;
  top: var(--window-y);
  left: var(--window-x);
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  width: min(var(--window-width), calc(100vw - 24px));
  height: min(var(--window-height), calc(100vh - 108px));
  border: 1px solid rgba(242, 239, 231, 0.22);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel-solid);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.54);
}

.os-window.maximised {
  inset: 42px 10px 56px 10px;
  width: auto;
  height: auto;
}

.os-window__titlebar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(214, 181, 109, 0.2), rgba(143, 191, 168, 0.09)), #111419;
  padding: 0 0.55rem 0 0.75rem;
  touch-action: none;
  user-select: none;
}

.os-window__icon {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 800;
}

.os-window__titlebar h2 {
  min-width: 0;
  flex: 1;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.os-window__actions {
  display: flex;
  gap: 0.3rem;
}

.os-window__actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.os-window__actions button:hover {
  border-color: var(--accent);
}

.os-window__body {
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
    var(--panel-solid);
}

.os-window__resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 26px;
  height: 26px;
  border: 0;
  background:
    linear-gradient(135deg, transparent 0 48%, var(--line) 50% 56%, transparent 58%),
    linear-gradient(135deg, transparent 0 66%, var(--line) 68% 74%, transparent 76%);
  cursor: nwse-resize;
  touch-action: none;
}

.content-window {
  padding: clamp(1rem, 2.4vw, 1.65rem);
  color: var(--text);
}

.content-window h2 {
  margin: 0 0 0.9rem;
  color: var(--text);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.content-window h3 {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 1rem;
}

.content-window p,
.content-window li {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.62;
}

.content-window blockquote {
  margin: 1rem 0;
  border-left: 3px solid var(--accent);
  background: rgba(214, 181, 109, 0.08);
  padding: 0.85rem 1rem;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.55;
}

.content-window ul {
  padding-left: 1.2rem;
}

.content-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.content-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(242, 239, 231, 0.045);
  padding: 0.85rem;
}

.content-card p {
  margin: 0;
  font-size: 0.92rem;
}

.content-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.content-cta a,
.document-hero a,
.control-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(214, 181, 109, 0.42);
  border-radius: 6px;
  background: rgba(214, 181, 109, 0.12);
  padding: 0.48rem 0.72rem;
  color: var(--text);
  text-decoration: none;
}

.content-cta span {
  color: var(--faint);
  font-size: 0.88rem;
}

.terminal-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100%;
  background: #050607;
  color: var(--ok);
  font-family: var(--font-mono);
}

.terminal-output {
  min-height: 0;
  overflow: auto;
  padding: 1rem;
}

.terminal-output pre {
  margin: 0 0 0.55rem;
  white-space: pre-wrap;
  color: var(--ok);
  font-size: 0.88rem;
  line-height: 1.45;
}

.terminal-output pre.terminal-input-line {
  color: var(--accent);
}

.terminal-form {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem;
  border-top: 1px solid rgba(155, 207, 155, 0.24);
  padding: 0.7rem;
}

.terminal-form input {
  min-width: 0;
  border: 1px solid rgba(155, 207, 155, 0.22);
  border-radius: 5px;
  background: rgba(155, 207, 155, 0.06);
  color: var(--ok);
  padding: 0.45rem 0.55rem;
}

.terminal-form button,
.control-panel button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(242, 239, 231, 0.08);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: start center;
  background: rgba(0, 0, 0, 0.48);
  padding-top: 12vh;
}

.command-palette {
  width: min(620px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.62);
  padding: 0.9rem;
}

.command-palette label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--accent-2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.command-palette input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(242, 239, 231, 0.06);
  color: var(--text);
  padding: 0.75rem;
}

.command-list {
  display: grid;
  gap: 0.35rem;
  max-height: 46vh;
  margin-top: 0.75rem;
  overflow: auto;
}

.command-list button {
  display: grid;
  gap: 0.2rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  padding: 0.65rem;
  text-align: left;
  cursor: pointer;
}

.command-list button:hover,
.command-list button:focus-visible {
  border-color: var(--line);
  background: rgba(242, 239, 231, 0.06);
}

.command-list span {
  font-family: var(--font-mono);
  color: var(--accent);
}

.command-list small {
  color: var(--muted);
}

.control-panel {
  padding: 1.2rem;
}

.control-panel h2 {
  margin: 0 0 1rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.control-grid section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(242, 239, 231, 0.045);
  padding: 0.9rem;
}

.control-grid h3 {
  margin: 0 0 0.4rem;
  color: var(--accent);
}

.control-grid p,
.switch span {
  color: var(--muted);
  line-height: 1.45;
}

.switch {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.segmented {
  display: inline-flex;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.25rem;
}

.segmented button.active {
  border-color: rgba(214, 181, 109, 0.58);
  background: rgba(214, 181, 109, 0.18);
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
}

.boot-identity {
  position: relative;
  width: min(1120px, 94vw);
  min-height: min(680px, 88vh);
  padding: clamp(1.2rem, 3vw, 2.4rem);
  border: 1px solid rgba(53, 65, 73, 0.1);
  background: #fbfbfa;
  color: #354149;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.32);
}

.boot-identity h1 {
  margin: 0;
  font-size: clamp(2.35rem, 4vw, 4.4rem);
  font-weight: 300;
  line-height: 1;
}

.boot-identity strong {
  font-weight: 700;
}

.identity-grid {
  position: relative;
  min-height: 420px;
  margin-top: 1rem;
  font-size: clamp(1.05rem, 2vw, 1.85rem);
}

.identity-grid span {
  position: absolute;
  white-space: nowrap;
}

.word-a { left: 9%; top: 20%; }
.word-b { left: 47%; top: 10%; }
.word-c { right: 7%; top: 20%; }
.word-d { left: 1%; top: 47%; }
.word-e { left: 42%; top: 42%; width: 28ch; text-align: center; white-space: normal; font-size: 1.15em; }
.word-f { right: 0; top: 47%; }
.word-g { left: 8%; bottom: 13%; }
.word-h { left: 40%; bottom: 7%; }
.word-i { right: 4%; bottom: 13%; }

.identity-footnote {
  max-width: 920px;
  margin: 0 auto;
  color: #5d6266;
  text-align: center;
  line-height: 1.5;
}

.boot-console {
  width: min(720px, 92vw);
  border: 1px solid rgba(214, 181, 109, 0.32);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at top right, rgba(143, 191, 168, 0.12), transparent 20rem),
    #050607;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.56);
  padding: clamp(1rem, 3vw, 2rem);
  color: var(--ok);
  font-family: var(--font-mono);
}

.boot-console h1 {
  margin: 0.8rem 0 0.35rem;
  color: var(--text);
  font-size: 2.4rem;
}

.boot-ascii {
  margin: 0;
  color: var(--accent);
  line-height: 1.25;
}

.boot-console ol {
  list-style: none;
  margin: 1.2rem 0;
  padding: 0;
}

.boot-console li {
  margin: 0.35rem 0;
  color: rgba(155, 207, 155, 0.42);
}

.boot-console li.active {
  color: var(--ok);
}

.progress {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(155, 207, 155, 0.36);
  border-radius: 999px;
  background: rgba(155, 207, 155, 0.08);
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width 420ms ease;
}

.boot-footer {
  color: var(--faint);
  font-size: 0.82rem;
}

.boot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.boot-actions button,
.boot-actions a {
  min-height: 40px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  cursor: pointer;
}

.document-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(143, 191, 168, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
  padding: clamp(1rem, 4vw, 3rem);
}

.document-hero,
.document-section {
  max-width: 980px;
  margin: 0 auto;
}

.document-hero {
  padding: 2rem 0 1.2rem;
}

.document-hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  line-height: 1;
}

.document-hero p {
  max-width: 740px;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.5;
}

.eyebrow {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.document-hero nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.document-section {
  border-top: 1px solid var(--line);
  padding: 1.2rem 0;
}

@media (max-width: 780px) {
  .desktop-shell {
    grid-template-rows: 34px 1fr auto;
  }

  .desktop {
    overflow: auto;
    padding-bottom: 5rem;
  }

  .desktop-icons {
    position: relative;
    top: auto;
    left: auto;
    grid-template-columns: repeat(3, minmax(82px, 1fr));
    gap: 0.65rem;
    padding: 0.85rem;
  }

  .app-icon {
    width: 100%;
  }

  .widgets {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    margin: 0 0.85rem 4.7rem;
  }

  .os-window,
  .os-window.maximised {
    position: fixed;
    inset: 34px 0 48px 0;
    z-index: 120 !important;
    width: auto;
    height: auto;
    border-radius: 0;
  }

  .os-window__resize {
    display: none;
  }

  .taskbar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .taskbar__windows {
    flex: 0 0 auto;
  }

  .boot-identity {
    width: 100vw;
    min-height: 100vh;
    border: 0;
  }

  .identity-grid {
    display: grid;
    gap: 1rem;
    min-height: auto;
    margin: 2rem 0;
  }

  .identity-grid span,
  .word-e {
    position: static;
    width: auto;
    text-align: left;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #111111;
    --muted: #333333;
    --line: #d2d2d2;
    --accent: #111111;
    --panel-solid: #ffffff;
  }

  body {
    background: #ffffff;
  }

  .document-page {
    padding: 0;
    background: #ffffff;
  }

  .document-hero nav,
  .content-cta {
    display: none;
  }

  .document-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .content-card {
    border-color: #d2d2d2;
  }
}
