@font-face {
  font-family: Anton;
  src: url("../fonts/Anton-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #100e18;
  --ink: #f8f1df;
  --muted: #c9bed4;
  --gold: #e2c78d;
  --panel: #1b1526;
  --line: #51405e;
  --lilac: #b69ad0;
  --btn: #c9a8ef;
  --btn-ink: #20152c;
  --footer: #9e91ae;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px 6%;
  border-bottom: 1px solid #ffffff20;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(16, 14, 24, 0.92);
  backdrop-filter: blur(10px);
}

header strong { letter-spacing: 0.04em; white-space: nowrap; }

nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  max-width: 100%;
}
nav::-webkit-scrollbar { display: none; }
nav a { white-space: nowrap; flex: 0 0 auto; }

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

nav a,
.button,
.file-btn {
  display: inline-block;
  border: 1px solid var(--lilac);
  border-radius: 30px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}

.button.primary,
.file-btn {
  background: var(--btn);
  color: var(--btn-ink);
  border-color: var(--btn);
}

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

.hero {
  min-height: 540px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  background:
    linear-gradient(0deg, #100e18 0%, transparent 70%),
    url("../img/hero.jpg") center / cover;
  padding: 60px 20px 24px;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 10vw, 112px);
  margin: 0;
  text-shadow: 0 4px 30px #000;
  font-weight: 700;
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 40px);
  margin: 8px 0 16px;
}

small.label,
.kicker {
  letter-spacing: 4px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 12px;
}

p { color: var(--muted); line-height: 1.7; }

main { max-width: 980px; margin: auto; padding: 40px 24px; text-align: center; }

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 22px;
  padding: 36px;
  margin: 24px 0;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 28px 0 8px;
}

.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 108px;
  padding: 22px 16px;
  border: 1px solid var(--lilac);
  border-radius: 22px;
  background: #241c32;
  font-weight: 700;
  font-size: 18px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.link-card:hover,
.link-card:focus-visible {
  background: #31243f;
  border-color: var(--btn);
  transform: translateY(-2px);
}

.link-card.buy {
  background: var(--btn);
  color: var(--btn-ink);
  border-color: var(--btn);
}

.link-card.buy:hover,
.link-card.buy:focus-visible { background: #d8c0f6; }

.link-card span.sub {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.95;
}

.link-card.buy span.sub { color: #5a3d78; }

.link-card svg { width: 28px; height: 28px; fill: currentColor; }

.ca-box {
  margin-top: 28px;
  padding: 18px 18px 16px;
  border: 1px dashed var(--lilac);
  border-radius: 18px;
  background: #140f1d;
  text-align: left;
}

.ca-box .kicker { display: block; margin-bottom: 8px; }

.ca-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ca-row code {
  flex: 1 1 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.5;
}

.ca-row .button { padding: 10px 18px; flex: 0 0 auto; }

#copy-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--gold);
}

.templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 20px 0;
  max-height: min(52vh, 380px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 4px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #c9a8ef #140f1d;
}

.templates button {
  appearance: none;
  border: 2px solid transparent;
  background: #140f1d;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--ink);
}

.templates button img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0b0910;
}

.templates button span {
  display: block;
  padding: 6px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.templates button[aria-pressed="true"],
.templates button:focus-visible {
  border-color: var(--btn);
  box-shadow: 0 0 0 3px #c9a8ef55;
}

.meme-stage {
  margin: 8px auto 20px;
  width: 100%;
  max-width: 560px;
  background: #0b0910;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.meme-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.controls {
  display: grid;
  gap: 14px;
  text-align: left;
  max-width: 560px;
  margin: 0 auto;
}

.controls label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}

.controls input[type="text"] {
  width: 100%;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #140f1d;
  color: var(--ink);
  font-size: 16px; /* prevent iOS zoom */
}

.controls input[type="range"] {
  width: 100%;
  accent-color: var(--btn);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.actions .button,
.actions .file-btn { min-width: 160px; }

.hint { font-size: 13px; margin: 16px 0 0; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  max-height: min(80vh, 720px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 4px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #c9a8ef #140f1d;
}

.gallery-grid figure {
  margin: 0;
  background: #140f1d;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
}

.gallery-grid figure:hover,
.gallery-grid figure:focus-visible {
  border-color: var(--btn);
  box-shadow: 0 0 0 3px #c9a8ef55;
}

.gallery-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0b0910;
}

.gallery-grid figcaption {
  display: block;
  padding: 8px 8px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}


.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

footer {
  text-align: center;
  color: var(--footer);
  padding: 30px;
  font-size: 13px;
}


.locks-dash {
  margin: 28px 0 16px;
}

.locks-dash .link-card {
  max-width: 420px;
  margin: 0 auto;
}

.locks-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 0;
  text-align: left;
}

.lock-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 18px;
  border: 1px dashed var(--lilac);
  border-radius: 18px;
  background: #140f1d;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, border-style 0.15s ease;
}

.lock-card:hover,
.lock-card:focus-visible {
  border-style: solid;
  border-color: var(--btn);
  background: #241c32;
  transform: translateY(-2px);
}

.lock-card strong {
  font-size: 18px;
  color: var(--ink);
  font-weight: 700;
}

.lock-card .sub {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.lock-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .hero { min-height: 440px; background-position: 42% center; }
  header {
    padding: 12px 16px 10px;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  header strong { flex: 0 0 auto; }
  nav {
    flex: 1 1 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  nav a { padding: 8px 12px; font-size: 13px; }
  .panel { padding: 24px 18px; }
  .links-grid { grid-template-columns: 1fr; }
  .link-card { min-height: 88px; }
  .locks-list { grid-template-columns: 1fr; }
  .templates {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    max-height: min(46vh, 320px);
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    max-height: min(70vh, 560px);
  }
  .actions .button,
  .actions .file-btn { flex: 1 1 100%; }
}

@media (max-width: 400px) {
  h1 { font-size: clamp(40px, 14vw, 64px); }
  h2 { font-size: clamp(22px, 7vw, 30px); margin: 6px 0 12px; }
  nav a, .button, .file-btn { padding: 8px 12px; font-size: 12px; }
  .panel { padding: 16px 14px; }
  .hero { min-height: 360px; padding: 40px 14px 20px; }
}

.panel { scroll-margin-top: 96px; }

.pfp-stage { max-width: 520px; }

#pfp-status { margin-top: 10px; min-height: 1.3em; }

.pfp-controls {
  display: grid;
  gap: 20px;
  text-align: left;
  margin: 8px auto 0;
  max-width: 640px;
}

.pfp-label,
.pfp-text-row label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.pfp-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.pfp-choices button {
  appearance: none;
  border: 2px solid transparent;
  background: #140f1d;
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  color: var(--ink);
  text-align: center;
}

.pfp-choices button img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0b0910;
}

.pfp-choices button span {
  display: block;
  padding: 6px 4px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.pfp-choices button[aria-pressed="true"],
.pfp-choices button:focus-visible {
  border-color: var(--btn);
  box-shadow: 0 0 0 3px #c9a8ef55;
}

.pfp-text-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.pfp-text-row label {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.pfp-text-row input[type="text"] {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #140f1d;
  color: var(--ink);
  font-size: 16px;
}

.pfp-text-row .button { padding: 12px 16px; white-space: nowrap; }

@media (max-width: 600px) {
  .panel { scroll-margin-top: 164px; }
  .pfp-choices {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 6px;
  }
  .pfp-choices button span { font-size: 10px; padding: 5px 3px 7px; }
  .pfp-text-row { grid-template-columns: 1fr; }
  .pfp-text-row .button { width: 100%; }
}


/* Desktop / tablet only. Mobile max-width 600 and 400 rules above stay unchanged. */
@media (max-width: 767px) {
  header { flex-wrap: wrap; gap: 10px; }
  nav { flex: 1 1 100%; justify-content: flex-start; }
}

@media (min-width: 768px) {
  header {
    flex-wrap: nowrap;
    align-items: center;
    padding: 16px 32px;
  }
  nav {
    flex: 1 1 auto;
    justify-content: flex-end;
    overflow: visible;
    gap: 8px;
  }
  nav a { padding: 10px 16px; font-size: 14px; }
  main { max-width: 1100px; padding: 44px 32px; }
  .hero { min-height: 600px; }
  .panel { padding: 40px 36px; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    max-height: min(74vh, 800px);
  }
  .templates { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .link-card { min-height: 112px; }
}

@media (min-width: 1024px) {
  header {
    padding: 16px max(40px, calc((100vw - 1320px) / 2));
  }
  nav a { padding: 10px 18px; }
  main { max-width: 1320px; padding: 52px 40px; }
  .hero { min-height: 640px; }
  .links-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .link-card { min-height: 120px; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    max-height: min(76vh, 880px);
  }
  .templates {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    max-height: min(46vh, 380px);
  }
  .locks-dash .link-card { max-width: none; }
  .pfp-stage { max-width: none; }
  .pfp-controls { max-width: none; }
  .meme-stage { max-width: 640px; }
  .controls { max-width: none; }

  #pfp.panel {
    display: grid;
    grid-template-columns: minmax(300px, 520px) minmax(0, 1fr);
    grid-template-areas:
      "kicker kicker"
      "title title"
      "intro intro"
      "stage controls"
      "status controls"
      "actions actions"
      "hint hint";
    gap: 24px 40px;
    align-items: start;
    text-align: left;
  }
  #pfp > .kicker { grid-area: kicker; text-align: center; }
  #pfp > h2 { grid-area: title; text-align: center; }
  #pfp > p:first-of-type { grid-area: intro; text-align: center; }
  #pfp .pfp-stage { grid-area: stage; position: sticky; top: 96px; }
  #pfp #pfp-status { grid-area: status; margin-top: 4px; }
  #pfp .pfp-controls { grid-area: controls; margin-top: 0; }
  #pfp .actions { grid-area: actions; text-align: center; }
  #pfp > .hint { grid-area: hint; text-align: center; }

  #meme.panel {
    display: grid;
    grid-template-columns: minmax(300px, 560px) minmax(0, 1fr);
    gap: 24px 40px;
    align-items: start;
    text-align: left;
  }
  #meme > .kicker,
  #meme > h2,
  #meme > p:first-of-type,
  #meme .templates {
    grid-column: 1 / -1;
    text-align: center;
  }
  #meme .meme-stage { position: sticky; top: 96px; }
  #meme .actions,
  #meme > .hint { grid-column: 1 / -1; text-align: center; }
}

@media (min-width: 1440px) {
  header { padding: 18px max(48px, calc((100vw - 1320px) / 2)); }
  nav a { padding: 12px 20px; font-size: 15px; }
  main { max-width: 1320px; padding: 56px 40px; }
  .hero { min-height: 700px; }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    max-height: min(78vh, 980px);
  }
  .templates { max-height: min(48vh, 420px); }
}

/* HOME SITE ONLY: large-monitor type and width. Game page is not body.site. */

@media (min-width: 1024px) {
  body.site { font-size: 17px; }
  body.site header {
    padding: 18px max(40px, calc((100vw - min(86vw, 1680px)) / 2));
  }
  body.site header strong { font-size: 18px; }
  body.site nav { gap: 10px; }
  body.site nav a { padding: 14px 24px; font-size: 16px; }
  body.site main {
    width: 86%;
    max-width: 1680px;
    padding: 56px 48px;
  }
  body.site h1 { font-size: clamp(72px, 8vw, 150px); }
  body.site h2 { font-size: clamp(36px, 3.6vw, 52px); }
  body.site .kicker,
  body.site small.label { font-size: 13px; letter-spacing: 0.28em; }
  body.site p { font-size: 1.05em; line-height: 1.75; }
  body.site .hero { min-height: min(78vh, 820px); padding: 80px 24px 32px; }
  body.site .panel { padding: 52px 56px; margin: 32px 0; }
  body.site .links-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  body.site .link-card {
    min-height: 150px;
    padding: 28px 20px;
    font-size: 22px;
    border-radius: 24px;
    gap: 8px;
  }
  body.site .link-card svg { width: 36px; height: 36px; }
  body.site .link-card span.sub { font-size: 13px; }
  body.site .ca-row code { font-size: 15px; }
  body.site .ca-row .button { padding: 12px 22px; font-size: 16px; }
  body.site .button,
  body.site .file-btn { padding: 14px 24px; font-size: 16px; }
}

@media (min-width: 1440px) {
  body.site { font-size: 18px; }
  body.site header {
    padding: 20px max(48px, calc((100vw - min(80vw, 1760px)) / 2));
  }
  body.site header strong { font-size: 20px; }
  body.site nav a { padding: 16px 26px; font-size: 17px; }
  body.site main {
    width: 80%;
    max-width: 1760px;
    padding: 64px 48px;
  }
  body.site h1 { font-size: clamp(80px, 7.5vw, 168px); }
  body.site h2 { font-size: clamp(40px, 3.4vw, 58px); }
  body.site .hero { min-height: min(80vh, 880px); }
  body.site .panel { padding: 56px 64px; }
  body.site .link-card { min-height: 168px; font-size: 24px; padding: 32px 22px; }
  body.site .link-card svg { width: 40px; height: 40px; }
  body.site .link-card span.sub { font-size: 14px; }
}

@media (min-width: 1920px) {
  body.site main {
    width: 80%;
    max-width: 1920px;
  }
  body.site header {
    padding: 22px max(56px, calc((100vw - min(80vw, 1920px)) / 2));
  }
  body.site h1 { font-size: clamp(88px, 7vw, 180px); }
  body.site .hero { min-height: min(82vh, 940px); }
}
