:root {
    --bg: #f4f7f8;
    --surface: #ffffff;
    --surface-soft: #f8fbfb;
    --surface-strong: #e8f6f3;
    --text: #17313a;
    --muted: #60727a;
    --border: #d8e5e3;
    --primary: #0070ff;
    --primary-strong: #0057c7;
    --primary-soft: #e6f1ff;
    --accent: #f29f5c;
    --accent-soft: #fff1e4;
    --danger: #d45656;
    --danger-soft: #fdecec;
    --warning: #efb950;
    --warning-soft: #fff6dd;
    --success: #2f9a68;
    --success-soft: #eaf8f0;
    --info: #4d89c7;
    --info-soft: #ebf4ff;
    --shadow: 0 18px 50px rgba(25, 64, 72, 0.08);
    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --container-width: 1280px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(0, 112, 255, 0.14), transparent 30%),
        radial-gradient(circle at top right, rgba(242, 159, 92, 0.14), transparent 28%),
        linear-gradient(180deg, #f7fbfc 0%, #eef4f4 100%);
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-strong);
}

img {
    max-width: 100%;
    height: auto;
}

.container,
.content-container,
.download-container,
.upload-container,
.form-container {
    width: min(calc(100% - 2rem), var(--container-width));
    margin: 0 auto;
}

.content-container,
.download-container,
.upload-container,
.form-container {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(216, 229, 227, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}

.content-container,
.download-container,
.upload-container {
    padding: 2rem;
}

.form-container {
    max-width: 520px;
    padding: 2rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.row > * {
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.col {
    flex: 1 0 0%;
}

.col-md-4,
.col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.align-items-center {
    align-items: center;
}

.me-auto {
    margin-right: auto;
}

.me-2 {
    margin-right: 0.5rem;
}

.me-3 {
    margin-right: 1rem;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 2rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 2rem;
}

.py-3 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.px-5 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.text-center {
    text-align: center;
}

.text-muted,
.form-text,
.navbar-text {
    color: var(--muted);
}

.text-white {
    color: #fff;
}

.mb-lg-0 {
    margin-bottom: 0.5rem;
}

.text-danger {
    color: var(--danger);
}

.lead {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--muted);
}

.display-4 {
    margin: 0;
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    line-height: 1.1;
    font-weight: 700;
}

.page-title,
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    color: var(--text);
    line-height: 1.3;
}

.page-title {
    font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0057c7 0%, #0070ff 55%, #5aa7ff 100%);
    color: #fff;
    padding: 3.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 55px rgba(0, 112, 255, 0.22);
    margin-bottom: 2rem;
}

.hero-section::before,
.hero-section::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}

.hero-section::before {
    width: 220px;
    height: 220px;
    top: -60px;
    right: -40px;
}

.hero-section::after {
    width: 150px;
    height: 150px;
    bottom: -45px;
    left: -35px;
}

.hero-section .lead {
    color: rgba(255, 255, 255, 0.92);
}

.card {
    background: linear-gradient(180deg, #ffffff 0%, #fbfefe 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 28px rgba(31, 70, 77, 0.06);
    overflow: hidden;
}

.card-body,
.card-header,
.card-footer {
    padding: 1.25rem;
}

.card-header {
    background: linear-gradient(180deg, #f8fcfc 0%, #eff8f7 100%);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.card-footer {
    background: #fbfdfd;
    border-top: 1px solid var(--border);
}

.feature-card,
.ringtone-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover,
.ringtone-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(31, 70, 77, 0.12);
}

.feature-icon,
.download-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: 1rem;
    border-radius: 1.4rem;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 2rem;
}

.stats-section,
.system-req {
    background: linear-gradient(180deg, #f8fdfc 0%, #eef6f5 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--muted);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    margin: 1.25rem auto 1.5rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(216, 229, 227, 0.9);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 30px rgba(31, 70, 77, 0.08);
}

.navbar > .container-fluid {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-width: 0;
}

.navbar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-toggler {
    display: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.navbar-toggler-icon,
.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
    content: "";
}

.navbar-toggler-icon::before {
    transform: translateY(-6px);
}

.navbar-toggler-icon::after {
    transform: translateY(4px);
}

.navbar-collapse {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
}

.navbar-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.2rem;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.4rem 0.72rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.navbar .d-flex {
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.navbar-text {
    white-space: nowrap;
    font-size: 0.95rem;
}

.navbar .btn.btn-sm {
    min-height: 38px;
    padding: 0.55rem 0.9rem;
}

.nav-link:hover,
.nav-link.is-active {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.btn,
button,
input[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover,
button:hover,
input[type="submit"]:hover {
    transform: translateY(-1px);
}

.btn:disabled,
button:disabled,
input[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary,
.btn-success {
    background: linear-gradient(135deg, var(--primary) 0%, #3d92ff 100%);
    color: #fff;
    box-shadow: 0 12px 24px rgba(0, 112, 255, 0.2);
}

.btn-light {
    background: rgba(255, 255, 255, 0.96);
    color: var(--primary-strong);
    border-color: rgba(255, 255, 255, 0.8);
}

.btn-outline-light {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.74);
    color: #fff;
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-secondary,
.btn-outline-danger,
.btn-outline-warning {
    background: var(--surface);
    border-color: var(--border);
}

.btn-outline-primary {
    color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-success:hover {
    background: var(--primary-soft);
    border-color: rgba(0, 112, 255, 0.35);
}

.btn-outline-secondary {
    color: var(--muted);
}

.btn-outline-secondary:hover {
    background: #f0f5f5;
}

.btn-outline-danger {
    color: var(--danger);
}

.btn-outline-danger:hover,
.btn-danger {
    background: var(--danger-soft);
    border-color: rgba(212, 86, 86, 0.3);
    color: var(--danger);
}

.btn-outline-warning,
.btn-warning {
    color: #8b6500;
    background: var(--warning-soft);
    border-color: rgba(239, 185, 80, 0.38);
}

.btn-lg {
    min-height: 52px;
    padding: 0.85rem 1.35rem;
    font-size: 1rem;
}

.btn-sm {
    min-height: 36px;
    padding: 0.45rem 0.85rem;
    font-size: 0.92rem;
}

.btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-group .btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.65rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
}

.bg-info {
    background: var(--info-soft);
    color: var(--info);
}

.bg-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.bg-success {
    background: var(--success-soft);
    color: var(--success);
}

.bg-warning {
    background: var(--warning-soft);
    color: #7d610e;
}

.text-dark {
    color: #7d610e;
}

.bg-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #3d92ff 100%);
    color: #fff;
}

.bg-light,
.table-striped tbody tr:nth-child(even) {
    background: #f7fbfb;
}

.bg-dark {
    background: #18343a;
}

.alert {
    position: relative;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    margin-bottom: 1rem;
}

.alert-success {
    background: var(--success-soft);
    border-color: rgba(47, 154, 104, 0.25);
    color: #236f4a;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: rgba(212, 86, 86, 0.25);
    color: #944646;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: rgba(239, 185, 80, 0.25);
    color: #7d610e;
}

.alert-info {
    background: var(--info-soft);
    border-color: rgba(77, 137, 199, 0.25);
    color: #355f8b;
}

.alert-dismissible {
    padding-right: 3rem;
}

.btn-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    width: 1.8rem;
    height: 1.8rem;
    min-height: 1.8rem;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    border: 0;
}

.btn-close::before {
    content: "\00d7";
    font-size: 1.3rem;
    line-height: 1;
}

.form-label {
    display: inline-block;
    margin-bottom: 0.45rem;
    font-weight: 600;
}

.form-control,
.form-select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 16px;
    padding: 0.8rem 0.95rem;
    font: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(0, 112, 255, 0.45);
    box-shadow: 0 0 0 4px rgba(0, 112, 255, 0.12);
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.form-check-input {
    margin-top: 0.25rem;
}

.form-check-label {
    color: var(--muted);
}

.input-group {
    display: flex;
    gap: 0.75rem;
}

.input-group .form-control {
    flex: 1 1 auto;
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.95rem 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table thead th {
    background: #f2f8f8;
    font-weight: 700;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
}

.page-item {
    list-style: none;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
}

.page-item.active .page-link,
.page-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: rgba(0, 112, 255, 0.3);
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
}

.current-sort {
    color: var(--primary);
    font-weight: 700;
}

.list-group {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.list-group-item {
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.list-group-item:last-child {
    border-bottom: 0;
}

.release-notes {
    max-height: 300px;
    overflow-y: auto;
    background: #f7fbfb;
    padding: 1rem;
    border-radius: 14px;
    line-height: 1.7;
}

.download-count {
    margin-top: 0.8rem;
    color: var(--muted);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.badge-admin {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e9f1f2;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.site-dialog {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(18, 36, 40, 0.58);
    z-index: 9999;
}

.site-dialog.is-open {
    display: flex;
}

.site-dialog-card {
    width: min(100%, 420px);
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 24px 50px rgba(18, 36, 40, 0.2);
    text-align: center;
}

.site-dialog-card img {
    border-radius: 18px;
}

.site-dialog-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    font-style: normal;
    line-height: 1;
}

.bi::before {
    content: "";
}

.bi-download::before,
.bi-cloud-download::before {
    content: "\2193";
}

.bi-music-note::before {
    content: "\266A";
}

.bi-music-note-list::before {
    content: "\2630";
}

.bi-upload::before {
    content: "\2191";
}

.bi-calendar::before {
    content: "\25F7";
}

.bi-heart-fill::before,
.bi-heart::before {
    content: "\2665";
}

.bi-search::before {
    content: "\2315";
}

.bi-hourglass-split::before {
    content: "\231B";
}

.bi-info-circle::before {
    content: "\2139";
}

.bi-exclamation-triangle::before {
    content: "\26A0";
}

.bi-wechat::before {
    content: "\263A";
}

.bi-arrow-left::before {
    content: "\2190";
}

.bi-check-circle::before {
    content: "\2713";
}

.bi-x-circle::before {
    content: "\2715";
}

.bi-trash::before {
    content: "\232B";
}

footer {
    margin-top: 2rem;
}

footer a {
    color: #ffd58a;
}

audio {
    width: 100%;
}

@media (max-width: 991px) {
    .navbar > .container-fluid {
        flex-wrap: wrap;
    }

    .navbar-toggler {
        display: inline-flex;
        margin-left: auto;
    }

    .navbar-collapse {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 0.5rem;
    }

    .navbar-collapse.is-open {
        display: flex;
    }

    .navbar-nav {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .d-flex {
        flex-wrap: wrap;
    }

    .input-group {
        flex-direction: column;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 992px) {
    .mb-lg-0 {
        margin-bottom: 0;
    }

    .navbar {
        padding: 0.9rem 1.1rem;
    }
}

@media (max-width: 767px) {
    body {
        padding-bottom: 2rem;
    }

    .content-container,
    .download-container,
    .upload-container,
    .form-container {
        width: min(calc(100% - 1rem), var(--container-width));
        padding: 1.25rem;
        border-radius: 22px;
    }

    .hero-section {
        padding: 2.5rem 1.25rem;
    }
}
