/* Autor: DiagonalHosting.com */
* { box-sizing: border-box; }

html, body {
    width: 100%; height: 100%; margin: 0; overflow: hidden;
    background: #050507; color: #f9fafb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body { user-select: none; -webkit-user-select: none; }

.fb-header {
    width: 100%; height: 60px; min-height: 60px;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center; gap: 12px; padding: 0 14px;
    background: rgba(5, 5, 7, 0.92); color: #f8f4f8;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(16px);
    overflow: hidden;
}

.fb-brand-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fb-brand { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.fb-brand img { width: auto; max-width: 154px; height: 38px; display: block; }
.fb-menu { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fb-menu a {
    min-height: 34px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 12px; border: 1px solid rgba(255,255,255,0.13); border-radius: 999px;
    background: rgba(255,255,255,0.06); color: #fff; text-decoration: none;
    font-size: 13px; font-weight: 800; white-space: nowrap;
}
.fb-menu a:first-child { background: linear-gradient(135deg, #ff2a7f, #b96cff); border-color: transparent; }
.fb-menu a:hover { transform: translateY(-1px); }

.fb-header-html {
    min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    font-size: 15px; line-height: 1.1; color: #f8f4f8;
}
.fb-header-html strong { margin-right: 10px; }
.fb-header-html span { color: #b9aeba; }

.fb-controls { height: 60px; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.fb-controls button {
    height: 36px; border: 1px solid rgba(255,255,255,0.14); border-radius: 10px;
    padding: 0 12px; background: rgba(255,255,255,0.07); color: #fff; cursor: pointer;
    font: inherit; font-weight: 800;
}
.fb-controls button:hover { background: rgba(255,255,255,0.13); }
#fb-fullscreen { background: linear-gradient(135deg, #ff2a7f, #b96cff); border-color: transparent; }
#fb-prev, #fb-next { min-width: 38px; font-size: 26px; line-height: 30px; }
#fb-counter, #fb-zoom-label { min-width: 76px; text-align: center; font-size: 14px; color: #cfc5d0; font-variant-numeric: tabular-nums; }
#fb-zoom-label { min-width: 54px; padding: 0 2px; }
#fb-zoom-out, #fb-zoom-in { min-width: 38px; font-size: 20px; line-height: 24px; }
#fb-zoom-reset { min-width: 54px; }
.fb-controls button:disabled { cursor: not-allowed; opacity: 0.45; }

.fb-stage {
    width: 100%; height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center;
    padding: 12px; overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; touch-action: pan-x pan-y;
    background:
        radial-gradient(circle at top left, rgba(255,42,127,0.18), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(185,108,255,0.17), transparent 30rem),
        linear-gradient(135deg, #050507, #100b14 50%, #0a0710);
}
#fb-zoom-space { width: 100%; min-width: 260px; min-height: 340px; display: flex; align-items: flex-start; justify-content: center; margin: auto; }
#book { display: flex; align-items: center; justify-content: center; transition: transform 160ms ease; will-change: transform; }
.fb-stage.is-zoomed { align-items: flex-start; justify-content: flex-start; }
.fb-stage.is-zoomed #fb-zoom-space { margin: 0 auto; }
#book canvas, #book img, .stf__parent, .stf__wrapper { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

.fb-error {
    width: min(720px, calc(100% - 28px)); padding: clamp(24px, 5vw, 42px); border-radius: 24px;
    background: rgba(17,15,22,0.96); color: #fff; box-shadow: 0 24px 70px rgba(0,0,0,0.46); text-align: center;
    border: 1px solid rgba(255,255,255,0.12);
}
.fb-error h1 { margin: 0 0 12px; }
.fb-error p { color: #cfc5d0; line-height: 1.55; }
.fb-error code { padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,0.08); color: #fff; }
.fb-error a { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; margin-top: 12px; padding: 0 16px; border-radius: 999px; background: linear-gradient(135deg, #ff2a7f, #b96cff); color: #fff; text-decoration: none; font-weight: 800; }

@media (max-width: 980px) {
    .fb-header { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 30px 30px; gap: 0 8px; padding: 0 8px; }
    .fb-brand-row { gap: 8px; }
    .fb-brand img { height: 28px; max-width: 118px; }
    .fb-menu a { min-height: 26px; padding: 0 9px; font-size: 12px; }
    .fb-menu a:nth-child(2) { display: none; }
    .fb-header-html { font-size: 13px; grid-column: 1 / 2; }
    .fb-controls { grid-column: 1 / -1; justify-content: center; height: 30px; gap: 6px; }
    .fb-controls button { height: 26px; padding: 0 9px; border-radius: 8px; font-size: 12px; }
    #fb-prev, #fb-next { min-width: 34px; font-size: 22px; line-height: 20px; }
    #fb-counter, #fb-zoom-label { min-width: 58px; font-size: 12px; }
    #fb-zoom-label { min-width: 44px; }
    #fb-zoom-out, #fb-zoom-in { min-width: 30px; font-size: 18px; line-height: 18px; }
    #fb-zoom-reset { display: none; }
    .fb-stage { padding: 8px; }
}

@media (max-width: 520px) {
    .fb-menu a:first-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
    #fb-fullscreen { max-width: 94px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    #fb-counter { min-width: 50px; }
    #fb-zoom-label { min-width: 38px; }
}

@media (max-width: 390px) {
    .fb-brand img { max-width: 98px; }
    .fb-menu a:first-child { max-width: 90px; }
}

@media print { body { display: none !important; } }
