:root {
    --ink: #2f312d;
    --muted: #666b68;
    --paper: #fdf9ee;
    --paper-cool: #edeef0;
    --panel: rgba(253, 249, 238, 0.96);
    --panel-strong: #fffdf8;
    --line: rgba(91, 91, 91, 0.18);
    --accent: #b1ab97;
    --accent-dark: #8d8773;
    --accent-soft: #d7d1bf;
    --green: #6f7a70;
    --shadow: 0 10px 30px rgba(70, 71, 68, 0.11);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: linear-gradient(180deg, var(--paper) 0%, #f7f4ea 58%, var(--paper-cool) 100%);
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.deck-hero {
    padding: 18px 18px 12px;
}

.hero-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        linear-gradient(rgba(255, 253, 248, 0.94), rgba(255, 253, 248, 0.94)),
        url("/img/site/LandBack.jpg");
    background-size: auto, 220px;
    background-repeat: repeat;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-inner h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 3.3rem);
    line-height: 1.08;
}

.hero-copy {
    max-width: 760px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.96rem;
    line-height: 1.7;
}

.deck-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.deck-tabs a {
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
    color: var(--ink);
    font-weight: 800;
}

.deck-tabs a.active {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-color: var(--accent-dark);
}

.deck-page {
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 18px 48px;
}

.deck-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    gap: 14px 20px;
    align-items: end;
    margin: 0 auto 22px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
        linear-gradient(rgba(253, 249, 238, 0.96), rgba(253, 249, 238, 0.96)),
        url("/img/site/LandBack.jpg");
    background-size: auto, 180px;
    background-repeat: repeat;
    box-shadow: 0 6px 20px rgba(70, 71, 68, 0.08);
}

.deck-search {
    min-width: 0;
}

.deck-search label {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.deck-search div {
    display: flex;
    gap: 8px;
}

.deck-search input {
    width: 100%;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffef9;
    color: var(--ink);
    font-size: 1rem;
    outline: none;
}

.deck-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(177, 171, 151, 0.2);
}

.deck-search button,
.primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

.deck-count {
    color: var(--muted);
    font-weight: 800;
    text-align: right;
}

.deck-pagination {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.deck-pagination a,
.deck-pagination span {
    min-width: 38px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
    text-align: center;
    font-weight: 800;
}

.deck-pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-dark);
}

.deck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
    gap: 24px;
}

.deck-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.deck-image-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: linear-gradient(180deg, #f2f3f1 0%, #e7e8e4 100%);
    border-bottom: 1px solid var(--line);
}

.deck-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
}

.source-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(253, 249, 238, 0.95);
    color: var(--accent-dark);
    font-size: 0.76rem;
    font-weight: 900;
    border: 1px solid rgba(177, 171, 151, 0.35);
}

.image-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(62, 62, 62, 0.54);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.image-nav.prev {
    left: 12px;
}

.image-nav.next {
    right: 12px;
}

.deck-body {
    padding: 18px;
}

.deck-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.deck-title {
    margin: 0;
    font-size: 1.22rem;
    line-height: 1.4;
}

.deck-name,
.deck-event,
.deck-content {
    margin: 9px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.deck-name {
    color: var(--accent-dark);
    font-weight: 800;
}

.deck-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.deck-actions a:not(.primary-action) {
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-strong);
    color: var(--ink);
    font-weight: 900;
}

.deck-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.deck-tags a {
    max-width: 100%;
    padding: 7px 10px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(177, 171, 151, 0.14);
    color: var(--accent-dark);
    font-size: 0.82rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    grid-column: 1 / -1;
    padding: 52px 22px;
    border: 1px dashed var(--line);
    border-radius: 12px;
    background: rgba(253, 249, 238, 0.9);
    text-align: center;
}

.deck-footer {
    margin-top: 28px;
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 22, 21, 0.88);
}

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

.modal-stage {
    max-width: min(96vw, 1500px);
    text-align: center;
}

#deck-modal-image {
    max-width: 96vw;
    max-height: 84vh;
    border-radius: 16px;
    object-fit: contain;
    cursor: pointer;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

#deck-modal-caption {
    margin: 12px 0 0;
    color: #fff;
    font-weight: 800;
}

.modal-close {
    position: fixed;
    top: 18px;
    right: 22px;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

@media (max-width: 760px) {
    .deck-hero {
        padding: 12px 10px 12px;
    }

    .hero-inner {
        padding: 20px;
        border-radius: 12px;
    }

    .hero-copy {
        font-size: 0.92rem;
    }

    .deck-page {
        padding: 0 10px 32px;
    }

    .deck-toolbar {
        position: static;
        grid-template-columns: 1fr;
        padding: 12px;
        border-radius: 12px;
    }

    .deck-search div {
        flex-direction: column;
    }

    .deck-count {
        text-align: left;
    }

    .deck-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .deck-card {
        border-radius: 12px;
    }

    .deck-image-wrap {
        aspect-ratio: 4 / 3;
    }

    .deck-body {
        padding: 14px;
    }

    .deck-title {
        font-size: 1.08rem;
    }

    .image-nav {
        width: 36px;
        height: 36px;
        font-size: 1.6rem;
    }

    .deck-pagination {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }
}
