/* =====================================================
   SZABÁLYZAT KÖNYV - a clssk_pausemenu könyvének webes változata
   ===================================================== */
#rulebook-panel {
    --primary: #0084ff;
    --badge-sale: #e74c3c;
    position: relative;
    margin-top: var(--navbar-height, 80px);
    height: calc(100vh - var(--navbar-height, 80px));
    min-height: 620px;
    display: flex; flex-direction: column;
    padding: 24px 40px 28px;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
    color: #e0e0e0;
}

#rulebook-panel .shop-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    min-height: 68px;
}
#rulebook-panel .shop-title-block { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
#rulebook-panel .shop-title-block h2 {
    color: white; font-size: 3rem; font-family: 'Oswald', sans-serif;
    text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
    line-height: 1; white-space: nowrap;
}
#rulebook-panel .shop-header-left, #rulebook-panel .shop-header-right { display: flex; gap: 20px; align-items: center; z-index: 10; }
#rulebook-panel .shop-header-left { min-width: 1px; }

#rulebook-panel .keyboard-footer { display: flex; justify-content: center; margin-top: 18px; }

/* a könyv oldalain a felsorolás látszódjon (a weboldal alapból kikapcsolja) */
#rulebook-panel .book-page ul { list-style: disc; }
#rulebook-panel .book-page ol { list-style: decimal; margin-left: 25px; font-size: 14px; line-height: 1.7; margin-bottom: 15px; }
#rulebook-panel .book-page strong { color: #222; }
#rulebook-panel button { font-family: 'Montserrat', sans-serif; }

/* =====================================================
   MOBIL: lapozós könyv helyett görgethető fejezetek
   ===================================================== */
#rulebook-mobile { display: none; }
#rulebook-panel.mobile-mode .rulebook-container,
#rulebook-panel.mobile-mode .keyboard-footer { display: none; }
#rulebook-panel.mobile-mode { height: auto; min-height: 0; overflow: visible; padding: 20px 16px 40px; }
#rulebook-panel.mobile-mode #rulebook-mobile { display: block; margin-top: 20px; }
#rulebook-panel.mobile-mode .shop-header { flex-direction: column; gap: 16px; }
#rulebook-panel.mobile-mode .shop-title-block { position: static; transform: none; }
#rulebook-panel.mobile-mode .shop-title-block h2 { font-size: 2.2rem; }
#rulebook-panel.mobile-mode .shop-header-right, #rulebook-panel.mobile-mode .rule-search { width: 100%; }
#rulebook-panel.mobile-mode .rule-search-results { width: 100%; left: 0; }

.rbm-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 10px; }
.rbm-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 20px; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; border: none; }
.rbm-cat { margin-bottom: 28px; scroll-margin-top: calc(var(--navbar-height, 80px) + 10px); }
.rbm-cat-title { display: flex; align-items: center; gap: 10px; font-family: 'Oswald', sans-serif; font-size: 1.6rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
#rulebook-panel .rbm-page.book-page { height: auto; overflow: visible; border-radius: 12px; padding: 24px 20px; margin-bottom: 14px; }
#rulebook-panel .info-pill {
    background: rgba(0, 0, 0, 0.35); border: none;
    padding: 12px 32px; border-radius: 50px; color: #fff; font-size: 16px; font-weight: 600;
    display: flex; align-items: center; gap: 12px;
    min-width: 400px; justify-content: center;
    text-shadow: none; box-shadow: none;
}
#rulebook-panel .info-pill i { color: rgba(255, 255, 255, 0.55); font-size: 18px; }

/* === SZABÁLYZAT KÖNYV (3D ANIMÁCIÓ) === */
#rulebook-panel .rulebook-container {
    display: flex; justify-content: center; align-items: center;
    flex-grow: 1; gap: 22px; margin-top: 20px;
}

#rulebook-panel .book-nav-btn {
    background: rgba(0, 0, 0, 0.9); border: 2px solid rgba(255,255,255,0.1);
    color: white; width: 60px; height: 60px; border-radius: 50%;
    font-size: 24px; cursor: pointer; transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s, transform 0.3s, opacity 0.3s;
    display: flex; justify-content: center; align-items: center;
    flex-shrink: 0; z-index: 10;
}
#rulebook-panel .book-nav-btn:hover:not(:disabled) {
    background: var(--primary); border-color: var(--primary);
    transform: scale(1.1);
}
#rulebook-panel .book-nav-btn:disabled { opacity: 0; pointer-events: none; }

#rulebook-panel .book-wrapper {
    perspective: 2500px;
    width: 900px;
    height: 750px;
    display: flex; justify-content: center; align-items: center;
    position: relative;
    margin-right: 185px; /* hely a lapokrol kilogo cetliknek */
    margin-left: 185px;  /* ugyanennyi a mar atlapozott oldalnak */
}

#rulebook-panel .book {
    position: relative;
    width: 450px;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateX(0); 
}

#rulebook-panel .paper {
    position: absolute;
    width: 100%; height: 100%;
    top: 0; left: 0;
    transform-style: preserve-3d;
    transform-origin: left center; 
    transition: transform 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
}

#rulebook-panel .paper.flipped {
    transform: rotateY(-180deg);
}

#rulebook-panel .front, #rulebook-panel .back {
    position: absolute;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    overflow: visible;   /* a lapra ragasztott cetli kiloghat */
}
#rulebook-panel .back {
    transform: rotateY(180deg);
}

#rulebook-panel .book-page {
    background: #fdf6e3; 
    color: #333;
    padding: 50px; 
    height: 100%;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.05);
    border-radius: 3px 12px 12px 3px;
    overflow-y: auto;
    overscroll-behavior: contain;
    contain: layout paint;   /* a lapon beluli valtozas/gorgetes nem rajzolja ujra a konyvet */
}
#rulebook-panel .back .book-page {
    border-radius: 12px 3px 3px 12px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
}

#rulebook-panel .book-cover {
    background: linear-gradient(135deg, #111, #222);
    border: 4px solid #333;
    border-radius: 5px 15px 15px 5px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: white;
    box-shadow: inset 4px 0 10px rgba(0,0,0,0.5), 5px 5px 15px rgba(0,0,0,0.3);
    text-align: center;
}
#rulebook-panel .back .book-cover {
    border-radius: 15px 5px 5px 15px;
    box-shadow: inset -4px 0 10px rgba(0,0,0,0.5), -5px 5px 15px rgba(0,0,0,0.3);
}

#rulebook-panel .book-cover h1 { font-family: 'Oswald', sans-serif; font-size: 45px; text-transform: uppercase; color: var(--primary); letter-spacing: 2px; }
#rulebook-panel .book-cover h3 { font-family: 'Montserrat', sans-serif; font-size: 20px; color: #aaa; margin-top: 10px; }

#rulebook-panel .book-page h2 { font-family: 'Oswald', sans-serif; color: var(--primary); margin-bottom: 25px; font-size: 26px; border-bottom: 2px solid rgba(0, 132, 255, 0.2); padding-bottom: 5px; }
#rulebook-panel .book-page h3 { font-family: 'Montserrat', sans-serif; color: #555; margin: 20px 0 10px; font-size: 18px; font-weight: bold; }
#rulebook-panel .book-page p { font-size: 14px; line-height: 1.7; margin-bottom: 15px; text-align: justify; }
#rulebook-panel .book-page ul { margin-left: 25px; font-size: 14px; line-height: 1.7; margin-bottom: 15px; }
#rulebook-panel .book-page li { margin-bottom: 10px; }

#rulebook-panel .book-page::-webkit-scrollbar { width: 4px; }
#rulebook-panel .book-page::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
#rulebook-panel .book-page::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 2px; }
/* =====================================================
   SZABALYZAT - A LAPOKRA RAGASZTOTT JEGYZET CETLIK
   ===================================================== */
/* a regi kulso sin mar nem hasznalt */
#rulebook-panel #book-tabs { display: none; }

#rulebook-panel .book-tab {
    position: absolute;
    /* a cetli bal 50 px-e a lapon fekszik, a tobbi tullog a lap szelen */
    left: calc(100% - 50px);
    right: auto;
    width: max-content;          /* pontosan akkora, amekkora a tartalom */
    white-space: nowrap;
    overflow: visible;
    z-index: 5;

    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 58px;

    /* mindig szines cetli, feher szoveggel */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 55%),
        var(--tab-color, var(--primary));
    color: #fff;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
    border-right: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;

    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-align: left;
    line-height: 1.2;
    cursor: pointer;

    box-shadow:
        inset 10px 0 10px -8px rgba(0, 0, 0, 0.45),
        3px 3px 7px rgba(0, 0, 0, 0.35);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    backface-visibility: hidden;
    transform: none;
    transform-origin: left center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

/* a lapra ragadt resz kicsit sotetebb, mintha alatta lenne a ragaszto */
#rulebook-panel .book-tab::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 50px;
    background: linear-gradient(90deg, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.05) 100%);
    border-radius: 0;
}

/* a lap szelenek vonala a cetlin: itt hajlik at */
#rulebook-panel .book-tab::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 50px;
    width: 4px;
    background: linear-gradient(90deg, rgba(0,0,0,0.35), rgba(0,0,0,0));
    pointer-events: none;
}

#rulebook-panel .book-tab i {
    font-size: 14px;
    color: #fff;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

#rulebook-panel .book-tab .book-tab-label { flex: 0 0 auto; }

#rulebook-panel .book-tab .book-tab-count {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    border-radius: 6px;
    padding: 1px 6px;
    flex-shrink: 0;
}

#rulebook-panel .book-tab:hover {
    transform: translateX(5px);
    filter: brightness(1.12);
    box-shadow:
        inset 10px 0 10px -8px rgba(0, 0, 0, 0.45),
        5px 5px 12px rgba(0, 0, 0, 0.45);
}

#rulebook-panel .book-tab.active {
    transform: translateX(5px);
    box-shadow:
        inset 10px 0 10px -8px rgba(0, 0, 0, 0.45),
        5px 5px 12px rgba(0, 0, 0, 0.45);
}
#rulebook-panel .book-tab.active .book-tab-count { background: rgba(255, 255, 255, 0.35); }

/* A jobb oldali lapon a cetlik helyet kihagyjuk a szovegnek */
#rulebook-panel .front .book-page { padding-right: 62px; }

/* Kategoria fejlec a lapon */
#rulebook-panel .page-cat-badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    padding: 4px 10px; border-radius: 20px; margin-bottom: 14px;
    background: rgba(0,0,0,0.05);
}
#rulebook-panel .page-cat-badge i { font-size: 12px; }

#rulebook-panel .book-page-footer {
    position: absolute; bottom: 18px; left: 0; right: 0;
    text-align: center; font-size: 11px; color: #999; letter-spacing: 1px;
}

#rulebook-panel .book-page { position: relative; }
#rulebook-panel .book-page-empty { background: #fdf6e3; }

/* Talalat kiemelese */
#rulebook-panel mark.rule-hit {
    background: #ffe27a;
    color: #222;
    border-radius: 3px;
    padding: 0 2px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}
#rulebook-panel mark.rule-hit.rule-hit-active { background: #ffb703; }

/* =====================================================
   SZABALYZAT - KERESO
   ===================================================== */
#rulebook-panel .rule-search {
    position: relative;
    display: flex; align-items: center;
    height: 50px; width: 360px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 0 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#rulebook-panel .rule-search:focus-within {
    border-color: rgba(255, 255, 255, 0.3);
}
#rulebook-panel .rule-search-icon { color: var(--primary); font-size: 15px; margin-right: 10px; }

#rulebook-panel #rule-search-input, #rulebook-panel #command-search-input {
    flex: 1; height: 100%;
    background: transparent; border: none; outline: none;
    color: #fff; font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 500;
    user-select: text; -webkit-user-select: text;
}
#rulebook-panel #rule-search-input::placeholder, #rulebook-panel #command-search-input::placeholder { color: #8a8a8a; }

#rulebook-panel .rule-search-clear {
    background: rgba(255,255,255,0.08); border: none; color: #ccc;
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 12px;
    transition: background-color 0.2s, color 0.2s;
}
#rulebook-panel .rule-search-clear:hover { background: var(--badge-sale); color: #fff; }

#rulebook-panel .rule-search-results {
    position: absolute; top: 58px; right: 0;
    width: 460px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain;
    background: rgba(18, 18, 22, 0.99);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.65);
    z-index: 400;
    padding: 8px;
}
#rulebook-panel .rule-search-results::-webkit-scrollbar { width: 6px; }
#rulebook-panel .rule-search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

#rulebook-panel .rule-result {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-radius: 10px; cursor: pointer;
    transition: background 0.15s;
    border-left: 4px solid transparent;
}
#rulebook-panel .rule-result:hover, #rulebook-panel .rule-result.sel { background: rgba(0, 132, 255, 0.12); }

#rulebook-panel .rule-result-icon {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff;
}
#rulebook-panel .rule-result-body { flex: 1; min-width: 0; }
#rulebook-panel .rule-result-title { font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 3px; }
#rulebook-panel .rule-result-cat { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 4px; }
#rulebook-panel .rule-result-snippet { font-size: 12px; color: #aaa; line-height: 1.5; }
#rulebook-panel .rule-result-snippet mark { background: rgba(255, 210, 60, 0.28); color: #ffd23c; border-radius: 3px; padding: 0 2px; }
#rulebook-panel .rule-result-page { font-size: 10px; color: #777; font-weight: 700; flex-shrink: 0; align-self: center; }

#rulebook-panel .rule-search-empty { padding: 22px; text-align: center; color: #888; font-size: 13px; }
#rulebook-panel .rule-search-count { padding: 6px 14px 10px; font-size: 11px; color: #777; letter-spacing: 0.5px; }


/* az oldalszam se csusszon a cetlik ala */
#rulebook-panel .front .book-page-footer { right: 62px; }

/* =====================================================
   A MAR ATLAPOZOTT (bal oldali) lapok cetlijei
   A lap hatoldalan a cetli a KULSO, bal szelre kerul,
   nem a konyv gerincehez.
   ===================================================== */
#rulebook-panel .back .book-tab {
    left: auto;
    right: calc(100% - 50px);
    padding: 8px 58px 8px 12px;
    flex-direction: row-reverse;
    text-align: right;
    border-radius: 8px 0 0 8px;
    border-right: none;
    border-left: 1px solid rgba(0, 0, 0, 0.2);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 55%),
        var(--tab-color, var(--primary));
    box-shadow:
        inset -10px 0 10px -8px rgba(0, 0, 0, 0.45),
        -3px 3px 7px rgba(0, 0, 0, 0.35);
    transform: none;
    transform-origin: right center;
}

#rulebook-panel .back .book-tab::before {
    left: auto;
    right: 0;
    background: linear-gradient(270deg, rgba(0,0,0,0.28) 0%, rgba(0,0,0,0.05) 100%);
}

#rulebook-panel .back .book-tab::after {
    left: auto;
    right: 50px;
    background: linear-gradient(270deg, rgba(0,0,0,0.35), rgba(0,0,0,0));
}

#rulebook-panel .back .book-tab:hover {
    transform: translateX(-5px);
    box-shadow:
        inset -10px 0 10px -8px rgba(0, 0, 0, 0.45),
        -5px 5px 12px rgba(0, 0, 0, 0.45);
}

#rulebook-panel .back .book-tab.active {
    transform: translateX(-5px);
    box-shadow:
        inset -10px 0 10px -8px rgba(0, 0, 0, 0.45),
        -5px 5px 12px rgba(0, 0, 0, 0.45);
}

/* a bal oldali lapon a szoveg es az oldalszam is kiterjen a cetlik elol */
#rulebook-panel .back .book-page { padding-left: 62px; }
#rulebook-panel .back .book-page-footer { left: 62px; }

/* =====================================================
   CETLI: kiemelt (rad vonatkozik) vs. szurke
   ===================================================== */
#rulebook-panel .book-tab.muted { opacity: 1; }   /* atlatszatlan, hogy eles maradjon a szoveg */
#rulebook-panel .book-tab.relevant { font-weight: 800; }

/* verzio a boriton */
#rulebook-panel .book-cover-version {
    margin-top: 26px;
    font-size: 12px;
    letter-spacing: 1px;
    color: #777;
    font-family: 'Montserrat', sans-serif;
}

/* =====================================================
   MERETEZES - a konyv barmilyen felbontason kiferjen
   (a pontos aranyt a fitRulebook() szamolja JS-bol)
   ===================================================== */
/* A meretezes zoom-mal tortenik (JS), igy a szoveg ujra van rajzolva
   a vegleges mereten - nem lesz elmosodott, mint transform: scale eseten. */
#rulebook-panel .rulebook-container {
    transform-origin: center center;
}


/* =====================================================
   TELJESITMENY
   ===================================================== */
/* Visszalapozas / ujraepites animacio nelkul (a JS kapcsolja) */
#rulebook-panel .book.no-anim, #rulebook-panel .book.no-anim .paper { transition: none !important; }
