:root {
    color-scheme: light;
    --catalog-pink: #f15b88;
    --catalog-dark: #242424;
    --catalog-paper: #ffffff;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    color: #222;
    background: radial-gradient(circle at 50% 18%, #fafafa 0, #e8e8e8 48%, #cacaca 100%);
    font-family: Arial, "Noto Sans KR", sans-serif;
}

button, input, a { font: inherit; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.catalog-header {
    min-height: 72px;
    padding: 12px clamp(16px, 4vw, 56px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(255, 255, 255, .95);
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

.catalog-logo img {
    display: block;
    width: auto;
    max-width: 170px;
    max-height: 48px;
}

.catalog-actions { display: flex; gap: 8px; }

.catalog-link,
.catalog-controls button {
    padding: 9px 14px;
    color: #333;
    background: #fff;
    border: 1px solid #cfcfcf;
    border-radius: 7px;
    text-decoration: none;
    cursor: pointer;
}

.catalog-link:hover,
.catalog-controls button:hover { border-color: var(--catalog-pink); color: var(--catalog-pink); }

.catalog-link-primary { color: #fff; background: var(--catalog-pink); border-color: var(--catalog-pink); }
.catalog-link-primary:hover { color: #fff; filter: brightness(.93); }

.catalog-main {
    min-height: calc(100vh - 72px);
    padding: 18px 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.catalog-status {
    padding: 20px;
    color: #555;
    text-align: center;
}

.catalog-status.is-error { color: #a51d1d; }

.catalog-shell {
    width: min(100%, 1500px);
    height: calc(100vh - 174px);
    min-height: 420px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.catalog-book {
    width: calc(100% - 100px);
    height: 100%;
    filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .22));
}

.catalog-page {
    position: relative;
    overflow: hidden;
    background: var(--catalog-paper);
}

.catalog-page canvas {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #fff;
}

.catalog-page-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #999;
    background: #fff;
}

.catalog-arrow {
    width: 44px;
    height: 64px;
    flex: 0 0 44px;
    color: #fff;
    background: rgba(25, 25, 25, .78);
    border: 0;
    border-radius: 8px;
    font-size: 27px;
    cursor: pointer;
    z-index: 5;
}

.catalog-arrow:hover { background: var(--catalog-pink); }
.catalog-arrow:disabled { opacity: .3; cursor: default; }

.catalog-controls {
    min-height: 48px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
}

.catalog-controls input {
    width: 62px;
    padding: 8px 5px;
    text-align: center;
    border: 1px solid #bbb;
    border-radius: 6px;
}

body.catalog-fullscreen .catalog-header { display: none; }
body.catalog-fullscreen .catalog-main { min-height: 100vh; }
body.catalog-fullscreen .catalog-shell { height: calc(100vh - 74px); }

@media (max-width: 700px) {
    .catalog-header { min-height: 60px; padding: 8px 12px; }
    .catalog-logo img { max-width: 125px; max-height: 40px; }
    .catalog-link { padding: 8px 9px; font-size: 13px; }
    .catalog-main { min-height: calc(100vh - 60px); padding: 10px 6px 14px; }
    .catalog-shell { height: calc(100vh - 174px); min-height: 330px; }
    .catalog-book { width: 100%; }
    .catalog-arrow {
        position: absolute;
        top: 50%;
        width: 38px;
        height: 58px;
        transform: translateY(-50%);
    }
    .catalog-prev { left: 4px; }
    .catalog-next { right: 4px; }
    .catalog-controls button { padding: 8px 10px; font-size: 13px; }
    #catalog-first, #catalog-last { display: none; }
}
