:root {
    --zmath-primary: #5F86A6;
    --zmath-text: #2E333A;
    --zmath-accent: #8FB6D8;
    --zmath-bg: #EDF4FA;
    --zmath-line: #CFE3F1;
    --zmath-white: #ffffff;
    --zmath-muted: #6b7785;
    --zmath-danger: #d45555;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body.zmath-body {
    min-height: 100%;
}

body.zmath-body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--zmath-text);
    background: var(--zmath-bg);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.zmath-main {
    flex: 1;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 20px 24px;
}

.zmath-header {
    background: var(--zmath-white);
    border-bottom: 1px solid var(--zmath-line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.zmath-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.zmath-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--zmath-text);
    font-weight: 600;
    font-size: 16px;
}

.zmath-brand img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
    border-radius: 8px;
}

.zmath-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.zmath-user {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--zmath-text);
    font-size: 14px;
}

.zmath-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--zmath-line);
}

.zmath-logout,
.zmath-login-link {
    font-size: 14px;
    color: var(--zmath-primary);
    text-decoration: none;
    cursor: pointer;
}

.zmath-footer {
    background: var(--zmath-white);
    border-top: 1px solid var(--zmath-line);
    padding: 20px 20px;
    text-align: center;
}

.zmath-footer-inner {
    max-width: 720px;
    margin: 0 auto;
}

.zmath-footer h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--zmath-primary);
    margin-bottom: 12px;
}

.zmath-footer p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--zmath-muted);
}

.zmath-icp {
    display: inline-block;
    margin-top: 16px;
    font-size: 12px;
    color: var(--zmath-muted);
    text-decoration: none;
}

.zmath-page-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.zmath-empty {
    background: var(--zmath-white);
    border: 1px solid var(--zmath-line);
    border-radius: 12px;
    padding: 48px 20px;
    text-align: center;
    color: var(--zmath-muted);
}

.zmath-course-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.zmath-course-card {
    display: flex;
    gap: 16px;
    background: var(--zmath-white);
    border: 1px solid var(--zmath-line);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
}

.zmath-course-cover {
    width: 180px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--zmath-line);
}

.zmath-course-cover img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.zmath-course-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.zmath-course-name {
    font-size: 18px;
    font-weight: 600;
}

.zmath-course-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--zmath-muted);
}

.zmath-tag {
    background: var(--zmath-bg);
    color: var(--zmath-primary);
    border-radius: 4px;
    padding: 2px 8px;
}

.zmath-course-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.zmath-progress {
    flex: 1;
    min-width: 140px;
    height: 8px;
    background: var(--zmath-line);
    border-radius: 4px;
    overflow: hidden;
}

.zmath-progress span {
    display: block;
    height: 100%;
    background: var(--zmath-primary);
}

.zmath-course-action {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--zmath-muted);
}

.zmath-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    background: var(--zmath-primary);
    color: var(--zmath-white);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.zmath-btn:hover { background: #4e7391; }

.zmath-pager {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.zmath-pager a,
.zmath-pager span {
    padding: 10px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--zmath-line);
    background: var(--zmath-white);
    color: var(--zmath-text);
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
}

.zmath-pager .is-active {
    background: var(--zmath-primary);
    border-color: var(--zmath-primary);
    color: #fff;
}

.zmath-card {
    background: var(--zmath-white);
    border: 1px solid var(--zmath-line);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.zmath-card h2 {
    font-size: 18px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--zmath-line);
}

.zmath-field {
    margin-bottom: 16px;
}

.zmath-field label {
    display: block;
    font-size: 13px;
    color: var(--zmath-muted);
    margin-bottom: 6px;
}

.zmath-field input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--zmath-line);
    border-radius: 8px;
    background: var(--zmath-bg);
    padding: 0 12px;
    font-size: 15px;
    color: var(--zmath-text);
    font-family: inherit;
}

.zmath-field input:focus {
    outline: none;
    border-color: var(--zmath-primary);
    background: #fff;
}

.zmath-select {
    position: relative;
}

.zmath-select-trigger {
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--zmath-line);
    border-radius: 8px;
    background: var(--zmath-bg);
    padding: 0 12px;
    font-size: 15px;
    color: var(--zmath-text);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
}

.zmath-select-trigger:hover {
    border-color: var(--zmath-accent);
}

.zmath-select.is-open .zmath-select-trigger,
.zmath-select-trigger:focus {
    outline: none;
    border-color: var(--zmath-primary);
    background: #fff;
}

.zmath-select-value {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zmath-select-value.is-placeholder {
    color: var(--zmath-muted);
}

.zmath-select-chevron {
    width: 18px;
    height: 18px;
    color: var(--zmath-muted);
    flex-shrink: 0;
    transition: transform 0.18s ease;
}

.zmath-select.is-open .zmath-select-chevron {
    transform: rotate(180deg);
    color: var(--zmath-primary);
}

.zmath-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow: auto;
    background: var(--zmath-white);
    border: 1px solid var(--zmath-line);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(46, 51, 58, 0.12);
    z-index: 30;
    padding: 8px;
}

.zmath-select-group + .zmath-select-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--zmath-line);
}

.zmath-select-group-title {
    padding: 6px 10px 4px;
    font-size: 12px;
    color: var(--zmath-muted);
    letter-spacing: 0.02em;
}

.zmath-select-option {
    width: 100%;
    display: block;
    border: none;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--zmath-text);
    font-family: inherit;
    cursor: pointer;
}

.zmath-select-option:hover {
    background: var(--zmath-bg);
    color: var(--zmath-primary);
}

.zmath-select-option.is-active {
    background: #E4EEF6;
    color: var(--zmath-primary);
    font-weight: 600;
}

.zmath-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: rgba(46, 51, 58, 0.92);
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.zmath-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.zmath-toast.is-error { background: var(--zmath-danger); }

.zmath-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    color: var(--zmath-primary);
    text-decoration: none;
    font-size: 14px;
}

.zmath-back svg {
    width: 18px;
    height: 18px;
}

.zmath-back:hover {
    color: #4e7391;
}

.zmath-terms h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.zmath-terms-meta {
    font-size: 13px;
    color: var(--zmath-muted);
    margin-bottom: 20px;
}

.zmath-terms h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 10px;
    padding-bottom: 0;
    border-bottom: none;
}

.zmath-terms p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--zmath-text);
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .zmath-header-inner { height: 56px; }
    .zmath-brand span { font-size: 15px; }
    .zmath-user span:first-child { display: none; }
    .zmath-user span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .zmath-course-card { flex-direction: column; }
    .zmath-course-cover { width: 100%; }
    .zmath-course-cover img { height: 160px; }
    .zmath-main { padding: 16px 12px 24px; }
}
