/* ===========================================================
   Bookshelf — Literary Parchment Aesthetic
   Personal library / reading room feel
   =========================================================== */

:root {
    --color-bg: #f5f0e8;
    --color-bg-warm: #ede8de;
    --color-sidebar: #1e2d1e;
    --color-sidebar-active: rgba(255, 255, 255, 0.09);
    --color-accent: #5c3d1e;
    --color-accent-hover: #7a5228;
    --color-text: #2a1f14;
    --color-muted: #7a6a5a;
    --color-border: #d4c9b8;
    --color-tag-bg: rgba(92, 61, 30, 0.10);
    --font-serif: 'Lora', Georgia, serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --sidebar-width: 180px;
    --list-width: 230px;
    --shadow-cover: inset 0 0 0 1px rgba(0, 0, 0, 0.12), 2px 4px 12px rgba(0, 0, 0, 0.18);
    --shadow-card: 0 2px 12px rgba(42, 31, 20, 0.10);
    --transition: 0.15s ease;
}

/* ----------- Reset ----------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

/* ----------- Parchment texture overlay ----------- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    opacity: 0.6;
}

/* ----------- Body layout ----------- */
body {
    font-family: var(--font-serif);
    background: var(--color-bg);
    color: var(--color-text);
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body > * {
    position: relative;
    z-index: 1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    line-height: 1.25;
    font-weight: 700;
    color: var(--color-text);
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--color-accent-hover);
}

button {
    font-family: inherit;
    cursor: pointer;
}

input, textarea, select {
    font-family: inherit;
    color: inherit;
}

/* ===========================================================
   Sidebar — Deep forest green
   =========================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: #e8e0d0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25);
}

.sidebar-brand {
    font-family: var(--font-display);
    font-size: 1.4rem;
    padding: 0 1.5rem 2rem;
    color: #f0ead8;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.sidebar-nav li a {
    display: block;
    padding: 0.65rem 1.5rem;
    color: #a89880;
    text-decoration: none;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    transition: background var(--transition), color var(--transition), padding var(--transition);
    border-left: 2px solid transparent;
}

.sidebar-nav li a:hover {
    color: #f0ead8;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-nav li a.active {
    color: #f0ead8;
    background: var(--color-sidebar-active);
    border-left: 2px solid #c8a87a;
    padding-left: calc(1.5rem - 2px);
}

/* ===========================================================
   Main area
   =========================================================== */
.main-area {
    flex: 1;
    display: flex;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===========================================================
   Book list panel (left column of shelf view)
   =========================================================== */
.book-list-panel {
    width: var(--list-width);
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    height: 100vh;
    height: 100dvh;
}

.filter-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-bottom: 1px solid var(--color-border);
    background: transparent;
    font-family: var(--font-serif);
    font-size: 0.85rem;
    outline: none;
    color: var(--color-text);
    transition: background var(--transition);
}

.filter-input::placeholder {
    color: var(--color-muted);
    font-style: italic;
}

.filter-input:focus {
    background: rgba(255, 255, 255, 0.4);
}

.book-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.book-item {
    display: flex;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
}

.book-item:hover {
    background: rgba(92, 61, 30, 0.06);
}

.book-item.selected {
    background: rgba(92, 61, 30, 0.12);
}

.book-item-cover {
    flex-shrink: 0;
}

.book-item-cover img {
    width: 34px;
    height: 50px;
    object-fit: cover;
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
    display: block;
}

.cover-placeholder {
    background: linear-gradient(135deg, #c8b89a 0%, #b09875 100%);
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
}

.book-item-cover .cover-placeholder {
    width: 34px;
    height: 50px;
}

.cover-placeholder.large {
    width: 90px;
    height: 130px;
}

.cover-placeholder.small {
    width: 28px;
    height: 40px;
}

.book-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    flex: 1;
}

.book-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-item-author {
    font-size: 0.75rem;
    color: var(--color-muted);
    font-style: italic;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-item-elo {
    font-size: 0.7rem;
    color: var(--color-accent);
    font-weight: 600;
    margin-top: 0.1rem;
}

.book-friend-signal {
    font-size: 11px;
    color: var(--color-accent);
    font-style: italic;
    display: block;
    margin-top: 1px;
}

.add-book-btn {
    margin: 1rem;
    text-align: center;
}

/* ===========================================================
   Detail panel
   =========================================================== */
.detail-panel {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem 3rem;
    height: 100vh;
    height: 100dvh;
}

.detail-panel > * {
    max-width: 720px;
}

.detail-empty {
    color: var(--color-muted);
    font-style: italic;
    margin-top: 4rem;
    text-align: center;
    font-size: 0.95rem;
}

.book-detail-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.75rem;
    align-items: flex-start;
}

.book-detail-cover {
    flex-shrink: 0;
}

.book-detail-cover img {
    width: 110px;
    height: 160px;
    object-fit: cover;
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
    display: block;
}

.book-detail-cover .cover-placeholder.large {
    width: 110px;
    height: 160px;
}

.book-detail-info {
    flex: 1;
    min-width: 0;
}

.book-detail-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.book-detail-author {
    font-size: 1rem;
    font-style: italic;
    color: var(--color-muted);
    margin-bottom: 0.35rem;
}

.book-detail-year {
    font-size: 0.82rem;
    color: var(--color-muted);
}

/* ----------- Genre tags ----------- */
.genre-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.7rem 0;
}

.genre-tag {
    background: var(--color-tag-bg);
    color: var(--color-accent);
    padding: 0.2rem 0.65rem;
    border-radius: 2px;
    font-size: 0.72rem;
    letter-spacing: 0.02em;
}

/* ----------- Book meta row with · separators ----------- */
.book-meta-row {
    font-size: 0.8rem;
    color: var(--color-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.book-meta-row span:not(:last-child)::after {
    content: ' · ';
    margin: 0 0.15rem;
    color: var(--color-border);
}

/* ----------- Book actions ----------- */
.book-actions {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ----------- ELO display ----------- */
.elo-display {
    display: flex;
    align-items: baseline;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.elo-score {
    font-family: var(--font-display);
    font-size: 2.4rem;
    color: var(--color-accent);
    line-height: 1;
    font-weight: 700;
}

.elo-rank {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-style: italic;
}

/* ----------- Synopsis section ----------- */
.book-detail-synopsis {
    border-top: 1px solid var(--color-border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.synopsis-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.synopsis-text {
    font-size: 0.92rem;
    line-height: 1.8;
    color: var(--color-text);
}

.synopsis-empty {
    color: var(--color-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* ----------- Blurb editor ----------- */
.blurb-edit textarea {
    width: 100%;
    min-height: 90px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.4);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 0.5rem;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition), background var(--transition);
    border-radius: 2px;
}

.blurb-edit textarea:focus {
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.6);
}

/* ===========================================================
   Buttons
   =========================================================== */
.btn {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    font-family: var(--font-serif);
    font-size: 0.82rem;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
    line-height: 1.4;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--color-accent);
    color: #f5f0e8;
    border-color: var(--color-accent);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #f5f0e8;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}

.btn-secondary:hover {
    background: var(--color-tag-bg);
    color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
}

.btn-danger {
    background: transparent;
    border: 1px solid #8b2222;
    color: #8b2222;
}

.btn-danger:hover {
    background: rgba(139, 34, 34, 0.08);
    border-color: #a52a2a;
    color: #a52a2a;
}

/* ===========================================================
   Rankings panel
   =========================================================== */
.rankings-panel {
    flex: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: 1.75rem;
    color: var(--color-text);
}

.rankings-table {
    width: 100%;
    border-collapse: collapse;
}

.rankings-table th {
    text-align: left;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    font-family: var(--font-serif);
}

.rankings-table td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.rankings-table tr {
    transition: background var(--transition);
}

.rankings-table tbody tr:hover {
    background: rgba(92, 61, 30, 0.05);
}

.rank-num {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--color-accent);
    font-weight: 700;
    width: 3rem;
}

.rank-cover {
    width: 36px;
}

.rank-cover img {
    width: 28px;
    height: 40px;
    object-fit: cover;
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
    display: block;
}

.rank-cover .cover-placeholder.small {
    width: 28px;
    height: 40px;
}

.rank-title {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    transition: color var(--transition);
}

.rank-title:hover {
    color: var(--color-accent);
}

.rank-author {
    color: var(--color-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.rank-elo {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-accent);
    font-size: 1.05rem;
}

/* ===========================================================
   ELO match panel
   =========================================================== */
.elo-match-panel {
    flex: 1;
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
}

.elo-match-container {
    width: 100%;
    max-width: 720px;
}

.elo-match-container .panel-title {
    text-align: center;
}

.elo-match-prompt {
    text-align: center;
    color: var(--color-muted);
    font-style: italic;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.elo-cards {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: stretch;
    margin-top: 1.5rem;
}

.elo-vs {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--color-muted);
    align-self: center;
    font-style: italic;
}

.elo-card {
    flex: 1;
    max-width: 280px;
    background: var(--color-bg-warm);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1.75rem 1.5rem;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    font-family: var(--font-serif);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
}

.elo-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
    background: #f0ebe0;
}

.elo-card-cover img {
    width: 100px;
    height: 145px;
    object-fit: cover;
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
    display: block;
}

.elo-card-cover .cover-placeholder.large {
    width: 100px;
    height: 145px;
}

.elo-card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.elo-card-author {
    font-size: 0.82rem;
    font-style: italic;
    color: var(--color-muted);
    line-height: 1.4;
}

.elo-message {
    color: var(--color-muted);
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
    font-size: 0.95rem;
}

/* ===========================================================
   Add book panel
   =========================================================== */
.add-book-panel {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 760px;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
}

.search-area {
    margin-bottom: 1.5rem;
}

.search-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 160px;
    padding: 0.65rem 0.95rem;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.4);
    font-family: var(--font-serif);
    font-size: 0.9rem;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition), background var(--transition);
    border-radius: 2px;
}

.search-input::placeholder {
    color: var(--color-muted);
    font-style: italic;
}

.search-input:focus {
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.7);
}

.search-results {
    margin-top: 1rem;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--color-border);
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.3);
    transition: background var(--transition), border-color var(--transition);
    border-radius: 2px;
    line-height: 1.4;
}

.search-result:hover {
    background: rgba(92, 61, 30, 0.06);
    border-color: var(--color-accent);
}

.search-result.selected {
    background: rgba(92, 61, 30, 0.10);
    border-color: var(--color-accent);
}

.search-result strong {
    font-weight: 600;
    color: var(--color-text);
}

.result-year, .result-edition {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.result-cover {
    width: 40px;
    height: 54px;
    flex-shrink: 0;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.searching, .no-results, .error {
    color: var(--color-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding: 0.75rem 0;
}

.error {
    color: #8b2222;
}

.book-preview {
    margin-top: 2rem;
}

.preview-card {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--color-border);
    background: var(--color-bg-warm);
    margin-bottom: 1.25rem;
    border-radius: 3px;
    box-shadow: var(--shadow-card);
}

.preview-cover {
    flex-shrink: 0;
}

.preview-cover img {
    width: 80px;
    height: 115px;
    object-fit: cover;
    box-shadow: var(--shadow-cover);
    border-radius: 1px;
    display: block;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.preview-info h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
    color: var(--color-text);
}

.preview-info p {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.shelf-selector {
    display: flex;
    gap: 1.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text);
}

.shelf-selector label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: color var(--transition);
}

.shelf-selector label:hover {
    color: var(--color-accent);
}

.shelf-selector input[type="radio"] {
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* ===========================================================
   Recommendations panel
   =========================================================== */
.recommendations-panel {
    flex: 1;
    padding: 2.5rem 3rem;
    overflow-y: auto;
    height: 100vh;
    height: 100dvh;
}

.recommendations-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.recs-empty {
    color: var(--color-muted);
    font-style: italic;
    margin-top: 2rem;
    font-size: 0.95rem;
}

.rec-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 820px;
}

.rec-card {
    background: var(--color-bg-warm);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 1.35rem 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.rec-card:hover {
    box-shadow: var(--shadow-card);
    border-color: rgba(92, 61, 30, 0.3);
}

.rec-info {
    flex: 1;
    min-width: 0;
}

.rec-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
    color: var(--color-text);
    line-height: 1.3;
}

.rec-author {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--color-muted);
    margin-bottom: 0.6rem;
}

.rec-reason {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--color-text);
}

.rec-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* ===========================================================
   Scrollbar styling
   =========================================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(92, 61, 30, 0.2);
    border-radius: 5px;
    border: 2px solid var(--color-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(92, 61, 30, 0.35);
}

/* ===========================================================
   Utilities
   =========================================================== */
.hidden {
    display: none !important;
}

/* ===========================================================
   Rankings — split panel
   =========================================================== */
.rankings-split {
    display: flex;
    gap: 0;
    padding: 32px;
    align-items: flex-start;
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
}

.rankings-divider {
    width: 1px;
    background: var(--color-border);
    align-self: stretch;
    margin: 0 32px;
    flex-shrink: 0;
}

.rankings-col {
    flex: 1;
    min-width: 0;
}

.rankings-col-heading {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--color-text);
}

.rankings-no-genres {
    color: var(--color-muted);
    font-size: 14px;
    margin-top: 48px;
}

/* Genre pills */
.genre-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.genre-pill {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-family: var(--font-serif);
    cursor: pointer;
    transition: all var(--transition);
}

.genre-pill:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.genre-pill.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.rank-author {
    color: var(--color-muted);
    font-size: 13px;
}

/* ===========================================================
   Getting Started wizard
   =========================================================== */
.gs-panel {
    padding: 40px;
    max-width: 600px;
}

.gs-subtitle {
    color: var(--color-muted);
    margin-bottom: 8px;
    font-size: 15px;
}

.gs-shelf-note {
    font-size: 13px;
    color: var(--color-accent);
    margin-bottom: 20px;
}

.gs-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 36px;
}

.gs-tag {
    background: var(--color-tag-bg);
    border: 1px solid var(--color-border);
    padding: 3px 10px 3px 12px;
    border-radius: 3px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gs-tag button {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

.gs-tag button:hover { color: var(--color-accent); }

.gs-input {
    width: 100%;
    border: 1px solid var(--color-border);
    background: var(--color-bg-warm);
    padding: 8px 12px;
    font-size: 15px;
    border-radius: 3px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color var(--transition);
}

.gs-input:focus { border-color: var(--color-accent); }

.gs-input-wrap {
    position: relative;
    margin-bottom: 16px;
}

.gs-input-wrap .gs-input {
    margin-bottom: 0;
}

.gs-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--color-bg-warm);
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 3px 3px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .10);
    max-height: 220px;
    overflow-y: auto;
}

.gs-dropdown.gs-dropdown--open {
    display: block;
}

.gs-dropdown-item {
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.gs-dropdown-item:last-child {
    border-bottom: none;
}

.gs-dropdown-item:hover,
.gs-dropdown-item--active {
    background: var(--color-tag-bg);
}

.gs-dropdown-item strong {
    color: var(--color-text);
}

.gs-dropdown-item span {
    color: var(--color-muted);
    font-size: 13px;
}

/* Shared button styles */
.btn-primary {
    background: var(--color-accent);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }

.btn-secondary {
    background: transparent;
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    padding: 8px 20px;
    border-radius: 3px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.btn-secondary:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-text {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.btn-text:hover { color: var(--color-accent); }

/* Getting Started review card */
.gs-progress {
    color: var(--color-muted);
    font-size: 13px;
    margin-bottom: 24px;
}

.gs-card {
    border: 1px solid var(--color-border);
    background: var(--color-bg-warm);
    border-radius: 4px;
    padding: 32px 24px;
    text-align: center;
    max-width: 320px;
    margin: 0 auto 16px;
}

.gs-card-title {
    font-family: var(--font-display);
    font-size: 20px;
    margin-bottom: 6px;
    color: var(--color-text);
}

.gs-card-author {
    color: var(--color-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.gs-card-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.gs-confirmed-count {
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
    margin-top: 12px;
}

/* ===========================================================
   ELO Match — completion + queue state
   =========================================================== */
.elo-complete {
    text-align: center;
    padding: 80px 40px;
}

.elo-complete h2 {
    font-size: 26px;
    margin-bottom: 12px;
}

.elo-complete p {
    color: var(--color-muted);
    margin-bottom: 28px;
    font-size: 15px;
}

.elo-queue-info {
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ============ Discovery Center ============ */
.discovery-center { max-width: 860px; }

.discovery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

/* Tab navigation */
.discovery-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 1.75rem;
}

.discovery-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.5rem 1.25rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.discovery-tab-btn:hover { color: var(--color-text); }
.discovery-tab-btn.active {
    color: var(--color-text);
    border-bottom-color: var(--color-accent, #8b5e3c);
}

/* For You section */
.rec-group { margin-bottom: 2rem; }
.rec-group-label {
    font-family: var(--font-display);
    font-size: 0.72rem;
    color: var(--color-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

/* Curated accordion */
.curated-accordion {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.curated-list-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    color: var(--color-text);
    transition: background 0.15s;
}

.curated-list-header:hover { background: rgba(255,255,255,0.03); }

.curated-list-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.curated-accordion-icon {
    font-size: 0.9rem;
    color: var(--color-muted);
    transition: transform 0.15s;
}

.curated-list-body { padding: 0 1.1rem 1rem; }

.curated-list-desc {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* AI recommendation card within curated list */
.curated-ai-rec {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
}

.curated-ai-rec-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent, #8b5e3c);
    margin-bottom: 0.5rem;
    font-family: var(--font-display);
}

.curated-ai-rec-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.curated-ai-rec-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

/* Curated book list */
.curated-book-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.curated-book-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 1rem;
}

.curated-book-item:last-child { border-bottom: none; }

.curated-book-info {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex: 1;
}

.curated-book-title {
    font-size: 0.9rem;
    color: var(--color-text);
}

.curated-book-author {
    font-size: 0.82rem;
    color: var(--color-muted);
}

.curated-book-year {
    font-size: 0.75rem;
    color: var(--color-muted);
    opacity: 0.6;
}

.curated-list-empty {
    font-size: 0.85rem;
    color: var(--color-muted);
    font-style: italic;
    padding: 0.5rem 0;
}

/* Small button variant */
.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
}

/* Discovery feed */
.discovery-feed {
    list-style: none;
    padding: 0;
    margin: 0;
}

.discovery-event {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--color-border);
}

.discovery-event:last-child { border-bottom: none; }

.event-body { flex: 1; }

.event-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.event-summary {
    font-size: 0.85rem;
    color: var(--color-muted);
    line-height: 1.5;
    margin-bottom: 0.3rem;
}

.event-book {
    font-size: 0.8rem;
    color: var(--color-muted);
    font-style: italic;
}

.event-time {
    font-size: 0.75rem;
    color: var(--color-muted);
    white-space: nowrap;
    padding-top: 0.2rem;
}

/* ===========================================================
   Mobile top bar and overlay — hidden on desktop by default
   =========================================================== */
.mobile-top-bar {
    display: none;
}

.mobile-nav-overlay {
    display: none;
}

/* ===========================================================
   Mobile layout — ≤480px (phones only)
   =========================================================== */
@media (max-width: 480px) {
    /* Hide desktop sidebar */
    .sidebar {
        display: none;
    }

    /* Top bar */
    .mobile-top-bar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        padding-top: env(safe-area-inset-top);
        background: var(--color-sidebar);
        align-items: center;
        justify-content: space-between;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        z-index: 100;
        box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
    }

    .mobile-brand {
        font-family: var(--font-display);
        font-size: 1.2rem;
        color: #f0ead8;
        letter-spacing: 0.02em;
    }

    .mobile-hamburger {
        background: none;
        border: none;
        color: #e8e0d0;
        font-size: 1.3rem;
        cursor: pointer;
        padding: 4px 8px;
        line-height: 1;
        -webkit-tap-highlight-color: transparent;
    }

    /* Push content below the fixed top bar */
    .main-area {
        padding-top: calc(52px + env(safe-area-inset-top));
    }

    /* Shrink full-viewport panels to fit below the top bar */
    .book-list-panel,
    .detail-panel,
    .rankings-panel,
    .elo-match-panel,
    .add-book-panel,
    .recommendations-panel {
        height: calc(100dvh - 52px - env(safe-area-inset-top));
    }

    /* Fullscreen overlay */
    .mobile-nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 1000;
        background: var(--color-sidebar);
        flex-direction: column;
    }

    .mobile-nav-overlay.open {
        display: flex;
    }

    /* Overlay header (mirrors top bar height) */
    .mobile-nav-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        padding-top: env(safe-area-inset-top);
        height: calc(52px + env(safe-area-inset-top));
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        flex-shrink: 0;
    }

    .mobile-nav-close {
        background: none;
        border: none;
        color: #e8e0d0;
        font-size: 1.1rem;
        cursor: pointer;
        padding: 4px 8px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Nav links list */
    .mobile-nav-links {
        list-style: none;
        flex: 1;
        overflow-y: auto;
        padding: 0.75rem 0;
    }

    .mobile-nav-links li a {
        display: block;
        padding: 0.85rem 1.5rem;
        color: #a89880;
        font-size: 0.9375rem;
        text-decoration: none;
        letter-spacing: 0.02em;
        border-left: 2px solid transparent;
        transition: background var(--transition), color var(--transition);
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-links li a:active {
        color: #f0ead8;
        background: rgba(255, 255, 255, 0.04);
    }

    .mobile-nav-links li a.active {
        color: #f0ead8;
        background: var(--color-sidebar-active);
        border-left: 2px solid #c8a87a;
        padding-left: calc(1.5rem - 2px);
    }

    /* Footer with username + logout */
    .mobile-nav-footer {
        padding: 1rem 1.25rem;
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }

    .mobile-nav-footer span {
        color: rgba(232, 220, 200, 0.7);
        font-size: 13px;
    }

    .mobile-nav-footer a {
        color: rgba(232, 220, 200, 0.4);
        font-size: 12px;
        text-decoration: none;
    }
}

/* --- Duplicate detection page --- */
.duplicate-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: rgba(255,255,255,0.3);
}

.duplicate-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 160px;
    max-width: 240px;
}

.dup-cover {
    width: 80px;
    height: 108px;
    background: var(--color-border);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.dup-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dup-info {
    font-size: 0.88rem;
    line-height: 1.5;
}

.dup-actions {
    margin-top: auto;
}
