*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --black:    #080808;
    --border:   rgba(210, 175, 120, 0.18);
    --gold:     #c9a96e;
    --gold-dim: #7a5f35;
    --cream:    #f0e8d8;
    --muted:    rgba(240, 232, 216, 0.45);
    --input-bg: rgba(255, 255, 255, 0.05);
}

html, body {
    min-height: 100vh;
    background: var(--black);
    font-family: 'DM Mono', monospace;
    color: var(--cream);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(139,46,22,.20) 0%, transparent 65%),
        radial-gradient(ellipse 50% 60% at 80% 70%, rgba(29,52,97,.22) 0%, transparent 65%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(201,169,110,.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

header {
    position: relative; z-index: 10;
    padding: 22px 36px;
    display: flex; align-items: center; justify-content: space-between;
}
header a {
    font-family: 'DM Mono', monospace; font-size: .72rem; letter-spacing: .18em;
    text-transform: uppercase; color: var(--gold); text-decoration: none;
    border: 1px solid var(--gold-dim); padding: 7px 16px; border-radius: 2px;
    transition: background .2s, color .2s;
}
header a:hover { background: var(--gold); color: var(--black); }
.header-right { display: flex; align-items: center; gap: 12px; }
#lang-group, #theme-group { display: flex; gap: 6px; }
#lang-group button, #theme-group button {
    font-family: 'DM Mono', monospace; font-size: .65rem; letter-spacing: .14em;
    text-transform: uppercase; padding: 6px 12px;
    border: 1px solid var(--gold-dim); background: transparent; color: var(--muted);
    cursor: pointer; border-radius: 2px;
    transition: background .2s, color .2s, border-color .2s;
}
#lang-group button:hover, #lang-group button.active,
#theme-group button:hover, #theme-group button.active {
    background: var(--gold); border-color: var(--gold); color: var(--black);
}

main { position: relative; z-index: 1; display: flex; justify-content: center; padding: 20px 16px 60px; }

.detail-card {
    width: 100%; max-width: 1400px;
    background-image: linear-gradient(rgba(8,6,4,.80), rgba(8,6,4,.80)), url('biblio1.jpeg');
    background-size: cover; background-position: center;
    border: 1px solid var(--border); border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(201,169,110,.08), 0 40px 100px rgba(0,0,0,.85), inset 0 1px 0 rgba(201,169,110,.14);
    overflow: hidden;
    animation: cardIn .7s cubic-bezier(.22,1,.36,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

.detail-card-header {
    padding: 28px 36px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; gap: 20px;
}
.detail-book-3d { perspective: 600px; width: 80px; flex-shrink: 0; }
.detail-book-3d-inner {
    width: 80px; height: 115px; transform-style: preserve-3d;
    transform: rotateY(-22deg); transition: transform .4s; position: relative;
}
.detail-book-3d:hover .detail-book-3d-inner { transform: rotateY(-8deg); }
.detail-book-face {
    position: absolute; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    padding: 8px; border-radius: 1px 3px 3px 1px;
}
.detail-book-face-title { font-family: 'Cormorant Garamond', serif; font-size: .6rem; color: rgba(255,255,255,.85); text-align: center; line-height: 1.3; }
.detail-book-spine { position: absolute; width: 14px; height: 100%; left: -14px; transform: rotateY(-90deg) translateZ(7px); transform-origin: right; border-radius: 1px 0 0 1px; }
.detail-book-shadow { position: absolute; bottom: -8px; left: -4px; right: -4px; height: 14px; background: radial-gradient(ellipse, rgba(0,0,0,.55) 0%, transparent 70%); filter: blur(5px); }

.detail-title-block { flex: 1; }
#bd-book-title { font-family: 'Cormorant Garamond', serif; font-size: 2rem; font-weight: 300; letter-spacing: .03em; color: var(--cream); line-height: 1.2; font-style: italic; margin-bottom: 6px; }
#bd-book-author { font-size: .75rem; letter-spacing: .15em; color: var(--gold); text-transform: uppercase; margin-bottom: 10px; }
.bd-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bd-meta-tag { font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; padding: 3px 10px; border: 1px solid var(--border); border-radius: 20px; color: var(--muted); }

.detail-body { padding: 28px 36px; }
#bd-book-summary { font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; line-height: 1.8; color: var(--muted); margin-bottom: 28px; font-style: italic; border-left: 2px solid var(--gold-dim); padding-left: 16px; }

#bd-rating-section { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }

.bd-rating-row { display: flex; align-items: flex-start; gap: 40px; flex-wrap: wrap; }
.bd-rating-col, .bd-fav-col { display: flex; flex-direction: column; gap: 8px; }

.bd-section-label { font-size: .6rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-dim); margin-bottom: 10px; }

#bd-stars { display: flex; gap: 4px; }
.bd-star { font-size: 1.8rem; cursor: pointer; color: #888; transition: color .15s, transform .1s; }
.bd-star:hover { transform: scale(1.15); }
.bd-star.bd-star-on { color: #f5a623; }

#bd-fav-btn {
    font-size: 1.6rem; background: transparent;
    border: 1px solid var(--border); border-radius: 4px;
    padding: 6px 14px; cursor: pointer;
    transition: transform .15s ease, border-color .2s, background .2s; line-height: 1;
}
#bd-fav-btn:hover { transform: scale(1.15); border-color: rgba(220,80,80,.5); background: rgba(220,80,80,.07); }
#bd-fav-btn.bd-fav-active { border-color: rgba(220,80,80,.5); background: rgba(220,80,80,.07); }

#bd-doc-section { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
#bd-url-section a {
    font-family: 'DM Mono', monospace; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
    color: var(--gold); text-decoration: none; border: 1px solid var(--gold-dim);
    padding: 7px 16px; border-radius: 2px; display: inline-block;
    transition: background .2s, color .2s;
}
#bd-url-section a:hover { background: var(--gold); color: var(--black); }
#bd-pdf-viewer { border: none; border-top: 1px solid var(--border); display: block; width: calc(100% + 72px); margin-left: -36px; height: 100vh; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }

body.theme-normal { background: #f5efe6; color: #2a1f14; }
body.theme-normal::before { background: radial-gradient(ellipse 60% 50% at 20% 30%, rgba(210,160,80,.15) 0%, transparent 65%), radial-gradient(ellipse 50% 60% at 80% 70%, rgba(120,180,100,.12) 0%, transparent 65%); }
body.theme-normal .detail-card { background-image: linear-gradient(rgba(245,239,230,.85), rgba(245,239,230,.85)), url('biblio2.png'); border-color: rgba(180,130,70,.3); box-shadow: 0 40px 100px rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.8); }
body.theme-normal .detail-card-header { border-color: rgba(180,130,70,.2); }
body.theme-normal #bd-rating-section { border-color: rgba(180,130,70,.2); }
body.theme-normal #bd-book-title  { color: #3a2510; }
body.theme-normal #bd-book-author { color: #8b5e2a; }
body.theme-normal .bd-meta-tag    { color: rgba(42,31,20,.5); border-color: rgba(180,130,70,.25); }
body.theme-normal #bd-book-summary { color: rgba(42,31,20,.7); border-color: #a07840; }
body.theme-normal .bd-section-label { color: #a07840; }
body.theme-normal .bd-star { color: #ccc; }
body.theme-normal .bd-star.bd-star-on { color: #f5a623; }
body.theme-normal #bd-fav-btn { border-color: rgba(180,130,70,.3); }
body.theme-normal #bd-fav-btn:hover, body.theme-normal #bd-fav-btn.bd-fav-active { border-color: rgba(180,60,40,.4); background: rgba(180,60,40,.07); }
body.theme-normal #bd-url-section a { color: #8b5e2a; border-color: rgba(139,94,42,.4); }
body.theme-normal #bd-url-section a:hover { background: #8b5e2a; color: #fff; }
body.theme-normal header a { color: #8b5e2a; border-color: rgba(139,94,42,.4); }
body.theme-normal header a:hover { background: #8b5e2a; color: #fff; }
body.theme-normal #lang-group button, body.theme-normal #theme-group button { border-color: rgba(139,94,42,.4); color: rgba(42,31,20,.6); }
body.theme-normal #lang-group button:hover, body.theme-normal #lang-group button.active,
body.theme-normal #theme-group button:hover, body.theme-normal #theme-group button.active { background: #8b5e2a; border-color: #8b5e2a; color: #fff; }

@media (max-width: 600px) {
    .detail-card-header { flex-direction: column; }
    .detail-body, .detail-card-header { padding: 20px; }
    .bd-rating-row { gap: 24px; }
}