:root {
  --gold: #f5c400;
  --gold-deep: #e8a800;
  --green: #3ddc63;
  --green-deep: #22a845;
  --ink: #2a1a08;
  --cream: #fff6d6;
  --sky: #ffe566;
  --pipe: #2ecc55;
  --pipe-dark: #1f9a3a;
  --safe: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sky);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255, 229, 102, 0.55) 0%, rgba(245, 196, 0, 0.75) 45%, rgba(232, 168, 0, 0.9) 100%),
    url("assets/banner.jpg") center / cover no-repeat;
  filter: saturate(1.15);
  pointer-events: none;
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 90%, rgba(61, 220, 99, 0.2), transparent 50%);
}

.top,
.ca-bar,
.game-wrap,
.foot {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 8px;
  flex-shrink: 0;
}

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

.brand-logo {
  width: clamp(40px, 11vw, 52px);
  height: clamp(40px, 11vw, 52px);
  flex-shrink: 0;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 rgba(42, 26, 8, 0.25);
  object-fit: cover;
  background: #f5c400;
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  font-size: clamp(1.45rem, 5.2vw, 2.15rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--green);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 3px 0 rgba(42, 26, 8, 0.25);
}

.tag {
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
  opacity: 0.85;
}

.tag span {
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-x {
  background: var(--ink);
  color: var(--cream);
  min-width: 48px;
  padding-inline: 12px;
}

.btn-buy {
  background: var(--green);
  color: var(--ink);
}

.ca-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 10px;
  padding: 8px 10px;
  background: rgba(255, 246, 214, 0.92);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(42, 26, 8, 0.2);
  backdrop-filter: blur(8px);
}

.ca-label {
  flex-shrink: 0;
  font-weight: 900;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 4px 8px;
}

.ca-addr {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.btn-copy {
  flex-shrink: 0;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 7px 12px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: var(--green);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
}

.btn-copy:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn-copy.copied {
  background: var(--gold);
}

.game-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 12px;
  position: relative;
}

#game {
  display: block;
  width: min(100%, 420px);
  height: auto;
  max-height: calc(100dvh - 200px);
  aspect-ratio: 2 / 3;
  border-radius: 20px;
  border: 3.5px solid var(--ink);
  box-shadow:
    0 6px 0 rgba(42, 26, 8, 0.35),
    0 18px 40px rgba(42, 26, 8, 0.25);
  background: #7ec8ff;
  touch-action: none;
  cursor: pointer;
}

.hint {
  margin-top: 10px;
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--ink);
  opacity: 0.75;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  animation: pulse 1.6s ease-in-out infinite;
}

.hint.hidden {
  visibility: hidden;
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.foot {
  flex-shrink: 0;
  text-align: center;
  padding: 8px 16px calc(10px + var(--safe));
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.7;
}

@media (max-width: 380px) {
  .top {
    flex-wrap: wrap;
  }

  .actions {
    width: 100%;
  }

  .btn-buy {
    flex: 1;
  }

  .brand h1 {
    -webkit-text-stroke: 2.5px var(--ink);
  }
}

@media (min-width: 700px) {
  .top {
    padding: 18px 28px 10px;
  }

  .ca-bar {
    max-width: 520px;
    margin-inline: auto;
    width: calc(100% - 56px);
  }

  #game {
    max-height: calc(100dvh - 220px);
  }
}
