/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Add accessible line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

button {
  border: none;
}

button:hover {
  cursor: pointer;
}

ul {
  padding: 0;
}

li {
  list-style: none;
}

a,
a:visited {
  text-decoration: none;
}

/* Main Page Title (e.g., "Overview", "Settings") */

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* Card/Widget Titles */

h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

/* Section subsections / Key Data Metrics */

h3 {
  font-size: 1rem;
  font-weight: 600;
}

/* Column Headers (often Uppercase + Bold) */

h4 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

/* Standard data tables, logs, standard text */

p,
li,
input,
table {
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Meta text, timestamps, footnotes */

small,
caption {
  font-size: 0.75rem;
}

:root {
  /* Base neutrals (already have these) */
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;
  --stone-950: #0c0a09;

  /* Background / surfaces (light theme) */
  --bg-body: var(--stone-100);
  --bg-surface: var(--stone-50); /* cards, panels */
  --bg-subtle: var(--stone-200); /* subtle section backgrounds */

  /* Borders */
  --border-subtle: var(--stone-200);
  --border-strong: var(--stone-300);

  /* Text */
  --text-primary: var(--stone-900);
  --text-secondary: var(--stone-600);
  --text-muted: var(--stone-500);

  --text-link: var(--text-primary);

  /* Interactive (outline / focus / active) */
  --outline: var(--stone-400); /* focus rings */
  --button-bg: var(--stone-900); /* primary button */
  --button-bg-hover: var(--stone-800);
  --button-text: var(--stone-50);
  --button-border: var(--stone-800);
  --radius-sm: 0.25rem;
  --sidebar-active-bg: var(--stone-900);
  --sidebar-active-text: var(--stone-50);

  /* Subtle button / chips */
  --chip-bg: var(--stone-200);
  --chip-text: var(--stone-800);
}

[data-theme="dark"] {
  --bg-body: #090909;
  --bg-surface: #101010;
  --bg-subtle: var(--stone-800);

  --border-subtle: var(--stone-800);
  --border-strong: var(--stone-700);

  --text-primary: var(--stone-50);
  --text-secondary: var(--stone-300);
  --text-muted: var(--stone-400);

  --text-link: var(--text-primary);

  --outline: var(--stone-500);
  --button-bg: var(--stone-50);
  --button-bg-hover: var(--stone-200);
  --button-text: var(--stone-900);
  --button-border: var(--stone-200);
  --radius-sm: 0.25rem;
  --sidebar-active-bg: var(--stone-800);
  --sidebar-active-text: var(--stone-50);

  --chip-bg: var(--stone-800);
  --chip-text: var(--stone-50);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg-body: #090909;
    --bg-surface: #101010;
    --bg-subtle: var(--stone-800);

    --border-subtle: var(--stone-800);
    --border-strong: var(--stone-700);

    --text-primary: var(--stone-50);
    --text-secondary: var(--stone-300);
    --text-muted: var(--stone-400);

    --outline: var(--stone-500);
    --button-bg: var(--stone-50);
    --button-bg-hover: var(--stone-200);
    --button-text: var(--stone-900);
    --button-border: var(--stone-200);
    --radius-sm: 0.25rem;
    --sidebar-active-bg: var(--stone-800);
    --sidebar-active-text: var(--stone-50);

    --chip-bg: var(--stone-800);
    --chip-text: var(--stone-50);
  }
}

[data-theme="dark"] .sidebar img:not([src*="logo_light.png"]),
[data-theme="dark"] .header img,
[data-theme="dark"] .project-actions img,
[data-theme="dark"] .trending img {
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .sidebar img:not([src*="logo_light.png"]),
  :root:not([data-theme]) .header img,
  :root:not([data-theme]) .project-actions img,
  :root:not([data-theme]) .trending img {
    filter: invert(1);
  }
}

[data-theme="light"] img[src*="logo_light.png"] {
  filter: invert(1);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) img[src*="logo_light.png"] {
    filter: invert(1);
  }
}

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

html {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

body {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  padding: 1.5rem;
}

.app {
  max-width: 32.5rem;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.controls {
  display: grid;
  gap: 0.5rem;

  label {
    display: grid;
    gap: 0.25rem;
  }

  input {
    padding: 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-body);
    color: inherit;
  }

  button {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 0.25rem;
    font-weight: 600;
    cursor: pointer;
  }
}

.status {
  min-height: 1.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-body);
  border-radius: 0.25rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.cell {
  height: 7.5rem;
  border-radius: 0.25rem;
  background: var(--bg-body);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  display: grid;
  place-items: center;
  font-size: 3rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.cell.disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
