/* ==========================================================================
   World of Riddles — efstathopoulos.world/worldofriddles
   Single stylesheet, no external dependencies.
   ========================================================================== */

:root {
  --bg:          #050813;
  --bg-deep:     #02040a;
  --surface:     rgba(255, 255, 255, 0.045);
  --surface-2:   rgba(255, 255, 255, 0.075);
  --border:      rgba(255, 255, 255, 0.11);
  --border-lit:  rgba(255, 255, 255, 0.22);

  --text:        #e9edf7;
  --text-muted:  #9aa6c0;
  --text-dim:    #6f7b96;

  --gold:        #e6b653;
  --gold-soft:   #f2d493;
  --green:       #5fd18c;
  --blue:        #6ea8e8;

  --radius:      14px;
  --radius-lg:   22px;

  --wrap:        1080px;
  --prose:       44rem;

  --font: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;

  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------- reset -- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%,  rgba(255,255,255,.55), transparent 100%),
    radial-gradient(1.5px 1.5px at 78% 9%,   rgba(255,255,255,.45), transparent 100%),
    radial-gradient(1px 1px   at 34% 62%,    rgba(255,255,255,.40), transparent 100%),
    radial-gradient(1px 1px   at 91% 47%,    rgba(255,255,255,.35), transparent 100%),
    radial-gradient(1.5px 1.5px at 58% 82%,  rgba(255,255,255,.40), transparent 100%),
    radial-gradient(1px 1px   at 6%  74%,    rgba(255,255,255,.30), transparent 100%),
    radial-gradient(1px 1px   at 47% 30%,    rgba(255,255,255,.30), transparent 100%),
    radial-gradient(ellipse 900px 620px at 50% -8%, rgba(45, 82, 148, .30), transparent 70%),
    linear-gradient(180deg, #070b1a 0%, var(--bg) 45%, var(--bg-deep) 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 .5em;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: clamp(2rem, 5.2vw, 3.15rem); }
h2 { font-size: clamp(1.45rem, 3.2vw, 1.95rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1.15em; }

a {
  color: var(--gold-soft);
  text-decoration-color: rgba(230, 182, 83, .45);
  text-underline-offset: 3px;
}
a:hover { color: var(--gold); text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: .92em;
  background: var(--surface-2);
  padding: .12em .4em;
  border-radius: 5px;
}

/* ------------------------------------------------------------- helpers -- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--gold);
  color: #14100a;
  padding: .7rem 1.2rem;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* -------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 8, 19, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: .7rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img {
  width: 34px; height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: .25rem 1.15rem;
  flex-wrap: wrap;
  font-size: .945rem;
}
.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--gold);
}

/* ---------------------------------------------------------------- hero -- */

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.75rem) clamp(2rem, 5vw, 3.5rem);
}

.hero-grid {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3.25rem);
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}

.hero-figure { margin: 0; }

.hero-figure img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-lit);
  box-shadow: var(--shadow);
}

.hero-figure figcaption {
  margin-top: .75rem;
  font-size: .84rem;
  color: var(--text-dim);
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: .765rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(230, 182, 83, .10);
  border: 1px solid rgba(230, 182, 83, .28);
  border-radius: 999px;
  padding: .34rem .85rem;
  margin-bottom: 1.1rem;
}

.hero h1 { margin-bottom: .55rem; }

.hero .lede {
  font-size: clamp(1.08rem, 2.1vw, 1.22rem);
  color: var(--text-muted);
  max-width: 34rem;
}

.hero .lede strong { color: var(--text); font-weight: 600; }

/* "No account needed to start playing." Its own line under the lede rather
   than a third clause in it: the sentence above is about what the game is, and
   this is about what it costs to try -- two different promises, and running
   them together buries the second. */
.hero .lede .lede-note {
  display: block;
  margin-top: .5rem;
  font-size: .9em;
  color: var(--text-muted);
  opacity: .85;
}

/* ------------------------------------------------------------- buttons -- */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: inherit;
  font-weight: 600;
  font-size: .97rem;
  line-height: 1.2;
  padding: .78rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--border-lit);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-lit);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #d99f2f 100%);
  border-color: transparent;
  color: #1a1305;
}
.btn-primary:hover {
  color: #1a1305;
  background: linear-gradient(135deg, var(--gold-soft) 0%, var(--gold) 100%);
}

.btn-kofi {
  background: linear-gradient(135deg, #ff5e5b 0%, #e8443f 100%);
  border-color: transparent;
  color: #fff;
}
.btn-kofi:hover {
  color: #fff;
  background: linear-gradient(135deg, #ff7b78 0%, #ff5e5b 100%);
}

.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* -------------------------------------------------------------- panels -- */

.section { padding-block: clamp(2.25rem, 5vw, 3.75rem); }

.section-head { max-width: var(--prose); margin-bottom: 1.9rem; }
.section-head p { color: var(--text-muted); margin-bottom: 0; }

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 265px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: 1.4rem 1.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}
a.card:hover {
  color: var(--text);
  transform: translateY(-2px);
  border-color: var(--border-lit);
  background: var(--surface-2);
}

.card h3 {
  margin: 0;
  font-size: 1.06rem;
  display: flex;
  align-items: center;
  gap: .55rem;
}
.card h3 .ico { font-size: 1.15rem; line-height: 1; }
.card p {
  margin: 0;
  font-size: .93rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.feature-grid {
  display: grid;
  gap: 1.35rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.feature h3 {
  font-size: 1rem;
  margin-bottom: .3rem;
  color: var(--gold-soft);
}
.feature p { margin: 0; color: var(--text-muted); font-size: .95rem; }

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.15rem 1.35rem;
  margin: 1.9rem 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--gold-soft); }

/* ---------------------------------------------------------------- prose -- */

.page-header {
  padding-block: clamp(2.25rem, 5vw, 3.5rem) 1.5rem;
  border-bottom: 1px solid var(--border);
}
/* +40px so the heading's text edge lines up with .prose inside the wider wrap. */
.page-header .wrap { max-width: calc(var(--prose) + 40px); }
.page-header h1 { margin-bottom: .35rem; }
.page-header .sub { color: var(--text-muted); margin-bottom: 0; font-size: 1.02rem; }

.prose {
  max-width: var(--prose);
  margin-inline: auto;
  padding-block: 2.25rem 1rem;
}

.prose h2 {
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  font-size: 1.32rem;
}
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.prose h3 {
  margin-top: 1.8rem;
  font-size: 1.05rem;
  color: var(--gold-soft);
}

.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 1.15em; }
.prose li { margin-bottom: .6em; }
.prose li::marker { color: var(--gold); }

/* Code of Conduct: a rule, then why it exists. */
.rules { margin: 0 0 1.5rem; }

.rules dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 1.5rem;
  padding-left: 1.15rem;
  position: relative;
}
.rules dt::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.rules dt:first-child { margin-top: 0; }

.rules dd {
  margin: .35rem 0 0 1.15rem;
  color: var(--text-muted);
  font-size: .975rem;
}

.prose .meta {
  font-size: .89rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  background: var(--surface);
}
.prose .meta p:last-child { margin-bottom: 0; }

.toc {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin-bottom: 2.4rem;
}
.toc h2 {
  margin: 0 0 .6rem;
  padding: 0;
  border: 0;
  font-size: .78rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.toc ol { margin: 0; padding-left: 1.25rem; }
.toc li { margin-bottom: .3em; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- form -- */

.form {
  max-width: var(--prose);
  margin-inline: auto;
}

.field { margin-bottom: 1.35rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .45rem;
}
.field .hint {
  display: block;
  font-weight: 400;
  font-size: .87rem;
  color: var(--text-dim);
  margin-top: .2rem;
}

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, .05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  transition: border-color .15s ease, background-color .15s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, .08);
}

.field textarea { min-height: 11rem; resize: vertical; }

.field input:user-invalid,
.field textarea:user-invalid { border-color: #e06a63; }

.form-note {
  font-size: .91rem;
  color: var(--text-muted);
  margin-top: 1.1rem;
}

.fallback {
  margin-top: 1.35rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .93rem;
}
.fallback p:last-child { margin-bottom: 0; }

.copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-top: .6rem;
}
.copy-row .addr {
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: .92rem;
  color: var(--gold-soft);
  word-break: break-all;
}
.btn-small {
  font-size: .85rem;
  padding: .42rem .9rem;
}

.status {
  margin-top: 1rem;
  font-size: .93rem;
  color: var(--green);
}
.status:empty { margin: 0; }

/* -------------------------------------------------------------- footer -- */

.site-footer {
  margin-top: clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--border);
  padding-block: 2.25rem 2.75rem;
  font-size: .92rem;
  color: var(--text-muted);
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--gold-soft); text-decoration: underline; }

.footer-brand { max-width: 24rem; }
.footer-brand strong { color: var(--text); display: block; margin-bottom: .25rem; }
.footer-brand p { margin: 0; font-size: .9rem; color: var(--text-dim); }

.colophon {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-dim);
}
.colophon p { margin: 0; }

/* ------------------------------------------------------------ 404 page -- */

.centred {
  text-align: center;
  padding-block: clamp(3rem, 12vw, 7rem);
}
.centred .btn-row { justify-content: center; }

/* -------------------------------------------------------- media tweaks -- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .btn-row, .skip-link { display: none; }
  a { color: #000; }
}

/* ------------------------------------------------- share-link fallbacks -- */
/* The pages a shared riddle or challenge link opens without the app
   (architecture doc 3.39/3.42). Reuse the card; these only size what goes in
   it, and keep a long player-typed question from pushing past the gutter. */

/* `hidden` is only a UA-stylesheet `display: none`, and `.btn` and `.card` both
   set a display of their own, which wins. These pages hide and reveal elements
   with the attribute, so it has to win back -- otherwise the empty card shows
   while loading and after a failure, and the Android-only "Open in the app"
   button shows everywhere. */
.share-page [hidden] { display: none !important; }

.share-page .share-card {
  max-width: 34rem;
  margin: 1.5rem auto;
  text-align: left;
  overflow-wrap: anywhere;
}
.share-page .share-thumb {
  width: 100%;
  max-height: 16rem;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
}
.share-page .share-facts { color: var(--text-muted); font-size: .88rem; }
.share-page .share-question { color: var(--text); font-size: 1.05rem; white-space: pre-line; }
.share-page .share-description { white-space: pre-line; }
.share-page .share-results { margin: .25rem 0 0; padding-left: 1.2rem; color: var(--text); }
.share-page .share-results li { margin: .2rem 0; }
.share-page .share-note { color: var(--text-dim); font-size: .85rem; max-width: 34rem; margin-inline: auto; }
