/* Glyphloop — original styles */
:root {
  --bg: #0f1220;
  --bg2: #171b2e;
  --card: #1e2440;
  --text: #eef1ff;
  --muted: #9aa3c7;
  --line: #2c3358;
  --correct: #3dba7a;
  --present: #d4a017;
  --absent: #4a516e;
  --key: #2a3152;
  --accent: #7c6cff;
  --accent2: #56c7ff;
  --danger: #ff6b7a;
  --radius: 14px;
  --max: 720px;
  --ad-h: 90px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100%; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.wrap { width: min(100% - 1.5rem, var(--max)); margin: 0 auto; }
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(15,18,32,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 0; width: min(100% - 1.5rem, var(--max)); margin: 0 auto;
}
.logo {
  font-weight: 800; letter-spacing: .02em; font-size: 1.15rem;
  color: var(--text); display: flex; align-items: center; gap: .5rem;
}
.logo span.mark {
  display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-size: .85rem;
}
.nav { display: flex; flex-wrap: wrap; gap: .65rem 1rem; font-size: .9rem; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--text); }
/* Ad slots — reserved space, never over controls */
.ad-slot {
  min-height: var(--ad-h);
  margin: .75rem auto;
  width: min(100% - 1.5rem, var(--max));
  border: 1px dashed var(--line);
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--muted); font-size: .75rem; letter-spacing: .04em;
  background: rgba(255,255,255,.02);
}
.ad-slot.leader { min-height: 90px; }
.ad-slot.footer-banner { min-height: 100px; margin-bottom: 1.25rem; }
.hero {
  text-align: center; padding: 1.25rem 0 .5rem;
}
.hero h1 { margin: 0 0 .35rem; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.hero p { margin: 0; color: var(--muted); font-size: .98rem; }
.mode-bar {
  display: flex; justify-content: center; gap: .5rem; flex-wrap: wrap;
  margin: 1rem 0 .5rem;
}
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; cursor: pointer;
}
.chip.active { color: var(--text); border-color: var(--accent); background: #262b55; }
.stats {
  display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap;
  color: var(--muted); font-size: .85rem; margin-bottom: .75rem;
}
.stats strong { color: var(--text); display: block; font-size: 1.15rem; text-align: center; }
.board-wrap {
  display: flex; justify-content: center; padding: .5rem 0 1rem;
}
.board {
  display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px;
  width: min(100%, 330px);
}
.row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile {
  aspect-ratio: 1; border: 2px solid var(--line); border-radius: 8px;
  display: grid; place-items: center; font-weight: 800; font-size: 1.35rem;
  text-transform: uppercase; background: var(--bg2); transition: transform .12s ease;
}
.tile.filled { border-color: #4a5485; }
.tile.correct { background: var(--correct); border-color: var(--correct); color: #062314; }
.tile.present { background: var(--present); border-color: var(--present); color: #2a1d00; }
.tile.absent { background: var(--absent); border-color: var(--absent); color: #d7dbef; }
.tile.pop { transform: scale(1.08); }
.keyboard {
  width: min(100% - 1rem, 520px); margin: 0 auto 1rem;
  display: grid; gap: 6px; padding-bottom: calc(.5rem + var(--safe-bottom));
}
.krow { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1 1 0; max-width: 42px; min-height: 48px; border: 0; border-radius: 8px;
  background: var(--key); color: var(--text); font-weight: 700; font-size: .85rem;
  cursor: pointer; touch-action: manipulation;
}
.key.wide { max-width: 68px; font-size: .72rem; }
.key.correct { background: var(--correct); color: #062314; }
.key.present { background: var(--present); color: #2a1d00; }
.key.absent { background: #2d3348; color: #8b92b0; }
.toolbar {
  display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: .25rem 0 1rem;
}
.btn {
  border: 0; border-radius: 999px; padding: .65rem 1.1rem; font-weight: 700;
  cursor: pointer; background: linear-gradient(135deg, var(--accent), #5a8dff); color: white;
}
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.toast {
  position: fixed; left: 50%; top: 4.5rem; transform: translateX(-50%);
  background: #11162a; border: 1px solid var(--line); color: var(--text);
  padding: .55rem 1rem; border-radius: 999px; font-size: .9rem; z-index: 50;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none;
  place-items: center; z-index: 60; padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(100%, 420px); background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; max-height: 85vh; overflow: auto;
}
.modal h2 { margin-top: 0; }
.modal .share-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border-radius: 10px; padding: .85rem; white-space: pre-wrap;
  font-size: .9rem; margin: .75rem 0;
}
.content {
  width: min(100% - 1.5rem, var(--max)); margin: 0 auto; padding: 1.25rem 0 2.5rem;
  line-height: 1.65; color: #d5daf0;
}
.content h1 { margin-top: 0; font-size: 1.75rem; color: var(--text); }
.content h2 { margin-top: 1.75rem; font-size: 1.25rem; color: var(--text); }
.content h3 { margin-top: 1.25rem; color: var(--text); }
.content p, .content li { color: var(--muted); }
.content ul { padding-left: 1.2rem; }
.content .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin: 1rem 0;
}
.site-footer {
  border-top: 1px solid var(--line); padding: 1.5rem 0 2rem; color: var(--muted); font-size: .85rem;
}
.site-footer .inner {
  width: min(100% - 1.5rem, var(--max)); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; justify-content: space-between;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: .75rem 1rem; }
.example { display: flex; gap: 6px; margin: .5rem 0 1rem; }
.example .tile { width: 42px; height: 42px; font-size: 1rem; }
@media (max-width: 480px) {
  .key { min-height: 46px; font-size: .78rem; }
  .tile { font-size: 1.2rem; }
  .nav { font-size: .8rem; gap: .5rem .75rem; }
}
