/* Activities: brain games & puzzles (templates/activities/index.html, js/activities.js) */

.ac-page { --ac-card: #fff; --ac-line: #e9e6f7; --ac-ink: var(--text-main, #1e293b); --ac-muted: var(--text-muted, #64748b); --ac-soft: #f6f4ff;
    --ac-purple: #7c3aed; --ac-cell: #fff; --ac-cell-line: #dcd8ee; --ac-block: #d4d4d8;
    background: linear-gradient(180deg, #f7f5ff 0%, transparent 420px); }
[data-bs-theme="dark"] .ac-page, html.dark-theme .ac-page { --ac-card: var(--dark-2, #161b22); --ac-line: var(--dark-border, #30363d); --ac-soft: rgba(139, 92, 246, .1);
    --ac-cell: #1d2430; --ac-cell-line: #343c4b; --ac-block: #3f4654; background: none; }

.ac-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }

/* ---------- sidebar ---------- */
.ac-side { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 100px); overflow-y: auto; padding-bottom: 6px; scrollbar-width: thin; }
.ac-search { position: relative; margin: 0; }
.ac-search i { position: absolute; left: 12px; font-size: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.ac-search input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--ac-line); background: var(--ac-card); padding: 0 10px 0 34px; font-size: 13px; color: var(--ac-ink); outline: 0; }
.ac-search input:focus { border-color: var(--ac-purple); box-shadow: 0 0 0 3px rgba(124, 58, 237, .15); }
.ac-side-toggle { display: none; }
.ac-side-groups { display: flex; flex-direction: column; gap: 10px; }
.ac-group { --cc: #f97316; border-radius: 14px; padding: 8px; border: 1px solid color-mix(in srgb, var(--cc) 22%, transparent);
    background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 10%, var(--ac-card)), color-mix(in srgb, var(--cc) 4%, var(--ac-card))); }
.ac-group-title { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 800; margin: 2px 6px 6px; color: color-mix(in srgb, var(--cc) 70%, var(--ac-ink)); }
.ac-group-title i { color: var(--cc); }
.ac-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-group li[hidden] { display: none; }
.ac-group a { display: flex; align-items: center; gap: 9px; padding: 5px 7px; border-radius: 9px; text-decoration: none; color: var(--ac-ink); font-size: 13px; font-weight: 500; transition: background .15s, transform .15s; }
.ac-group a:hover { background: color-mix(in srgb, var(--cc) 12%, transparent); color: var(--ac-ink); }
.ac-group a.is-active { background: linear-gradient(135deg, var(--cc), color-mix(in srgb, var(--cc) 75%, #000)); color: #fff; font-weight: 700; box-shadow: 0 6px 14px -9px var(--cc); }
.ac-group a.is-active .ac-gicon { background: rgba(255, 255, 255, .22); box-shadow: none; }
.ac-gname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-new { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: #dcfce7; color: #15803d; }
.ac-group a.is-active .ac-new { background: #22c55e; color: #fff; }
.ac-today { color: #f59e0b; font-size: 13px; }
.ac-group a.is-active .ac-today { color: #fde68a; }
.ac-nomatch { font-size: 13px; color: var(--ac-muted); text-align: center; margin: 4px 0; }

/* game icon tile */
.ac-gicon { --gc: #8b5cf6; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; color: #fff; font-size: 14px; overflow: hidden;
    background: linear-gradient(145deg, var(--gc), color-mix(in srgb, var(--gc) 70%, #000)); box-shadow: 0 4px 10px -6px var(--gc); }
.ac-gicon img { width: 100%; height: 100%; object-fit: cover; }
.ac-gicon.is-sm { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.ac-gicon.is-lg { width: 44px; height: 44px; font-size: 20px; border-radius: 12px; }

/* ---------- banner ---------- */
.ac-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.ac-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 16px; border: 1px solid #e4dcff;
    background: linear-gradient(120deg, #f1ebff 0%, #f8f5ff 55%, #efe9ff 100%); position: relative; overflow: hidden; }
[data-bs-theme="dark"] .ac-hero, html.dark-theme .ac-hero { background: linear-gradient(120deg, #1d1636, #17142b 55%, #1b1533); border-color: var(--ac-line); }
.ac-hero-art svg { width: 60px; height: 50px; display: block; }
.ac-hero-text { flex: 1; min-width: 200px; }
.ac-hero h1 { font-size: clamp(19px, 1.8vw, 24px); font-weight: 800; letter-spacing: -.02em; margin: 0; color: #4c1d95; }
[data-bs-theme="dark"] .ac-hero h1, html.dark-theme .ac-hero h1 { color: #ddd6fe; }
.ac-hero-text p { margin: 2px 0 0; color: var(--ac-muted); font-size: 13.5px; }
.ac-daily { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; text-decoration: none; color: var(--ac-ink); max-width: 340px;
    background: linear-gradient(120deg, #fff6dc, #fff9e8); border: 1px solid #fde68a; box-shadow: 0 10px 24px -18px #d97706; transition: transform .15s; }
.ac-daily:hover { transform: translateY(-2px); color: var(--ac-ink); }
.ac-daily.is-active { outline: 2px solid #f59e0b; outline-offset: 2px; }
[data-bs-theme="dark"] .ac-daily, html.dark-theme .ac-daily { background: rgba(245, 158, 11, .1); border-color: rgba(245, 158, 11, .35); }
.ac-daily b { display: block; font-size: 14px; font-weight: 800; }
.ac-daily small { display: block; font-size: 11.5px; color: var(--ac-muted); }
.ac-daily small em { font-style: normal; font-weight: 700; color: #b45309; }
.ac-daily .ac-daily-game { color: #b45309; font-weight: 600; margin-top: 2px; }
.ac-daily-cup { font-size: 24px; color: #f59e0b; filter: drop-shadow(0 4px 6px rgba(217, 119, 6, .35)); }
.ac-daily-target { font-size: 20px; color: #e11d48; }

/* ---------- game card ---------- */
.ac-board-card { background: var(--ac-card); border: 1px solid var(--ac-line); border-radius: 18px; padding: 16px; box-shadow: 0 6px 24px -16px rgba(15, 23, 42, .18); }
.ac-game-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.ac-game-title { display: flex; align-items: center; gap: 12px; flex: 1 1 280px; min-width: 0; }
.ac-game-title h2 { font-size: 19px; font-weight: 800; color: var(--ac-ink); margin: 0; letter-spacing: -.02em; }
.ac-game-title p { margin: 1px 0 0; font-size: 13px; color: var(--ac-muted); max-width: 380px; }
.ac-pill { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #fef3c7; color: #92400e; letter-spacing: 0; }
.ac-level { position: relative; display: flex; align-items: center; }
.ac-level i { position: absolute; left: 10px; font-size: 13px; color: #f59e0b; pointer-events: none; }
.ac-level select { appearance: none; -webkit-appearance: none; height: 36px; padding: 0 30px 0 30px; border-radius: 10px; border: 1px solid var(--ac-line); background: var(--ac-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748b' d='M1.6 5.1 8 11.5l6.4-6.4-1.1-1.1L8 9.3 2.7 4z'/%3E%3C/svg%3E") no-repeat right 12px center;
    font-weight: 700; font-size: 13px; color: var(--ac-ink); cursor: pointer; }
.ac-level select:disabled { opacity: .7; cursor: not-allowed; }
.ac-scorebar { display: flex; align-items: stretch; border: 1px solid var(--ac-line); border-radius: 12px; overflow: hidden; }
.ac-scorebar > div { padding: 4px 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 70px; }
.ac-scorebar > div + div { border-left: 1px solid var(--ac-line); }
.ac-scorebar span { font-size: 11px; font-weight: 600; color: var(--ac-muted); display: flex; align-items: center; gap: 5px; }
.ac-scorebar span .bi-star-fill { color: #f59e0b; }
.ac-scorebar b { font-size: 16px; font-weight: 800; color: var(--ac-ink); font-variant-numeric: tabular-nums; }
.ac-scorebar .ac-xp { background: #fef9c3; }
.ac-scorebar .ac-xp span { color: #92400e; }
.ac-scorebar .ac-xp b { color: #15803d; }
[data-bs-theme="dark"] .ac-scorebar .ac-xp, html.dark-theme .ac-scorebar .ac-xp { background: rgba(234, 179, 8, .12); }

.ac-game-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); gap: 16px; align-items: start; }
.ac-stage { min-width: 0; border: 1px solid var(--ac-line); border-radius: 14px; padding: 14px; background: var(--ac-soft); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ac-board-wrap { width: 100%; display: flex; justify-content: center; }
.ac-board { outline: 0; width: 100%; max-width: 380px; user-select: none; -webkit-user-select: none; touch-action: none; }
.ac-board.is-free { touch-action: auto; }
.ac-msg { min-height: 20px; font-size: 13px; font-weight: 600; text-align: center; color: var(--ac-muted); }
.ac-msg.is-ok { color: #15803d; }
.ac-msg.is-bad { color: #dc2626; }

.ac-panels { display: flex; flex-direction: column; gap: 12px; }
.ac-panel { border: 1px solid var(--ac-line); border-radius: 14px; padding: 12px 14px; background: var(--ac-card); }
.ac-panel h3 { font-size: 15px; font-weight: 800; color: var(--ac-ink); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.ac-panel h3 i { color: var(--ac-purple); }
.ac-how { background: linear-gradient(180deg, #eef4ff, #f5f8ff); border-color: #dbe6ff; }
.ac-how h3 i { color: #2563eb; }
[data-bs-theme="dark"] .ac-how, html.dark-theme .ac-how { background: rgba(37, 99, 235, .08); border-color: rgba(37, 99, 235, .3); }
.ac-how ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ac-ink); }
.ac-how li { margin: 2px 0; line-height: 1.5; }
.ac-actions { display: flex; gap: 8px; }
.ac-actions .ac-act { flex: 1 1 0; min-width: 0; }
.ac-act { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 36px; padding: 0 8px; border-radius: 10px; font-weight: 700; font-size: 13px; border: 1px solid transparent; cursor: pointer; transition: transform .12s, filter .12s; white-space: nowrap; }
.ac-act:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.03); }
.ac-act:disabled { opacity: .5; cursor: not-allowed; }
.ac-act-restart { background: #f1edff; border-color: #c4b5fd; color: #5b21b6; }
.ac-act-hint { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.ac-act-hint i { color: #f59e0b; }
.ac-act-check { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
[data-bs-theme="dark"] .ac-act-restart, html.dark-theme .ac-act-restart { background: rgba(139, 92, 246, .14); border-color: rgba(139, 92, 246, .4); color: #c4b5fd; }
[data-bs-theme="dark"] .ac-act-hint, html.dark-theme .ac-act-hint { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); color: #fcd34d; }
.ac-practice { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--ac-purple); }
.ac-stats { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.ac-stats > div + div { border-left: 1px solid var(--ac-line); }
.ac-stats span { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ac-muted); font-weight: 600; }
.ac-stats span i { color: #e11d48; }
.ac-stats b { display: block; font-size: 17px; font-weight: 800; color: var(--ac-ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ac-xp-total { font-size: 12px; color: var(--ac-muted); margin: 8px 0 0; text-align: center; }
.ac-xp-total i { color: var(--ac-purple); }
.ac-empty { text-align: center; padding: 70px 20px; color: var(--ac-muted); }
.ac-empty > i { font-size: 46px; color: var(--ac-purple); }
.ac-empty h2 { font-size: 22px; font-weight: 800; color: var(--ac-ink); margin: 10px 0 4px; }

/* ---------- finished dialog ---------- */
.ac-done { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.ac-done[hidden] { display: none; }
.ac-done-card { width: 100%; max-width: 380px; background: var(--ac-card, #fff); border-radius: 22px; padding: 26px 22px 20px; text-align: center; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .4); animation: acPop .35s cubic-bezier(.2, 1.4, .4, 1); }
[data-bs-theme="dark"] .ac-done-card, html.dark-theme .ac-done-card { background: var(--dark-2, #161b22); color: #e2e8f0; }
.ac-done-burst { width: 64px; height: 64px; margin: -52px auto 10px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff; background: linear-gradient(135deg, #f59e0b, #f97316); box-shadow: 0 12px 26px -10px #f97316; }
.ac-done-card h3 { font-size: 19px; font-weight: 800; margin: 0 0 6px; }
.ac-done-card p { font-size: 13.5px; color: var(--text-muted, #64748b); margin: 0 0 16px; }
.ac-done-actions { display: flex; gap: 8px; justify-content: center; }
.ac-done-actions .ac-act { flex: 1; }
@keyframes acPop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* =====================================================================
   Boards of the game engines
   ===================================================================== */
.ac-grid { display: grid; gap: 0; width: 100%; aspect-ratio: 1; border: 2px solid var(--ac-cell-line); border-radius: 12px; overflow: hidden; background: var(--ac-cell); position: relative; }
.ac-cell { position: relative; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--ac-cell-line); border-bottom: 1px solid var(--ac-cell-line);
    font-weight: 800; color: var(--ac-ink); cursor: pointer; font-size: clamp(13px, 3vw, 19px); background: var(--ac-cell); transition: background .12s; }
.ac-cell.is-block { background: var(--ac-cell); cursor: default; }
.ac-cell.is-block::after { content: ''; position: absolute; inset: 14%; border-radius: 8px; background: var(--ac-block); }

/* number path */
.ac-path-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.ac-path-svg polyline { fill: none; stroke: #8b5cf6; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.ac-cell.is-on { background: color-mix(in srgb, #8b5cf6 10%, var(--ac-cell)); }
.ac-node { position: relative; z-index: 2; width: 70%; height: 70%; border-radius: 22%; display: flex; align-items: center; justify-content: center; font-weight: 800;
    background: linear-gradient(180deg, #e9d5ff, #c4b5fd); color: #2e1065; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 3px 8px -4px rgba(76, 29, 149, .5); }
.ac-node.is-first { background: linear-gradient(180deg, #fecdd3, #fb7185); color: #4c0519; }
.ac-node.is-last { background: linear-gradient(180deg, #bbf7d0, #4ade80); color: #052e16; }
.ac-node.is-mid { background: linear-gradient(180deg, #e0f2fe, #7dd3fc); color: #082f49; }
.ac-cell.is-hint { animation: acBlink 1s ease 2; }
@keyframes acBlink { 50% { background: #fde68a; } }

/* sudoku & numbers */
.ac-sudoku .ac-cell { font-size: clamp(15px, 3.4vw, 21px); }
.ac-sudoku .ac-cell.is-given { color: var(--ac-ink); background: color-mix(in srgb, var(--ac-cell-line) 30%, var(--ac-cell)); cursor: default; }
.ac-sudoku .ac-cell.is-user { color: #6d28d9; }
.ac-sudoku .ac-cell.is-sel { background: #ede9fe; box-shadow: inset 0 0 0 2px #8b5cf6; }
[data-bs-theme="dark"] .ac-sudoku .ac-cell.is-sel, html.dark-theme .ac-sudoku .ac-cell.is-sel { background: rgba(139, 92, 246, .25); }
.ac-sudoku .ac-cell.is-peer { background: color-mix(in srgb, #8b5cf6 6%, var(--ac-cell)); }
.ac-sudoku .ac-cell.is-bad { color: #dc2626; }
.ac-sudoku .ac-cell.bR { border-right: 2px solid #8b8aa8; }
.ac-sudoku .ac-cell.bB { border-bottom: 2px solid #8b8aa8; }
.ac-pad { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; width: 100%; margin-top: 12px; }
.ac-pad button { height: 36px; border-radius: 9px; border: 1px solid var(--ac-line); background: var(--ac-card); font-size: 15px; font-weight: 800; color: var(--ac-ink); cursor: pointer; }
.ac-pad button:hover { border-color: #8b5cf6; color: #6d28d9; }

/* crown grid */
.ac-crown .ac-cell { font-size: clamp(13px, 3.2vw, 20px); }
.ac-crown .ac-cell .bi-x-lg { font-size: .6em; color: rgba(15, 23, 42, .45); }
.ac-crown .ac-cell .bi-award-fill { color: #1e1b4b; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .2)); }
.ac-crown .ac-cell.is-bad .bi-award-fill { color: #dc2626; }
.ac-crown .ac-cell.rT { border-top: 3px solid #1f2937; } .ac-crown .ac-cell.rL { border-left: 3px solid #1f2937; }
.ac-crown .ac-cell.rR { border-right: 3px solid #1f2937; } .ac-crown .ac-cell.rB { border-bottom: 3px solid #1f2937; }

/* sun & moon */
.ac-sun .ac-cell { overflow: visible; }
.ac-sun .ac-cell.is-given { background: color-mix(in srgb, var(--ac-cell-line) 35%, var(--ac-cell)); cursor: default; }
.ac-sun .ac-cell .bi-sun-fill { color: #f59e0b; font-size: 1.3em; }
.ac-sun .ac-cell .bi-moon-stars-fill { color: #6366f1; font-size: 1.15em; }
.ac-sun .ac-cell.is-bad { background: #fee2e2; }
.ac-sun .ac-grid { overflow: visible; }
.ac-sign { position: absolute; z-index: 3; width: 18px; height: 18px; border-radius: 50%; background: var(--ac-card); border: 1px solid var(--ac-cell-line); display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 900; color: #64748b; pointer-events: none; transform: translate(-50%, -50%); }

/* merge tiles */
.ac-merge { width: 100%; aspect-ratio: 1; border-radius: 14px; padding: 8px; background: #bdb3a6; display: grid; gap: 8px; position: relative; }
[data-bs-theme="dark"] .ac-merge, html.dark-theme .ac-merge { background: #3b3530; }
.ac-tile { border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: clamp(15px, 3.6vw, 26px); background: rgba(238, 228, 218, .35); color: #776e65; }
.ac-tile.is-pop { animation: acPop .18s ease; }
.ac-merge-goal { font-size: 13px; color: var(--ac-muted); text-align: center; margin-top: 8px; }

/* nonogram */
.ac-nono { display: grid; width: 100%; gap: 0; }
.ac-nono .ac-clue { display: flex; align-items: flex-end; justify-content: center; gap: 2px; font-size: clamp(10px, 2.3vw, 13px); font-weight: 700; color: var(--ac-muted); padding: 2px; line-height: 1.15; }
.ac-nono .ac-clue.is-col { flex-direction: column; align-items: center; justify-content: flex-end; }
.ac-nono .ac-clue.is-row { justify-content: flex-end; align-items: center; padding-right: 6px; }
.ac-nono .ac-clue.is-done { color: #16a34a; }
.ac-nono .ac-cell { aspect-ratio: 1; border: 1px solid var(--ac-cell-line); font-size: clamp(10px, 2.5vw, 16px); }
.ac-nono .ac-cell.is-fill { background: #334155; }
[data-bs-theme="dark"] .ac-nono .ac-cell.is-fill, html.dark-theme .ac-nono .ac-cell.is-fill { background: #c4b5fd; }
.ac-nono .ac-cell.is-x { color: #94a3b8; }
.ac-nono .ac-cell.b5R { border-right: 2px solid #8b8aa8; } .ac-nono .ac-cell.b5B { border-bottom: 2px solid #8b8aa8; }

/* memory */
.ac-memory { display: grid; gap: 8px; width: 100%; }
.ac-card { aspect-ratio: 1; perspective: 600px; cursor: pointer; border: 0; padding: 0; background: none; }
.ac-card-in { position: relative; width: 100%; height: 100%; transition: transform .35s; transform-style: preserve-3d; }
.ac-card.is-open .ac-card-in, .ac-card.is-done .ac-card-in { transform: rotateY(180deg); }
.ac-card-f, .ac-card-b { position: absolute; inset: 0; border-radius: 12px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.ac-card-f { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: rgba(255, 255, 255, .55); font-size: 22px; box-shadow: 0 6px 14px -8px #6d28d9; }
.ac-card-b { background: var(--ac-card); border: 2px solid var(--ac-cell-line); transform: rotateY(180deg); font-size: clamp(20px, 4vw, 30px); font-weight: 800; color: var(--ac-ink); }
.ac-card.is-done .ac-card-b { border-color: #22c55e; background: color-mix(in srgb, #22c55e 10%, var(--ac-card)); }

/* word games */
.ac-wg { display: grid; gap: 5px; width: 100%; max-width: 270px; margin: 0 auto; }
.ac-wg-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ac-wg-cell { aspect-ratio: 1; border: 2px solid var(--ac-cell-line); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: clamp(16px, 4vw, 22px); font-weight: 900; text-transform: uppercase; color: var(--ac-ink); background: var(--ac-cell); }
.ac-wg-cell.is-filled { border-color: #94a3b8; }
.ac-wg-cell.g, .ac-key.g { background: #16a34a; border-color: #16a34a; color: #fff; }
.ac-wg-cell.y, .ac-key.y { background: #eab308; border-color: #eab308; color: #fff; }
.ac-wg-cell.x, .ac-key.x { background: #64748b; border-color: #64748b; color: #fff; }
.ac-keys { display: flex; flex-direction: column; gap: 6px; width: 100%; margin-top: 12px; }
.ac-keys > div { display: flex; justify-content: center; gap: 5px; }
.ac-key { min-width: 0; flex: 1; max-width: 36px; height: 40px; border-radius: 7px; border: 1px solid var(--ac-line); background: var(--ac-card); font-weight: 800; font-size: 13px; color: var(--ac-ink); cursor: pointer; }
.ac-key.is-wide { max-width: 58px; font-size: 11px; }

.ac-input-row { display: flex; gap: 8px; width: 100%; max-width: 420px; margin: 0 auto; }
.ac-input-row input { flex: 1; min-width: 0; height: 40px; border-radius: 10px; border: 1px solid var(--ac-line); background: var(--ac-card); padding: 0 12px; font-size: 14px; font-weight: 600; color: var(--ac-ink); outline: 0; }
.ac-input-row input:focus { border-color: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, .15); }
.ac-input-row .ac-act { height: 40px; padding: 0 16px; }
.ac-clues { list-style: none; margin: 0 auto 14px; padding: 0; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; }
.ac-clues li { padding: 8px 12px; border-radius: 10px; font-size: 14px; background: var(--ac-card); border: 1px solid var(--ac-line); font-weight: 600; color: var(--ac-ink); display: flex; gap: 10px; align-items: center; animation: acPop .25s ease; }
.ac-clues li b { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #ef4444; color: #fff; font-size: 13px; flex-shrink: 0; }
.ac-clues li.is-hidden { color: var(--ac-muted); background: transparent; border-style: dashed; font-weight: 500; }
.ac-clues li.is-hidden b { background: #cbd5e1; }
.ac-guesses { font-size: 13px; color: var(--ac-muted); text-align: center; margin-top: 8px; }

.ac-ladder { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 440px; margin: 0 auto; }
.ac-rung { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: center; }
.ac-rung-n { width: 30px; height: 30px; font-size: 13px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; background: #ccfbf1; color: #0f766e; }
.ac-rung input { width: 100%; height: 40px; border-radius: 10px; border: 2px solid var(--ac-cell-line); background: var(--ac-cell); text-align: center; text-transform: uppercase; letter-spacing: .3em; font-weight: 900; font-size: 16px; color: var(--ac-ink); outline: 0; }
.ac-rung input:focus { border-color: #0d9488; }
.ac-rung input:disabled { background: #0d9488; border-color: #0d9488; color: #fff; opacity: 1; -webkit-text-fill-color: #fff; }
.ac-rung input.is-ok { border-color: #16a34a; background: color-mix(in srgb, #16a34a 10%, var(--ac-cell)); }
.ac-rung input.is-bad { border-color: #dc2626; }
.ac-rung small { grid-column: 2; font-size: 12.5px; color: var(--ac-muted); margin-top: -4px; }

.ac-big { text-align: center; width: 100%; }
.ac-big-q { font-size: clamp(26px, 5vw, 38px); font-weight: 900; color: var(--ac-ink); letter-spacing: .02em; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.ac-seq { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 18px; }
.ac-seq span { min-width: 46px; height: 46px; padding: 0 8px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900;
    background: var(--ac-card); border: 2px solid var(--ac-cell-line); color: var(--ac-ink); }
.ac-seq span.is-q { border-style: dashed; border-color: #8b5cf6; color: #8b5cf6; }
.ac-progress { height: 8px; border-radius: 999px; background: var(--ac-line); overflow: hidden; margin: 6px auto 0; max-width: 420px; }
.ac-progress > i { display: block; height: 100%; background: linear-gradient(90deg, #8b5cf6, #ec4899); transition: width .3s; }
.ac-round { font-size: 13px; font-weight: 700; color: var(--ac-muted); }

.ac-ws { display: grid; width: 100%; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--ac-cell-line); background: var(--ac-cell); overflow: hidden; }
.ac-ws .ac-cell { border: 0; font-size: clamp(11px, 2.8vw, 16px); text-transform: uppercase; }
.ac-ws .ac-cell.is-sel { background: #ddd6fe; }
.ac-ws .ac-cell.is-found { background: #bbf7d0; color: #14532d; }
[data-bs-theme="dark"] .ac-ws .ac-cell.is-sel, html.dark-theme .ac-ws .ac-cell.is-sel { background: rgba(139, 92, 246, .35); }
[data-bs-theme="dark"] .ac-ws .ac-cell.is-found, html.dark-theme .ac-ws .ac-cell.is-found { background: rgba(34, 197, 94, .3); color: #bbf7d0; }
.ac-ws .ac-cell.is-hint { animation: acBlink 1s ease 2; }
.ac-words { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.ac-words span { padding: 3px 10px; border-radius: 999px; background: var(--ac-card); border: 1px solid var(--ac-line); font-size: 12px; font-weight: 700; color: var(--ac-ink); }
.ac-words span.is-found { text-decoration: line-through; color: #16a34a; border-color: #86efac; }

/* ---------- responsive ---------- */
@media (max-width: 1199.98px) {
    .ac-game-body { grid-template-columns: minmax(0, 1fr); }
    .ac-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
}
@media (max-width: 991.98px) {
    .ac-layout { grid-template-columns: minmax(0, 1fr); }
    .ac-side { position: static; max-height: none; overflow: visible; }
    .ac-side-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--ac-line); background: var(--ac-card); font-weight: 700; font-size: 13.5px; color: var(--ac-ink); }
    .ac-side-toggle > span { display: flex; align-items: center; gap: 8px; }
    .ac-side-groups { display: none; }
    .ac-side.is-open .ac-side-groups, .ac-side.is-searching .ac-side-groups { display: flex; }
    .ac-side.is-open .ac-side-toggle i { transform: rotate(180deg); }
    .ac-daily { max-width: none; flex: 1 1 100%; min-width: 0; }
}
@media (max-width: 575.98px) {
    .ac-board-card { padding: 14px; border-radius: 16px; }
    .ac-stage { padding: 10px; }
    .ac-game-title h2 { font-size: 17px; }
    .ac-gicon.is-lg { width: 40px; height: 40px; font-size: 18px; }
    .ac-scorebar { width: 100%; }
    .ac-scorebar > div { flex: 1; min-width: 0; padding: 6px 8px; }
    .ac-level { flex: 1 1 100%; } .ac-level select { width: 100%; }
    .ac-actions .ac-act { font-size: 13px; padding: 0 6px; }
    .ac-hero { padding: 14px 16px; }
    .ac-hero-art svg { width: 48px; height: 40px; }
}

/* twin tiles */
.ac-tt { display: block; width: 62%; height: 62%; }
.ac-tt-a { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fb923c, #ea580c); box-shadow: 0 2px 4px rgba(234, 88, 12, .35); }
.ac-tt-b { border-radius: 6px; background: linear-gradient(135deg, #2dd4bf, #0f766e); transform: rotate(45deg) scale(.82); box-shadow: 0 2px 4px rgba(15, 118, 110, .35); }
.ac-twin .ac-cell.is-bad { background: #fee2e2; }

/* shape split */
.ac-split { touch-action: none; user-select: none; }
.ac-split .ac-cell { touch-action: none; }
.ac-split-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.ac-split-rect { position: absolute; box-sizing: border-box; border-radius: 6px; border: 3px solid color-mix(in srgb, var(--rc, #8b5cf6) 70%, #1f2937);
    background: color-mix(in srgb, var(--rc, #8b5cf6) 55%, transparent); display: flex; align-items: center; justify-content: center; }
.ac-split-rect.is-bad { background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--rc, #8b5cf6) 45%, transparent) 0 8px, transparent 8px 14px); border-style: dashed; border-color: #dc2626; }
.ac-split-rect.is-preview { background: rgba(139, 92, 246, .18); border: 2px dashed #7c3aed; }
.ac-split-size { font-size: 12px; font-weight: 900; color: #fff; background: #7c3aed; border-radius: 999px; padding: 1px 8px; }
.ac-split-clue { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 8px; background: var(--ac-card, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18); font-size: clamp(12px, 2.8vw, 17px); }
.ac-split-clue .bi { font-size: .7em; color: var(--ac-muted); }

/* win celebration popup (signed-in players) */
.ac-done { overflow: hidden; }
.ac-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ac-confetti i { position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 2px; opacity: .95; animation: acConfetti 3s cubic-bezier(.25, .6, .4, 1) forwards; }
@keyframes acConfetti { to { transform: translate(var(--dx, 0), 105vh) rotate(var(--rot, 360deg)); opacity: .9; } }
.ac-done-card { position: relative; }
.ac-done-card.is-win { max-width: 400px; }
.ac-done-card.is-win::before { content: ''; position: absolute; inset: 0 0 auto; height: 120px; border-radius: 22px 22px 0 0; background: radial-gradient(120% 100% at 50% 0, rgba(250, 204, 21, .28), transparent 70%); pointer-events: none; }
.ac-done-card.is-win .ac-done-burst { position: relative; background: linear-gradient(135deg, #facc15, #f97316); animation: acTrophy 1.2s ease .2s both; }
.ac-done-card.is-win .ac-done-burst::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(250, 204, 21, .6); animation: acRing 1.6s ease-out .3s infinite; }
@keyframes acTrophy { 0% { transform: scale(.4) rotate(-20deg); } 55% { transform: scale(1.15) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes acRing { from { transform: scale(1); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.ac-done-card.is-win h3 { font-size: 22px; background: linear-gradient(90deg, #f97316, #ec4899, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ac-done-card.is-win #acDoneText:empty { display: none; }
.ac-win { position: relative; margin: 2px 0 16px; animation: acPop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.ac-win-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; color: #fff;
    background: linear-gradient(90deg, #8b5cf6, #ec4899); box-shadow: 0 6px 16px -8px #ec4899; margin-bottom: 8px; }
.ac-win-badge[hidden] { display: none; }
.ac-win-hello { margin: 0 0 4px !important; font-size: 14.5px !important; color: inherit !important; }
.ac-win-hello b { color: #7c3aed; word-break: break-word; }
.ac-win-score { display: flex; flex-direction: column; align-items: center; line-height: 1; margin: 6px 0 12px; }
.ac-win-score span { font-size: 48px; font-weight: 900; letter-spacing: -.02em; background: linear-gradient(180deg, #f59e0b, #ea580c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ac-win-score small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted, #64748b); margin-top: 4px; }
.ac-win-chips { display: flex; gap: 8px; justify-content: center; }
.ac-win-chips span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px; font-size: 13.5px; background: rgba(100, 116, 139, .1); }
.ac-win-chips .is-xp { background: rgba(34, 197, 94, .14); color: #15803d; }
.ac-win-prev { margin: 10px 0 0 !important; font-size: 12.5px !important; }
.ac-win-prev:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
    .ac-win, .ac-done-card.is-win .ac-done-burst, .ac-done-card.is-win .ac-done-burst::after { animation: none; }
}
