:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --border: #e6e6e6;
  --border-strong: #d4d4d4;
  --surface: #ffffff;
  --surface-alt: #f6f6f6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .08), 0 2px 6px rgba(0, 0, 0, .04);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .14), 0 6px 16px rgba(0, 0, 0, .06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --transition: 180ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--fg);
  text-decoration: none;
}
.logo::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform var(--transition);
}
.logo:hover::before { transform: scale(1.4); }

.nav { display: flex; gap: 4px; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--fg); background: var(--surface-alt); }
.nav-link.active { color: var(--fg); background: var(--surface-alt); }

.hero {
  padding: 48px 0 8px;
  animation: fadeInUp .6s ease both;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  letter-spacing: -.03em;
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(180deg, #0a0a0a 0%, #555 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
  font-size: 16px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 22px 0 14px;
  animation: fadeInUp .6s .05s ease both;
}
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--fg);
  background: var(--fg);
  color: #fff;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition),
              color var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-1px); background: #1a1a1a; }
.btn:active { transform: translateY(0); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-alt); }

.desktop {
  position: relative;
  min-height: 70vh;
  padding: 4px 0 48px;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
  animation: fadeInUp .5s ease both;
}

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  color: var(--fg);
  text-align: center;
  transition: background var(--transition), transform var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}
.app-icon:hover {
  background: var(--surface-alt);
  border-color: var(--border);
  transform: translateY(-2px);
}
.app-icon:active { transform: translateY(0); }
.app-icon.is-open {
  border-color: var(--fg);
  background: var(--surface-alt);
  box-shadow: var(--shadow-sm);
}

.app-icon-img,
.app-icon-fallback {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  flex: 0 0 auto;
  object-fit: cover;
  background: var(--surface-alt);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.app-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fg);
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.app-icon-name {
  font-size: 13px;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.app-grid .state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
  font-size: 15px;
}
.app-grid .state.error { color: #b42318; }
.app-grid .state .loading-spin {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--fg);
  animation: spin .8s linear infinite;
}

.windows-layer {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}
.windows-layer .window { pointer-events: auto; }

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: windowIn .35s cubic-bezier(.2, .8, .2, 1) both;
  transition: box-shadow var(--transition);
  will-change: left, top, width, height;
}
.window:hover { box-shadow: var(--shadow-lg); }
.window.is-dragging,
.window.is-resizing {
  transition: none;
  box-shadow: var(--shadow-lg);
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 40px;
  padding: 0 8px 0 14px;
  background: var(--fg);
  color: #fff;
  cursor: grab;
  user-select: none;
  flex: 0 0 auto;
  touch-action: none;
}
.window.is-dragging .window-titlebar { cursor: grabbing; }

.window-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.window-title > span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.window-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #2a2a2a;
}

.window-controls { display: flex; gap: 4px; flex: 0 0 auto; }
.win-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #ddd;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.win-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.win-close:hover { background: #e5484d; color: #fff; }

.window-body {
  flex: 1 1 auto;
  position: relative;
  background: #fff;
  min-height: 0;
  overflow: hidden;
}
.window-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.window-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 2;
  background:
    linear-gradient(135deg, transparent 0 50%,
      var(--border-strong) 50% 60%, transparent 60% 70%,
      var(--border-strong) 70% 80%, transparent 80%);
}

.page {
  padding: 64px 0;
  animation: fadeInUp .6s ease both;
}
.page h1 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.03em;
  margin: 0;
}

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  max-width: 760px;
  margin: 0 auto;
  background: var(--fg);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 16px 20px;
  animation: fadeInUp .4s ease both;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.cookie-banner p {
  flex: 1 1 260px;
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #e5e5e5;
}
.cookie-banner a {
  color: #fff;
  text-decoration: underline;
}
.cookie-banner .btn {
  background: #fff;
  color: var(--fg);
  border-color: #fff;
  flex: 0 0 auto;
}
.cookie-banner .btn:hover { background: #e5e5e5; color: var(--fg); }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes windowIn {
  from { opacity: 0; transform: scale(.98); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}