[hidden] { display: none !important; }
:root {
  --bg: #0b0b12; --panel: #161622; --panel2: #20202e; --text: #f4f4f8; --muted: #9a9ab0;
  --pink: #FF3B8D; --ok: #2DC653; --bad: #ff5252;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, system-ui, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; }
.btn {
  border: 0; border-radius: 14px; padding: 14px 22px; font-weight: 800; background: var(--panel2); color: var(--text);
}
.btn.primary { background: #fff; color: #111; }
.btn.pink { background: var(--pink); color: #fff; }
.btn.small { padding: 8px 14px; font-size: 0.9rem; border-radius: 10px; }
.btn:disabled { opacity: 0.4; cursor: default; }
.logo { font-weight: 900; letter-spacing: 0.04em; color: var(--pink); text-shadow: 0 0 18px rgba(255, 59, 141, 0.6); }
#conn { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); display: inline-block; }
#conn.off { background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* Cards */
.card { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; background: #000; padding: 6px; border-radius: 12px; aspect-ratio: 1; }
.card.mini { gap: 2px; padding: 3px; border-radius: 6px; }
.cell {
  border: 0; padding: 0; border-radius: 6px; position: relative; aspect-ratio: 1;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c) 35%, white) 0%, var(--c) 75%);
}
.card.mini .cell { border-radius: 2px; }
.cell.marked::after {
  content: ""; position: absolute; inset: 12%;
  background:
    linear-gradient(45deg, transparent 42%, #111 42%, #111 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, #111 42%, #111 58%, transparent 58%);
}
.cell.marked { filter: saturate(0.7) brightness(0.85); }
.cell.win { outline: 3px solid #fff; outline-offset: -3px; filter: none; }
.cell:disabled { cursor: default; }
.cell.can { animation: pulse 1s ease-in-out infinite; outline: 3px solid #fff; outline-offset: -3px; }
.cell.hl { box-shadow: inset 0 0 0 3px rgba(255,255,255,0.9); }
@keyframes pulse { 50% { transform: scale(0.88); } }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.open { display: flex; }
.sheet { background: var(--panel); border-radius: 20px; padding: 24px; width: min(720px, 100%); max-height: 90vh; overflow: auto; }
.sheet h2 { margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; }
.sheet h3 { color: var(--muted); text-transform: uppercase; font-size: 0.9rem; letter-spacing: 0.06em; margin: 22px 0 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 12px; align-items: center; padding: 8px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ok); }
.note { color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #fff; color: #111;
  padding: 14px 22px; border-radius: 14px; font-weight: 700; z-index: 99; display: none;
}
.toast.show { display: block; animation: pop 0.3s; }
@keyframes pop { 0% { transform: translateX(-50%) scale(0.8); } 100% { transform: translateX(-50%) scale(1); } }

/* One away from winning */
@keyframes nearGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 141, 0); } 50% { box-shadow: 0 0 22px 4px rgba(255, 59, 141, 0.85); } }
@keyframes hotGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); transform: scale(1); } 50% { box-shadow: 0 0 30px 8px rgba(255, 214, 10, 0.95); transform: scale(1.03); } }
.near { animation: nearGlow 2.2s ease-in-out infinite; }
.hot { animation: hotGlow 0.6s ease-in-out infinite; }
.cell.need { outline: 2px dashed rgba(255, 255, 255, 0.9); outline-offset: -3px; }
.card.mini .cell.need { outline-width: 1px; outline-offset: -2px; }
