/* Styles for the ten live demos. Kept separate from the site stylesheet
   because none of this is needed on any other page. */

.demo {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 2.5rem;
  background: var(--surface);
}

.demo-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.demo-num {
  flex: 0 0 auto;
  width: 2rem; height: 2rem; line-height: 2rem;
  text-align: center; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: .95rem;
}

@media (prefers-color-scheme: dark) { .demo-num { color: #14201a; } }

.demo-head h2 {
  margin: 0; border: 0; padding: 0;
  font-size: 1.15rem; letter-spacing: -0.01em;
}

/* The live area */
.stage {
  padding: 1.5rem 1.2rem;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 10px,
      rgba(128,128,128,.045) 10px 20px);
  overflow: hidden;
}

.stage canvas { max-width: 100%; display: block; border-radius: 10px; }

/* The explanation underneath */
.build {
  padding: 1.1rem 1.2rem 1.3rem;
  border-top: 1px solid var(--line);
  font-size: .95rem;
}

.build h3 {
  margin: 0 0 .7rem;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent);
}

.build p { margin: 0 0 .8rem; }
.build > :last-child { margin-bottom: 0; }

.facts {
  display: flex; flex-wrap: wrap; gap: .45rem;
  margin: 0 0 .9rem;
}

.fact {
  font-size: .76rem; font-weight: 650;
  padding: .28rem .6rem; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  white-space: nowrap;
}

.fact.easy   { background: #dff2e5; color: #226b38; }
.fact.medium { background: #fdf3d8; color: #8a5f10; }

@media (prefers-color-scheme: dark) {
  .fact.easy   { background: #1a2c21; color: #7cc898; }
  .fact.medium { background: #332a16; color: #e3b65c; }
}

.fact.hard { background: #fbe3e0; color: #97372a; }

@media (prefers-color-scheme: dark) {
  .fact.hard { background: #331e1b; color: #f0998c; }
}

/* ---- Level index cards ---- */

.levels { display: grid; gap: .9rem; margin: 2rem 0; }

.level {
  display: flex; align-items: center; gap: 1rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.level:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.09); border-color: var(--accent); }

.level-badge {
  flex: 0 0 auto;
  width: 3rem; height: 3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: 1.2rem;
}

@media (prefers-color-scheme: dark) { .level-badge { color: #14201a; } }

.level-body h3 { margin: 0 0 .2rem; font-size: 1.02rem; }
.level-body p  { margin: 0; font-size: .9rem; color: var(--muted); }

.level.locked { opacity: .45; pointer-events: none; }
.level.locked .level-badge { background: var(--line); color: var(--muted); }

/* ---- Level tabs ---- */

.tabs {
  display: flex;
  gap: .4rem;
  overflow-x: auto;
  padding: .3rem .3rem .7rem;
  margin: 0 0 1.8rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  min-width: 2.6rem;
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: .35rem;
  padding: 0 .75rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700; font-size: .92rem;
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover { border-color: var(--accent); color: var(--accent); }

.tab.current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (prefers-color-scheme: dark) { .tab.current { color: #14201a; } }

.tab.locked { opacity: .35; pointer-events: none; }

.tab-all { font-size: .82rem; font-weight: 650; }

@media (pointer: coarse) {
  .tab { min-height: 2.9rem; }
}
