/* ============================================================
   style.css — theme variables, base styles, taskbar, start menu
   ============================================================ */

/* ---------- Theme variables ---------- */

:root {
  --bg: #dde6f2;
  --bg-glow: rgba(255, 255, 255, 0.55);
  --window-bg: #f5f8fc;
  --body-bg: #ffffff;
  --text: #1d2733;
  --text-muted: #56637a;
  --accent: #2456c4;
  --accent-strong: #1a44a6;
  --link: #2456c4;
  --border: #b7c4d8;
  --border-strong: #8ba3c7;
  --chip-bg: #e6edf8;
  --chip-border: #c3d2ea;
  --shadow: rgba(23, 52, 102, 0.16);
  --shadow-strong: rgba(23, 52, 102, 0.28);
  --titlebar-from: #3165cc;
  --titlebar-to: #5a96e6;
  --titlebar-text: #ffffff;
  --taskbar-bg: linear-gradient(180deg, #3d74d6 0%, #2a5cc0 55%, #2252ae 100%);
  --taskbar-text: #eef3ff;
  --menu-bg: #f4f7fc;
  --focus-ring: #e58a00;
  --radius: 8px;
  --taskbar-h: 48px;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

[data-theme="dark"] {
  --bg: #0c1016;
  --bg-glow: rgba(90, 130, 200, 0.07);
  --window-bg: #151b25;
  --body-bg: #1a212d;
  --text: #dde3ec;
  --text-muted: #8b96a8;
  --accent: #6aa2f0;
  --accent-strong: #8bb8f7;
  --link: #7db0f5;
  --border: #2c3648;
  --border-strong: #3e4c66;
  --chip-bg: #202b3d;
  --chip-border: #364a68;
  --shadow: rgba(0, 0, 0, 0.45);
  --shadow-strong: rgba(0, 0, 0, 0.6);
  --titlebar-from: #1d3f73;
  --titlebar-to: #2c5ea3;
  --titlebar-text: #e6edfb;
  --taskbar-bg: linear-gradient(180deg, #1b2330 0%, #12181f 100%);
  --taskbar-text: #c9d4e6;
  --menu-bg: #151c27;
  --focus-ring: #f0a93e;
}

/* ---------- Reset & base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding-bottom: var(--taskbar-h);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(1000px 480px at 50% -10%, var(--bg-glow), transparent 65%);
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, p, ul, blockquote {
  margin-top: 0;
}

img, svg {
  max-width: 100%;
}

a {
  color: var(--link);
}

a:hover {
  color: var(--accent-strong);
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 4px;
  padding: 1px 5px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] ::selection {
  color: #0c1016;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: fixed;
  top: -48px;
  left: 12px;
  z-index: 200;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Desktop layout ---------- */

.desktop {
  max-width: 880px;
  margin: 0 auto;
  padding: 52px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.site-footer {
  margin: 6px 0 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.noscript-note {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Buttons & chips ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  background: var(--body-bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--border), 0 2px 4px var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--titlebar-to), var(--titlebar-from));
  border-color: var(--titlebar-from);
}

.btn-primary:hover {
  color: #fff;
  border-color: var(--titlebar-from);
  filter: brightness(1.07);
}

.btn .icon {
  flex: none;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 3px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  color: var(--text);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 999px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.text-link:hover {
  border-bottom-color: currentColor;
}

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

.taskbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--taskbar-h);
  padding: 6px 10px;
  background: var(--taskbar-bg);
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .taskbar {
  border-top-color: var(--border-strong);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.4);
}

.start-btn {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 10px;
  font-family: inherit;
  font-size: 14px;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  cursor: pointer;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
  background: linear-gradient(180deg, #4cb85f 0%, #2f9e44 55%, #26873a 100%);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: filter 0.12s ease;
}

.start-btn:hover {
  filter: brightness(1.07);
}

.start-btn:active,
.start-btn.open {
  filter: brightness(0.93);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.start-btn .flag {
  display: inline-flex;
}

.task-links {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.task-links::-webkit-scrollbar {
  display: none;
}

.task-link {
  flex: none;
  height: 36px;
  padding: 0 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--taskbar-text);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.task-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

.task-link.active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.taskbar-tray {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] .taskbar-tray {
  border-left-color: var(--border-strong);
}

.tray-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--taskbar-text);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  transition: background-color 0.12s ease;
}

.tray-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.clock {
  min-width: 62px;
  padding: 0 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
  color: var(--taskbar-text);
}

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

.start-menu {
  position: fixed;
  bottom: calc(var(--taskbar-h) + 8px);
  left: 10px;
  z-index: 99;
  width: 254px;
  overflow: hidden;
  background: var(--menu-bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px var(--shadow-strong);
}

.start-menu:not([hidden]) {
  animation: menu-pop 0.14s ease-out;
}

@keyframes menu-pop {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.start-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: var(--titlebar-text);
  background: linear-gradient(90deg, var(--titlebar-from), var(--titlebar-to));
}

.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 13px;
  font-weight: 700;
  color: var(--titlebar-text);
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
}

.menu-id {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.menu-name {
  font-size: 13.5px;
  font-weight: 700;
}

.menu-sub {
  font-size: 11px;
  opacity: 0.8;
}

.start-list {
  margin: 6px;
  padding: 0;
  list-style: none;
}

.start-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 13.5px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.start-item:hover {
  color: #fff;
  background: var(--accent);
}

[data-theme="dark"] .start-item:hover {
  color: #0c1016;
}

.start-item svg {
  flex: none;
  opacity: 0.85;
}

.start-menu-footer {
  padding: 6px;
  border-top: 1px solid var(--border);
}

#restore-all {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ---------- Error state (shown only if data.json fails to load) ---------- */

.code-block {
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 6px;
}

.error-detail {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #b3261e;
}

[data-theme="dark"] .error-detail {
  color: #f0968e;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}