:root {
  color-scheme: light;
  --bg: #f6f1e8;
  --ink: #1f2328;
  --muted: #626a73;
  --line: rgba(31, 35, 40, 0.14);
  --panel: rgba(255, 255, 255, 0.78);
  --accent: #2f7c72;
  --accent-strong: #1f5f57;
  --warn: #d58a2c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 210, 128, 0.34), transparent 32rem),
    linear-gradient(135deg, #f6f1e8 0%, #e9f2ef 52%, #f8e7d3 100%);
  color: var(--ink);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button,
label {
  font: inherit;
}

.app {
  width: min(1120px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

[hidden] {
  display: none !important;
}

.puzzle-view,
.tower-view,
.space-view {
  display: contents;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3.3rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.stats {
  display: flex;
  gap: 8px;
}

.stat {
  min-width: 84px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(12px);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.18rem;
  line-height: 1;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.primary,
.secondary {
  min-height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  font-weight: 900;
}

.primary {
  background: var(--ink);
  color: #fff;
}

.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
}

.secondary:disabled {
  cursor: progress;
  opacity: 0.68;
}

.status-text {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 820px) {
  .app {
    gap: 14px;
  }

  .topbar {
    align-items: start;
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
  }

  .stats {
    width: 100%;
  }

  .stat {
    flex: 1;
  }

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

  .primary,
  .secondary {
    min-height: 44px;
  }
}
