/**
 * Giao diện Bida Carom 3 Băng (UMB International Tournament Style)
 */

:root {
    --bg-dark: #0b0e14;
    --card-bg: rgba(18, 24, 38, 0.88);
    --card-border: rgba(255, 255, 255, 0.08);
    --gold: #f59e0b;
    --gold-glow: rgba(245, 158, 11, 0.45);
    --blue-glow: rgba(59, 130, 246, 0.5);
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text-main);
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ================== UI OVERLAY ================== */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.interactive {
    pointer-events: auto;
}

/* ================== TOP SCOREBOARD ================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 20px;
    background: linear-gradient(180deg, rgba(10, 14, 22, 0.95) 0%, rgba(10, 14, 22, 0) 100%);
}

.scoreboard-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 auto;
}

.player-card {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 2px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 16px;
    min-width: 220px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.player-card.active-turn {
    border-color: var(--gold);
    box-shadow: 0 0 16px var(--gold-glow);
    transform: translateY(-2px);
}

.ball-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 12px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

.white-ball {
    background: #ffffff;
    border: 1px solid #ddd;
}
.white-ball::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 6px;
    height: 6px;
    background: #d32f2f;
    border-radius: 50%;
}

.yellow-ball {
    background: #ffca28;
    border: 1px solid #d4a017;
}
.yellow-ball::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 6px;
    height: 6px;
    background: #c62828;
    border-radius: 50%;
}

.player-info {
    flex: 1;
}

.player-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.player-stats {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 2px;
}

.score-badge {
    font-size: 32px;
    font-weight: 800;
    font-family: 'Consolas', monospace;
    color: #fff;
    margin-left: 12px;
    min-width: 44px;
    text-align: right;
}

.match-header {
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 6px 16px;
    border-radius: 10px;
    backdrop-filter: blur(8px);
}

.match-title {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--gold);
    text-transform: uppercase;
}

.target-score {
    font-size: 11px;
    color: var(--text-muted);
}

/* ================== TOP TOOLBAR ================== */
.top-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, border-color 0.2s;
    backdrop-filter: blur(6px);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-online-nav {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: 1px solid #34d399 !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}
.btn-online-nav:hover {
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.6) !important;
    transform: translateY(-1px);
}

.select-control {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    outline: none;
}

.select-control option {
    background: #1a202c;
    color: #fff;
}

/* ================== EVENT BANNER ================== */
.banner-container {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.event-banner {
    padding: 10px 24px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
}

.banner-neutral {
    background: rgba(26, 32, 44, 0.85);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.banner-gold {
    background: rgba(245, 158, 11, 0.9);
    color: #000;
    border: 1px solid #fde68a;
    box-shadow: 0 0 20px var(--gold-glow);
}

.banner-success {
    background: rgba(16, 185, 129, 0.95);
    color: #fff;
    border: 1px solid #6ee7b7;
    animation: pulse 0.5s infinite alternate;
}

.banner-miss {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border: 1px solid #fca5a5;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

/* ================== ONLINE STATUS & ROOM BADGE ================== */
.online-room-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(16, 24, 40, 0.9);
    border: 1px solid var(--gold);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.online-room-badge .room-code-tag {
    color: var(--gold);
    font-family: monospace;
    font-weight: 800;
}

.online-room-badge .turn-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.turn-tag.my-turn {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid #34d399;
}
.turn-tag.opp-turn {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
    border: 1px solid #f87171;
}

/* Emote Floating Reactions */
.emote-popup-container {
    position: absolute;
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 30;
}

.floating-emote-bubble {
    background: rgba(20, 27, 44, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6);
    animation: floatUp 2.8s ease-out forwards;
}
.floating-emote-bubble .emote-char {
    font-size: 26px;
}
.floating-emote-bubble .emote-sender {
    font-size: 12px;
    color: var(--gold);
    font-weight: 600;
}

@keyframes floatUp {
    0% { opacity: 0; transform: translateY(20px) scale(0.8); }
    15% { opacity: 1; transform: translateY(0) scale(1.1); }
    25% { transform: translateY(0) scale(1); }
    80% { opacity: 1; transform: translateY(-30px); }
    100% { opacity: 0; transform: translateY(-60px); }
}

/* Online Emote Bar */
.online-emote-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 4px 10px;
    border-radius: 24px;
    backdrop-filter: blur(8px);
    margin-bottom: 6px;
}
.emote-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: transform 0.15s;
}
.emote-btn:hover {
    transform: scale(1.3);
}

/* ================== BOTTOM CONTROLS ================== */
.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 16px 24px;
    background: linear-gradient(0deg, rgba(10, 14, 22, 0.95) 0%, rgba(10, 14, 22, 0) 100%);
}

/* English Widget */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.widget-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.english-ball-container {
    width: 180px;   /* quả bi chọn tip / ép-phê thật to để đặt điểm chạm chính xác (bản trước 116px) */
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #dcdcdc 50%, #999999 100%);
    border: 2px solid #555;
    position: relative;
    cursor: crosshair;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.4);
}

.crosshair-h {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0,0,0,0.25);
}

.crosshair-v {
    position: absolute;
    left: 50%;
    top: 0;
    height: 100%;
    width: 1px;
    background: rgba(0,0,0,0.25);
}

.english-tip {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    margin-left: -7px;
    border-radius: 50%;
    background: #d32f2f;
    border: 2px solid #ffffff;
    box-shadow: 0 0 6px rgba(211, 47, 47, 0.8);
    pointer-events: none;
    transform: translate(0px, 0px);
    transition: transform 0.05s ease-out;
}

.english-readout {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.btn-small {
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
}
.btn-small:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-traj-active {
    background: rgba(0, 240, 255, 0.18) !important;
    border-color: #00f0ff !important;
    color: #00f0ff !important;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
    font-weight: 600;
}

/* Elevation / Massé Widget */
.elevation-card {
    min-width: 125px;
    padding: 12px;
}

.elevation-visual-container {
    width: 76px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.elevation-svg {
    width: 100%;
    height: 100%;
}

.elevation-slider-box {
    width: 100%;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.elevation-slider {
    width: 100%;
    accent-color: #38bdf8;
    cursor: pointer;
    height: 6px;
}

.elevation-readout {
    font-size: 11px;
    font-weight: 600;
    color: #38bdf8;
    margin-top: 4px;
    text-align: center;
    letter-spacing: 0.3px;
}

.elevation-quick-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 100%;
    margin-top: 8px;
}

.elev-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    border-radius: 5px;
    padding: 3px 2px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.elev-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    border-color: #38bdf8;
}

.elev-btn.active {
    background: #38bdf8;
    color: #0b1320;
    border-color: #38bdf8;
    font-weight: 700;
}

/* Center Bottom Panel */
.center-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.camera-modes {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    backdrop-filter: blur(8px);
}

.cam-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cam-btn:hover {
    color: #fff;
}

.cam-btn.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--gold);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.fine-aim-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 4px 12px;
    border-radius: 10px;
}

.fine-aim-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Right Side: Power & Shoot */
.power-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.power-meter-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px 10px;
    backdrop-filter: blur(12px);
}

.power-track {
    width: 20px;
    height: 140px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    margin: 8px 0;
    cursor: pointer;
}

.power-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(0deg, #10b981 0%, #f59e0b 60%, #ef4444 100%);
    border-radius: 10px;
    transition: height 0.05s ease-out;
}

.power-val-label {
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    color: var(--gold);
}

.btn-shoot {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    color: #000;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 1px;
    padding: 16px 28px;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px var(--gold-glow);
    transition: transform 0.1s, box-shadow 0.2s;
}

.btn-shoot:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 22px rgba(245, 158, 11, 0.6);
}

.btn-shoot:active {
    transform: scale(0.97);
}

.btn-shoot:disabled {
    background: #4b5563 !important;
    color: #9ca3af !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    transform: none !important;
}

/* Practice & Drill Panels */
.side-card {
    position: absolute;
    left: 24px;
    top: 90px;
    width: 260px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.ai-status-badge {
    position: absolute;
    top: 90px;
    right: 24px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    animation: pulse 0.8s infinite alternate;
}

/* ================== MODAL DIALOGS ================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: #141b29;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 24px 32px;
    max-width: 580px;
    width: 90%;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gold);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.6;
}

.modal-body h4 {
    color: #60a5fa;
    margin: 12px 0 4px 0;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 8px;
}

/* ================== ONLINE LOBBY MODAL STYLES ================== */
.online-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    padding: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: rgba(10, 14, 22, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 14px;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: var(--gold);
}

.room-code-box {
    text-align: center;
    background: rgba(10, 14, 22, 0.9);
    border: 2px dashed var(--gold);
    border-radius: 12px;
    padding: 18px;
    margin: 14px 0;
}

.big-room-code {
    font-size: 38px;
    font-family: monospace;
    font-weight: 900;
    letter-spacing: 6px;
    color: var(--gold);
    margin-bottom: 8px;
}

.waiting-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: var(--gold);
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================== THICKNESS CARD ================== */
.thickness-card {
    background: rgba(18, 24, 38, 0.92);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 14px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin-bottom: 6px;
    min-width: 320px;
    transition: opacity 0.2s, transform 0.2s;
}

.thickness-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-size: 11px;
}

.thickness-title {
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.thickness-badge {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
}

.thickness-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.thickness-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 50%, #f59e0b 80%, #ef4444 100%);
    border-radius: 4px;
    transition: width 0.08s ease-out;
}

.thickness-quick-buttons {
    display: flex;
    gap: 4px;
    width: 100%;
    justify-content: center;
}

.thick-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-main);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex: 1;
    text-align: center;
}

.thick-btn:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

.thick-btn.active {
    background: var(--gold);
    color: #000;
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
}

.thick-btn-side {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    color: #60a5fa;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.thick-btn-side:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.hidden {
    display: none !important;
}

/* Nút Gợi ý AI */
.btn-ai-hint { border-color: rgba(255, 200, 60, 0.55) !important; color: #ffd166; }
.btn-ai-hint:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ai-hint.btn-hint-busy { animation: hintPulse 0.8s ease-in-out infinite; }
@keyframes hintPulse { 50% { box-shadow: 0 0 12px rgba(255, 200, 60, 0.6); } }

/* Nút chỉnh độ nghiêng camera Aim View (chỉ hiện ở Aim View) */
.aim-tilt-control {
    position: fixed;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 5px;
    border-radius: 14px;
    background: rgba(10, 16, 28, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.aim-tilt-control.hidden { display: none; }
.aim-tilt-btn {
    width: 40px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(56, 189, 248, 0.45);
    background: rgba(31, 36, 48, 0.9);
    color: #e2e8f0;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    touch-action: none;
}
.aim-tilt-btn:active { background: rgba(56, 189, 248, 0.35); }
.aim-tilt-label {
    font-size: 10px;
    line-height: 1.15;
    color: #94a3b8;
    text-align: center;
    cursor: default;
}
.aim-tilt-label b { color: #38bdf8; font-size: 12px; }

/* Bảng Rules & User Guide dài: giới hạn chiều cao, phần nội dung cuộn được (trước đây tràn khỏi màn hình) */
#help-modal .modal-content {
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    max-width: 680px;
}
#help-modal .modal-header { flex: 0 0 auto; }
#help-modal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
    overscroll-behavior: contain;
}

/* Vòng giới hạn điểm chạm: lệch tâm tối đa 0.7R = TIP_OFFSET_MAX (vẽ đúng tỉ lệ trên quả bi) */
.english-limit {
    position: absolute;
    left: 15%;
    top: 15%;
    width: 70%;
    height: 70%;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px dashed rgba(211, 47, 47, 0.55);
    pointer-events: none;
}

/* Vòng 1 / 2 / 3 tip trong quả bi chọn điểm chạm (vòng đỏ ngoài cùng = 4 tip = lệch tâm tối đa) */
.english-ring {
    position: absolute; pointer-events: none; box-sizing: border-box; border-radius: 50%;
    width: calc(70% * var(--k)); height: calc(70% * var(--k));
    left: calc(50% - 35% * var(--k)); top: calc(50% - 35% * var(--k));
    border: 1px dotted rgba(0, 0, 0, 0.28);
}
/* Bộ số tip: nút chiều (R/L, F/D) + mức 0 – 4 */
.eng-presets { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; align-items: center; }
.eng-preset-row { display: flex; gap: 3px; }
.eng-lvl, .eng-sign {
    width: 20px; height: 20px; padding: 0; line-height: 1; font-size: 10px; font-weight: 700;
    color: var(--text-main); background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border); border-radius: 5px; cursor: pointer; touch-action: manipulation;
}
.eng-sign { width: 24px; color: #fbbf24; border-color: rgba(251, 191, 36, 0.5); }
.eng-lvl:hover, .eng-sign:hover { background: rgba(255, 255, 255, 0.16); }
.eng-lvl.active { background: #f59e0b; color: #1a1206; border-color: #f59e0b; }

/* Nút mũi tên ±0.5 tip (◀ ▶ ép-phê ngang, ▼ ▲ trô / culê) quanh số đọc */
.english-steppers { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; width: 100%; align-items: center; }
.eng-step-row { display: flex; align-items: center; justify-content: center; gap: 4px; }
.eng-step {
    width: 22px; height: 20px; padding: 0; line-height: 1; font-size: 10px; color: var(--text-main);
    background: rgba(255, 255, 255, 0.08); border: 1px solid var(--card-border); border-radius: 5px;
    cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.eng-step:hover { background: rgba(255, 255, 255, 0.16); }
.eng-step:active { background: rgba(0, 240, 255, 0.22); }
.eng-step-val { min-width: 78px; text-align: center; font-size: 11px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Mũi tên ±0.5 tip nằm chung hàng với nút tip: ◀ R 0 1 2 3 4 ▶ / ▼ F 0 1 2 3 4 ▲ */
.english-steppers { gap: 1px; }
.eng-preset-row { align-items: center; }
.eng-preset-row .eng-step { width: 20px; height: 20px; font-size: 9px; }

/* Thanh dưới chỉ là khung xếp các bảng: phần trong suốt giữa các bảng KHÔNG được chặn chuột / chạm trên bàn
   (bàn đã phóng to tới sát các bảng; trước đây bấm vào vùng đó không đổi được hướng ngắm). Nền gradient tối bỏ đi
   để không làm tối mép dưới mặt nỉ. */
.bottom-bar.interactive,
.bottom-bar .center-controls,
.bottom-bar .power-controls { pointer-events: none; }
.bottom-bar { background: none; }
.bottom-bar .widget-card,
.bottom-bar .center-controls > *,
.bottom-bar .power-controls > * { pointer-events: auto; }

/* Hệ thống nút số trong bảng Practice (systems.js) */
.sys-toggle { margin-top: 8px; width: 100%; }
.systems-readout { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sys-row { font-size: 12px; color: var(--text-main, #e5e7eb); line-height: 1.35; padding: 5px 7px;
    border-radius: 8px; background: rgba(255,255,255,0.04); }
.sys-row b { font-weight: 700; }
.sys-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.sys-eq { float: right; font-variant-numeric: tabular-nums; font-weight: 700; color: #fff; }
.sys-sub { font-size: 11px; color: var(--text-muted); clear: both; }
.sys-na { opacity: 0.55; }
.sys-ok { color: #2ecc71; }
.sys-warn { color: #fbbf24; }
.sys-apply { padding: 2px 8px !important; font-size: 11px !important; margin-left: 4px; }
.sys-legend { font-size: 10.5px; color: var(--text-muted); }

/* Máy tính: bảng chỉnh đầu cơ (Tip Position / English) chuyển sang cột phải, ngay trên thanh lực + SHOOT.
   (Mobile: mobile.js chuyển bảng này vào bảng "Cue controls" nên quy tắc dưới không áp dụng.) */
html:not(.mobile) .bottom-bar { position: relative; }
html:not(.mobile) .bottom-bar .english-card {
    position: absolute;
    right: 14px;
    bottom: 100%;
    margin-bottom: 6px;
}
.sys-mode { font-size: 11px; color: #e5e7eb; background: rgba(56,189,248,0.10); border: 1px solid rgba(56,189,248,0.35);
    border-radius: 8px; padding: 4px 7px; line-height: 1.35; }

/* Máy tính: dãy nút độ dày nằm cùng hàng với nút ngắm trái / phải (trong .fine-aim-group) */
html:not(.mobile) .fine-aim-group .thickness-quick-buttons { width: auto; flex: 0 0 auto; padding: 0 4px;
    border-left: 1px solid rgba(255,255,255,0.12); border-right: 1px solid rgba(255,255,255,0.12); }
html:not(.mobile) .fine-aim-group .thick-btn { flex: 0 0 auto; min-width: 34px; }
html:not(.mobile) .thickness-card { min-width: 280px; }

/* Bảng Practice: nút ✕ thu gọn (mọi bố cục); nút "🎯 Practice" mở lại nằm sau nút Gợi ý AI */
#practice-panel { padding-right: 40px; }
#practice-panel .m-card-close { position: absolute; top: 8px; right: 8px; }
.btn-practice-show { border-color: rgba(245, 158, 11, 0.6) !important; color: var(--gold) !important; }
.btn-practice-show.hidden { display: none; }
