@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/noto-sans-sc-400.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans SC";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/noto-sans-sc-700.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #2c241c;
  --tile: 58px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 92% 0, #ffe38a 0 42px, transparent 44px),
    linear-gradient(#b7e6fb 0%, #e7f7c8 42%, #8ed15c 100%);
}

button { font: inherit; color: inherit; }

.sky {
  width: min(920px, 100%);
  max-width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 16px 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.top { position: relative; }

.top-links {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
}

button.jump {
  border: 0;
  cursor: pointer;
}

.jump {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.86);
  color: #315c18;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

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

.logo { width: 72px; height: 72px; flex: none; }

.eyebrow {
  margin: 0;
  color: #3d6b22;
  font-size: 13px;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1;
  letter-spacing: 0.04em;
}

.lede {
  max-width: 38em;
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.55;
}

.levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-width: 420px;
  margin-top: 14px;
}

.level, .tool, .banner button, .pile {
  border: 0;
  cursor: pointer;
}

.level {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 54px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 3px 0 rgba(70, 90, 30, 0.15);
  text-align: left;
}

.level span { font-size: 12px; color: #6a5b48; }

.level.is-on {
  background: #fffaf0;
  box-shadow: 0 3px 0 #d7a441;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
}

.tool, .banner button {
  border-radius: 999px;
  padding: 8px 14px;
  background: #fff;
  border: 2px solid #efd7a4;
  box-shadow: 0 3px 0 #c4a06a;
}

.tool:active, .banner button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c4a06a;
}

.tool b { font-weight: 700; }

.tool.is-off { opacity: 0.4; cursor: default; }

.tool-strong {
  background: #2f6f2a;
  color: #f4ffe8;
  box-shadow: 0 3px 0 #1d4d1c;
}

.status {
  margin: 0;
  flex: 1 1 180px;
  font-size: 14px;
}

.table {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 180px;
  overflow: hidden;
}

.board-fit {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  margin: 0 auto;
}

.board {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.tile {
  position: absolute;
  width: var(--tile);
  height: var(--tile);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: block;
  filter: drop-shadow(0 4px 0 rgba(40, 28, 8, 0.28));
  transform: rotate(var(--spin, 0deg));
}

.tile.is-free { cursor: pointer; }

.tile.is-covered {
  filter: drop-shadow(0 2px 0 rgba(40, 28, 8, 0.16)) saturate(0.6) brightness(0.74);
  cursor: default;
}

.tile.is-gone {
  visibility: hidden;
  pointer-events: none;
}

.mark,
.mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.banner {
  display: none;
}

.banner.is-on {
  display: block;
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 38%;
  width: min(340px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 18px 16px 14px;
  border-radius: 18px;
  background: #fffaf0;
  text-align: center;
  box-shadow: 0 12px 0 rgba(60, 40, 10, 0.12);
}

.banner.is-lost { top: 34%; }

.banner.is-chicken .banner-actions { display: none; }

#litter { position: fixed; inset: 0; z-index: 36; pointer-events: none; }

.chicken {
  display: none;
  position: fixed;
  z-index: 50;
  width: 96px;
  height: 96px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: left 0.5s cubic-bezier(0.22, 0.12, 0.36, 1), top 0.5s cubic-bezier(0.22, 0.12, 0.36, 1);
}

.chicken.is-on { display: block; }

.chicken .bird {
  position: relative;
  z-index: 2;
  width: 96px;
  height: 96px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 6px 0 rgba(40, 28, 8, 0.25));
}

.chicken.is-on .bird { animation: bob 0.18s ease-in-out infinite; }

.chicken .leg { transform-box: view-box; }

.chicken.is-on .leg-a {
  transform-origin: 26px 50px;
  animation: stride 0.16s ease-in-out infinite alternate;
}

.chicken.is-on .leg-b {
  transform-origin: 38px 50px;
  animation: stride 0.16s ease-in-out infinite alternate;
  animation-delay: -0.16s;
}

.wake {
  position: absolute;
  z-index: 1;
  left: -34px;
  top: 28px;
  width: 78px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.35) 42%, rgba(255, 255, 255, 0) 72%);
  filter: blur(2px);
  opacity: 0;
  pointer-events: none;
}

.chicken.is-on .wake { opacity: 1; animation: wake 0.36s linear infinite; }

.mist {
  position: fixed;
  z-index: 40;
  width: 64px;
  height: 64px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.72) 38%, rgba(255, 255, 255, 0) 74%);
  filter: blur(2px);
  animation: mist 0.9s ease-out forwards;
}

.poop {
  position: fixed;
  z-index: 36;
  width: 34px;
  height: 26px;
  pointer-events: none;
}

.poop svg { width: 34px; height: 26px; display: block; }

@keyframes bob {
  50% { transform: translateY(-3px); }
}

@keyframes stride {
  from { transform: rotate(-34deg); }
  to { transform: rotate(34deg); }
}

@keyframes wake {
  0% { transform: scale(0.7); opacity: 0.35; }
  50% { opacity: 0.9; }
  100% { transform: scale(1.15) translateX(-8px); opacity: 0.2; }
}

@keyframes mist {
  from { opacity: 0.95; transform: scale(0.35); }
  to { opacity: 0; transform: scale(1.9); }
}

.banner-title {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
}

.banner p { margin: 0 0 12px; }

.banner-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.banner button.ghost {
  background: transparent;
  box-shadow: none;
}

.is-hidden { display: none; }

.dock-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin-top: auto;
  padding: 18px 0 16px;
  background: linear-gradient(transparent, rgba(120, 176, 62, 0.2) 28%, #79b84a 70%);
}

.pile {
  width: 54px;
  height: 62px;
  border-radius: 12px;
  background: rgba(255, 250, 240, 0.35);
  box-shadow: inset 0 0 0 2px rgba(90, 60, 20, 0.15);
  display: grid;
  place-items: center;
  position: relative;
}

.pile.is-full {
  background: transparent;
  box-shadow: none;
}

.pile .count {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 99px;
  background: #d4543c;
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.dock {
  display: grid;
  grid-template-columns: repeat(7, 48px);
  gap: 6px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(#f6d7a0, #e4b56a);
  box-shadow: inset 0 2px 0 #fff3d2, 0 8px 0 #b07d32;
}

.slot {
  height: 56px;
  border-radius: 10px;
  background: rgba(130, 84, 32, 0.16);
  display: grid;
  place-items: center;
}

.slot.is-filled {
  background: transparent;
  box-shadow: none;
}

.slot .mark,
.pile .mark {
  width: 44px;
  height: 44px;
}

.dock.is-pop .slot.is-filled {
  animation: pop 180ms ease-out;
}

@keyframes pop {
  50% { transform: scale(1.08); }
}

@media (hover: hover) {
  .tile.is-free:hover { transform: translateY(-6px) rotate(var(--spin, 0deg)); }
}

@media (max-width: 720px) {
  .top-links {
    position: static;
    justify-content: center;
    margin-bottom: 8px;
  }
  .brand,
  .tools,
  .levels { justify-content: center; }
  .brand { width: 100%; }
  .lede,
  .levels,
  .status { margin-left: auto; margin-right: auto; text-align: center; }
  .level { align-items: center; text-align: center; }
  .tools { justify-content: center; }
  .status { flex: 1 1 100%; }
  body[data-level="mountain"] .logo { width: 48px; height: 48px; }
  body[data-level="mountain"] h1 { font-size: 32px; }
  body[data-level="mountain"] .lede { font-size: 13px; }
  body[data-level="mountain"] .tools { margin: 8px 0; }
}

@media (max-width: 520px) {
  .sky { padding: 14px 10px 0; }
  .logo { width: 56px; height: 56px; }
  .lede { font-size: 14px; }
  .dock-wrap { gap: 6px; width: 100%; }
  .dock {
    flex: 1;
    min-width: 0;
    width: auto;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
  }
  .slot { height: 46px; }
  .pile { width: 44px; height: 52px; flex: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dock.is-pop .slot.is-filled,
  .tile.is-free:hover { animation: none; transform: none; }
}
