/* ============================================================================
 * Strike Party — styles
 * ----------------------------------------------------------------------------
 * Tông màu quán bowling: nền tối, đèn neon hắt lên, mặt gỗ ấm ở giữa. Phần
 * khung chung (header/footer) lấy từ /site-chrome.css, ở đây chỉ đặt lại
 * --card-bg / --card-border cùng các thành phần riêng của game.
 * ==========================================================================*/

:root {
    --card-bg: rgba(15, 20, 38, 0.80);
    --card-border: rgba(255, 255, 255, 0.10);

    --ink: #eaf0ff;
    --dim: #9aa4b8;
    --lane: #dda55f;
    --neon: #4dd2ff;
    --hot: #ff5f6d;
    --gold: #ffd166;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    color: var(--ink);
    background: #070a14;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

/* Ánh đèn quán hắt lên từ phía đường lăn */
.bg-alley-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(60vmax 42vmax at 50% 92%, rgba(255, 170, 80, 0.20), transparent 62%),
        radial-gradient(44vmax 34vmax at 12% 10%, rgba(77, 210, 255, 0.16), transparent 60%),
        radial-gradient(40vmax 32vmax at 88% 14%, rgba(199, 125, 255, 0.16), transparent 60%),
        linear-gradient(180deg, #070a14 0%, #0c1122 55%, #131a30 100%);
}

/* ---------- Header ---------- */
.brand-img {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    object-fit: cover;
    flex-shrink: 0;
}

/* Ảnh icon và emoji là hai phương án cho cùng một chỗ: có ảnh thì ẩn emoji,
   ảnh hỏng thì onerror gỡ thẻ img và emoji hiện ra. */
.brand-img + .brand-icon { display: none; }

.unified-nav .brand-title {
    margin: 0;
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    background: linear-gradient(92deg, #ffd166 0%, #ff9e5c 45%, #ff5f6d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 44px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--ink);
    font-family: 'Baloo 2', cursive;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.btn:hover { background: rgba(255, 255, 255, 0.13); }
.btn:active { transform: translateY(2px); }
.btn.muted { color: var(--dim); }

/* ---------- Sân chơi ---------- */
.game-viewport {
    position: relative;
    flex: 1;
    min-height: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #0b0f1c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.hud-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 12px;
}

.hud-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* ---------- Bảng điểm ----------
 * Mỗi bé một dòng: tên, dãy ô hiệp, tổng điểm. Ô hiệp hiện đúng ký hiệu
 * bowling thật — X cho strike, "/" cho spare. */
.score-rows {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

/* Chip điểm: emoji + tổng điểm, cao đúng một hàng dù có mấy bé */
.pchip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 8px;
    border-radius: 999px;
    background: rgba(8, 12, 24, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.10);
    opacity: 0.6;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

/* Bé đang tới lượt sáng hẳn lên, các bé kia mờ đi */
.pchip.active {
    opacity: 1;
    border-color: var(--pc);
    box-shadow: 0 0 0 1px var(--pc);
}

.pc-emoji { font-style: normal; font-size: 1rem; }

.pc-score {
    font-family: 'Baloo 2', cursive;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--pc);
}

.fboxes { display: flex; gap: 3px; }

.fbox.wide { min-width: 76px; font-size: 0.66rem; letter-spacing: 0.4px; }

/* Chuỗi strike hiện ngay trên chip điểm — bé nào đang "nóng" là thấy liền */
.pc-fire {
    font-style: normal;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 140, 40, 0.22);
    color: #ffb703;
}

.fc-extra {
    font-size: 0.74rem;
    color: var(--dim);
    margin-top: 2px;
}

.fbox {
    min-width: 26px;
    height: 22px;
    padding: 0 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
    font-family: 'Baloo 2', cursive;
    font-size: 0.74rem;
    font-weight: 700;
}

.fbox.cur { border-color: var(--pc); background: rgba(255, 255, 255, 0.13); }

.ptotal {
    margin-left: auto;
    font-family: 'Baloo 2', cursive;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--pc);
    min-width: 40px;
    text-align: right;
}

/* Nằm ngang chứ không xếp chồng: giàn ki ở sát mép trên hai bên, khung này mà
   cao lên là che mất ki của làn ngoài cùng. */
.turn-box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(8, 12, 24, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.turn-cap {
    font-size: 0.58rem;
    letter-spacing: 1.5px;
    color: var(--dim);
    white-space: nowrap;
}

.turn-name {
    font-family: 'Baloo 2', cursive;
    font-size: 1rem;
    font-weight: 800;
    white-space: nowrap;
}

.hud-bottom { display: flex; justify-content: center; }

.control-hint {
    padding: 6px 15px;
    border-radius: 999px;
    background: rgba(8, 12, 24, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: var(--dim);
    text-align: center;
}

/* ---------- Màn hình phủ ---------- */
.screen {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(5, 8, 18, 0.82);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    overflow-y: auto;
}

.screen.hidden { display: none; }

.panel {
    width: min(760px, 100%);
    max-height: 100%;
    overflow-y: auto;
    padding: 20px 20px 22px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(20, 27, 50, 0.96), rgba(12, 17, 34, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.panel-small { width: min(430px, 100%); }
.panel-emoji { font-size: 2.9rem; line-height: 1; }

.panel-title {
    margin: 6px 0 10px;
    font-family: 'Baloo 2', cursive;
    font-size: 1.85rem;
    font-weight: 800;
    background: linear-gradient(92deg, #ffd166, #ff9e5c 55%, #ff5f6d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.panel-desc {
    margin: 0 auto 16px;
    max-width: 620px;
    font-size: 0.93rem;
    line-height: 1.62;
    color: #c3cce0;
}

.setup-block { margin-bottom: 15px; }

.setup-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-bottom: 8px;
    font-family: 'Baloo 2', cursive;
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    color: var(--dim);
}

.opt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.opt {
    flex: 1 1 150px;
    max-width: 210px;
    min-height: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.opt:hover { background: rgba(255, 255, 255, 0.10); }
.opt:active { transform: translateY(2px); }

.opt.sel {
    border-color: var(--gold);
    background: rgba(255, 209, 102, 0.16);
    box-shadow: 0 0 0 1px var(--gold);
}

.opt-row.small .opt { min-height: 62px; flex-basis: 120px; }
.opt-icon { font-size: 1.3rem; line-height: 1; }

.opt-name {
    font-family: 'Baloo 2', cursive;
    font-size: 0.92rem;
    font-weight: 800;
}

.opt-desc { font-size: 0.7rem; color: var(--dim); line-height: 1.3; }
.opt-insane.sel { border-color: var(--hot); background: rgba(255, 95, 109, 0.18); box-shadow: 0 0 0 1px var(--hot); }

/* ---------- Bảng phím ---------- */
.keys-note {
    margin: 4px 0 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.keys-head {
    font-family: 'Baloo 2', cursive;
    font-size: 0.74rem;
    letter-spacing: 1.4px;
    color: var(--dim);
    margin-bottom: 7px;
}

.keys-list {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: center;
}

.key-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
}

.key-emoji { font-size: 1rem; }

kbd {
    padding: 1px 8px;
    border-radius: 6px;
    background: #1d2540;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-bottom-width: 3px;
    font-family: 'Baloo 2', cursive;
    font-size: 0.76rem;
}

.keys-touch { margin: 8px 0 0; font-size: 0.76rem; color: var(--dim); }

/* Máy chỉ có cảm ứng thì bảng phím vô nghĩa — giấu đi, để lại dòng chạm */
@media (hover: none) and (pointer: coarse) {
    .keys-head, .keys-list { display: none; }
    .keys-touch { margin: 0; }
}

/* ---------- Chú thích điểm ---------- */
.point-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-bottom: 15px;
}

.pt {
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.pt-x { color: var(--gold); border-color: rgba(255, 209, 102, 0.4); }
.pt-s { color: var(--neon); border-color: rgba(77, 210, 255, 0.4); }
.pt-g { color: var(--dim); }
.pt-t { color: #ff9e5c; border-color: rgba(255, 158, 92, 0.4); }

/* ---------- Nút lớn ---------- */
.big-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    padding: 12px 28px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(92deg, #ffb703, #ff5f6d);
    color: #12060a;
    font-family: 'Baloo 2', cursive;
    font-size: 1.1rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(140, 40, 45, 0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.big-btn:active { transform: translateY(5px); box-shadow: none; }

.btn-ghost {
    background: rgba(255, 255, 255, 0.09);
    color: var(--ink);
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}

/* ---------- Bảng kết quả ---------- */
.final-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.final-card {
    flex: 1 1 130px;
    max-width: 190px;
    padding: 12px 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--pc);
}

.final-card.win {
    background: rgba(255, 209, 102, 0.14);
    box-shadow: 0 0 0 2px var(--gold), 0 8px 26px rgba(255, 183, 3, 0.25);
}

.fc-medal { font-size: 1.7rem; line-height: 1; }

.fc-name {
    font-family: 'Baloo 2', cursive;
    font-size: 0.86rem;
    color: var(--pc);
    margin: 3px 0;
}

.fc-score {
    font-family: 'Baloo 2', cursive;
    font-size: 1.9rem;
    font-weight: 800;
}

.over-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 22px);
    z-index: 80;
    padding: 11px 20px;
    border-radius: 999px;
    background: rgba(8, 12, 24, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: 'Baloo 2', cursive;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Màn nhỏ ---------- */
@media (max-width: 620px) {
    .unified-nav .brand-title { font-size: 1.05rem; }
    .brand-img { width: 32px; height: 32px; }
    .nav-actions .btn { width: 44px; padding: 0; justify-content: center; }
    .nav-actions .btn span { display: none; }
    .fbox { min-width: 20px; height: 19px; font-size: 0.64rem; }
    .pc-score { font-size: 0.92rem; }
    .turn-box { padding: 5px 9px; }
    .turn-name { font-size: 0.9rem; }
    .control-hint { font-size: 0.7rem; padding: 5px 11px; }
    .panel { padding: 15px 13px 17px; }
    .panel-title { font-size: 1.45rem; }
    .panel-desc { font-size: 0.85rem; }
    .site-footer .footer-credit {
        font-size: 0.72rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Điện thoại xoay ngang: bảng điểm gọn lại nhường chỗ cho đường lăn */
@media (max-height: 520px) {
    .hud-overlay { padding: 6px 8px; }
    .control-hint { display: none; }
    .score-row { padding: 3px 7px; font-size: 0.7rem; }
}
