/* Shared look for the playground apps: same tokens as the portfolio */
:root {
  --bg: #0c0d10;
  --bg-2: #101116;
  --card: #121318;
  --card-hi: #181a21;
  --line: #23252e;
  --text: #f1f2f6;
  --muted: #a3a8b8;
  --accent: #8b9bff;
  --on-accent: #0c0d10;
  --ok: #34d399;
  --bad: #f87171;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #fbfbfa;
  --bg-2: #ffffff;
  --card: #ffffff;
  --card-hi: #f3f3f1;
  --line: #e4e4e0;
  --text: #15161a;
  --muted: #525766;
  --accent: #3b3fcf;
  --on-accent: #ffffff;
  --ok: #047857;
  --bad: #b91c1c;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* top bar */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, calc((100% - 1040px) / 2));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.appbar .back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s, border-color 0.2s;
}
.appbar .back:hover {
  color: var(--text);
  border-color: var(--accent);
}
.appbar .app-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.2s;
}
.icon-btn:hover {
  border-color: var(--accent);
}
.theme-btn .i-sun {
  display: none;
}
[data-theme="light"] .theme-btn .i-sun {
  display: block;
}
[data-theme="light"] .theme-btn .i-moon {
  display: none;
}

/* controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 500;
  transition: border-color 0.2s, filter 0.2s, background 0.2s;
}
.btn:hover {
  border-color: var(--accent);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.segmented button {
  padding: 7px 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.segmented button:hover {
  color: var(--text);
}
.segmented button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 640px) {
  .appbar .back {
    min-height: 44px;
    padding: 10px 14px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
  .btn {
    min-height: 46px;
  }
  .segmented button {
    min-height: 44px;
    padding-inline: 18px;
  }
}
