@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
    --md-sys-color-primary: #006a67;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #9cf1ed;
    --md-sys-color-on-primary-container: #00201f;
    --md-sys-color-secondary: #4a6361;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #cde8e5;
    --md-sys-color-on-secondary-container: #051f1d;
    --md-sys-color-tertiary: #4f5f7d;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #d6e3ff;
    --md-sys-color-on-tertiary-container: #091b36;
    --md-sys-color-error: #ba1a1a;
    --md-sys-color-surface: #f4fbf9;
    --md-sys-color-surface-container: #e8efed;
    --md-sys-color-surface-container-high: #e2e9e7;
    --md-sys-color-surface-container-highest: #dce4e2;
    --md-sys-color-outline: #6f7978;
    --md-sys-color-outline-variant: #bec9c7;
    --md-sys-color-on-surface: #161d1c;
    --md-sys-color-on-surface-variant: #3f4948;
    --bg-accent-1: #d6f5f3;
    --bg-accent-2: #d9e8ff;
    --hero-grad-1: #006a67;
    --hero-grad-2: #138d89;
    --hero-grad-3: #64b8bd;
    --primary-hover: #005250;
    --batch-card-bg: #d2f0ea;
    --batch-card-text: #123f37;
    --batch-card-icon: #1f6c5d;
    --sync-card-bg: #d6e3ff;
    --sync-card-text: #102343;
    --sync-card-icon: #244a86;
    --md-elevation-1: 0 1px 3px rgba(22, 29, 28, 0.08), 0 1px 2px rgba(22, 29, 28, 0.14);
    --md-elevation-2: 0 2px 6px rgba(22, 29, 28, 0.1), 0 1px 3px rgba(22, 29, 28, 0.16);
    --md-elevation-3: 0 6px 16px rgba(22, 29, 28, 0.14), 0 2px 5px rgba(22, 29, 28, 0.12);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --grid-gap: clamp(12px, 1.5vmin, 20px);
}

body.beta-theme {
    --md-sys-color-primary: #7a5800;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #ffdea6;
    --md-sys-color-on-primary-container: #261900;
    --md-sys-color-secondary: #6b5d3f;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #f2e1bc;
    --md-sys-color-on-secondary-container: #241a04;
    --md-sys-color-tertiary: #006875;
    --md-sys-color-on-tertiary: #ffffff;
    --md-sys-color-tertiary-container: #9eeffd;
    --md-sys-color-on-tertiary-container: #001f25;
    --md-sys-color-surface: #fff8f2;
    --md-sys-color-surface-container: #f8eee4;
    --md-sys-color-surface-container-high: #f3e8de;
    --md-sys-color-surface-container-highest: #ede2d8;
    --md-sys-color-outline: #837465;
    --md-sys-color-outline-variant: #d4c4b4;
    --md-sys-color-on-surface: #231a12;
    --md-sys-color-on-surface-variant: #544539;
    --bg-accent-1: #ffe8c3;
    --bg-accent-2: #cdefff;
    --hero-grad-1: #7a5800;
    --hero-grad-2: #a16f00;
    --hero-grad-3: #d49a2c;
    --primary-hover: #5f4300;
    --batch-card-bg: #ffe6bf;
    --batch-card-text: #3f2b05;
    --batch-card-icon: #7a5800;
    --sync-card-bg: #ffe3b0;
    --sync-card-text: #3b2a08;
    --sync-card-icon: #7a5800;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    width: 100%;
    padding: var(--grid-gap);
    background:
        radial-gradient(1400px 500px at 10% -10%, var(--bg-accent-1) 0%, transparent 65%),
        radial-gradient(1200px 380px at 90% 0%, var(--bg-accent-2) 0%, transparent 60%),
        var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow-x: hidden;
}

.bento-container {
    width: min(1240px, 100%);
    min-height: calc(100vh - (var(--grid-gap) * 2));
    display: grid;
    gap: var(--grid-gap);
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(170px, 1fr));
    grid-template-areas:
        "hero hero ai platform"
        "hero hero glossary batch"
        "download download log log";
}

.card {
    background: color-mix(in oklab, var(--md-sys-color-surface-container) 80%, white 20%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-elevation-1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    padding: clamp(16px, 2vmin, 24px);
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
    animation: card-enter 380ms ease both;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--md-elevation-2);
}

.card h3 {
    font-size: clamp(18px, 2.4vmin, 24px);
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--md-sys-color-on-surface);
}

.card p {
    font-size: clamp(13px, 1.6vmin, 16px);
    line-height: 1.45;
    color: var(--md-sys-color-on-surface-variant);
}

.icon {
    width: clamp(30px, 4.8vmin, 52px);
    height: clamp(30px, 4.8vmin, 52px);
    margin-bottom: 10px;
    color: var(--md-sys-color-primary);
}

.icon-img {
    object-fit: contain;
}

.hero-card {
    background: linear-gradient(160deg, var(--hero-grad-1) 0%, var(--hero-grad-2) 48%, var(--hero-grad-3) 100%);
    border: none;
    color: var(--md-sys-color-on-primary);
    align-items: flex-start;
    text-align: left;
    justify-content: space-between;
    padding: clamp(20px, 3.4vmin, 42px);
    box-shadow: var(--md-elevation-3);
}

.hero-top {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.hero-card::after {
    content: "";
    position: absolute;
    right: -64px;
    bottom: -64px;
    width: 210px;
    height: 210px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.hero-logo {
    width: clamp(72px, 28%, 180px);
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    margin-bottom: 0;
    background-color: #ffffff;
    object-fit: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: clamp(28px, 4.8vmin, 56px);
    line-height: 1.1;
    margin: 10px 0;
    font-weight: 800;
}

.hero-content .subtitle {
    font-size: clamp(12px, 1.7vmin, 18px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.88;
}

.hero-content p {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(14px, 1.9vmin, 22px);
}

.ai-card {
    background: color-mix(in oklab, var(--md-sys-color-secondary-container) 70%, #ffffff 30%);
}

.glossary-card {
    background: color-mix(in oklab, var(--md-sys-color-primary-container) 62%, #ffffff 38%);
}

.batch-card {
    background: color-mix(in oklab, var(--batch-card-bg) 78%, #ffffff 22%);
    border-color: color-mix(in oklab, var(--batch-card-icon) 34%, var(--md-sys-color-outline-variant));
}

.batch-card .icon {
    color: var(--batch-card-icon);
}

.batch-card h3 {
    color: var(--batch-card-text);
}

.batch-card p {
    color: color-mix(in oklab, var(--batch-card-text) 70%, black 30%);
}

.cloud-sync-card {
    background: color-mix(in oklab, var(--sync-card-bg) 78%, #ffffff 22%);
    border-color: color-mix(in oklab, var(--sync-card-icon) 35%, var(--md-sys-color-outline-variant));
}

.cloud-sync-card .icon {
    color: var(--sync-card-icon);
}

.cloud-sync-card h3 {
    color: var(--sync-card-text);
}

.cloud-sync-card p {
    color: color-mix(in oklab, var(--sync-card-text) 70%, black 30%);
}

.download-card {
    background: color-mix(in oklab, var(--md-sys-color-surface-container-high) 72%, #ffffff 28%);
    border: 1px solid var(--md-sys-color-outline-variant);
    flex-direction: row;
    justify-content: stretch;
    gap: 18px;
    padding-inline: clamp(16px, 3.2vmin, 40px);
}

.download-panel {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    text-align: left;
    gap: 18px;
    padding: clamp(14px, 1.6vmin, 20px);
    border-radius: var(--radius-lg);
    background: color-mix(in oklab, var(--md-sys-color-surface) 72%, white 28%);
    border: 1px solid color-mix(in oklab, var(--md-sys-color-outline-variant) 78%, white 22%);
}

.beta-download-panel {
    background: color-mix(in oklab, var(--md-sys-color-secondary-container) 42%, white 58%);
}

.dl-text {
    text-align: left;
}

.dl-text p {
    margin-top: 8px;
}

.download-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: clamp(11px, 1.3vmin, 13px);
    font-weight: 700;
    margin-bottom: 8px;
}

.download-card h2 {
    font-size: clamp(22px, 3.1vmin, 36px);
    line-height: 1.15;
    color: var(--md-sys-color-on-surface);
}

.btn-download {
    appearance: none;
    border: none;
    border-radius: 999px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: clamp(11px, 1.5vmin, 15px) clamp(18px, 2.7vmin, 30px);
    font-size: clamp(14px, 1.9vmin, 19px);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--md-elevation-1);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
    white-space: nowrap;
}

.btn-download:hover {
    background: var(--primary-hover);
    box-shadow: var(--md-elevation-2);
}

.btn-download:active {
    transform: scale(0.98);
}

.btn-download:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    box-shadow: none;
    transform: none;
}

.btn-download:disabled:hover {
    background: var(--md-sys-color-primary);
    box-shadow: none;
}

.btn-download svg {
    width: clamp(16px, 2.2vmin, 24px);
    height: clamp(16px, 2.2vmin, 24px);
    fill: currentColor;
}

.btn-icon {
    width: clamp(16px, 2.2vmin, 24px);
    height: clamp(16px, 2.2vmin, 24px);
    object-fit: contain;
}

.btn-download-secondary {
    background: color-mix(in oklab, var(--md-sys-color-secondary-container) 70%, white 30%);
    color: var(--md-sys-color-on-secondary-container);
}

.btn-download-secondary:hover {
    background: color-mix(in oklab, var(--md-sys-color-secondary-container) 84%, white 16%);
}

.btn-download-secondary:disabled:hover {
    background: color-mix(in oklab, var(--md-sys-color-secondary-container) 70%, white 30%);
}

.log-card {
    align-items: flex-start;
    text-align: left;
    justify-content: flex-start;
}

.log-list {
    margin-top: 10px;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 3px;
}

.log-list::-webkit-scrollbar {
    width: 8px;
}

.log-list::-webkit-scrollbar-thumb {
    background: color-mix(in oklab, var(--md-sys-color-outline) 44%, transparent);
    border-radius: 999px;
}

.log-item {
    font-size: clamp(12px, 1.4vmin, 14px);
    color: var(--md-sys-color-on-surface-variant);
    border-bottom: 1px solid color-mix(in oklab, var(--md-sys-color-outline-variant) 70%, transparent);
    padding: 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 980px), (max-aspect-ratio: 1/1) {
    body {
        align-items: flex-start;
    }

    .bento-container {
        min-height: auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(6, minmax(128px, auto));
        grid-template-areas:
            "hero hero"
            "hero hero"
            "download download"
            "ai platform"
            "glossary batch"
            "log log";
    }

    .card {
        border-radius: var(--radius-lg);
    }

    .hero-logo {
        width: clamp(82px, 32%, 170px);
    }

    .download-card {
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: stretch;
    }

    .download-actions {
        justify-content: flex-start;
    }

    .download-panel {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .bento-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "hero"
            "download"
            "ai"
            "platform"
            "glossary"
            "batch"
            "log";
    }

    .card {
        min-height: 132px;
        border-radius: var(--radius-md);
    }

    .hero-card {
        min-height: 280px;
    }

    .hero-top {
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-logo {
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    .download-card {
        align-items: flex-start;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
    }

    .download-actions {
        width: 100%;
    }

    .log-card {
        min-height: 260px;
    }
}
