html, body {
  height: 100vh;
  margin: 0;
  touch-action: none;
}

:root {
  --bg: #11111b;
  --window-bg: #1e1e2e;
  --accent: #cba6f7;
  --accent-text: #181825;
  --font: 'JetBrains Mono', monospace;
  --btn-padding: 8px 16px;
  --link-padding: 8px 12px;
}

/* use border-box everywhere to simplify sizing calculations */
*, *::before, *::after { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  font-family: var(--font);
}

.window {
  background: var(--window-bg);
  border: solid 2px var(--accent);
  color: var(--accent);
  margin: 16px;
  padding: 24px 16px;
}

.main {
  margin-bottom: 0px;
  margin-top: 0px;
}

nav.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px;
}

nav.navbar ul {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}

nav.navbar li { display: flex; }

nav.navbar button,
#links a {
  margin: 0;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  font-family: var(--font);
  text-decoration: none;
}

nav.navbar button {
  padding: var(--btn-padding);
  font-size: 14px;
}

#links a {
  padding: var(--link-padding);
  display: inline-block;
}

nav.navbar button.active,
#links a.active {
  background: var(--accent);
  color: var(--accent-text);
}

main {
  flex: 1;
  min-height: 0;
}

footer.window {
  text-align: center;
  padding: 12px 16px;
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

h1 {
  margin-top: 0;
}

section {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  height: 0;
  overflow: hidden;
}

section[data-active="true"] {
  opacity: 1;
  pointer-events: auto;
  height: auto;
}

#links ul {
  list-style: none;
  margin: 12px 0 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  align-items: start;
  justify-content: start;
}

#links ul li {
  width: 100%;
}

#links a {
  box-sizing: border-box;
  width: auto;
}

#links a:hover,
#links a:focus {
  background: #cba6f7;
  color: #181825;
  outline: none;
}

#links a:active {
  transform: translateY(1px);
}

/* Mobile styles (overrides) */
@media (max-width: 600px) {
  body {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  .window {
    margin: 8px;
    padding: 16px 12px;
  }
  
  nav.navbar {
    padding: 4px;
  }
  
  nav.navbar ul {
    gap: 4px;
  }
  
  nav.navbar button {
    padding: 6px 12px;
    font-size: 13px;
  }

  .nav-num {
    display: none;
  }

  h1 {
    font-size: 1.5rem;
  }
  
  p {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  #links a {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
  }

  #links ul {
    grid-template-columns: 1fr;
  }

  .mobilehidden {
    display: none;
  }
}
