:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #666666;
  --line: #e6e6e6;
  --soft: #f6f6f6;
  --focus: #111111;
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  --bg: #0f0f0f;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --soft: #1a1a1a;
  --focus: #f2f2f2;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", "Trebuchet MS", "Segoe UI", sans-serif;
  line-height: 1.45;
  user-select: none;
}

a,
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

[role="button"] {
  cursor: pointer;
}


a {
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.siteHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.2px;
  cursor: pointer;
}

.brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 60ch;
  cursor: pointer;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.navGroup {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.navHint {
  color: var(--muted);
  font-size: 12px;
}

.btn,
.linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}

.nav .linkbtn[aria-current="page"] {
  background: var(--soft);
  border-color: var(--text);
}

.btn:hover,
.linkbtn:hover {
  background: var(--soft);
}

.btn:focus,
input:focus,
textarea:focus,
select:focus,
.bigBox:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

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

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  align-items: start;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 14px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 650;
}

.card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input,
textarea,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text);
  min-height: 36px;
  flex: 1 1 200px;
}

input,
textarea,
[contenteditable="true"] {
  user-select: text;
}

input.inputSmall {
  max-width: 140px;
}

input.inputMedium {
  max-width: 320px;
}

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.mono {
  font-family: "IBM Plex Mono", "Consolas", "Courier New", monospace;
  font-size: 12px;
}

.pageTitle {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 650;
}

.cleanList {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cleanList li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.cleanList li:last-child {
  border-bottom: none;
}

.tileGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.tile {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 16px 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.tile:hover {
  background: var(--soft);
}

.tile.done {
  background: var(--soft);
  color: var(--muted);
}

.bigBox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-align: center;
  user-select: none;
  cursor: pointer;
}

.bigBox[data-state="go"] {
  background: var(--soft);
  border-color: var(--text);
}

footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  cursor: pointer;
}

footer #year {
  cursor: pointer;
}

@media (max-width: 820px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .siteHeader {
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .tileGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Command palette */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  z-index: 50;
}

.overlay.show {
  display: flex;
}

.palette {
  width: min(640px, calc(100vw - 28px));
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.paletteTop {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.palette input {
  max-width: none;
  width: 100%;
}

.paletteList {
  max-height: 320px;
  overflow: auto;
}

.item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.item:hover {
  background: var(--soft);
}

.item small {
  color: var(--muted);
}

/* Loading screen */
.loaderOverlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: all;
  transition: opacity 200ms ease;
  z-index: 60;
}

.loaderOverlay.show {
  opacity: 1;
}

.loaderOverlay.hide {
  opacity: 0;
}

.loaderCard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  min-width: 200px;
}

.loaderTitle {
  font-weight: 650;
  font-size: 16px;
  margin-bottom: 8px;
}

.loaderLine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.loaderBar {
  width: 100%;
  height: 6px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.loaderFill {
  height: 100%;
  background: var(--text);
  opacity: 0.12;
  transform: scaleX(0);
  transform-origin: left;
}

.loaderPct {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.loaderDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--text);
  background: var(--soft);
  animation: loaderPulse 1s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

/* Toast for easter eggs */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(6px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 70;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
