.page-pop {
  user-select: none;
}

.pop-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
  padding-top: clamp(1.75rem, 4vw, 2.75rem);
  padding-bottom: 3rem;
  min-height: calc(100svh - 4.5rem);
}

.neo {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.42));
  border: 1px solid rgba(63, 122, 85, 0.11);
  border-radius: 1.45rem;
  padding: 1.35rem 1.4rem;
  box-shadow: 0 14px 44px rgba(44, 90, 61, 0.07);
}

.pop-rank {
  position: sticky;
  top: 5rem;
  max-height: calc(100svh - 6rem);
  display: flex;
  flex-direction: column;
}

.pop-rank h2 {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--moss);
  letter-spacing: -0.02em;
}

.pop-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 1.05rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(63, 122, 85, 0.12);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.pop-total strong {
  color: var(--moss);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.55rem);
  font-variant-numeric: tabular-nums;
}

.pop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(480px, calc(100svh - 16rem));
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(63, 122, 85, 0.35) transparent;
}

.pop-list li {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.58rem 0.45rem;
  border-radius: 0.7rem;
  transition: background 0.15s ease;
}

.pop-list li:nth-child(odd) {
  background: rgba(63, 122, 85, 0.05);
}

.pop-list li:hover {
  background: rgba(63, 122, 85, 0.1);
}

.rank-num {
  width: 1.4rem;
  color: var(--leaf);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank-id {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-pops {
  color: var(--moss);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pop-hint {
  margin: 0.9rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.pop-hint.subtle {
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.pop-stage {
  display: grid;
  place-items: center;
  min-height: min(70vh, 640px);
  align-self: stretch;
}

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

.pop-panel.neo {
  padding: 1.75rem 1.65rem 1.85rem;
}

.pop-kicker {
  margin: 0 0 0.4rem;
  color: var(--leaf);
  font-size: 0.86rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.pop-panel h1 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 5vw, 3.25rem);
  color: var(--moss);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.pop-lead,
.pop-label {
  color: var(--ink-soft);
}

.pop-lead {
  margin: 0 auto;
  max-width: 28ch;
  line-height: 1.55;
}

.pop-label {
  display: block;
  text-align: left;
  margin: 1.45rem 0 0.4rem;
  font-size: 0.92rem;
}

#user-id {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(63, 122, 85, 0.2);
  font: inherit;
  margin-bottom: 1.05rem;
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#user-id:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(143, 184, 145, 0.28);
}

#start-button {
  width: 100%;
}

.pop-you {
  margin: 0 0 0.25rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.pop-week {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.pop-week.done {
  color: var(--leaf);
  font-weight: 600;
}

.pop-score {
  margin: 0.15rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 4.5rem);
  color: #b3473a;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

#popcat-canvas {
  width: min(100%, min(380px, 72vw));
  height: auto;
  margin: 0 auto;
  cursor: pointer;
  border-radius: 1.35rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 20px 48px rgba(44, 90, 61, 0.14);
  transition: transform 0.08s ease, box-shadow 0.2s ease;
}

#popcat-canvas:hover {
  box-shadow: 0 24px 56px rgba(44, 90, 61, 0.18);
}

#popcat-canvas:active {
  transform: scale(0.98);
}

.pop-tools {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

#sound-toggle-btn.muted {
  color: #b3473a;
}

@media (min-width: 1200px) {
  .pop-layout {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .pop-stage {
    min-height: min(74vh, 720px);
  }
}

@media (max-width: 840px) {
  .pop-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .pop-rank {
    order: 2;
    position: static;
    max-height: none;
  }

  .pop-stage {
    min-height: auto;
    order: 1;
  }

  .pop-list {
    max-height: 280px;
  }
}

@media (max-width: 480px) {
  .pop-panel.neo {
    padding: 1.35rem 1.15rem 1.45rem;
  }

  #popcat-canvas {
    width: min(100%, 300px);
  }
}
