:root {
    --ink: #1a1208;
    --paper: #f7f3ec;
    --paper-dark: #ede8df;
    --cream: #faf7f2;
    --amber: #c17b3f;
    --amber-light: #e8c088;
    --amber-pale: #f5e8d0;
    --muted: #7a6f5e;
    --rule: rgba(26, 18, 8, 0.12);
    --sidebar-w: 260px;
    --card-radius: 4px;
}

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

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    zoom: 1.5;
}

/* ── TOP BAR (header + search + phrase lookup unified background) ── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background-image:
        linear-gradient(rgba(8, 6, 3, 0.80), rgba(8, 6, 3, 0.80)),
        url('SaveIcon.png');
    background-size: cover;
    background-position: center 25%;
}

/* ── HEADER ── */
.site-header {
    background: transparent;
    color: var(--cream);
    padding: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    border-bottom: 4px solid var(--amber);
    overflow: hidden;
}

.header-left,
.header-right {
    display: flex;
    align-items: stretch;
}

.header-spines {
    display: flex;
    align-items: stretch;
}

.header-spine-strip {
    width: 10px;
    height: 100%;
    min-height: 112px;
}

/* Spine colours — Crime, Drama, Classic, Fantasy, Travel, Kids, Fact */
.header-left .header-spines .header-spine-strip:nth-child(1),
.header-right .header-spines .header-spine-strip:nth-child(1) { background: #e05858; }
.header-left .header-spines .header-spine-strip:nth-child(2),
.header-right .header-spines .header-spine-strip:nth-child(2) { background: #4a8a7a; }
.header-left .header-spines .header-spine-strip:nth-child(3),
.header-right .header-spines .header-spine-strip:nth-child(3) { background: #c4a870; }
.header-left .header-spines .header-spine-strip:nth-child(4),
.header-right .header-spines .header-spine-strip:nth-child(4) { background: #7a4a8a; }
.header-left .header-spines .header-spine-strip:nth-child(5),
.header-right .header-spines .header-spine-strip:nth-child(5) { background: #5a7a9a; }
.header-left .header-spines .header-spine-strip:nth-child(6),
.header-right .header-spines .header-spine-strip:nth-child(6) { background: #7ab85a; }
.header-left .header-spines .header-spine-strip:nth-child(7),
.header-right .header-spines .header-spine-strip:nth-child(7) { background: #8a8a9a; }

.header-book-covers {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    padding-top: 6px;
    pointer-events: auto;
}

.header-book-img {
    height: 58px;
    width: auto;
    object-fit: contain;
    display: block;
}

.site-header {
    position: relative;
}

.header-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding-top: 14px;
    pointer-events: none;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--amber-light);
    line-height: 1.1;
}

.site-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, .7);
    letter-spacing: .18em;
    text-transform: uppercase;
}

.book-count-badge {
    display: flex;
    align-items: baseline;
    gap: 5px;
    white-space: nowrap;
}

.book-count-badge strong {
    font-size: 16px;
    color: var(--amber-light);
    font-weight: 600;
    line-height: 1;
    font-family: 'Playfair Display', serif;
}

.books-label {
    font-size: 12px;
    color: rgba(255, 255, 255, .65);
    font-family: 'Playfair Display', serif;
    letter-spacing: .06em;
    line-height: 1;
}

/* ── SEARCH BAR ── */
.search-wrap {
    background: transparent;
    padding: 14px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-inner {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 3px;
    color: var(--cream);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    padding: 8px 12px 8px 34px;
    outline: none;
    transition: border-color .2s;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, .3);
}

.search-input:focus {
    border-color: var(--amber);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: .4;
    pointer-events: none;
    font-size: 14px;
}

/* ── LAYOUT ── */
.layout {
    display: flex;
    min-height: calc(100vh - 185px);
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--cream);
    border-right: 1px solid var(--rule);
    padding: 20px 0;
    position: sticky;
    top: 185px;
    height: calc(100vh - 185px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--amber-pale) transparent;
}

.sidebar-section {
    padding: 0 16px 4px;
}

.sidebar-heading {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 12px 4px 8px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    user-select: none;
}

.sidebar-checkbox-label:hover {
    background: rgba(0,0,0,0.04);
}

.sidebar-checkbox-label input[type="checkbox"] {
    accent-color: var(--amber);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.clear-btn {
    font-size: 10px;
    letter-spacing: .04em;
    color: var(--amber);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    padding: 1px 4px;
    border-radius: 2px;
    transition: background .15s;
}

.clear-btn:hover {
    background: var(--amber-pale);
}

.clear-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: #6b2020;
    color: #ffd5d5;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.clear-all-btn:hover {
    background: #8b2828;
}

/* Mode toggle */
.mode-toggle {
    display: flex;
    gap: 4px;
    padding: 8px 4px 10px;
}

.mode-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    letter-spacing: .04em;
    border-radius: 2px;
    border: 1px solid var(--rule);
    background: white;
    color: var(--muted);
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}

.mode-btn.active {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}

/* Tag pills */
.tag-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
}

.tag-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all .15s;
    user-select: none;
    border: 1px solid transparent;
}

.tag-pill:hover {
    background: var(--amber-pale);
}

.tag-pill.active {
    background: var(--ink);
    color: var(--cream);
}

.tag-pill.excluded {
    background: rgba(180, 50, 50, .1);
    border-color: rgba(180, 50, 50, .35);
    color: var(--ink);
}

.tag-pill.excluded .tag-count {
    color: #b44040;
}

.tag-pill.disabled {
    opacity: .35;
    pointer-events: none;
}

.tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-label {
    flex: 1;
    font-size: 12.5px;
    line-height: 1.3;
}

.tag-count {
    font-size: 11px;
    color: var(--muted);
    font-weight: 400;
}

.tag-pill.active .tag-count {
    color: rgba(255, 255, 255, .5);
}

/* Sort row */
.sort-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px 10px;
    flex-wrap: wrap;
}

.sort-label {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.sort-select {
    flex: 1;
    min-width: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    padding: 4px 6px;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: white;
    color: var(--ink);
    outline: none;
    cursor: pointer;
}

.sort-select:focus {
    border-color: var(--amber);
}

/* ── MAIN CONTENT ── */
.main {
    flex: 1;
    min-width: 0;
    padding: 12px 24px 20px;
    background-color: var(--paper);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.68' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='250' height='250' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

/* Active filters bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 12px;
    min-height: 0;
}

.active-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    background: var(--ink);
    color: var(--cream);
    border-radius: 20px;
    font-size: 11.5px;
    cursor: pointer;
    transition: background .15s;
}

.active-chip:hover {
    background: #4a3828;
}

.active-chip.excluded-chip {
    background: #8b3030;
}

.active-chip.excluded-chip:hover {
    background: #a03838;
}

.active-chip .chip-x {
    opacity: .85;
    font-size: 14px;
    margin-left: 4px;
    line-height: 1;
}

.results-info {
    font-size: 12px;
    color: var(--muted);
    margin-left: auto;
    white-space: nowrap;
}

/* ── BOOK GRID ── */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

/* ── BOOK CARD ── */
.book-card {
    background: white;
    border: 1px solid var(--rule);
    border-radius: var(--card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transition: box-shadow .18s, transform .18s;
    position: relative;
}

.book-card:hover {
    box-shadow: 0 4px 16px rgba(26, 18, 8, .12);
    transform: translateY(-2px);
}

.book-spine {
    width: 10px;
    flex-shrink: 0;
    align-self: stretch;
}

.book-body {
    padding: 12px 12px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-fake-badge {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--amber);
    border: 1px solid var(--amber-light);
    padding: 1px 5px;
    border-radius: 2px;
    background: var(--amber-pale);
    margin-left: auto;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-size: 13.5px;
    line-height: 1.35;
    font-weight: 600;
    margin-bottom: 3px;
    color: var(--ink);
}

.book-author {
    font-size: 11.5px;
    color: var(--muted);
    font-style: italic;
    margin-bottom: 6px;
}

.book-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 8px;
}

.book-meta span::before {
    content: '';
}

.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 8px;
}

.book-desc-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin-top: 8px;
    min-height: 1.55em;
    font-size: 11.5px; /* anchor em units */
}

.book-desc {
    font-family: 'Libre Baskerville', serif;
    font-size: 11.5px;
    line-height: 1.55;
    color: #4a3e2e;
    padding-right: 18px; /* room for arrow on last visible line */
}


.book-grid.hide-tags .book-tags {
    display: none;
}

.book-grid.hide-descriptions .book-desc-wrap {
    display: none;
}

.book-tag {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 2px;
    cursor: pointer;
    transition: all .12s;
    white-space: nowrap;
}

.book-tag.genre-tag {
    font-weight: 500;
    border: 1px solid;
}

.book-tag.quality-tag {
    background: var(--paper-dark);
    color: var(--muted);
    border: 1px solid var(--rule);
}

.book-tag:hover {
    filter: brightness(.92);
    transform: translateY(-1px);
}

/* Show more */
.show-more {
    display: flex;
    justify-content: center;
    margin-top: 28px;
    padding-bottom: 32px;
}

.show-more-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .04em;
    padding: 10px 28px;
    background: var(--ink);
    color: var(--cream);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: background .15s, transform .12s;
}

.show-more-btn:hover {
    background: #3a2c1c;
    transform: translateY(-1px);
}

/* Partial match section */
.section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 4px;
}

.section-divider-line {
    flex: 1;
    height: 1px;
    background: var(--rule);
}

.section-divider-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    padding: 3px 10px;
    border: 1px solid var(--rule);
    border-radius: 20px;
    background: var(--paper-dark);
}

.book-card.partial {
    opacity: 0.62;
    filter: saturate(0.6);
}

.book-card.partial:hover {
    opacity: 0.85;
    filter: saturate(0.8);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.empty-state-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--ink);
    margin-bottom: 6px;
}

/* ── TABLET ── */
@media (min-width: 701px) and (max-width: 1024px) {
    body {
        zoom: 1;
    }

    :root {
        --sidebar-w: 210px;
    }

    .header-book-img {
        height: 48px;
    }

    .header-spine-strip {
        min-height: 96px;
    }

    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }

    .search-wrap {
        padding: 12px 20px;
    }

    .phrase-lookup-header {
        padding: 12px 20px;
    }
}

/* Mobile */
@media (max-width: 700px) {
    :root {
        --sidebar-w: 100%;
    }

    body {
        zoom: 1;
    }

    /* Hide book covers on mobile — too wide */
    .header-book-covers {
        display: none;
    }

    .header-right {
        display: none;
    }

    .header-spine-strip {
        width: 7px;
        min-height: 56px;
    }

    .site-title {
        font-size: 20px;
    }

    .site-subtitle {
        font-size: 10px;
    }

    .search-wrap {
        padding: 10px 16px;
    }

    .search-inner {
        max-width: 100%;
    }

    .search-input {
        font-size: 16px;
        padding: 10px 12px 10px 36px;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        top: auto;
        height: auto;
        max-height: 50vh;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--rule);
        overflow-y: auto;
        padding: 12px 0;
    }

    .main {
        padding: 12px;
    }

    .book-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .book-spine {
        width: 8px;
    }

    .book-body {
        padding: 10px 12px;
    }

    .book-title {
        font-size: 14px;
    }

    .book-desc {
        font-size: 12px;
    }

    .book-tags {
        gap: 4px;
    }

    .book-tag {
        font-size: 10px;
        padding: 2px 7px;
    }

    .filters-bar {
        gap: 5px;
        margin-bottom: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .filters-bar::-webkit-scrollbar {
        display: none;
    }

    .active-chip {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tag-pill {
        padding: 6px 10px;
    }

    .tag-label {
        font-size: 13px;
    }

    .tag-count {
        font-size: 12px;
    }

    .mode-toggle {
        gap: 6px;
    }

    .mode-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .sort-select {
        font-size: 13px;
        padding: 6px 8px;
    }

    .show-more-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 14px;
    }

    .section-divider-label {
        font-size: 10px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .site-title {
        font-size: 16px;
    }

    .search-wrap {
        padding: 8px 12px;
    }

    .main {
        padding: 10px;
    }

    .book-body {
        padding: 8px 10px;
    }
}

.filter-toggle {
    display: none;
}

/* ── PHRASE LOOKUP ── */
.phrase-lookup-wrap {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.phrase-lookup-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, .85);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    text-align: left;
    transition: color .15s;
}

.phrase-lookup-header:hover {
    color: rgba(255, 255, 255, 1);
}

.phrase-lookup-icon {
    font-size: 16px;
}

.phrase-lookup-title {
    font-weight: 600;
    letter-spacing: .04em;
    color: rgba(255, 255, 255, .9);
    white-space: nowrap;
}

.phrase-lookup-hint {
    font-size: 12px;
    opacity: .6;
}

.phrase-lookup-arrow {
    margin-left: auto;
    font-size: 12px;
    opacity: .6;
    transition: transform .2s;
}

.phrase-lookup-body {
    padding: 0 28px 16px;
}

.phrase-top-row {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 12px;
}

.phrase-search-col {
    flex-shrink: 0;
    min-width: 0;
}

.phrase-search-row {
    position: relative;
    max-width: 420px;
    margin-bottom: 12px;
}

.phrase-selected-col {
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 6px;
    padding: 8px 10px;
}

.phrase-selected-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.phrase-selected-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.4);
}

.phrase-clear-all-btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--amber);
    background: none;
    border: 1px solid rgba(193,123,63,.4);
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background .12s;
}

.phrase-clear-all-btn:hover {
    background: rgba(193,123,63,.15);
}

.phrase-selected-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phrase-selected-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.phrase-selected-detail {
    font-size: 11px;
    color: rgba(255,255,255,.4);
    font-style: italic;
    margin-left: 2px;
}

.phrase-selected-text {
    flex: 1;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: rgba(255,255,255,.7);
    line-height: 1.3;
}

.phrase-selected-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,.3);
    cursor: pointer;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: color .12s;
}

.phrase-selected-remove:hover {
    color: rgba(255,255,255,.7);
}

.phrase-search-row .search-icon {
    color: rgba(255, 255, 255, .4);
}

.phrase-search-input {
    width: 100%;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 3px;
    color: var(--cream);
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    padding: 8px 12px 8px 34px;
    outline: none;
    transition: border-color .2s;
}

.phrase-search-input::placeholder {
    color: rgba(255, 255, 255, .3);
}

.phrase-search-input:focus {
    border-color: var(--amber);
}

.phrase-results {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.phrase-hint-text {
    font-size: 12px;
    color: rgba(255, 255, 255, .3);
    padding: 4px 0;
    font-style: italic;
}

.phrase-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.phrase-result-row:last-child {
    border-bottom: none;
}

.phrase-type-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.phrase-type-wants { background: #5cb85c; }
.phrase-type-wants--strong- { background: #2e7d32; }
.phrase-type-dislikes { background: #e57373; }
.phrase-type-dislikes--strong- { background: #c62828; }

.phrase-text-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.phrase-text {
    font-size: 12px;
    color: rgba(255, 255, 255, .65);
    line-height: 1.4;
}

.phrase-mark {
    background: rgba(193, 123, 63, .45);
    color: var(--amber-light);
    border-radius: 2px;
    padding: 0 1px;
}

.phrase-type-key {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 6px 0 4px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    margin-bottom: 2px;
}

.phrase-key-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    color: rgba(255, 255, 255, .45);
    letter-spacing: .03em;
}

.phrase-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
}

.phrase-add-btn {
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--amber);
    background: none;
    border: 1px solid rgba(193,123,63,.4);
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
}

.phrase-add-btn:hover {
    background: rgba(193,123,63,.15);
}

.phrase-add-btn--added {
    color: rgba(255,255,255,.3);
    border-color: rgba(255,255,255,.15);
    cursor: default;
}

.phrase-tag-pill {
    font-family: 'DM Sans', sans-serif;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 2px;
    border: 1px solid;
    cursor: pointer;
    transition: filter .12s, transform .12s;
    white-space: nowrap;
}

.phrase-tag-pill:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.phrase-quality-pill {
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .7);
    border-color: rgba(255, 255, 255, .2);
}

.phrase-quality-pill:hover {
    background: rgba(255, 255, 255, .15);
}

@media (max-width: 700px) {
    .phrase-lookup-header {
        padding: 10px 16px;
    }

    .phrase-lookup-hint {
        display: none;
    }

    .phrase-lookup-body {
        padding: 8px 16px 14px;
    }

    .phrase-top-row {
        flex-direction: column;
        gap: 10px;
    }

    .phrase-search-row {
        max-width: 100%;
    }

    .phrase-results {
        max-height: 220px;
    }

    .phrase-result-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .phrase-text-group {
        flex: 1;
        min-width: 0;
    }

    .phrase-tags {
        flex-shrink: 0;
    }
}
