/* Mindgamr — shared styles */
:root {
  --bg: #ffffff;
  --surface: #f6f6f6;
  --border: #e0e0e0;
  --border-strong: #c0c0c0;
  --text: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #999;
  --green: #6aaa64;
  --green-bg: #eaf3de;
  --green-text: #3b6d11;
  --yellow: #c9b458;
  --yellow-bg: #faeeda;
  --yellow-text: #854f0b;
  --grey: #787c7e;
  --blue: #378add;
  --blue-bg: #e6f1fb;
  --red-bg: #fcebeb;
  --red-text: #a32d2d;
  --radius: 4px;
  --tile: 54px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  text-decoration: none;
  color: var(--text);
  text-transform: uppercase;
}

.logo span { color: var(--green); }

nav { display: flex; gap: 4px; }

nav a {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  transition: background 0.15s;
}

nav a:hover { background: var(--surface); color: var(--text); }
nav a.active { background: var(--text); color: #fff; }

.header-right { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius);
}
.icon-btn:hover { background: var(--surface); }

/* ── Ad banner ── */
.ad-banner {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: var(--text-muted);
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Main ── */
main { max-width: 420px; margin: 0 auto; padding: 1.25rem 0.75rem 6rem; }

/* ── Stats ── */
.stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.stat { text-align: center; }
.stat-n { font-size: 22px; font-weight: 600; }
.stat-l { font-size: 10px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; margin-top: 1px; }

/* ── Puzzle box ── */
.puzzle-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
}
.puzzle-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* ── Tiles ── */
.tile-row { display: flex; gap: 5px; justify-content: center; }

.tile {
  width: var(--tile);
  height: var(--tile);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background 0.15s;
  user-select: none;
}
.tile.correct { background: var(--green); border-color: var(--green); color: #fff; }
.tile.present { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.tile.absent  { background: var(--grey);  border-color: var(--grey);  color: #fff; }
.tile.active  { border-color: var(--blue); background: var(--blue-bg); }
.tile.filled  { border-color: var(--border-strong); }
.tile.hinted  { border-color: var(--yellow); background: var(--yellow-bg); color: var(--yellow-text); }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}
.shake { animation: shake 0.4s; }

/* ── Message ── */
.msg-wrap { min-height: 24px; text-align: center; margin: 0.5rem 0; }
.msg {
  display: inline-block;
  font-size: 13px;
  font-weight: 500;
  background: var(--text);
  color: #fff;
  border-radius: 20px;
  padding: 4px 14px;
  opacity: 0;
  transition: opacity 0.2s;
}
.msg.show { opacity: 1; }

/* ── Buttons ── */
.btn-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 1rem; }

.btn {
  padding: 9px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.btn:hover { background: var(--surface); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-hint { border-color: var(--yellow); color: var(--yellow-text); background: var(--yellow-bg); }
.btn-hint:hover { background: #f5d99a; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: #5a9955; }

/* ── Result ── */
.result-box {
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  display: none;
  margin-top: 0.75rem;
}
.result-box.win  { background: var(--green-bg); color: var(--green-text); }
.result-box.lose { background: var(--red-bg);   color: var(--red-text);   }
.result-box .rt  { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.result-box .rs  { font-size: 13px; }

/* ── Keyboard ── */
.keyboard { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.kb-row { display: flex; gap: 5px; }
.key {
  height: 56px;
  min-width: 36px;
  padding: 0 6px;
  border: none;
  border-radius: var(--radius);
  background: #d3d6da;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.key:hover { opacity: 0.85; }
.key.wide { min-width: 56px; font-size: 12px; }
.key.correct { background: var(--green); color: #fff; }
.key.present { background: var(--yellow); color: #fff; }
.key.absent  { background: var(--grey);  color: #fff; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 340px;
  width: 90%;
  position: relative;
}
.modal h2 { font-size: 15px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 1rem; text-align: center; }
.modal p  { font-size: 14px; color: var(--text-secondary); margin-bottom: 0.75rem; line-height: 1.5; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.ex-row { display: flex; gap: 4px; margin: 0.5rem 0; }
.ex-tile { width: 38px; height: 38px; border: 2px solid var(--border-strong); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; }
.ex-tile.correct { background: var(--green); border-color: var(--green); color: #fff; }
.ex-tile.present { background: var(--yellow); border-color: var(--yellow); color: #fff; }
.ex-tile.absent  { background: var(--grey); border-color: var(--grey); color: #fff; }

/* ── Homepage ── */
.home-hero { text-align: center; padding: 2rem 1rem 1.5rem; }
.home-hero h1 { font-size: 36px; font-weight: 700; letter-spacing: 4px; margin-bottom: 6px; }
.home-hero h1 span { color: var(--green); }
.home-hero p { font-size: 15px; color: var(--text-secondary); }

.game-cards { display: flex; flex-direction: column; gap: 12px; padding: 0 0.75rem; max-width: 480px; margin: 0 auto 2rem; }

.game-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--bg);
}
.game-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.game-card-left { display: flex; align-items: center; gap: 1rem; }
.game-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.game-icon.scramble { background: var(--green-bg); }
.game-icon.numbers  { background: var(--blue-bg); }
.game-icon.cipher   { background: var(--yellow-bg); }
.game-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.game-card p  { font-size: 13px; color: var(--text-secondary); }
.game-card-arrow { font-size: 20px; color: var(--text-muted); }
.game-badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 10px; background: var(--green-bg); color: var(--green-text); }

/* ── Footer ── */
footer { text-align: center; font-size: 11px; color: var(--text-muted); padding: 1.5rem 1rem; border-top: 1px solid var(--border); margin-top: 2rem; }
footer a { color: var(--text-muted); }

/* ── Ad side panels ── */
@media (min-width: 900px) {
  .ad-side { display: block; position: fixed; top: 120px; width: 160px; min-height: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-muted); }
  .ad-side.left  { left: calc(50% - 380px); }
  .ad-side.right { right: calc(50% - 380px); }
}
@media (max-width: 899px) { .ad-side { display: none; } }

/* ── Responsive ── */
@media (max-width: 380px) {
  :root { --tile: 48px; }
  .key { height: 50px; min-width: 32px; }
  .key.wide { min-width: 48px; }
  nav a { padding: 6px 8px; font-size: 12px; }
}
