/* Hallmark · macrostructure: Workbench · tone: editorial · anchor hue: forest */
:root {
    --ink: #173f3a;
    --ink-soft: #55706a;
    --paper: #f5f3ee;
    --card: #fffdf9;
    --line: #dfe4dc;
    --accent: #e76b4d;
    --accent-r: hsl(12, 76%, 90%);
    --mustard: #e2bd52;
    --mint: #dce9dd;
    --shadow: 0 18px 50px rgba(23, 63, 58, .08);
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --font-display: Georgia, 'Times New Roman', serif;
    --font-body: 'Trebuchet MS', 'Yu Gothic', sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font-body);
    overflow-x: clip;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
label {
    cursor: pointer;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    background-color: currentColor;
    mask: center / contain no-repeat;
    -webkit-mask: center / contain no-repeat;
}

.icon-grid { mask-image: url('../img/grid_on.svg'); -webkit-mask-image: url('../img/grid_on.svg'); }
.icon-add { mask-image: url('../img/add.svg'); -webkit-mask-image: url('../img/add.svg'); }
.icon-history { mask-image: url('../img/history.svg'); -webkit-mask-image: url('../img/history.svg'); }
.icon-export { mask-image: url('../img/file_export.svg'); -webkit-mask-image: url('../img/file_export.svg'); }
.icon-sync { mask-image: url('../img/sync.svg'); -webkit-mask-image: url('../img/sync.svg'); }
.icon-upload { mask-image: url('../img/upload.svg'); -webkit-mask-image: url('../img/upload.svg'); }
.icon-arrow { mask-image: url('../img/keyboard_arrow_right.svg'); -webkit-mask-image: url('../img/keyboard_arrow_right.svg'); }
.icon-search { mask-image: url('../img/search.svg'); -webkit-mask-image: url('../img/search.svg'); }
.icon-expand { mask-image: url('../img/expand_circle_down.svg'); -webkit-mask-image: url('../img/expand_circle_down.svg'); }
.icon-asterisk { mask-image: url('../img/asterisk.svg'); -webkit-mask-image: url('../img/asterisk.svg'); }
.icon-close { mask-image: url('../img/close.svg'); -webkit-mask-image: url('../img/close.svg'); }

.nav-icon .icon { font-size: 20px; }
.drive-symbol .icon { font-size: 16px; }
.search-box .icon { font-size: 20px; }
.upload-symbol .icon { font-size: 24px; }
.empty-icon .icon { font-size: 26px; }
.filter-button .icon { font-size: 15px; }
.icon-button .icon { font-size: 22px; }
.primary-button .icon { font-size: 17px; }
.text-button .icon { font-size: 15px; }

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 32px 20px 24px;
    background: var(--ink);
    color: #eaf0e8;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    text-decoration: none;
    margin: 0 12px 70px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    font: 700 20px var(--font-display);
    transform: rotate(-8deg);
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font: 700 18px var(--font-display);
}

.brand small {
    margin-top: 2px;
    color: #9cb4a9;
    font-size: 9px;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.main-nav {
    display: grid;
    gap: 5px;
    margin: 0 0 48px;
}

.nav-link,
.subject-link {
    border: 0;
    background: none;
    color: #9cb4a9;
    text-decoration: none;
    text-align: left;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    font-size: 13px;
    border-radius: 8px;
}

.nav-link:hover,
.nav-link.is-active {
    color: #fff;
    background: rgba(255, 255, 255, .09);
}

.nav-icon {
    width: 18px;
    color: var(--accent);
    font-size: 20px;
    text-align: center;
}

.nav-label {
    margin: 0 12px 12px;
    color: #709187;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.subject-nav {
    display: grid;
    gap: 3px;
}

.subject-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13px;
}

.subject-link:hover,
.subject-link.is-selected {
    color: #fff;
    background: rgba(255, 255, 255, .08);
}

.subject-count {
    margin-left: auto;
    color: #708d82;
    font-size: 11px;
}

.subject-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #aaa;
}

.subject-dot.all {
    background: var(--accent);
}

.subject-dot.math {
    background: var(--mustard);
}

.subject-dot.english {
    background: #84aeb8;
}

.subject-dot.japanese {
    background: #bf8c9e;
}

.subject-dot.science {
    background: #82a17b;
}

.subject-dot.social {
    background: #aa92b8;
}

.storage-note {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    margin: auto 12px 0;
    padding-top: 19px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    color: #9cb4a9;
    font-size: 10px;
}

.storage-note strong,
.storage-note small {
    display: block;
}

.storage-note strong {
    color: #d6e2d9;
    font-size: 11px;
    font-weight: 400;
}

.storage-note small {
    margin-top: 4px;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-top: 4px;
    border-radius: 50%;
    background: #86bf77;
    box-shadow: 0 0 0 3px rgba(134, 191, 119, .15);
}

.main-content {
    min-width: 0;
    padding: 0 6.5vw 80px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 78px;
    border-bottom: 1px solid var(--line);
}

.breadcrumb {
    color: #8b9d96;
    font-size: 11px;
    letter-spacing: .08em;
}

.breadcrumb strong {
    color: var(--ink);
    font-size: 12px;
    letter-spacing: 0;
}

.breadcrumb i {
    margin: 0 10px;
    color: #bac5bd;
    font-style: normal;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 13px;
}

.offline-badge {
    color: #6d8179;
    font-size: 11px;
}

.offline-badge .status-dot {
    margin-right: 6px;
}

.icon-button,
.close-button {
    border: 0;
    background: none;
    color: var(--ink);
    font-size: 22px;
}

.icon-button:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.drive-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 10px;
    white-space: nowrap;
}

.drive-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.drive-button.is-connected {
    border-color: #9ebca0;
    color: #43734e;
}

.drive-symbol {
    color: var(--accent);
    font-size: 16px;
}

.sync-status {
    color: #899890;
    font-size: 10px;
    white-space: nowrap;
}

.sync-status.is-syncing {
    color: var(--accent);
}

.page-intro {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 30px;
    padding: 75px 0 66px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 1000px;
    margin-bottom: 23px;
    font: normal 64px/1.06 var(--font-display);
    letter-spacing: -.035em;
}

h1 em {
    color: var(--accent);
    font-style: normal;
}

.intro-copy {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.8;
}

.intro-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 7px;
}

.intro-stat span {
    font: normal 50px var(--font-display);
}

.intro-stat small {
    color: #83948c;
    font-size: 11px;
    line-height: 1.45;
}

.upload-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
    padding: 23px 26px;
    background: var(--mint);
    border: 1px solid #c7d9c9;
}

.upload-copy {
    display: flex;
    align-items: center;
    gap: 17px;
}

.upload-symbol {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    font-size: 24px;
}

.upload-panel h2 {
    margin: 0 0 5px;
    font: normal 20px var(--font-display);
}

.upload-panel p {
    margin: 0 0 4px;
    font-size: 12px;
}

.upload-hint {
    color: #728a7d;
    font-size: 10px;
}

.primary-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
    padding: 13px 17px;
    border: 0;
    background: var(--ink);
    color: white;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
    transition: 0.2s;
}

.primary-button span {
    color: var(--accent);
    font-size: 17px;
}

.primary-button:hover {
    background: var(--accent);
    transform: scale(101%, 105%);
}

.primary-button:hover span {
    color: white;
}

.drop-zone {
    min-height: 0;
    border: 1px dashed transparent;
}

.drop-zone.is-dragging {
    min-height: 45px;
    margin-top: 10px;
    border-color: var(--accent);
    background: #fff4ed;
}

.queue-status {
    min-height: 25px;
    padding-top: 13px;
    color: var(--accent);
    font-size: 12px;
}

.library-section {
    padding-top: 55px;
}

.section-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.section-header h2 {
    margin: 0;
    font: normal 34px var(--font-display);
}

.view-tools {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 220px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: var(--card);
}

.search-box span {
    color: var(--accent);
    font-size: 21px;
    line-height: .7;
}

.search-box input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: none;
    color: var(--ink);
    font-size: 11px;
}

.filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 12px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-soft);
    font-size: 11px;
    transition: border-color .2s ease, color .2s ease, transform .2s ease;
}

.filter-button span {
    margin-left: 12px;
    color: var(--accent);
    transition: transform .25s var(--ease-out);
}

.filter-button.is-open {
    border-color: var(--accent);
    color: var(--ink);
}

.filter-button.is-open .icon-expand {
    transform: rotate(180deg);
}

.tag-menu {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-height: 0;
    margin: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height .3s var(--ease-out), opacity .2s ease, margin .3s var(--ease-out);
}

.tag-menu.is-open {
    max-height: 180px;
    margin: -12px 0 20px;
    opacity: 1;
    pointer-events: auto;
}

.tag-choice {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink-soft);
    padding: 6px 10px;
    font-size: 11px;
}

.tag-choice.is-selected {
    background: var(--ink);
    color: #fff;
}

.print-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 19px;
}

.print-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--card);
    transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}

.print-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.card-image {
    position: relative;
    aspect-ratio: 1.38;
    overflow: hidden;
    background: #e6e1d8;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s var(--ease-out);
}

.print-card:hover .card-image img {
    transform: scale(1.03);
}

.subject-badge {
    position: absolute;
    top: 11px;
    left: 11px;
    padding: 5px 8px;
    background: rgba(255, 253, 249, .9);
    font-size: 10px;
}

.card-body {
    padding: 17px 16px 15px;
}

.card-body h3 {
    overflow-wrap: anywhere;
    min-width: 0;
    margin-bottom: 9px;
    font: normal 18px/1.25 var(--font-display);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #899890;
    font-size: 10px;
}

.tag-list {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.tag {
    padding: 4px 7px;
    background: #f0ede5;
    color: #798b82;
    font-size: 9px;
}

.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 13px;
}

.card-action {
    border: 0;
    background: none;
    color: #9aa9a2;
    font-size: 11px;
}

.card-action:hover {
    color: var(--accent);
}

.empty-state {
    padding: 72px 20px;
    border: 1px dashed var(--line);
    text-align: center;
}

.empty-icon {
    margin-bottom: 15px;
    color: var(--accent);
    font-size: 26px;
}

.empty-state h3 {
    margin-bottom: 8px;
    font: normal 24px var(--font-display);
}

.empty-state p {
    color: var(--ink-soft);
    font-size: 12px;
}

.text-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-size: 12px;
}

.modal-backdrop {
    position: fixed;
    z-index: 10;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(23, 63, 58, .55);
}

.modal-backdrop[hidden] {
    display: none;
}

.editor-modal {
    width: min(890px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    padding: 28px;
    background: var(--paper);
    box-shadow: 0 25px 70px rgba(0, 0, 0, .2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
}

.modal-header h2 {
    margin: 0;
    font: normal 31px var(--font-display);
}

.close-button {
    font-size: 30px;
    line-height: 1;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(240px, .85fr) minmax(300px, 1.15fr);
    gap: 27px;
}

.preview-wrap {
    position: relative;
    align-self: start;
    background: #ddd7cc;
}

.preview-wrap img {
    display: block;
    width: 100%;
    max-height: 510px;
    object-fit: contain;
}

.preview-label {
    position: absolute;
    left: 11px;
    bottom: 10px;
    padding: 5px 7px;
    background: rgba(255, 253, 249, .86);
    color: #74857d;
    font-size: 9px;
    letter-spacing: .1em;
}

#printForm {
    display: grid;
    gap: 15px;
}

#printForm label {
    display: grid;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 11px;
}

#printForm input,
#printForm select,
#printForm textarea {
    width: 100%;
    border: 1px solid var(--line);
    padding: 11px;
    outline: 0;
    background: var(--card);
    color: var(--ink);
    font-size: 12px;
    resize: vertical;
}

#printForm input:focus,
#printForm select:focus,
#printForm textarea:focus,
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(231, 107, 77, .15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.label-note {
    color: #9aa9a2;
    font-size: 9px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.delete-button {
    border: 0;
    background: none;
    color: #b65b4b;
    font-size: 11px;
}

.toast {
    position: fixed;
    z-index: 20;
    right: 22px;
    bottom: 22px;
    padding: 13px 17px;
    background: var(--ink);
    color: white;
    font-size: 12px;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: .2s var(--ease-out);
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
label:focus-within {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (max-width:900px) {
    .app-shell {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .sidebar {
        padding: 24px 10px;
        align-items: center;
    }

    .brand {
        margin: 0 0 45px;
    }

    .brand>span:last-child,
    .subject-nav,
    .storage-note {
        display: none;
    }

    .main-nav {
        width: 100%;
    }

    .nav-link {
        justify-content: center;
        padding: 12px 0;
        font-size: 0;
    }

    .nav-icon {
        font-size: 20px;
    }

    .main-content {
        padding: 0 5vw 65px;
    }

    .print-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width:620px) {
    .topbar {
        height: 64px;
    }

    .breadcrumb span,
    .breadcrumb i,
    .offline-badge {
        display: none;
    }

    .page-intro {
        display: block;
        padding: 50px 0 40px;
    }

    h1 {
        font-size: 43px;
    }

    .intro-stat {
        margin-top: 25px;
    }

    .upload-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .upload-panel .primary-button {
        align-self: stretch;
    }

    .section-header {
        align-items: stretch;
        flex-direction: column;
    }

    .section-header h2 {
        font-size: 30px;
    }

    .view-tools {
        width: 100%;
    }

    .search-box {
        flex: 1;
        width: auto;
    }

    .print-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-modal {
        padding: 20px;
    }

    .preview-wrap img {
        max-height: 300px;
    }
}

@media (prefers-reduced-motion:reduce) {

    *,
    *:before,
    *:after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}