@font-face {
  font-family: "MemeImpact";
  src: url("assets/fonts/impact.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --fg: #ffffff;
  --accent: #00ff88;
  --danger: #ff3b3b;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --size-display: clamp(2.6rem, 12vw, 4.25rem);
  --size-body: 0.875rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* The hidden attribute must win over display rules like .crude-btn's inline-flex */
[hidden] {
  display: none !important;
}

html, body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.35;
  overflow-x: hidden;
}

/* Strictly two type sizes across the entire page */
.display-type {
  font-size: var(--size-display);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.body-type {
  font-size: var(--size-body);
  font-weight: 600;
  line-height: 1.35;
}

/* Deliberate handmade / flyer imperfection */
.tilt-left {
  transform: rotate(-1.5deg);
}

.tilt-right {
  transform: rotate(1.5deg);
}

/* ABOVE THE FOLD: fits 390x844 with zero scrolling */
.hero {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  border-bottom: 3px solid var(--fg);
}

.hero-mascot-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.hero-mascot {
  max-height: 55svh;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: rotate(-2deg);
}

.hero-title-group {
  width: 100%;
  margin: 8px 0;
}

.hero-title-group h1 {
  word-break: break-word;
}

.hero-title-group p {
  margin-top: 6px;
  opacity: 0.88;
}

.buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  background-color: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-top: 2px solid var(--fg);
  border-right: 4px solid var(--fg);
  border-bottom: 4px solid var(--fg);
  border-left: 2px solid var(--fg);
  transform: rotate(-1deg);
  cursor: pointer;
  user-select: none;
}

.buy-btn:active {
  transform: rotate(0deg) translate(2px, 2px);
}

.buy-btn.is-prelaunch {
  background-color: var(--bg);
  color: var(--accent);
  border-color: var(--accent);
  cursor: default;
  font-size: var(--size-body);
  letter-spacing: 0.08em;
}

.hero-slot-4 {
  width: 100%;
  margin-top: 10px;
}

.ca-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background-color: var(--bg);
  color: var(--fg);
  border-top: 2px solid var(--fg);
  border-right: 3px solid var(--fg);
  border-bottom: 3px solid var(--fg);
  border-left: 2px solid var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  cursor: pointer;
  /* no text-transform: Solana addresses are case-sensitive */
  letter-spacing: 0.05em;
}

.ca-btn.is-copied {
  background-color: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* BELOW THE FOLD */
.main-content {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
}

/* A. Live Stats Bar */
.stats-bar {
  margin-top: 20px;
  border-top: 3px solid var(--fg);
  border-right: 2px solid var(--fg);
  border-bottom: 2px solid var(--fg);
  border-left: 3px solid var(--fg);
}

.stats-bar.is-stale {
  opacity: 0.42;
}

.stats-notice {
  padding: 16px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 440px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-cell {
  padding: 10px 8px;
  border-right: 2px solid var(--fg);
  border-bottom: 2px solid var(--fg);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  opacity: 0.65;
  text-transform: uppercase;
}

.stat-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.stat-val.is-pos {
  color: var(--accent);
}

.stat-val.is-neg {
  color: var(--danger);
}

.skeleton {
  background-color: var(--fg);
  color: transparent;
  opacity: 0.18;
  display: inline-block;
  width: 75%;
  height: 1.2em;
  animation: pulse-op 1s steps(2, start) infinite;
}

@keyframes pulse-op {
  0%, 100% { opacity: 0.12; }
  50% { opacity: 0.28; }
}

/* Sections */
.section-block {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 3px solid var(--fg);
}

.section-title {
  margin-bottom: 16px;
  display: inline-block;
}

/* B. Meme Generator */
.canvas-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-top: 3px solid var(--fg);
  border-right: 4px solid var(--fg);
  border-bottom: 4px solid var(--fg);
  border-left: 2px solid var(--fg);
  background-color: var(--bg);
  position: relative;
}

#meme-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

#meme-canvas:active {
  cursor: grabbing;
}

.strip-label {
  margin-top: 12px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.preset-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.preset-thumb,
.sticker-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--fg);
  background: var(--bg);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}

.preset-thumb.is-active {
  border-color: var(--accent);
  border-width: 3px;
}

.preset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Sticker thumbs add a sticker on every tap, so they get press feedback instead of an active state */
.sticker-thumb:active {
  transform: translate(1px, 1px);
}

.sticker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3px;
  display: block;
}

.gen-controls {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr;
  gap: 8px;
}

.crude-btn {
  background-color: var(--bg);
  color: var(--fg);
  border-top: 2px solid var(--fg);
  border-right: 3px solid var(--fg);
  border-bottom: 3px solid var(--fg);
  border-left: 2px solid var(--fg);
  min-height: 44px;
  padding: 8px 10px;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  user-select: none;
}

.crude-btn:active {
  transform: translate(1px, 1px);
}

.accent-btn {
  background-color: var(--accent);
  color: var(--bg);
  border-color: var(--fg);
}

.scale-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--fg);
  padding: 8px 10px;
}

.scale-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 24px;
}

.text-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.crude-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  background-color: var(--bg);
  color: var(--fg);
  border-top: 2px solid var(--fg);
  border-right: 3px solid var(--fg);
  border-bottom: 3px solid var(--fg);
  border-left: 2px solid var(--fg);
  text-transform: uppercase;
}

.crude-input::placeholder {
  color: var(--fg);
  opacity: 0.45;
}

.crude-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.output-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.output-btn {
  min-height: 52px;
}

.share-note {
  padding: 8px 10px;
  border: 2px solid var(--accent);
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
}

/* C. Meme Wall */
.meme-wall-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 480px) {
  .meme-wall-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.wall-item {
  aspect-ratio: 1 / 1;
  border-top: 2px solid var(--fg);
  border-right: 3px solid var(--fg);
  border-bottom: 3px solid var(--fg);
  border-left: 2px solid var(--fg);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
}

.wall-item:nth-child(odd) {
  transform: rotate(-1deg);
}

.wall-item:nth-child(even) {
  transform: rotate(1deg);
}

.wall-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* D. The Gimmick */
.gimmick-box {
  margin-bottom: 32px;
  padding: 16px;
  border-top: 3px solid var(--fg);
  border-right: 2px solid var(--fg);
  border-bottom: 4px solid var(--fg);
  border-left: 3px solid var(--fg);
  text-align: center;
  transform: rotate(-1deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* E. Footer */
.footer {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px calc(32px + env(safe-area-inset-bottom, 0px));
  border-top: 3px solid var(--fg);
  opacity: 0.72;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.socials-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.footer .socials-row {
  justify-content: flex-start;
}

.disclosure-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.inline-copy {
  background: none;
  border: none;
  border-bottom: 1px dashed var(--fg);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  padding: 0 2px;
}

.inline-copy.is-copied {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.disclosure-text {
  opacity: 0.85;
}

.copyright a {
  color: inherit;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  background-color: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.lightbox-img {
  max-width: 100%;
  max-height: 82vh;
  border: 3px solid var(--fg);
  object-fit: contain;
}