:root {
  --navy: #071018;
  --ink: #e7eef6;
  --muted: #93a4b8;
  --line: rgba(186, 214, 232, 0.16);
  --line-strong: rgba(186, 214, 232, 0.38);
  --gold: #e4d2a8;
  --glow: rgba(120, 190, 210, 0.22);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  font-family: ui-sans-serif, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 3px;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 520px at 50% 118%, rgba(196, 156, 108, 0.16), transparent 62%),
    radial-gradient(880px 460px at 78% -8%, rgba(120, 180, 206, 0.18), transparent 56%),
    radial-gradient(640px 380px at 8% -4%, rgba(90, 140, 170, 0.12), transparent 52%),
    var(--navy);
  overflow: hidden;
}

.sky::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(520px 280px at 62% 18%, rgba(160, 206, 220, 0.09), transparent 70%);
}

.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 0;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 196, 214, 0.16), transparent 68%);
  pointer-events: none;
  mix-blend-mode: screen;
}

body.is-sky-painter .window {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0;
}

body.is-sky-painter .body {
  padding: 0;
}

body.is-sky-painter .play,
body.is-sky-painter .mount {
  min-height: 0;
}

.sky-painter {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.sky-calibrate {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 16, 28, 0.72);
  color: var(--ink);
  padding: 6px 12px;
}

.sky-calibrate:hover {
  border-color: var(--line-strong);
}

.window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(1040px, calc(100% - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 32, 48, 0.94), rgba(8, 16, 28, 0.96));
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.titlebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(120, 180, 206, 0.08), rgba(228, 210, 168, 0.05) 70%, transparent);
}

.titlebar-start {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  min-width: 0;
}

.mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f3f7fb, #8eb8c8 45%, #1a3a4a 78%);
  box-shadow: 0 0 12px var(--glow);
  flex: none;
}

h1 {
  margin: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#board-toggle {
  justify-self: end;
}

.ghost {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 6px 12px;
  color: var(--ink);
  transition:
    border-color 480ms var(--ease),
    box-shadow 480ms var(--ease),
    background 480ms var(--ease);
}

.ghost:hover {
  border-color: var(--line-strong);
  background: rgba(140, 196, 214, 0.06);
  box-shadow: 0 0 18px rgba(120, 190, 210, 0.12);
}

.body {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0;
}

.tile {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 156px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 22, 34, 0.55);
  color: inherit;
  text-align: left;
  transition:
    transform 520ms var(--ease),
    border-color 520ms var(--ease),
    box-shadow 520ms var(--ease);
}

.tile:hover {
  border-color: var(--line-strong);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.18),
    0 0 24px rgba(120, 190, 210, 0.1);
  transform: translateY(-3px);
}

.tile-mark {
  width: 32px;
  height: 32px;
  color: #b7d5e2;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-name {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.play,
.mount {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.quiet-stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  min-height: 100%;
  padding: 12px 8px 8px;
}

.quiet-stage h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.quiet-stage p {
  max-width: 38rem;
  margin: 0;
  color: var(--muted);
}

.board {
  position: absolute;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: min(280px, calc(100% - 20px));
  padding: 14px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 16, 28, 0.9);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
  transform: translateX(calc(100% + 24px));
  visibility: hidden;
  transition:
    transform 560ms var(--ease),
    visibility 0s linear 560ms;
}

.board.is-open {
  transform: translateX(0);
  visibility: visible;
  transition:
    transform 560ms var(--ease),
    visibility 0s;
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.board h2,
.board h3 {
  margin: 0;
  font-weight: 500;
}

.board h2 {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.board h3 {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.board-lists {
  overflow: auto;
}

.board-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.board ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.board li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(186, 214, 232, 0.1);
  font-size: 0.88rem;
}

.board li span:last-child {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.noscript {
  position: relative;
  z-index: 1;
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  color: var(--muted);
}

@media (max-width: 720px) {
  .window {
    width: min(1040px, calc(100% - 16px));
    height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 14px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .tile {
    min-height: 96px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
  }

  h1 {
    font-size: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .ghost,
  .board {
    transition: none;
  }

  .tile:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .sky::after {
    animation: floaty 36s var(--ease) infinite alternate;
  }
}

@keyframes floaty {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(-2%, 1.5%, 0);
  }
}
