@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Manrope:wght@300;400;500;600&display=swap");

:root {
  color-scheme: dark;
  --ink: #e2dfd4;
  --muted: #8c8c82;
  --accent: #c66835;
  --line: rgba(226, 223, 212, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #111411;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 540px;
  isolation: isolate;
  background: #171b18;
}

.game-nav {
  position: absolute;
  z-index: 7;
  top: 22px;
  left: 50%;
  display: flex;
  gap: 8px;
  align-items: center;
  transform: translateX(-50%);
}

.game-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(17, 20, 17, 0.52);
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.game-nav-link:hover,
.game-nav-link:focus-visible {
  color: var(--ink);
  border-color: rgba(226, 223, 212, 0.4);
}

.game-nav-button {
  cursor: pointer;
}

.game-nav-button.hidden {
  display: none;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 32px 42px;
  pointer-events: none;
}

.eyebrow,
.stat-label,
.footer,
.hint,
.final-label {
  font-family: "DM Mono", monospace;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand h1 {
  margin: 4px 0 0;
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 300;
  letter-spacing: 0.25em;
}

.stats {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

.stat {
  display: grid;
  gap: 4px;
  min-width: 68px;
}

.stat strong {
  font-family: "DM Mono", monospace;
  font-size: 19px;
  font-weight: 300;
  letter-spacing: 0.05em;
}

.season-stat {
  width: min(21vw, 210px);
  gap: 6px;
}

.season-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.season-heading strong {
  color: #d8a06a;
}

.season-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.season-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--ink);
  transform-origin: left;
  transition: transform 0.2s linear;
}

.season-phase {
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-align: right;
  text-transform: uppercase;
}

.overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 90px 24px 64px;
  overflow-y: auto;
  background: rgba(12, 15, 13, 0.3);
  backdrop-filter: blur(3px);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel {
  width: min(620px, 100%);
  text-align: center;
}

.panel h2 {
  margin: 10px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.panel > p:not(.hint):not(.final-label):not(.verdict) {
  max-width: 440px;
  margin: 0 auto;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.7;
  color: #aaa99f;
}

.tree-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 32px 0 18px;
}

.tree-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 5px;
  min-height: 128px;
  padding: 20px 10px 14px;
  border: 1px solid var(--line);
  background: rgba(31, 35, 31, 0.72);
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease,
    transform 0.25s ease;
}

.tree-card:hover {
  transform: translateY(-2px);
  border-color: rgba(226, 223, 212, 0.4);
}

.tree-card.active {
  border-color: var(--accent);
  background: rgba(82, 50, 30, 0.3);
}

.tree-card strong {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 500;
}

.tree-card small {
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.leaf-icon {
  display: block;
  width: 28px;
  height: 40px;
  background: #a9572e;
  clip-path: polygon(50% 0, 66% 21%, 92% 17%, 78% 42%, 100% 58%, 70% 65%, 61% 100%, 48% 70%, 17% 87%, 25% 58%, 0 44%, 31% 32%);
  transform: rotate(12deg);
}

.beech-icon {
  width: 24px;
  height: 39px;
  border-radius: 75% 20% 75% 20%;
  background: #c08a43;
  clip-path: none;
  transform: rotate(36deg);
}

.pine-icon {
  width: 7px;
  height: 44px;
  border-radius: 100%;
  background: #68724d;
  clip-path: none;
  transform: rotate(-14deg);
}

.maple-icon {
  width: 35px;
  height: 39px;
  background: #b9542e;
  clip-path: polygon(50% 0, 60% 23%, 76% 11%, 73% 35%, 100% 31%, 82% 52%, 96% 66%, 65% 65%, 58% 100%, 45% 70%, 17% 84%, 25% 58%, 0 47%, 30% 35%);
  transform: rotate(-7deg);
}

.birch-icon {
  width: 22px;
  height: 35px;
  border-radius: 50% 50% 50% 12%;
  background: #d1a34d;
  clip-path: none;
  transform: rotate(42deg);
}

.primary-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border: 1px solid rgba(226, 223, 212, 0.65);
  background: rgba(226, 223, 212, 0.92);
  color: #171a17;
  font-family: "DM Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}

.primary-button:hover {
  color: var(--ink);
  background: transparent;
}

.secondary-button {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  color: var(--ink);
  border-color: rgba(226, 223, 212, 0.4);
}

.hint {
  margin-top: 14px;
}

.end-panel {
  max-width: 500px;
}

.final-label {
  margin: 18px 0 0;
}

.final-score {
  display: block;
  margin: 0;
  font-family: "DM Mono", monospace;
  font-size: 58px;
  font-weight: 300;
  color: #c87a43;
}

.verdict {
  min-height: 24px;
  margin: 0 0 14px;
  color: #aaa99f;
  font-size: 13px;
}

.score-form {
  margin-bottom: 14px;
  text-align: left;
}

.score-form label,
.ranking-heading {
  font-family: "DM Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
}

.name-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  margin-top: 6px;
}

.name-entry input,
.name-entry button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  font-family: "DM Mono", monospace;
}

.name-entry input {
  min-width: 0;
  padding: 0 13px;
  outline: none;
  background: rgba(13, 16, 14, 0.72);
  color: var(--ink);
  text-transform: uppercase;
}

.name-entry input:focus {
  border-color: var(--accent);
}

.name-entry button {
  padding: 0 18px;
  background: var(--ink);
  color: #171a17;
  cursor: pointer;
  text-transform: uppercase;
}

.score-form.saved {
  opacity: 0.52;
  pointer-events: none;
}

.ranking {
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.ranking-heading,
.ranking li {
  display: grid;
  grid-template-columns: 48px 1fr 70px;
  align-items: center;
}

.ranking-heading {
  padding: 8px 10px 5px;
}

.ranking-heading span:last-child,
.ranking li span:last-child {
  text-align: right;
}

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

.ranking li {
  min-height: 28px;
  padding: 0 10px;
  border-top: 1px solid rgba(226, 223, 212, 0.08);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  color: #b9b6aa;
}

.ranking li.current {
  color: #d8a06a;
}

.ranking-player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.rank-leaf {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 15px;
  background: #a9572e;
  transform: rotate(18deg);
}

.rank-leaf-oak {
  clip-path: polygon(50% 0, 66% 21%, 92% 17%, 78% 42%, 100% 58%, 70% 65%, 61% 100%, 48% 70%, 17% 87%, 25% 58%, 0 44%, 31% 32%);
}

.rank-leaf-beech {
  border-radius: 75% 20% 75% 20%;
  background: #c08a43;
  transform: rotate(36deg);
}

.rank-leaf-pine {
  width: 3px;
  height: 17px;
  border-radius: 100%;
  background: #68724d;
  transform: rotate(-14deg);
}

.rank-leaf-maple {
  width: 13px;
  height: 15px;
  background: #b9542e;
  clip-path: polygon(50% 0, 60% 23%, 76% 11%, 73% 35%, 100% 31%, 82% 52%, 96% 66%, 65% 65%, 58% 100%, 45% 70%, 17% 84%, 25% 58%, 0 47%, 30% 35%);
  transform: rotate(-7deg);
}

.rank-leaf-birch {
  width: 9px;
  height: 14px;
  border-radius: 50% 50% 50% 12%;
  background: #d1a34d;
  transform: rotate(42deg);
}

.ranking li.empty-rank {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
}

.footer {
  position: absolute;
  z-index: 4;
  left: 0;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 42px;
  pointer-events: none;
}

.sound-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  pointer-events: auto;
  cursor: pointer;
}

.sound-bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 10px;
}

.sound-bars i {
  display: block;
  width: 1px;
  height: 5px;
  background: currentColor;
  animation: sound 0.8s ease-in-out infinite alternate;
}

.sound-bars i:nth-child(2) {
  height: 9px;
  animation-delay: -0.4s;
}

.sound-bars i:nth-child(3) {
  height: 3px;
  animation-delay: -0.2s;
}

.sound-button.muted .sound-bars i {
  height: 1px;
  animation: none;
}

@keyframes sound {
  to {
    transform: scaleY(0.35);
  }
}

@media (max-width: 700px) {
  .game-nav {
    top: 18px;
  }

  .game-nav-link {
    padding-inline: 9px;
    font-size: 8px;
  }

  .hud {
    padding: 20px;
  }

  .stats {
    gap: 14px;
  }

  .season-stat {
    position: absolute;
    top: 76px;
    left: 20px;
    width: calc(100vw - 40px);
  }

  .footer {
    padding: 18px 20px;
  }

  .tree-picker {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 24px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 3px;
  }

  .tree-card {
    min-height: 104px;
    padding-inline: 4px;
  }

  .overlay {
    padding-top: 76px;
  }

  .end-panel h2 {
    font-size: 38px;
  }

  .final-score {
    font-size: 46px;
  }
}

@media (max-width: 420px) {
  .game-nav {
    top: auto;
    bottom: 54px;
    left: auto;
    right: 20px;
    transform: none;
  }

  .game-nav-link:first-child {
    display: none;
  }

}
