:root {
  --bg: #0a0a0a;
  --fg: #e0e0e0;
  --accent: #2b8fff;        /* PaiyBit blue — reads on black as well as gold did */
  --accent-solid: #1a73e8;  /* solid buttons / the app blue */
  --accent-ink: #ffffff;    /* text on a solid-blue button */
  --muted: #7a8697;
}

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

/* The hidden attribute loses to any explicit inline display (display:grid,
   flex, block...). That silently un-hides things — it left the 12 plot
   words on screen during the write-down check, which defeated the check.
   Make hidden mean hidden, everywhere. */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  line-height: 1.6;
  padding: 2rem;
}

header { text-align: center; margin-bottom: 2rem; }
header h1 { font-size: 1.5rem; color: var(--accent); font-weight: normal; letter-spacing: 0.05em; }
/* The title is <h1><a>…</a></h1>; without this the anchor falls back to the
   browser's purple visited-link colour, which is the unreadable purple on
   black across login / me / signup. Inherit the h1's gold instead. */
header h1 a, h1 a.brand-link, .brand a { color: inherit; text-decoration: none; }
header .tagline { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }

.countdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 3rem 0;
  flex-wrap: wrap;
}
.cd-box {
  background: #111;
  border: 1px solid var(--muted);
  padding: 1rem 1.25rem;
  min-width: 90px;
  text-align: center;
  border-radius: 4px;
}
.cd-val {
  display: block;
  font-size: 2.25rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.cd-label {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.25rem;
}
.countdown.fired .cd-val { color: var(--fg); }

.copy {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}
.copy p { margin-bottom: 1rem; }
.copy .lead {
  font-size: 1.1rem;
  color: var(--fg);
}
.copy .sub {
  color: var(--muted);
}
.copy .hook {
  margin-top: 2rem;
  color: var(--fg);
  font-size: 0.95rem;
}
.copy .hook strong { color: var(--accent); }

footer {
  text-align: center;
  margin-top: 4rem;
  color: var(--muted);
  font-size: 0.8rem;
}
footer .risk-note {
  max-width: 560px;
  margin: 0.75rem auto 0;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #666;
  padding: 0 1rem;
}
footer .legal-links {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: #666;
}
footer .legal-links a {
  color: #999;
  text-decoration: none;
  border-bottom: 1px dotted #333;
  margin: 0 0.2rem;
}
footer .legal-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.legal-footer {
  text-align: center;
  margin: 2.5rem 0 1rem;
  color: var(--muted);
}

body.legal .legal-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  line-height: 1.6;
  color: var(--fg);
}
body.legal .legal-body h2 {
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 2.25rem 0 0.5rem;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 0.35rem;
}
body.legal .legal-body p { margin: 0 0 0.85rem; font-size: 0.95rem; }
body.legal .legal-body ul { padding-left: 1.5rem; margin: 0 0 0.85rem; }
body.legal .legal-body li { margin: 0.25rem 0; font-size: 0.93rem; }
body.legal .legal-body a { color: var(--accent); }
body.legal .legal-body code {
  background: #151515; padding: 1px 5px; border-radius: 2px; font-size: 0.85em;
}

.topnav {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 0.9rem;
  z-index: 10;
}
.grid-body main { max-width: 1100px; margin: 0 auto; }
.grid-meta { text-align: center; margin: 1rem 0 1.5rem; }
.grid-meta .muted { color: var(--muted); font-size: 0.9rem; }
.grid-meta a { color: var(--accent); text-decoration: none; }
.centered { text-align: center; }
.small { font-size: 0.8rem; }
.muted { color: var(--muted); }
#grid { cursor: crosshair; }

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 2rem 1rem;
  overflow-y: auto;
}
.modal-inner {
  background: #0a0a0a;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 3rem 2rem 2rem;
  max-width: 500px;
  width: 100%;
  position: relative;
  margin: auto;
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #111;
  border: 1px solid var(--muted);
  color: var(--fg);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  z-index: 2;
}
.modal-close:hover { color: var(--accent); }
.modal h2 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.2rem;
}
.topnav a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
  padding-bottom: 2px;
}
.topnav a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.cta-wrap { margin-top: 2.5rem; }
.cta {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 0.9rem 2rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 4px;
  transition: transform 0.15s;
}
.cta:hover { transform: translateY(-1px); }
.cta-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.cta-ghost:hover { background: rgba(43,143,255,0.10); }

.story {
  max-width: 640px;
  margin: 5rem auto;
  text-align: center;
  padding: 0 1rem;
  position: relative;
}
.story::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--accent);
  margin: 0 auto 2.5rem;
  opacity: 0.5;
}
.story h2 {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  font-weight: normal;
}
.story p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--fg);
  margin-bottom: 0.9rem;
}
.story p.sub { color: var(--muted); }
.story p.small { font-size: 0.85rem; }

body.auth main {
  max-width: 480px;
  margin: 0 auto;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #111;
  padding: 2rem;
  border: 1px solid var(--muted);
  border-radius: 4px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--fg);
  font-size: 0.9rem;
}
.auth-form input {
  background: var(--bg);
  border: 1px solid var(--muted);
  color: var(--fg);
  padding: 0.75rem 0.9rem;
  border-radius: 3px;
  font-family: inherit;
  font-size: 1rem;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-form .help {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: -0.75rem;
}
.risk-ack {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.6rem !important;
  background: #150a02;
  border: 1px solid #3a2408;
  border-radius: 3px;
  padding: 0.7rem 0.8rem;
  font-size: 0.75rem !important;
  color: #b8a080 !important;
  line-height: 1.5;
}
.risk-ack input { flex-shrink: 0; margin-top: 0.2rem; }
.risk-ack strong { color: var(--accent); }
.auth-form .help code {
  background: #222;
  padding: 1px 4px;
  border-radius: 2px;
}
.auth-form button, .auth-form .ghost {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 3px;
  font-weight: 600;
}
.auth-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--muted) !important;
}
.err {
  color: #ff6666;
  font-size: 0.9rem;
  background: #2a0c0c;
  padding: 0.75rem;
  border-radius: 3px;
}
.alt {
  text-align: center;
  margin-top: 1.5rem;
}
.alt a { color: var(--accent); text-decoration: none; }

.phrase-box {
  background: #111;
  padding: 2rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  text-align: center;
}
.phrase-box h2 { color: var(--accent); margin-bottom: 1rem; font-size: 1.25rem; }
.phrase-box .warn {
  color: #ffb86b;
  font-size: 0.9rem;
  background: #2a1c08;
  padding: 0.75rem;
  border-radius: 3px;
  margin-bottom: 1rem;
}
.phrase {
  background: var(--bg);
  border: 1px solid var(--accent);
  padding: 1.25rem;
  border-radius: 3px;
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  white-space: pre-wrap;
  /* Wrap on word boundaries; fall back to breaking inside only when a single
     token (e.g. a WIF) is longer than the container. */
  word-break: normal;
  overflow-wrap: anywhere;
  font-family: inherit;
  margin-bottom: 1.5rem;
}
.phrase-box .confirm {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
}
.phrase-box button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.75rem 2rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 3px;
  font-weight: 600;
}
.phrase-box button:disabled { opacity: 0.4; cursor: not-allowed; }

.me {
  text-align: center;
  padding: 2rem;
  max-width: 520px;
  margin: 0 auto;
}
.me .char-tagline {
  color: var(--accent);
  font-style: italic;
  font-size: 0.95rem;
  margin: 0.75rem 0 0.5rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.me .char-story-open,
.me .char-traits-wrap,
.me .char-look-wrap {
  margin: 1rem auto;
  text-align: left;
  background: #111;
  padding: 1rem 1.2rem;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  max-width: 460px;
}
.me .char-story-label {
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 0.3rem;
}
.me .char-story-open pre {
  margin: 0;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.88rem;
  white-space: pre-wrap;
  line-height: 1.55;
}
.me .char-traits {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--fg);
}
.me .char-traits li {
  padding: 0.25rem 0;
  border-bottom: 1px dotted #333;
}
.me .char-look {
  margin: 0;
  font-style: italic;
  color: var(--fg);
  font-size: 0.88rem;
  line-height: 1.5;
}
.me h2, .me .char-name { color: var(--accent); margin-bottom: 0.75rem; font-size: 1.35rem; }
.me .sub { color: var(--muted); margin-bottom: 1rem; }
.me .small { font-size: 0.85rem; }
.me form { margin-top: 2rem; }

.char-frame {
  display: inline-block;
  padding: 0.75rem;
  background: #111;
  border: 1px solid var(--accent);
  border-radius: 8px;
  margin-bottom: 1rem;
}
.char-img {
  display: block;
  image-rendering: pixelated;
  background: #111;
  border-radius: 4px;
}
.char-persona {
  max-width: 420px;
  margin: 0 auto 1rem;
  color: var(--fg);
  font-size: 0.95rem;
  font-style: italic;
}
.char-reveal {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--muted);
}
.char-reveal .char-img {
  margin: 0 auto 0.75rem;
  width: 160px;
  height: 160px;
  border: 1px solid var(--accent);
  padding: 0.5rem;
  background: #0a0a0a;
  border-radius: 8px;
}
.char-reveal .char-name {
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
}
.char-reveal .char-persona {
  font-size: 0.85rem;
  color: var(--muted);
}
