:root {
    --ink: #151d24;
    --muted: #66747d;
    --paper: #f4f6f4;
    --white: #ffffff;
    --green: #00a879;
    --green-dark: #007e5e;
    --cyan: #42d7d2;
    --line: #dce2df;
    --danger: #dc3545;
    --gold: #f4c34f;
}

html { 
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    color: var(--ink);
    background: var(--paper);
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

html.modal-open,
body.modal-open { overflow: hidden !important; }

button, input { font: inherit; }
button { cursor: pointer; }

.activity-header {
    position: fixed;
    z-index: 30;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(8, 13, 14, 0.88);
    border-bottom: 2px solid var(--green);
    backdrop-filter: blur(12px);
}

.brand { height: 58px; width: 210px; display: flex; flex-shrink: 0; align-items: center; overflow: hidden; }
.brand img { width: 100%; height: auto; }
.activity-header nav { height: 100%; display: flex; flex-shrink: 0; align-items: center; gap: 30px; justify-content: flex-end;}
.activity-header nav a,
.nav-submit { color: #fff; font-size: 15px; }
.activity-header nav a:hover { color: var(--cyan); }
.nav-submit { padding: 11px 20px; white-space: nowrap; background: var(--green); border: 1px solid #3de1bd; }
.nav-submit:hover { background: var(--green-dark); }

.activity-hero {
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    padding: 150px max(7vw, 28px) 64px;
    color: #fff;
    background-color: #071917;
    background-image: linear-gradient(90deg, rgba(4, 13, 14, 0.9) 0%, rgba(4, 13, 14, 0.35) 52%, rgba(4, 13, 14, 0.72) 100%), url("../image/bg.png"), url("../image/motor-workshop/bg_mtgf_01.png");
    background-position: center, top, center;
    background-size: cover, cover, cover;
}

.hero-content { width: min(720px, 100%); }
.hero-kicker,
.section-kicker,
.callout-eyebrow,
.modal-heading > p {
    color: var(--cyan);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.download-button { width: 15%; }

.hero-content h1 { margin-top: 12px; margin-bottom: 32px; font-size: clamp(44px, 5vw, 76px); line-height: 1.08; }
.hero-copy { margin-top: 10px; font-size: 19px; color: #dce9e5; }

.ranking-section { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 80px; }
.ranking-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.ranking-heading h2 { margin-top: 8px; font-size: 36px; }
.vote-balance { min-width: 310px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-left: 18px; border-left: 3px solid var(--green); }
.vote-balance-copy > span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.vote-balance-copy p { display: flex; align-items: baseline; gap: 5px; color: var(--green-dark); }
.vote-balance-copy strong { font-size: 30px; line-height: 1; }
.vote-balance-copy em { font-size: 14px; font-style: normal; font-weight: 700; }
.vote-more-button { height: 42px; padding: 0 18px; color: #fff; background: var(--green); border: 1px solid #29cda4; font-weight: 700; white-space: nowrap; }
.vote-more-button:hover { background: var(--green-dark); }

.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; }
.ranking-tools { display: flex; gap: 8px; }
.ranking-search { width: min(380px, 100%); }
.ranking-search input { width: 100%; height: 44px; padding: 0 14px; color: var(--ink); background: var(--white); border: 1px solid var(--line); outline: none; }
.ranking-search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 121, 0.12); }
.ranking-search-button,
.ranking-search-clear { height: 44px; border: 1px solid var(--green); font-weight: 700; }
.ranking-search-button { min-width: 76px; padding: 0 18px; color: #fff; background: var(--green); }
.ranking-search-button:hover { background: var(--green-dark); }
.ranking-search-clear { width: 44px; color: var(--green-dark); background: var(--white); font-size: 24px; line-height: 1; }
.ranking-search-clear:hover { background: #eaf6f2; }

.ranking-list { min-height: 180px; display: grid; gap: 14px; }
.loading-state,
.empty-state,
.error-state {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
}

.empty-state { flex-direction: column; text-align: center; }
.empty-state strong { color: var(--ink); font-size: 20px; }
.error-state button { color: var(--green-dark); font-weight: 700; }
.loading-spinner { width: 20px; height: 20px; border: 2px solid #d3ddda; border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.ranking-item {
    position: relative;
    min-height: 142px;
    display: grid;
    grid-template-columns: 66px 180px minmax(0, 1fr) 100px;
    align-items: center;
    gap: 22px;
    padding: 14px 20px 14px 12px;
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 5px 16px rgba(22, 46, 42, 0.07);
}

.ranking-item.top-three { border-color: rgba(0, 168, 121, 0.55); box-shadow: 0 0 24px rgba(0, 168, 121, 0.14); }
.ranking-item.top-three::before { content: ""; position: absolute; inset: -1px auto -1px -1px; width: 5px; background: var(--green); }
.rank-number { color: #929da1; font-size: 28px; font-weight: 800; text-align: center; }
.top-three .rank-number { color: var(--green-dark); }
.rank-number small { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); font-weight: 600; }
.work-image-trigger {
    width: 180px;
    height: 112px;
    position: relative;
    overflow: hidden;
    background: #dfe7e4;
    cursor: zoom-in;
}
.work-image-trigger:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.work-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform 0.2s ease; }
.work-image-trigger:hover .work-image { transform: scale(1.035); }
.work-info { min-width: 0; }
.work-name { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.vote-count { margin-top: 25px; display: flex; justify-content: space-between; align-items: center; color: var(--green-dark); font-weight: 700; }
.vote-count strong { font-size: 20px; }
.vote-bar { height: 10px; margin-top: 7px; overflow: hidden; background: #e6ebe9; }
.vote-bar span { display: block; height: 100%; min-width: 6px; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width 0.4s ease; }
.vote-button { width: 100px; height: 48px; color: #fff; font-weight: 700; background: var(--green); border: 1px solid #29cda4; }
.vote-button:hover { background: var(--green-dark); }

.ranking-pagination { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.ranking-pagination[hidden] { display: none; }
.ranking-pagination button { min-width: 76px; height: 42px; padding: 0 14px; color: var(--green-dark); background: var(--white); border: 1px solid var(--line); font-weight: 700; }
.ranking-pagination button:hover { color: #fff; background: var(--green); }
.ranking-pagination button:disabled { cursor: default; color: #9ba6a2; background: #edf0ef; border-color: var(--line); opacity: 0.7; }
.ranking-page-numbers { display: flex; align-items: center; gap: 6px; }
.ranking-page-numbers button { min-width: 42px; width: 42px; padding: 0; }
.ranking-page-numbers button[aria-current="page"] { color: #fff; background: var(--green); border-color: var(--green); }
.ranking-page-ellipsis { width: 26px; text-align: center; color: var(--muted); font-weight: 700; }

.submission-callout {
    margin-top: 34px;
    padding: 34px 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    color: #fff;
    background: #101d1c url("../image/motor-workshop/bg_mtgf_01.png") center / cover;
    border-top: 3px solid var(--green);
}
.submission-callout h2 { margin: 6px 0 8px; font-size: 28px; }
.submission-callout > div > p:last-child { color: #bfceca; }

.primary-action,
.secondary-action { min-height: 48px; padding: 0 26px; font-weight: 700; }
.primary-action { color: #fff; background: var(--green); border: 1px solid #3bdbb8; }
.primary-action:hover { background: var(--green-dark); }
.primary-action:disabled { cursor: wait; opacity: 0.65; }
.secondary-action { color: var(--ink); background: #e7ebe9; border: 1px solid #d4dad7; }

.activity-footer { min-height: 160px; padding: 36px max(7vw, 28px); display: flex; align-items: center; justify-content: center; gap: 42px; color: #9eaaa7; background: #070b0b; font-size: 12px; line-height: 2; }
.activity-footer img { width: 160px; height: auto; }

.modal[hidden] { display: none; }
.modal { position: fixed; z-index: 60; inset: 0; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 9, 9, 0.78); backdrop-filter: blur(5px); }
.modal-panel { position: relative; z-index: 1; width: min(660px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 30px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34); border-top: 4px solid var(--green); }
.submission-panel { width: min(720px, 100%); }
.modal-close { position: absolute; top: 16px; right: 17px; width: 38px; height: 38px; color: #53605d; font-size: 30px; line-height: 1; }
.modal-heading { padding-right: 40px; margin-bottom: 24px; }
.modal-heading h2 { margin: 5px 0 7px; font-size: 28px; }
.modal-heading span { color: var(--muted); font-size: 13px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.upload-field { min-width: 0; display: block; }
.upload-field input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.field-label,
.text-field > span { display: block; min-height: 24px; margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.field-label b,
.text-field b { color: var(--danger); }
.field-label em,
.text-field em { color: var(--muted); font-size: 12px; font-style: normal; font-weight: 400; }
.upload-box { height: 170px; display: grid; place-items: center; overflow: hidden; color: var(--muted); background: #f5f8f7; border: 1px dashed #aab8b3; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.upload-field:hover .upload-box,
.upload-field:focus-within .upload-box { border-color: var(--green); background: #eff9f6; }
.upload-preview { width: 100%; height: 100%; object-fit: contain; background: #17211f; }
.upload-placeholder { display: flex; align-items: center; flex-direction: column; text-align: center; }
.upload-placeholder strong { color: var(--green); font-size: 38px; font-weight: 300; }
.upload-placeholder span { color: var(--ink); font-weight: 700; }
.upload-placeholder small { margin-top: 5px; }
.upload-example { margin: 31px 0 0; padding: 8px; background: #f7faf9; border: 1px solid var(--line); }
.upload-example figcaption { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.upload-example img { width: 100%; height: 130px; display: block; object-fit: contain; background: #eaf0ee; }
.text-field { display: block; margin-top: 16px; }
.text-field input { width: 100%; height: 48px; padding: 0 14px; color: var(--ink); background: #fff; border: 1px solid #ced7d3; outline: none; }
.text-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 121, 0.1); }
.text-field input.invalid,
.upload-field.invalid .upload-box { border-color: var(--danger); }
.form-message { min-height: 20px; margin-top: 13px; color: var(--danger); font-size: 13px; }
.form-message.success { color: var(--green-dark); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 9px; }

.vote-panel { width: min(480px, 100%); }
.vote-options { margin: 8px 0 4px; padding: 0; border: 0; }
.vote-options legend { margin-bottom: 12px; font-weight: 700; }
.vote-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.vote-options legend { grid-column: 1 / -1; }
.vote-options input { position: absolute; opacity: 0; }
.vote-options span { height: 52px; display: grid; place-items: center; color: var(--muted); background: #f2f5f4; border: 1px solid #d8dfdc; font-weight: 700; }
.vote-options input:checked + span { color: var(--green-dark); background: #e8f8f3; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }

.vote-tasks-panel { width: min(620px, 100%); }
.vote-task-list { display: grid; }
.vote-task-message { padding: 34px 18px; color: var(--muted); background: #f5f8f7; border: 1px dashed #b7c5bf; text-align: center; }
.vote-task-item { min-width: 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.vote-task-item:first-child { border-top: 1px solid var(--line); }
.vote-task-index { width: 42px; height: 42px; display: grid; place-items: center; color: var(--green-dark); background: #e8f8f3; font-size: 13px; font-weight: 800; }
.vote-task-main { min-width: 0; }
.vote-task-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.vote-task-heading strong { font-size: 15px; overflow-wrap: anywhere; }
.vote-task-heading span { flex-shrink: 0; color: var(--green-dark); font-size: 13px; font-weight: 800; }
.vote-task-progress { height: 7px; margin-top: 9px; overflow: hidden; background: #e5ebe8; }
.vote-task-progress span { display: block; height: 100%; background: var(--green); transition: width 0.2s ease; }
.vote-task-reward { max-width: 126px; color: var(--muted); font-size: 13px; text-align: right; }

.vote-task-item { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 14px 0; }
.vote-task-index { transform: translate(-5px, 13px); }
.vote-task-reward { grid-column: 2; max-width: none; margin-top: -2px; text-align: left; }

.image-modal { z-index: 80; padding: 28px; overflow: hidden; }
.image-preview-panel {
    position: relative;
    z-index: 1;
    width: min(1200px, 96vw);
    height: min(860px, calc(100vh - 56px));
    height: min(860px, calc(100dvh - 56px));
    max-height: calc(100vh - 56px);
    max-height: calc(100dvh - 56px);
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #080d0c;
    border: 1px solid rgba(66, 215, 210, 0.32);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58);
}
.image-preview-panel figure {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    margin: 0;
    padding: 18px;
    overflow: hidden;
}
.image-preview-panel img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    place-self: center;
    object-fit: contain;
    overflow: hidden;
}
.image-preview-panel figcaption { min-height: 28px; padding: 12px 58px 0 0; color: #dce9e5; font-size: 14px; overflow-wrap: anywhere; }
.image-preview-close {
    position: absolute;
    z-index: 2;
    right: 18px;
    top: 15px;
    width: 42px;
    height: 42px;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.42);
    font-size: 30px;
    line-height: 1;
}
.image-preview-close:hover { background: var(--green-dark); }

.toast { position: fixed; z-index: 90; left: 50%; bottom: 28px; max-width: calc(100% - 40px); padding: 13px 20px; color: #fff; background: rgba(10, 20, 18, 0.94); opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: 0.2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.share-dock { position: fixed; z-index: 45; right: 24px; bottom: 24px; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 10px; }
.share-trigger { width: 56px; height: 56px; display: inline-grid; place-items: center; padding: 0; color: #fff; background: var(--green); border: 1px solid #3de1bd; border-radius: 50%; box-shadow: 0 8px 22px rgba(0, 62, 48, 0.24); font-weight: 700; }
.share-trigger:hover,
.share-trigger[aria-expanded="true"] { background: var(--green-dark); }
.share-trigger-icon { font-size: 24px; line-height: 1; transform: translateY(-1px); }
.share-panel { padding: 7px; color: var(--ink); background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(22, 46, 42, 0.2); }
.share-panel[hidden] { display: none; }
.copy-share-text { width: 100%; height: 40px; margin-bottom: 6px; color: var(--green-dark); border: 1px solid #7cd7bb; font-size: 12px; font-weight: 700; border-radius: 50%;}
.copy-share-text:hover { color: #fff; background: var(--green); border-color: var(--green); }
.share-panel .social-share { display: flex; flex-direction: column; white-space: nowrap; }
.share-panel .social-share a { margin: 2px; }
.share-panel .social-share .social-share-icon { width: 38px; height: 38px; line-height: 38px; }
.share-panel .social-share .icon-wechat .wechat-qrcode { top: -205px; left: auto; right: 42px; }

@media (max-width: 760px) {
    .activity-header { height: 62px; padding: 0 16px; }
    .brand { width: 132px; height: 46px; }
    .activity-header nav { gap: 12px; flex-shrink: unset; }
    body > header > nav > a { display: none; }
    .download-button { width: 37%; }
    .nav-submit { padding: 9px 13px; font-size: 13px; }
    .activity-hero { min-height: 350px; padding: 112px 20px 42px; background-position: center, 62% center, center; }
    .hero-content h1 { font-size: 42px; }
    .hero-copy { font-size: 16px; line-height: 1.7; }
    .ranking-section { width: calc(100% - 24px); padding: 40px 0 48px; }
    .ranking-heading { align-items: flex-start; flex-direction: column; gap: 18px; }
    .ranking-heading h2 { font-size: 28px; }
    .vote-balance { width: 100%; min-width: 0; }
    .ranking-tools { justify-content: stretch; }
    .ranking-search { flex: 1; min-width: 0; }
    .ranking-search-button { min-width: 64px; padding: 0 12px; }
    .ranking-pagination { gap: 5px; }
    .ranking-pagination > button { min-width: 62px; padding: 0 9px; font-size: 12px; }
    .ranking-page-numbers { gap: 4px; }
    .ranking-page-numbers button { min-width: 36px; width: 36px; }
    .ranking-item { min-height: 0; grid-template-columns: 40px 104px minmax(0, 1fr); grid-template-rows: auto auto; gap: 10px 12px; padding: 11px; }
    .rank-number { grid-row: 1 / 3; font-size: 21px; }
    .work-image-trigger { width: 104px; height: 86px; grid-row: 1 / 3; }
    .work-info { align-self: end; }
    .work-name { font-size: 13px; line-height: 1.5; }
    .vote-count { margin-top: 8px; font-size: 12px; }
    .vote-count strong { font-size: 17px; }
    .vote-bar { height: 6px; margin-top: 5px; }
    .vote-button { width: 100%; height: 38px; align-self: start; font-size: 13px; }
    .submission-callout { padding: 26px 20px; align-items: stretch; flex-direction: column; }
    .submission-callout h2 { font-size: 23px; }
    .activity-footer { padding: 28px 20px; align-items: flex-start; flex-direction: column; gap: 16px; }
    .activity-footer img { width: 128px; }
    .modal { padding: 0; align-items: end; }
    .modal-panel { width: 100%; max-height: 92vh; padding: 24px 18px calc(22px + env(safe-area-inset-bottom)); }
    .submission-panel { width: 100%; }
    .modal-heading h2 { font-size: 24px; }
    .field-label { min-height: 44px; font-size: 13px; }
    .field-label em { display: block; margin-top: 2px; }
    .upload-box { height: 125px; }
    .upload-example { margin-top: 50px; padding: 6px; }
    .upload-example img { height: 90px; }
    .upload-placeholder small { padding: 0 5px; font-size: 10px; }
    .text-field input { height: 46px; }
    .primary-action, .secondary-action { padding: 0 16px; }
    .vote-tasks-panel { width: 100%; }
    .vote-task-item { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 14px 0; }
    .vote-task-index { width: 36px; height: 36px; }
    .vote-task-reward { grid-column: 2; max-width: none; margin-top: -2px; text-align: left; }
    .image-modal { padding: 12px; align-items: center; }
    .image-preview-panel {
        width: 100%;
        height: min(82vh, 720px);
        height: min(82dvh, 720px);
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
    }
    .image-preview-panel figure { padding: 10px; }
    .image-preview-panel figcaption { padding: 10px 52px 0 2px; font-size: 12px; }
    .image-preview-close { top: 10px; right: 10px; bottom: auto; }
    .share-dock { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
    .share-trigger { width: 50px; height: 50px; }
    .share-panel { position: absolute; right: 0; bottom: 60px; max-width: calc(100vw - 28px); }
}

@media (max-width: 430px) {
    .ranking-item { grid-template-columns: 34px 88px minmax(0, 1fr); gap: 9px; }
    .work-image-trigger { width: 88px; height: 78px; }
    .rank-number small { display: none; }
    .work-name { font-size: 12px; }
}

@media (max-width: 360px) {
    .ranking-pagination { gap: 3px; }
    .ranking-pagination > button { min-width: 44px; padding: 0 5px; }
    .ranking-page-numbers { gap: 2px; }
    .ranking-page-numbers button { min-width: 26px; width: 26px; }
    .ranking-page-ellipsis { width: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
