.ab-book-3d {
    perspective: 600px;
    display: inline-block;
    width: 60px;
    height: 90px;
    position: relative;
    margin-bottom: 8px;
}

.ab-book-3d-inner {
    width: 60px;
    height: 90px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-25deg);
    transition: transform 0.5s ease;
    animation: ab-book-float 3s ease-in-out infinite;
}

.ab-book-3d:hover .ab-book-3d-inner {
    transform: rotateY(-45deg);
}

.ab-book-face {
    position: absolute;
    width: 60px;
    height: 90px;
    border-radius: 0 3px 3px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    text-align: center;
    overflow: hidden;
}

.ab-book-face-title {
    font-size: 0.42rem;
    font-weight: 700;
    color: rgba(255,255,255,0.92);
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.ab-book-face-deco {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 1px;
    background: rgba(255,255,255,0.25);
}

.ab-book-spine {
    position: absolute;
    left: 0;
    top: 0;
    height: 90px;
    width: 12px;
    transform: rotateY(90deg) translateZ(-6px);
    transform-origin: left center;
    border-radius: 1px 0 0 1px;
}

.ab-book-shadow {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 10px;
    background: radial-gradient(ellipse, rgba(0,0,0,0.4) 0%, transparent 70%);
    filter: blur(4px);
}

@keyframes ab-book-float {
    0% { transform: rotateY(-25deg) translateY(0px); }
    50% { transform: rotateY(-25deg) translateY(-4px); }
    100% { transform: rotateY(-25deg) translateY(0px); }
}

#ab-book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.ab-book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ab-book-card-info {
    text-align: center;
}

.ab-book-card-title {
    font-weight: bold;
    font-size: 0.85rem;
}

.ab-book-card-author {
    font-size: 0.75rem;
}

.ab-book-card-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 4px;
}

: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);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

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); }

main {
    position: relative; z-index: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 16px 60px;
}

.glass-card {
    width: 100%;
    max-width: 1060px;
    background-image:
        linear-gradient(rgba(8,6,4,.80), rgba(8,6,4,.80)),
        url('biblio1.jpeg');
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    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;
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto 1fr;
    height: 90vh;
    align-items: stretch;
    animation: cardIn .7s cubic-bezier(.22,1,.36,1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    grid-column: 1 / -1;
    padding: 26px 32px 22px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
}

.card-header h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: .04em;
    color: var(--cream);
}

#ab-form-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 300;
    letter-spacing: .04em;
    color: var(--cream);
}

#ab-mode-tag {
    font-size: .65rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    padding: 3px 10px;
    border-radius: 2px;
}

#ab-count-badge {
    margin-left: auto;
    font-size: .7rem;
    background: rgba(201,169,110,.12);
    color: var(--gold);
    border: 1px solid var(--gold-dim);
    padding: 3px 12px;
    border-radius: 20px;
}

.left-col {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ab-preview {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

#ab-preview > p {
    font-size: .62rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 16px;
}

.preview-row { display: flex; gap: 14px; align-items: flex-start; }

.preview-texts p {
    font-size: .78rem;
    line-height: 1.55;
    color: var(--muted);
    margin-bottom: 4px;
}

#ab-pv-title  {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem !important;
    color: var(--cream) !important;
    font-style: italic;
}
#ab-pv-author { font-size: .72rem !important; color: var(--gold) !important; }

#ab-list-section {
    padding: 20px 24px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#ab-list-section > h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--muted);
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}

#ab-list-section #ab-book-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0;
    grid-template-columns: unset;
}

#ab-list-section .ab-book-card {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    transition: background .2s;
    text-align: left;
}
#ab-list-section .ab-book-card:hover { background: rgba(201,169,110,.07); }

#ab-list-section .ab-book-card-info { flex: 1; }

#ab-list-section .ab-book-card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: .95rem;
    color: var(--cream);
    font-weight: 400;
}

#ab-list-section .ab-book-card-author {
    font-size: .68rem;
    color: var(--gold-dim);
    margin-top: 2px;
}

#ab-list-section .ab-book-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    justify-content: flex-start;
}

#ab-list-section .ab-book-card-actions button,
#ab-list-section .ab-book-card a {
    font-family: 'DM Mono', monospace;
    font-size: .6rem;
    letter-spacing: .1em;
    padding: 3px 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 2px;
    text-decoration: none;
    transition: border-color .2s, color .2s;
}
#ab-list-section .ab-book-card-actions button:hover { border-color: var(--gold); color: var(--gold); }

.right-col {
    padding: 28px 32px;
    overflow-y: auto;
    max-height: none;
}

.form-group { margin-bottom: 20px; }

label {
    display: block;
    font-size: .62rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 7px;
}

input[type="text"],
input[type="url"],
input[type="date"],
textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--cream);
    font-family: 'DM Mono', monospace;
    font-size: .8rem;
    padding: 9px 13px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 2px rgba(201,169,110,.08);
}
input::placeholder, textarea::placeholder { color: rgba(240,232,216,.22); }
textarea { resize: vertical; min-height: 72px; }

small {
    font-size: .62rem;
    color: var(--gold-dim);
    display: block;
    margin-top: 5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.tab-bar { display: flex; gap: 6px; margin-bottom: 10px; }

.tab-bar button,
#ab-tab-url,
#ab-tab-pdf {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 2px;
    transition: background .2s, color .2s, border-color .2s;
}
.tab-bar button.active,
.tab-bar button:hover,
#ab-tab-url:hover,
#ab-tab-pdf:hover {
    background: rgba(201,169,110,.1);
    border-color: var(--gold-dim);
    color: var(--gold);
}

#ab-pdf-dropzone {
    border: 1px dashed var(--border);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    border-radius: 3px;
    color: var(--muted);
    font-size: .75rem;
    transition: border-color .2s, background .2s;
}
#ab-pdf-dropzone:hover {
    border-color: var(--gold-dim);
    background: rgba(201,169,110,.04);
}

#ab-pdf-info {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: .75rem;
    color: var(--gold);
}

#ab-btn-clear-pdf {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .9rem;
    padding: 0 4px;
}

.url-row { display: flex; align-items: center; }
.url-row input { flex: 1; }
#ab-url-indicator { margin-left: 8px; }

#ab-color-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.ab-swatch {
    width: 22px; height: 22px;
    border-radius: 2px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .15s, border-color .15s;
}
.ab-swatch:hover { transform: scale(1.2); }
.ab-swatch-on { border-color: #fff !important; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

#ab-btn-reset {
    font-family: 'DM Mono', monospace;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 9px 20px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    border-radius: 2px;
    transition: border-color .2s, color .2s;
}
#ab-btn-reset:hover { border-color: var(--muted); color: var(--cream); }

#ab-save-btn {
    font-family: 'DM Mono', monospace;
    font-size: .68rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 9px 24px;
    background: var(--gold);
    border: 1px solid var(--gold);
    color: var(--black);
    cursor: pointer;
    border-radius: 2px;
    font-weight: 600;
    transition: background .2s, box-shadow .2s;
}
#ab-save-btn:hover {
    background: #e0bb7a;
    box-shadow: 0 0 20px rgba(201,169,110,.3);
}

#ab-toasts {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 999;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }

@media (max-width: 720px) {
    .glass-card { grid-template-columns: 1fr; }
    .left-col { border-right: none; border-bottom: 1px solid var(--border); }
    .right-col { max-height: none; }
    .form-row { grid-template-columns: 1fr; }
}

#ab-list-section .ab-book-card-info > a,
#ab-list-section .ab-book-card-info > button {
    display: inline-block;
    font-family: 'DM Mono', monospace;
    font-size: .6rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 3px 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 2px;
    text-decoration: none;
    margin-top: 4px;
    margin-right: 4px;
    transition: border-color .2s, color .2s, background .2s;
}

#ab-list-section .ab-book-card-info > a:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(201,169,110,.06);
}

#ab-list-section .ab-book-card-info > button:hover {
    border-color: var(--cream);
    color: var(--cream);
    background: rgba(240,232,216,.06);
}

#theme-group {
    display: flex;
    gap: 6px;
    margin-right: 16px;
}
#theme-group button {
    font-family: 'DM Mono', monospace;
    font-size: .65rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    padding: 6px 14px;
    border: 1px solid var(--gold-dim);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 2px;
    transition: background .2s, color .2s, border-color .2s;
}
#theme-group button:hover,
#theme-group button.active {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--black);
}

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 .glass-card {
    background-image:
        linear-gradient(rgba(245,239,230,.82), rgba(245,239,230,.82)),
        url('biblio2.png');
    background-size: cover;
    background-position: center;
    border-color: rgba(180,130,70,.3);
    box-shadow:
        0 0 0 1px rgba(180,130,70,.1),
        0 40px 100px rgba(0,0,0,.15),
        inset 0 1px 0 rgba(255,255,255,.8);
}

body.theme-normal .card-header,
body.theme-normal .left-col,
body.theme-normal #ab-preview,
body.theme-normal #ab-list-section {
    border-color: rgba(180,130,70,.2);
}

body.theme-normal #ab-form-title,
body.theme-normal .card-header h2 {
    color: #3a2510;
}

body.theme-normal #ab-mode-tag {
    color: #8b5e2a;
    border-color: rgba(139,94,42,.4);
}

body.theme-normal #ab-count-badge {
    background: rgba(139,94,42,.1);
    color: #8b5e2a;
    border-color: rgba(139,94,42,.3);
}

body.theme-normal label {
    color: #8b5e2a;
}

body.theme-normal input[type="text"],
body.theme-normal input[type="url"],
body.theme-normal input[type="date"],
body.theme-normal textarea {
    background: rgba(255,255,255,.65);
    border-color: rgba(180,130,70,.3);
    color: #2a1f14;
}

body.theme-normal input:focus,
body.theme-normal textarea:focus {
    border-color: #8b5e2a;
    box-shadow: 0 0 0 2px rgba(139,94,42,.1);
}

body.theme-normal input::placeholder,
body.theme-normal textarea::placeholder {
    color: rgba(42,31,20,.35);
}

body.theme-normal #ab-preview > p {
    color: #a07840;
}

body.theme-normal #ab-pv-title  { color: #2a1f14 !important; }
body.theme-normal #ab-pv-author { color: #8b5e2a !important; }
body.theme-normal .preview-texts p { color: rgba(42,31,20,.6); }

body.theme-normal #ab-list-section > h2 { color: rgba(42,31,20,.6); }

body.theme-normal #ab-list-section .ab-book-card {
    background: rgba(255,255,255,.4);
    border-color: rgba(180,130,70,.2);
}
body.theme-normal #ab-list-section .ab-book-card:hover {
    background: rgba(139,94,42,.08);
}
body.theme-normal #ab-list-section .ab-book-card-title { color: #2a1f14; }
body.theme-normal #ab-list-section .ab-book-card-author { color: #a07840; }

body.theme-normal #ab-list-section .ab-book-card-actions button,
body.theme-normal #ab-list-section .ab-book-card a {
    border-color: rgba(180,130,70,.3);
    color: rgba(42,31,20,.6);
}
body.theme-normal #ab-list-section .ab-book-card-actions button:hover {
    border-color: #8b5e2a;
    color: #8b5e2a;
}

body.theme-normal .tab-bar button,
body.theme-normal #ab-tab-url,
body.theme-normal #ab-tab-pdf {
    border-color: rgba(180,130,70,.3);
    color: rgba(42,31,20,.6);
}
body.theme-normal .tab-bar button:hover,
body.theme-normal .tab-bar button.active,
body.theme-normal #ab-tab-url:hover,
body.theme-normal #ab-tab-pdf:hover {
    background: rgba(139,94,42,.1);
    border-color: #8b5e2a;
    color: #8b5e2a;
}

body.theme-normal #ab-pdf-dropzone {
    border-color: rgba(180,130,70,.3);
    color: rgba(42,31,20,.5);
}
body.theme-normal #ab-pdf-dropzone:hover {
    border-color: #8b5e2a;
    background: rgba(139,94,42,.05);
}

body.theme-normal #ab-btn-reset {
    border-color: rgba(180,130,70,.3);
    color: rgba(42,31,20,.6);
}
body.theme-normal #ab-btn-reset:hover {
    border-color: #2a1f14;
    color: #2a1f14;
}

body.theme-normal #ab-save-btn {
    background: #8b5e2a;
    border-color: #8b5e2a;
    color: #fff;
}

body.theme-normal #ab-save-btn:hover {
    background: #a07840;
    box-shadow: 0 0 20px rgba(139,94,42,.3);
}

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 #theme-group button {
    border-color: rgba(139,94,42,.4);
    color: rgba(42,31,20,.6);
}
body.theme-normal #theme-group button:hover,
body.theme-normal #theme-group button.active {
    background: #8b5e2a;
    border-color: #8b5e2a;
    color: #fff;
}

body.theme-normal small { color: #a07840; }

#lang-group {
    display: flex;
    gap: 6px;
    margin-right: 16px;
}
#lang-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 {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--black);
}

body.theme-normal #lang-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 {
    background: #8b5e2a;
    border-color: #8b5e2a;
    color: #fff;
}