:root {
  --cream: #f2f2ed;
  --ink: #262221;
  --orange: #ef603e;
  --lime: #c8ff00;
  --green: #46ad18;
  --glass: rgba(255, 255, 255, 0.76);
  --glass-border: rgba(38, 34, 33, 0.9);
  --shadow: rgba(0, 0, 0, 0.24);
  --font: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  user-select: none;
  text-rendering: geometricPrecision;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.tap-site {
  width: 100%;
  height: 100vh;
  min-height: 100svh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  background: url("assets/bg.png") 70% center / cover no-repeat;
  cursor: pointer;
  padding: 0 20px;
}

.mouth-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  height: auto;
  margin: 0 auto;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.mouth-layer img {
  width: 100%;
  height: auto;
  object-fit: contain;
  -webkit-user-drag: none;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.mouth-open {
  opacity: 0;
  visibility: hidden;
}

.tap-site.is-popping .mouth-closed {
  opacity: 0;
  visibility: hidden;
}

.tap-site.is-popping .mouth-open {
  opacity: 1;
  visibility: visible;
}

.site-header {
  width: min(1400px, 100%);
  margin: 18px auto 0;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
}

.desktop-logo,
.mobile-logo {
  align-items: center;
  font-weight: 1000;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow:
    0 2px 0 #000,
    0 4px 0 rgba(0, 0, 0, 0.52);
}

.desktop-logo {
  display: flex;
  margin-left: 20px;
}

.desktop-logo img {
  width: 104px;
  border: 3px solid #111;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.28);
}

.mobile-logo {
  display: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.glass-button,
.about-button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  color: #111;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 242, 237, 0.72));
  box-shadow:
    0 8px 0 #111,
    0 18px 36px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
  border: 3px solid var(--glass-border);
  padding: 12px 26px;
  font-size: 1.05rem;
  font-weight: 1000;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.contract-button img,
.mobile-contract img {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.38));
}

.contract-full {
  display: none;
}

.contract-button:hover .contract-full {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contract-button:hover .contract-short {
  display: none;
}

.about-button {
  border-radius: 24px;
  text-transform: uppercase;
  cursor: pointer;
}

.icon-link {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  border: 3px solid #111;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 7px 0 #111;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.icon-link svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.glass-button:hover,
.about-button:hover,
.icon-link:hover {
  transform: translateY(3px);
  box-shadow:
    0 4px 0 #111,
    0 12px 24px rgba(0, 0, 0, 0.22);
  background: linear-gradient(180deg, #ffffff, #eaff8e);
}

.desktop-logo:hover,
.mobile-logo:hover {
  opacity: 0.8;
}

.mobile-contract {
  display: none;
}

[aria-disabled="true"] {
  cursor: not-allowed;
}

.tap-zone {
  height: 100%;
  flex: 1;
  position: relative;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.title-cat {
  width: 360px;
  max-width: min(82vw, 360px);
  margin: 4px auto 70px;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 5px 0 rgba(0, 0, 0, 0.34));
}

.click-count {
  color: var(--cream);
  min-width: 3ch;
  margin-top: -72px;
  text-align: center;
  font-family: "Arial Black", Impact, Arial, Helvetica, sans-serif;
  font-size: 5.4rem;
  line-height: 1;
  font-weight: 900;
  text-shadow:
    0 2px 0 #111,
    0 4px 0 #111,
    0 8px 0 rgba(0, 0, 0, 0.62);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  -webkit-text-stroke: 2px #111;
  paint-order: stroke fill;
}

.counterAnimate {
  animation: counterAnimation 500ms ease forwards;
}

.leaderboardAnimate {
  animation: leaderboardAnimation 500ms ease forwards;
}

.score-card {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 20px;
  width: min(800px, 90%);
  transform: translateX(-50%);
  color: #111;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(236, 255, 129, 0.58));
  box-shadow:
    0 10px 0 #111,
    0 24px 50px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  border: 4px solid #fff;
  outline: 3px solid #111;
  border-radius: 10px;
  text-transform: uppercase;
}

.score-toggle {
  width: 100%;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  padding: 18px 22px;
  color: inherit;
  cursor: pointer;
  font-size: 1.38rem;
  font-weight: 1000;
  text-align: left;
  text-transform: uppercase;
}

.score-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.score-label small {
  opacity: 0.48;
  font-size: 0.72rem;
  line-height: 1.1;
  font-weight: 1000;
}

.score-right {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: #111;
  color: var(--lime);
  box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.18);
}

.score-right strong,
.leaderboard-row strong {
  font-family: "Arial Black", Impact, Arial, Helvetica, sans-serif;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.arrow {
  width: 26px;
  margin-top: -4px;
  filter: invert(1);
  transition: transform 180ms ease;
}

.score-card.is-open .arrow {
  transform: rotate(180deg);
}

.leaderboard-panel {
  border-top: 3px solid #111;
  max-height: 440px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.66);
}

.panel-title,
.leaderboard-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.16);
  padding: 14px 20px;
  font-size: 1.15rem;
  font-weight: 850;
}

.panel-title {
  text-align: center;
  font-size: 1.35rem;
  justify-content: center;
  color: #111;
}

.project-copy {
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.45;
  text-transform: none;
}

.panel-actions,
.dialog-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.panel-actions a,
.dialog-links a {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid #111;
  background: var(--lime);
  color: #111;
  box-shadow: 0 4px 0 #111;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 1000;
}

.leaderboard-row.total {
  font-size: 1.2rem;
}

.music-toggle {
  position: fixed;
  z-index: 35;
  right: 18px;
  bottom: 42px;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #111;
  border-radius: 50%;
  background: rgba(242, 242, 237, 0.9);
  color: #111;
  box-shadow:
    0 6px 0 #111,
    0 16px 28px rgba(0, 0, 0, 0.22);
  padding: 0;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.music-toggle:hover {
  transform: translateY(3px);
  box-shadow:
    0 3px 0 #111,
    0 10px 18px rgba(0, 0, 0, 0.2);
}

.music-toggle.is-on {
  background: var(--lime);
}

.music-toggle:not(.is-on) {
  opacity: 0.72;
}

.music-toggle:not(.is-on)::after {
  content: "";
  position: absolute;
  width: 27px;
  height: 4px;
  border-radius: 999px;
  background: #111;
  transform: rotate(-38deg);
}

.music-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.music-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.about-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 4px solid #111;
  border-radius: 12px;
  background: rgba(242, 242, 237, 0.96);
  color: var(--ink);
  box-shadow:
    0 10px 0 #111,
    0 30px 80px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  padding: 28px;
}

.about-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: black;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 900;
}

.dialog-kicker {
  margin: 0 0 8px;
  color: #111;
  font-weight: 1000;
}

.about-dialog h2 {
  margin: 0 0 12px;
  font-size: 2.4rem;
  line-height: 1;
  text-transform: uppercase;
  font-weight: 1000;
}

.about-dialog p {
  margin: 0 0 13px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: 700;
}

.about-dialog p:last-of-type {
  margin-bottom: 0;
}

.about-dialog strong {
  font-weight: 1000;
}

@keyframes counterAnimation {
  0% { transform: scale(1) translateX(0); }
  25% { transform: scale(1.2) translateX(-10px); }
  50% { transform: scale(1.3) translateY(-20px) translateX(10px); }
  75% { transform: scale(1.2) translateX(-10px); }
  100% { transform: scale(1) translateX(0); }
}

@keyframes leaderboardAnimation {
  0% { transform: scale(1) translateX(0); }
  50% { transform: scale(1.1) translateY(-10px); }
  100% { transform: scale(1) translateX(0); }
}

@media (min-width: 768px) {
  .mouth-layer {
    width: 720px;
    height: 720px;
    max-width: 100vw;
  }
}

@media (min-width: 1024px) {
  .tap-site {
    background-position: center;
    padding-left: 0;
    padding-right: 0;
  }

  .mouth-layer {
    width: min(930px, 112vh);
    height: min(930px, 112vh);
    max-width: 72vw;
    bottom: -42px;
  }

  .title-cat {
    width: 390px;
    max-width: min(30vw, 390px);
    margin-top: -2px;
    margin-bottom: 64px;
  }

  .click-count {
    margin-top: -72px;
  }

  .contract-full {
    display: none;
  }
}

@media (max-width: 1023px) {
  .tap-site {
    background-image: url("assets/bg-mobile.png");
    background-position: center top;
    background-size: cover;
  }

  .site-header {
    margin-top: 4px;
  }

  .desktop-logo,
  .contract-button {
    display: none;
  }

  .mobile-logo {
    position: relative;
    z-index: 11;
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 4px auto 0;
  }

  .mobile-logo img {
    width: 92px;
    border: 3px solid #111;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 6px 0 #111;
  }

  .mobile-contract {
    position: relative;
    z-index: 12;
    display: block;
    margin-top: 8px;
  }

  .mobile-contract span {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border-radius: 999px;
    border: 3px solid #111;
    background: rgba(255, 255, 255, 0.86);
    color: #111;
    box-shadow: 0 5px 0 #111;
    padding: 8px 16px;
    font-size: 0.78rem;
    font-weight: 1000;
  }

  .nav-actions {
    margin-left: auto;
    gap: 12px;
  }

  .about-button {
    min-height: 48px;
    padding: 10px 16px;
    font-size: 0.9rem;
  }

  .title-cat {
    margin-top: 0;
  }
}

@media (max-width: 700px) {
  .tap-site {
    padding-left: 12px;
    padding-right: 12px;
  }

  .nav-actions {
    width: 100%;
    justify-content: center;
  }

  .site-header {
    justify-content: center;
    padding-left: 6px;
    padding-right: 6px;
  }

  .title-cat {
    width: 330px;
    margin-bottom: 82px;
  }

  .click-count {
    font-size: 4.2rem;
    -webkit-text-stroke: 2px #111;
  }

  .score-card {
    width: 90%;
    bottom: 40px;
  }

  .score-toggle {
    min-height: 68px;
    padding: 16px;
    font-size: 1.2rem;
  }

  .score-label small {
    font-size: 0.62rem;
  }

  .score-right {
    padding: 7px 9px 7px 12px;
  }

  .leaderboard-panel {
    max-height: 330px;
  }

  .panel-title,
  .leaderboard-row {
    font-size: 1rem;
    padding: 12px 14px;
  }

  .project-copy {
    padding: 12px 14px;
  }

  .music-toggle {
    right: 12px;
    bottom: 124px;
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 430px) {
  .about-button {
    padding: 8px 12px;
    font-size: 0.72rem;
    min-height: 42px;
  }

  .icon-link {
    width: 42px;
    height: 42px;
    box-shadow: 0 5px 0 #111;
  }

  .icon-link svg {
    width: 20px;
    height: 20px;
  }

  .title-cat {
    width: 290px;
  }

  .score-toggle {
    font-size: 1rem;
  }
}
