@font-face {
    font-family: "CustomFont";
    src: url("/-/static/font.otf") format("opentype");
}

* {
    box-sizing: border-box;
}

body {
    font-family: "CustomFont", monospace, sans-serif;
    line-height: 1.4;
    font-size: 16px;
    color: #2c2c2c;
    background: #ffffff;
    padding: 0 12px;
    margin: 44px auto 64px;
    max-width: 720px;
}

#maincontent {
    max-width: 50em;
    margin: 15px auto;
}

.header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.header-row h2 {
    margin: 0 0 8px 0;
}

.header-icon {
    width: 22px;
    height: 22px;
    vertical-align: -4px;
    margin-right: 6px;
}

.status-cluster {
    font-size: 12px;
}

a {
    color: #66b2a6;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: inherit;
    color: #2c2c2c;
    background: #f4f6f6;
    padding: 1px 4px;
    border-radius: 2px;
}

.search-section {
    margin: 14px 0 10px;
}

.search-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 8px 0;
}

.prompt-label {
    color: #2c2c2c;
    flex-shrink: 0;
}

input[type="text"] {
    font-family: inherit;
    font-size: inherit;
    color: #2c2c2c;
    background: transparent;
    border: none;
    border-bottom: 1px solid #cccccc;
    padding: 3px 4px;
    outline: none;
}

input[type="text"]:focus {
    border-bottom-color: #66b2a6;
}

input::placeholder {
    color: #999999;
}

.search-input {
    flex: 1;
    min-width: 0;
}

.filter-row {
    margin: 8px 0 4px;
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.sep {
    margin: 0 2px;
}

.text-btn {
    font-family: inherit;
    font-size: inherit;
    color: #66b2a6;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.text-btn:hover {
    text-decoration: underline;
}

.bracket-toggle {
    font-family: inherit;
    font-size: 12px;
    color: #999999;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.bracket-toggle:hover {
    color: #2c2c2c;
    text-decoration: underline;
}

.bracket-toggle.active {
    color: #66b2a6;
}

.muted-btn {
    font-family: inherit;
    font-size: 12px;
    color: #999999;
    background: none;
    border: none;
    padding: 0;
    margin-left: 4px;
    cursor: pointer;
}

.muted-btn:hover {
    color: #2c2c2c;
    text-decoration: underline;
}

.muted {
    color: #888888;
}

.error {
    color: #b04040;
    font-size: 12px;
    margin: 6px 0;
}

.syntax-box {
    border-left: 2px solid #66b2a6;
    padding: 6px 0 6px 12px;
    margin: 8px 0 12px;
    font-size: 12px;
}

.syntax-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 4px 16px;
}

.syntax-keys {
    margin: 6px 0 0;
}

.meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
    min-height: 18px;
    margin: 6px 0 8px;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 4px;
}

.results-list {
    display: flex;
    flex-direction: column;
}

.book-item {
    border-bottom: 1px solid #f0f0f0;
}

.book-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 152px;
    gap: 12px;
    align-items: center;
    padding: 8px 4px;
    cursor: pointer;
    transition: background-color 0.08s ease;
}

.book-row:hover,
.book-item.selected > .book-row {
    background: #f8fbfa;
}

.book-item.selected > .book-row {
    box-shadow: inset 2px 0 0 #66b2a6;
}

.cover-wrap {
    width: 40px;
    height: 58px;
    background: #f4f4f4;
    border: 1px solid #e6e6e6;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.cover-fallback {
    font-size: 10px;
    color: #999999;
    text-align: center;
    padding: 2px;
    line-height: 1.1;
    user-select: none;
}

.book-main {
    min-width: 0;
}

.book-title-line {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-title {
    color: #2c2c2c;
}

.series-tag {
    color: #888888;
    font-size: 12px;
    margin-left: 6px;
}

.book-sub {
    color: #888888;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-meta-line {
    font-size: 12px;
    color: #777777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.fmt-badge {
    font-size: 11px;
    color: #3d9486;
}

.fmt-badge.non-kindle {
    color: #999999;
}

mark {
    background: rgba(102, 178, 166, 0.24);
    color: inherit;
    padding: 0 1px;
    border-radius: 1px;
}

.lib-matrix {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 11.5px;
    line-height: 1.32;
}

.lib-cell {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    white-space: nowrap;
}

.lib-code {
    color: #999999;
}

.lib-state {
    text-align: right;
    color: #777777;
}

.lib-cell.avail .lib-code,
.lib-cell.avail .lib-state {
    color: #3d9486;
}

.lib-cell.lucky .lib-code,
.lib-cell.lucky .lib-state {
    color: #2e8577;
    font-weight: 600;
}

.lib-cell.none .lib-code,
.lib-cell.none .lib-state {
    color: #cccccc;
}

.lib-cell.dimmed {
    opacity: 0.38;
}

/* Inline Expanded Details Drawer */
.book-detail {
    padding: 10px 8px 14px 52px;
    background: #fafcfc;
    border-top: 1px dashed #e8eeee;
    font-size: 12.5px;
}

.detail-top {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.detail-cover {
    width: 84px;
    height: 124px;
    border: 1px solid #e2e2e2;
    background: #f4f4f4;
    object-fit: cover;
    flex-shrink: 0;
}

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

.best-callout {
    margin: 0 0 8px;
    padding: 5px 8px;
    background: #eef7f5;
    border-left: 2px solid #66b2a6;
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0 8px;
    font-size: 12px;
}

.holdings-table td {
    padding: 3px 6px 3px 0;
    vertical-align: baseline;
    border-bottom: 1px solid #f0f2f2;
}

.holdings-table td.actions-col {
    text-align: right;
    white-space: nowrap;
    padding-right: 0;
}

.detail-desc {
    color: #444444;
    margin: 8px 0 6px;
    line-height: 1.45;
    white-space: pre-line;
    max-height: 160px;
    overflow-y: auto;
}

.detail-tags {
    font-size: 11.5px;
    color: #888888;
}

.empty-state {
    padding: 24px 4px;
    color: #888888;
    font-size: 13px;
}

.load-more-wrap {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

@media (min-width: 481px) {
    body {
        font-size: 14px;
    }
}

@media (max-width: 560px) {
    body {
        margin: 20px auto 48px;
        padding: 0 14px;
    }

    #maincontent {
        margin-top: 0;
    }

    .book-row {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 8px 10px;
    }

    .lib-matrix {
        grid-column: 2;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px 12px;
    }

    .book-detail {
        padding-left: 8px;
    }

    .detail-cover {
        width: 64px;
        height: 96px;
    }
}
