@charset "utf-8";

@font-face {
    font-family: "Klee One";
    src: url("../external/KleeOne-Regular.woff2") format("woff2");
    font-display: swap;
}

html,
body,
button,
input,
select,
textarea {
    font-family: "Klee One", sans-serif;
}

:root {
    color-scheme: light;
    --bg: #f3f4f6;
    --panel: #ffffff;
    --line: #d1d5db;
    --text: #111827;
    --muted: #6b7280;
    --primary: #1f2937;
    --primary-ghost: #e5e7eb;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 14px;
}

body {
    overscroll-behavior: none;
}

#app-shell {
    width: 100%;
    height: calc(100vh - 4rem);
    height: calc(100dvh - 4rem);
    display: grid;
    grid-template-rows: auto 1fr;
}

/* スクロールスタンドバイ */
#stage {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

#st_mn_content {
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
    margin-top: 1rem;
}

nav,
main {
    scroll-snap-align: start;
}

footer {
    scroll-snap-align: end;
}

/* PDFリーダー */
.toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(209, 213, 219, 0.9);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-group--actions {
    margin-left: auto;
}

.btn,
.page-input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
}

.btn {
    min-width: 42px;
    padding: 0 14px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn.is-active {
    border-color: var(--primary);
    background: var(--primary-ghost);
}

.btn--wide {
    min-width: 118px;
}

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

.page-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    min-height: 42px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.page-input {
    width: 68px;
    border: 0;
    outline: none;
    text-align: center;
    background: transparent;
}

.page-total {
    color: var(--muted);
    font-size: 0.95rem;
}

.viewer-container {
    min-height: 0;
    overflow: auto;
    padding: 14px;
}

.viewer-stage {
    position: relative;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    display: grid;
    place-items: start center;
}

.page-surface {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

#pdfCanvas {
    display: block;
    background: #fff;
}

.overlay {
    position: sticky;
    top: 16px;
    justify-self: center;
    align-self: start;
    padding: 12px 16px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 5;
}

.overlay--error {
    background: #991b1b;
    max-width: min(92vw, 720px);
}

.is-hidden {
    display: none;
}

@media (max-width: 820px) {
    .toolbar {
        gap: 8px;
        padding-left: 10px;
        padding-right: 10px;
    }

    .toolbar-group {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .toolbar-group--actions {
        margin-left: 0;
    }

    .btn,
    .page-input,
    .page-box {
        min-height: 46px;
    }

    .btn--wide,
    .btn--primary {
        flex: 1 1 calc(50% - 4px);
    }

    .viewer-container {
        padding: 10px;
    }
}

/* 更に仕様変更 */
@media screen and (orientation: portrait) {
    .toolbar-group--zoom {
        display: flex;
        width: 100%;
    }

    .toolbar-group--zoom > button {
        flex: 0;
        max-width: calc(100% - 0.4rem);
    }

    .toolbar-group.toolbar-group--actions {
        z-index: 111;
        position: fixed;
        bottom: -4rem;
        right: 1rem;
        width: 3.5rem;
        font-size: 0.75rem;
        padding: 0;
        margin: 0.2rem;
        border-radius: 1rem;
        overflow: hidden;
        box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.3);
        opacity: 0.7;
    }
}
