/* Watts & Whiskers — shared styles (game + wall + modals).
   Layout: game left, wall right; stacks on mobile. */

:root {
  --bg: #10141c;
  --panel: #1a2230;
  --panel-2: #212c3d;
  --line: #33405a;
  --text: #e8edf5;
  --muted: #9aa7bd;
  --accent: #ffd54f;        /* watts yellow */
  --accent-2: #ff8a5c;      /* sponsor orange */
  --green: #5aad6f;
  --yellow: #c9b458;
  --gray: #3a4459;
  --pet: #7fc8f8;           /* pet theme accent */
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  min-height: 100vh;
}

/* ---------- layout ---------- */

.ww-shell { display: flex; gap: 20px; padding: 16px; max-width: 1100px; margin: 0 auto; }
.ww-main { flex: 1.4; min-width: 0; }
.ww-side { flex: 1; min-width: 280px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 820px) {
  .ww-shell { flex-direction: column; }
  .ww-side { max-width: none; }
}

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

.ww-header { text-align: center; padding: 14px 0 6px; }
.ww-logo { font-size: 26px; font-weight: 800; letter-spacing: 0.5px; margin: 0; }
.ww-logo .ww-zap { color: var(--accent); }
.ww-tagline { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.ww-theme {
  display: inline-block; margin-top: 8px; padding: 4px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; color: var(--pet);
}
.ww-countdown { color: var(--muted); font-size: 12px; margin: 6px 0 0; font-variant-numeric: tabular-nums; }

/* ---------- board ---------- */

.ww-board { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; }
.ww-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ww-tile {
  width: 56px; height: 56px; border: 2px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; text-transform: uppercase;
  background: transparent; transition: border-color 0.1s;
}
.ww-tile.filled { border-color: var(--muted); }
.ww-tile.correct { background: var(--green); border-color: var(--green); color: #fff; }
.ww-tile.present { background: var(--yellow); border-color: var(--yellow); color: #1a1a1a; }
.ww-tile.absent { background: var(--gray); border-color: var(--gray); color: #cfd6e4; }
.ww-tile.flip { animation: wwFlip 0.45s ease; }
@keyframes wwFlip {
  0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); }
}
.ww-board.shake { animation: wwShake 0.4s; }
@keyframes wwShake {
  0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); } 75% { transform: translateX(-4px); }
}
@media (max-width: 420px) { .ww-tile { width: 48px; height: 48px; font-size: 22px; } }

/* ---------- keyboard ---------- */

.ww-keyboard { display: flex; flex-direction: column; gap: 6px; align-items: center; padding-bottom: 8px; }
.ww-kb-row { display: flex; gap: 5px; }
.ww-key {
  min-width: 34px; height: 52px; padding: 0 8px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.ww-key:active { transform: scale(0.96); }
.ww-key-wide { min-width: 62px; font-size: 12px; }
.ww-key.correct { background: var(--green); border-color: var(--green); color: #fff; }
.ww-key.present { background: var(--yellow); border-color: var(--yellow); color: #1a1a1a; }
.ww-key.absent { background: var(--gray); border-color: var(--gray); color: #8b95a8; }
@media (max-width: 420px) { .ww-key { height: 46px; min-width: 28px; } }

/* ---------- wall (side panel) ---------- */

.ww-panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.ww-panel h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.ww-meter-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ww-meter-title { font-size: 13px; color: var(--muted); }
.ww-meter-value { font-size: 24px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.ww-meter-track { height: 12px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.ww-meter-fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; transition: width 0.8s ease; }
.ww-meter-goal { font-size: 12px; color: var(--muted); margin-top: 8px; }
.ww-meter-hit { font-size: 12px; color: var(--green); margin-top: 4px; }
.ww-meter-partner { font-size: 11px; color: var(--muted); margin-top: 4px; }
.ww-meter-partner a { color: inherit; font-weight: 600; text-decoration: underline; }

.ww-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--muted); }

.ww-status { font-size: 11px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ww-status.live { color: var(--green); border-color: var(--green); }

/* feed */
.ww-feed { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.ww-feed-item {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--panel-2); border-radius: 8px; padding: 8px 10px;
  font-size: 13px; line-height: 1.35; animation: wwSlide 0.4s ease;
}
@keyframes wwSlide { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ww-feed-icon { flex: 0 0 auto; }
.ww-feed-text { flex: 1; min-width: 0; }
.ww-feed-ago { flex: 0 0 auto; color: var(--muted); font-size: 11px; white-space: nowrap; }

/* cities */
.ww-cities-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.ww-city-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.ww-city-name { flex: 0 0 118px; }
.ww-city-bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.ww-city-bar span { display: block; height: 100%; background: var(--pet); border-radius: 999px; }
.ww-city-watts { flex: 0 0 44px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- CTAs ---------- */

.ww-cta {
  display: block; text-align: center; padding: 12px 14px; margin-top: 10px;
  border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none;
  border: 1px solid var(--line); color: var(--text); background: var(--panel-2);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.ww-cta:hover { filter: brightness(1.12); transform: translateY(-1px); }
.ww-cta-primary { background: linear-gradient(90deg, var(--accent-2), var(--accent)); color: #241a00; border: none; }
.ww-cta-donate { border-color: #b8860b; }
.ww-cta-foster { border-color: var(--pet); color: var(--pet); }
.ww-cta-sm { display: inline-block; padding: 6px 12px; font-size: 12px; margin: 0; }
.ww-cta-block { display: flex; flex-direction: column; gap: 2px; }
.ww-cta-block .ww-cta { margin-top: 6px; }

/* ---------- identity gate / replay notice ---------- */

.ww-gate {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 14, 20, 0.92);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.ww-gate-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; max-width: 380px; width: 100%; text-align: center;
}
.ww-gate-card h2 { margin: 0 0 6px; }
.ww-gate-card p { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.ww-gate-card input {
  width: 100%; padding: 10px 12px; font-size: 16px;
  background: var(--panel-2); color: var(--text);
  border: 2px solid var(--line); border-radius: 8px; outline: none; text-align: center;
}
.ww-gate-card input:focus { border-color: var(--accent); }
.ww-emoji-row { display: flex; justify-content: center; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.ww-emoji-btn {
  font-size: 20px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel-2); border: 2px solid var(--line); cursor: pointer;
}
.ww-emoji-btn.picked { border-color: var(--accent); }
.ww-gate-go {
  width: 100%; padding: 12px; font-size: 15px; font-weight: 800; cursor: pointer;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  color: #241a00; border: none; border-radius: 10px;
}

/* ---------- result modal ---------- */

.ww-result {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 20, 0.92);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.ww-result-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; max-width: 400px; width: 100%; text-align: center;
  animation: wwSlide 0.4s ease;
}
.ww-result-card h2 { margin: 0 0 8px; font-size: 22px; }
.ww-result-card p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 8px 0 14px; }
.ww-result-card strong { color: var(--accent); }
#ww-share {
  width: 100%; padding: 11px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  margin-top: 12px;
}
.ww-result-close {
  width: 100%; padding: 11px; font-size: 14px; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--muted); border: none; border-radius: 10px;
  margin-top: 8px;
}
.ww-result-close:hover { color: var(--text); }

/* ---------- marketing capture modal ---------- */

.ww-capture, .ww-archive {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(10, 14, 20, 0.92);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.ww-capture-card, .ww-archive-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; max-width: 380px; width: 100%;
  animation: wwSlide 0.4s ease;
}
.ww-capture-card h2, .ww-archive-card h2 { margin: 0 0 6px; font-size: 19px; }
.ww-capture-card p, .ww-archive-card p { color: var(--muted); font-size: 13px; margin: 6px 0 14px; line-height: 1.5; }
.ww-capture-card label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin: 10px 0 4px;
}
.ww-capture-card input[type="email"], .ww-capture-card input:not([type]) {
  width: 100%; padding: 10px 12px; font-size: 15px;
  background: var(--panel-2); color: var(--text);
  border: 2px solid var(--line); border-radius: 8px; outline: none;
}
.ww-capture-card input:focus { border-color: var(--accent); }
.ww-cap-consent {
  display: flex !important; gap: 8px; align-items: flex-start; text-transform: none !important;
  letter-spacing: 0 !important; font-size: 12px !important; color: var(--muted);
  margin: 14px 0 8px; cursor: pointer; line-height: 1.45;
}
.ww-cap-consent input { margin-top: 2px; accent-color: var(--accent); }
.ww-cap-err { color: #ff8a5c; font-size: 12px; min-height: 16px; margin: 6px 0; }

/* ---------- archive calendar ---------- */

.ww-archive-card { max-width: 460px; }
.ww-archive-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 8px 0 14px; max-height: 300px; overflow-y: auto;
}
.ww-arch-day {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; text-align: center;
}
.ww-arch-day:hover:not(:disabled) { border-color: var(--accent); }
.ww-arch-day:disabled { opacity: 0.55; cursor: default; }
.ww-arch-day.done-win { border-color: rgba(107, 184, 122, 0.6); }
.ww-arch-day.done-loss { border-color: rgba(255, 138, 92, 0.4); }
.ww-arch-date { font-size: 13px; font-weight: 700; }
.ww-arch-word { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ww-archive-btn {
  margin-top: 8px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 999px;
}
.ww-archive-btn:hover:not(:disabled) { border-color: var(--accent); }
.ww-archive-btn:disabled { opacity: 0.5; cursor: default; }
.ww-archive-note { font-size: 11px; color: var(--muted); margin-top: 8px; }

/* ---------- CTA secondary grid ---------- */

.ww-cta-secondary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
}
.ww-cta-mini {
  font-size: 12px; padding: 9px 8px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.ww-cta-mini:hover { border-color: var(--accent); }

/* ---------- toast ---------- */

.ww-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(80px);
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 60;
  opacity: 0; transition: all 0.3s ease; pointer-events: none; max-width: 90vw; text-align: center;
}
.ww-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- top players (per-player ranking) ---------- */

.ww-top { display: flex; flex-direction: column; gap: 6px; }
.ww-top-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px; font-size: 13px;
}
.ww-top-row:first-child { border-color: var(--accent); }
.ww-top-rank { width: 26px; text-align: center; color: var(--muted); font-weight: 700; font-size: 12px; }
.ww-top-avatar { font-size: 18px; line-height: 1; }
.ww-top-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ww-top-who strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ww-top-city { color: var(--muted); font-size: 11px; }
.ww-top-streak { color: var(--accent-2); font-size: 11px; white-space: nowrap; }
.ww-top-watts { color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ww-top-watts-label { color: var(--muted); font-weight: 400; font-size: 10px; }
.ww-top-empty { color: var(--muted); font-size: 12px; }

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

.ww-footer {
  text-align: center; color: var(--muted); font-size: 11px;
  padding: 10px 16px 20px; border-top: 1px solid var(--line); margin-top: 12px;
}
.ww-footer a { color: var(--muted); }
