:root { --bg: #f8fafc; --accent: #38bdf8; --dark: #1e293b; --grid-line: #cbd5e1; }
body { margin: 0; font-family: 'Quicksand', sans-serif; background: var(--bg); color: var(--dark); user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---------- LOBBY ---------- */
.lobby-container { max-width: 900px; margin: 40px auto; padding: 0 20px; }
.puzzle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; }
@media (min-width: 600px) { .puzzle-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; } }

.puzzle-card { background: white; padding: 20px; border-radius: 20px; text-decoration: none; color: inherit; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.02); border: 2px solid transparent; transition: 0.2s; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; }
.puzzle-card:hover { border-color: var(--accent); transform: translateY(-3px); }

.status-container { position: absolute; top: -8px; right: -8px; z-index: 50; }
.completion-seal { width: 32px; height: 32px; background: #88b04b; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: bold; border: 3px solid #ffffff; box-shadow: 0 4px 10px rgba(136, 176, 75, 0.3); }
.progress-seal { width: 32px; height: 32px; background: #f59e0b; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; border: 3px solid #ffffff; box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3); }

.mini-preview-box { width: 52px; height: 52px; background: #0f172a; border-radius: 12px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 8px; box-sizing: border-box; box-shadow: 0 4px 10px rgba(56, 189, 248, 0.2); }
.mini-sky-bar { width: 6px; background: var(--accent); border-radius: 2px 2px 0 0; transition: 0.3s; }
.mini-sky-bar.h1 { height: 30%; background: #60a5fa; }
.mini-sky-bar.h2 { height: 55%; background: #3b82f6; }
.mini-sky-bar.h3 { height: 80%; background: #2563eb; }
.mini-sky-bar.h4 { height: 100%; background: #1d4ed8; }

.diff-pill { font-size: 10px; text-transform: uppercase; font-weight: 700; padding: 2px 10px; border-radius: 20px; margin-top: 2px; letter-spacing: 0.5px; }
.diff-easy { background: #dcfce7; color: #166534; }
.diff-medium { background: #fef9c3; color: #854d0e; }
.diff-hard { background: #ffedd5; color: #9a3412; }
.diff-extreme { background: #fee2e2; color: #991b1b; }

.noos-pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 40px 0; font-weight: 700; }
.pagination-btn { background: white; padding: 8px 16px; border-radius: 12px; text-decoration: none; color: #475569; border: 2px solid transparent; box-shadow: 0 4px 10px rgba(0,0,0,0.02); transition: 0.2s; font-size: 14px; }
.pagination-btn:hover:not(.disabled) { border-color: var(--accent); color: var(--dark); }
.pagination-btn.active { background: var(--accent); color: white; pointer-events: none; }
.pagination-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ---------- GAME ----------
   The HUD and the board share one column whose width is capped by BOTH the
   viewport width and the viewport height (minus ~230px of page chrome), so on a
   desktop the board grows to fill the screen without ever needing a scroll. */
.game-layout-container { display: flex; justify-content: center; margin: 16px auto; padding: 0 15px; width: 100%; box-sizing: border-box; }
.sky-column { display: flex; flex-direction: column; gap: 14px; width: min(100%, max(320px, calc(100vh - 230px))); }

.stats-hud-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; background: #ffffff; padding: 12px 20px; border-radius: 18px; box-shadow: 0 4px 15px rgba(0,0,0,0.02); border: 1px solid #f1f5f9; box-sizing: border-box; gap: 10px; flex-wrap: wrap; }
.hud-moves-box { font-weight: 700; font-size: 15px; color: #475569; }
.hud-moves-box span { color: var(--accent); font-size: 18px; margin-left: 4px; }

.hud-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.hud-btn { background: #f1f5f9; border: none; padding: 9px 14px; border-radius: 12px; font-family: inherit; font-size: 13px; font-weight: 700; color: #475569; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.2s; white-space: nowrap; }
.hud-btn:hover { background: #cbd5e1; color: var(--dark); }
.hud-btn.btn-reset { background: #fff1f2; color: #e11d48; }
.hud-btn.btn-reset:hover { background: #ffe4e6; }
.hud-btn.btn-hint { background: #f0fdf4; color: #16a34a; }
.hud-btn.btn-hint:hover { background: #dcfce7; }

.board-wrapper { container-type: inline-size; background: #ffffff; padding: clamp(12px, 3.5%, 32px); border-radius: 24px; box-shadow: 0 15px 35px rgba(15, 23, 42, 0.05); border: 1px solid #e2e8f0; width: 100%; aspect-ratio: 1 / 1; box-sizing: border-box; display: flex; align-items: center; justify-content: center; }

.sky-outer-grid { display: grid; grid-template-columns: repeat(var(--total-cells), 1fr); grid-template-rows: repeat(var(--total-cells), 1fr); width: 100%; height: 100%; gap: clamp(3px, 1cqw, 8px); }

/* Type scales with the board. First declaration is the fallback for browsers
   without container query units. */
.sky-clue-node, .sky-input-cell { font-size: 20px; font-size: clamp(14px, calc(42cqw / var(--total-cells)), 46px); }

.sky-clue-node { display: flex; align-items: center; justify-content: center; font-weight: 700; color: #64748b; background: transparent; }

.sky-input-cell { background: #f8fafc; border: 2px solid var(--grid-line); border-radius: clamp(8px, 1.6cqw, 14px); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #1e293b; cursor: pointer; transition: all 0.15s ease-in-out; outline: none; -webkit-user-select: text; user-select: text; caret-color: transparent; }
.sky-input-cell:hover { border-color: #94a3b8; }
.sky-input-cell:focus { border-color: var(--accent); background: #ffffff; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25); }
.sky-input-cell.hinted-cell { background: #fef3c7 !important; border-color: #f59e0b !important; color: #b45309 !important; pointer-events: none; }

@media (max-width: 480px) {
    .stats-hud-bar { padding: 10px 12px; }
    .hud-btn { padding: 8px 10px; font-size: 12px; }
}