:root {
    color-scheme: light;
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    color: #17324d;
    background: #f0f7ff;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    margin: 0;
    min-width: 320px;
    background: #f0f7ff;
    font-size: 14px;
}

button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }

.search-app { width: 100%; flex: 1 0 auto; }

.search-header {
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #d5e4f5;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(100%, 1710px);
    margin: 0 auto;
}

.search-icon {
    width: 20px;
    height: 20px;
    margin-left: 6px;
    color: #3190f4;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    flex: 0 0 auto;
}

.search-form input {
    min-width: 0;
    flex: 1;
    height: 50px;
    border: 1px solid #c9d9eb;
    border-radius: 8px;
    padding: 0 14px;
    color: #17324d;
    background: #fff;
    outline: none;
}

.search-form input:focus { border-color: #348ef5; box-shadow: 0 0 0 3px #348ef51a; }
.search-form input::placeholder { color: #7590ad; }

.search-submit {
    height: 50px;
    min-width: 76px;
    padding: 0 20px;
    border: 1px solid #2787ec;
    border-radius: 8px;
    color: #fff;
    background: #278cf2;
    font-weight: 600;
    cursor: pointer;
}

.search-submit:hover { background: #1679df; }

.filters {
    padding: 18px 24px 16px;
    background: #fff;
    border-bottom: 1px solid #d5e4f5;
}

.filter-tools, .category-list {
    width: min(100%, 1710px);
    margin: 0 auto;
}

.filter-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.sort-control select, .quick-links a, .category-chip {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid #d7e0eb;
    border-radius: 8px;
    color: #34475b;
    background: #fff;
    text-decoration: none;
    transition: border-color .16s ease, color .16s ease, background-color .16s ease, box-shadow .16s ease;
}

.sort-control select {
    width: 122px;
    padding: 0 28px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%235f7185' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    text-align: center;
    text-align-last: center;
    cursor: pointer;
}

.sort-control select:focus-visible, .quick-links a:focus-visible, .category-chip:focus-visible {
    outline: 3px solid #348ef533;
    outline-offset: 2px;
}
.quick-links { display: flex; gap: 10px; }
.quick-links a { display: inline-flex; align-items: center; color: #45617d; }
.quick-links a:hover, .category-chip:hover, .sort-control select:hover { border-color: #9dbce0; color: #176fc9; background-color: #f7faff; }

.category-list { display: flex; flex-wrap: wrap; gap: 8px; }
.category-chip { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 550; white-space: nowrap; }
.category-chip.is-active { border-color: #278cf2; color: #fff; background: #278cf2; box-shadow: 0 2px 5px #278cf226; }

.results-area {
    width: min(calc(100% - 48px), 1710px);
    margin: 0 auto;
    padding: 40px 0 56px;
}

.results-status { min-height: 0; margin-bottom: 18px; color: #52708f; }
.results-status:empty { display: none; }

.category-fallback-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid #f2cc73;
    border-radius: 8px;
    color: #875b08;
    background: #fff9e8;
    line-height: 1.6;
}
.category-fallback-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin-top: 3px;
    border-radius: 50%;
    color: #fff;
    background: #d99a18;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}
.category-fallback-notice strong { color: #674307; }
.category-fallback-total { color: #8d7546; }

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

.resource-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    min-height: 162px;
    padding: 14px;
    border: 1px solid #dceafd;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px #265b850c;
}

.resource-poster-frame {
    position: relative;
    display: grid;
    width: 98px;
    height: 136px;
    flex: 0 0 98px;
    place-items: center;
    overflow: hidden;
    border-radius: 5px;
    color: #8ba2ba;
    background: #edf4fb;
}

.resource-poster-placeholder { display: grid; place-items: center; }
.resource-poster-placeholder svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.resource-poster-frame.is-loading .resource-poster-placeholder { opacity: .45; }
.resource-poster-frame.has-image .resource-poster-placeholder { display: none; }

.resource-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .18s ease;
}
.resource-poster-frame.has-image .resource-poster { opacity: 1; }

.resource-copy { min-width: 0; min-height: 136px; flex: 1 1 auto; display: flex; flex-direction: column; gap: 5px; }
.resource-title { display: -webkit-box; overflow: hidden; color: #17324d; font-size: 20px; font-weight: 650; line-height: 1.35; text-decoration: none; cursor: default; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.resource-description { overflow: hidden; color: #66819c; font-size: 15px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.resource-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: #6885a3; font-size: 12px; }
.resource-genres { color: #526f8b; }
.resource-facts, .resource-people { display: flex; min-width: 0; align-items: center; gap: 7px; color: #66819c; font-size: 12px; line-height: 1.5; }
.resource-facts { flex-wrap: wrap; }
.resource-facts > span:not(:last-child)::after, .resource-people > span:not(:last-child)::after { margin-left: 7px; color: #a0b2c4; content: "·"; }
.resource-media-type { padding: 1px 7px; border-radius: 5px; color: #278149; background: #e7f7ec; }
.resource-media-type::after { display: none; }
.resource-rating { color: #df7b16; font-weight: 600; }
.resource-people { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resource-badge { display: none; }
.resource-date { margin-top: auto; }

.resource-actions { width: 136px; flex: 0 0 136px; display: flex; flex-direction: column; gap: 8px; }
.resource-action {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #8bbcff;
    border-radius: 7px;
    color: #0866d9;
    background: #eaf3ff;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.resource-action:hover { background: #dcecff; }
.resource-action.copy { color: #56748f; border-color: #dae6f3; background: #fff; }
.resource-action.provider-0 { color: #8b2be2; border-color: #d7a6ff; background: #f6eaff; }
.resource-action.provider-0:hover { background: #eedbff; }
.resource-action.provider-2 { color: #0866d9; border-color: #8bbcff; background: #e7f1ff; }
.resource-action.provider-2:hover { background: #d8e9ff; }
.resource-action-icon { font-size: 15px; line-height: 1; }
.resource-inline-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 0; }
.resource-inline-actions .resource-action { min-height: 30px; padding: 0 7px; font-size: 12px; }
.resource-action.feedback { color: #56748f; border-color: #dae6f3; background: #fff; }

.copy-toast {
    position: fixed;
    z-index: 1100;
    top: 64px;
    left: 50%;
    display: flex;
    width: max-content;
    max-width: min(540px, calc(100vw - 32px));
    align-items: center;
    gap: 12px;
    padding: 17px 20px;
    transform: translateX(-50%);
    border: 1px solid #d9e4ef;
    border-radius: 11px;
    color: #293b4e;
    background: #fff;
    box-shadow: 0 8px 24px #17324d26;
    font-size: 14px;
    line-height: 1.5;
    animation: copy-toast-in .18s ease-out;
    transition: opacity .18s ease, transform .18s ease;
}
.copy-toast.is-leaving { opacity: 0; transform: translate(-50%, -8px); }
.copy-toast-icon {
    display: grid;
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #24384d;
    font-size: 14px;
    font-weight: 700;
}
@keyframes copy-toast-in {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgb(15 23 32 / 72%);
    backdrop-filter: blur(3px);
}
.feedback-dialog {
    width: min(100%, 560px);
    max-height: min(90vh, 720px);
    overflow: auto;
    padding: 28px;
    border: 1px solid #e3edf8;
    border-radius: 16px;
    color: #293c50;
    background: #fff;
    box-shadow: 0 22px 60px #10243d45;
}
.feedback-dialog h2 { margin: 0; color: #213b57; font-size: 22px; font-weight: 700; letter-spacing: 0; }
.feedback-intro { margin: 10px 0 22px; color: #6c88a5; font-size: 14px; line-height: 1.6; }
.feedback-options { display: grid; gap: 10px; }
.feedback-option {
    display: flex;
    min-height: 56px;
    align-items: center;
    gap: 11px;
    padding: 0 15px;
    border: 1px solid #d2e2f3;
    border-radius: 10px;
    color: #34485d;
    cursor: pointer;
}
.feedback-option:hover, .feedback-option.is-selected { border-color: #67a8f5; background: #f5f9ff; box-shadow: 0 3px 10px #348ef514; }
.feedback-option input { order: 3; width: 20px; height: 20px; margin: 0 0 0 auto; accent-color: #348ef5; cursor: pointer; }
.feedback-disk-icon { order: 1; display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border: 1px solid #dbe6f2; border-radius: 9px; color: #507093; background: #f4f8fc; }
.feedback-disk-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.feedback-disk-icon.provider-0 { border-color: #ead8ff; color: #8737cc; background: #f8f0ff; }
.feedback-disk-icon.provider-2 { border-color: #d1e4ff; color: #2676ce; background: #eff6ff; }
.feedback-option > span:last-child { order: 2; font-size: 15px; font-weight: 550; }
.feedback-note-label { display: flex; justify-content: space-between; margin: 22px 0 8px; color: #6883a0; font-size: 13px; }
.feedback-count { color: #91a4b7; }
.feedback-note {
    display: block;
    width: 100%;
    min-height: 88px;
    resize: vertical;
    padding: 12px 14px;
    border: 1px solid #d2e2f3;
    border-radius: 10px;
    color: #293c50;
    font: inherit;
    outline: none;
}
.feedback-note:focus { border-color: #348ef5; box-shadow: 0 0 0 3px #348ef51a; }
.feedback-note::placeholder { color: #91a4b7; }
.feedback-error { min-height: 20px; margin-top: 6px; color: #d9434f; font-size: 13px; }
.feedback-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.feedback-footer button { min-height: 40px; padding: 0 18px; border: 1px solid #d2e2f3; border-radius: 9px; color: #425c76; background: #fff; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.feedback-footer button:hover { border-color: #9fc5ed; background: #f5f9ff; }
.feedback-footer .feedback-submit { border-color: #348ef5; color: #fff; background: #348ef5; box-shadow: 0 4px 10px #348ef52e; }
.feedback-footer .feedback-submit:hover { border-color: #1679df; background: #1679df; }
.feedback-footer .feedback-submit:disabled { border-color: #b5d5f8; background: #b5d5f8; box-shadow: none; cursor: not-allowed; }

.empty-state, .loading-state, .error-state {
    grid-column: 1 / -1;
    padding: 48px 20px;
    border: 1px solid #dceafd;
    border-radius: 12px;
    color: #6985a0;
    background: #fff;
    text-align: center;
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding-top: 28px; }
.page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #b9d4f5;
    border-radius: 7px;
    color: #176fc9;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
}
.page-button[aria-current="page"] { border-color: #278cf2; color: #fff; background: #278cf2; }
.page-button:disabled, .page-button.is-disabled { color: #9bafc2; background: #f6faff; cursor: default; }
.page-count { color: #6d87a2; }
.search-footer {
    flex: 0 0 auto;
    padding: 22px 24px;
    border-top: 1px solid #d5e4f5;
    color: #66819c;
    background: #fff;
}
.search-footer-content {
    width: min(100%, 1710px);
    margin: 0 auto;
    text-align: center;
    line-height: 1.8;
    overflow-wrap: anywhere;
}
.search-footer-content p { margin: 0; }
.search-footer-content a { color: #2787ec; text-decoration: none; }
.search-footer-content a:hover { text-decoration: underline; }
.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; }

@media (max-width: 680px) {
    .search-header { padding: 12px 14px; }
    .search-form { gap: 7px; }
    .search-form input, .search-submit { height: 44px; }
    .search-submit { min-width: 60px; padding: 0 12px; }
    .filters { padding: 14px; }
    .filter-tools { align-items: flex-start; flex-direction: column; }
    .category-list { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
    .results-area { width: calc(100% - 28px); padding-top: 20px; }
    .search-footer { padding: 18px 14px; }
    .resource-grid { grid-template-columns: 1fr; gap: 12px; }
    .resource-card { min-height: 108px; padding: 10px; }
    .resource-poster-frame { width: 60px; height: 84px; flex-basis: 60px; }
    .resource-copy { min-height: 84px; }
    .resource-title { font-size: 16px; }
    .resource-description { font-size: 13px; }
    .resource-actions { width: 96px; flex-basis: 96px; }
    .resource-action { min-height: 30px; }
    .feedback-modal { padding: 14px; }
    .copy-toast { top: 24px; padding: 14px 16px; font-size: 13px; }
    .feedback-dialog { padding: 24px 18px; border-radius: 14px; }
    .feedback-dialog h2 { font-size: 18px; }
}

@media (min-width: 681px) and (max-width: 1200px) {
    .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
