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

:root {
  --bg: #0a0a14;
  --bg-2: #14142a;
  --card: #0f0f20;
  --border: rgba(255,255,255,0.08);
  --fg: #f5f3ff;
  --muted: #8a87a8;
  --accent: #ffd24a;
  --accent-soft: rgba(255,210,74,0.12);
  --radius: 14px;
}

html { background: #05050c; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: radial-gradient(ellipse at top, #1a1a35 0%, var(--bg) 60%);
  min-height: 100vh;
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* Header */
.bar {
  display: flex; align-items: center;
  max-width: 900px; margin: 0 auto; padding: 24px 24px 8px;
}
.wordmark {
  font-weight: 900; letter-spacing: -0.02em; font-size: 20px;
  background: linear-gradient(135deg, var(--accent), #ff9f4a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.wordmark .dot { opacity: 0.6; }

main {
  max-width: 900px; margin: 0 auto;
  padding: 12px 24px 80px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}

/* Status line */
.status {
  font-size: 14px; color: var(--muted); text-align: center;
}

/* Canvas */
.canvas-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #111118;
  line-height: 0;
}
#canvas {
  width: 100%;
  aspect-ratio: 8 / 5;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Palette */
.palette {
  display: flex; flex-wrap: wrap;
  gap: 6px; justify-content: center;
  max-width: 360px;
}
.swatch {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.swatch:hover { transform: scale(1.15); }
.swatch.on { border-color: var(--accent); transform: scale(1.2); }

/* Hint */
.hint {
  font-size: 12px; color: var(--muted);
  text-align: center; letter-spacing: 0.02em;
}

/* Ad slot */
.ad-slot {
  width: 100%; min-height: 90px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Footer */
.foot { margin-top: 24px; }
.legal {
  font-size: 11px; color: rgba(255,255,255,0.25);
  text-align: center; letter-spacing: 0.01em; line-height: 1.8;
}
.kofi-inline { color: rgba(255,255,255,0.25); text-decoration: none; transition: color .15s; }
.kofi-inline:hover { color: var(--accent); }
.linklike {
  background: none; border: 0; padding: 0; font: inherit;
  color: rgba(255,255,255,0.25); cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(255,255,255,0.12);
}
.linklike:hover { color: var(--accent); }

/* Modals */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; justify-content: center; align-items: center;
  z-index: 50; padding: 4vh 4vw; backdrop-filter: blur(6px);
}
.modal-box {
  position: relative; width: min(520px, 100%); height: min(720px, 90vh);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  overflow: hidden;
}
.modal-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(255,255,255,0.08); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 20px; line-height: 1; color: var(--fg);
}
.modal-close:hover { background: rgba(255,255,255,0.15); }
.modal iframe { width: 100%; height: 100%; border: 0; }
.modal-text { height: auto; max-height: 90vh; }
.modal-scroll {
  padding: 32px 28px 28px; overflow-y: auto;
  max-height: 90vh; font-size: 14px; line-height: 1.6;
}
.modal-scroll h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: var(--fg); }
.modal-scroll h3 {
  margin: 22px 0 6px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
}
.modal-scroll p { margin: 0 0 10px; color: var(--muted); }
.modal-scroll .updated { font-size: 12px; color: var(--muted); margin-bottom: 16px; }
.modal-scroll a { color: var(--accent); text-decoration: none; }
.modal-scroll a:hover { text-decoration: underline; }
