:root {
    --bg: #f5f7fb;
    --text: #142033;
    --muted: #64748b;
    --blue: #2563eb;
    --purple: #7c3aed;
    --card: #ffffff;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.topbar {
    height: 72px;
    padding: 0 32px;
    background: #111827;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    color: white;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand span {
    font-size: 24px;
}

.brand small {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

nav a {
    color: white;
    text-decoration: none;
    margin-left: 22px;
    font-weight: 700;
    opacity: 0.86;
}

main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 28px;
}

.hero {
    min-height: 430px;
    border-radius: 30px;
    padding: 46px;
    color: white;
    background: radial-gradient(circle at top left, #60a5fa, transparent 35%),
                linear-gradient(135deg, var(--blue), var(--purple));
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 32px;
    align-items: center;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.25);
}

.eyebrow {
    font-size: 14px;
    text-transform: uppercase;
    opacity: 0.8;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.hero h1 {
    font-size: 52px;
    margin: 12px 0 18px;
    line-height: 1.05;
}

.hero p {
    font-size: 19px;
    line-height: 1.6;
    opacity: 0.94;
}

.hero-actions {
    margin-top: 28px;
    display: flex;
    gap: 14px;
}

.primary-btn,
.secondary-btn {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
}

.primary-btn {
    background: white;
    color: var(--blue);
}

.secondary-btn {
    background: rgba(255,255,255,0.14);
    color: white;
    border: 1px solid rgba(255,255,255,0.35);
}

.hero-card {
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.25);
    backdrop-filter: blur(12px);
    border-radius: 22px;
    padding: 26px;
}

.hero-card h3 {
    margin-top: 0;
    font-size: 26px;
}

.hero-card li {
    margin: 10px 0;
}

.section {
    margin-top: 34px;
}

.section h1,
.section h2 {
    margin: 0 0 8px;
    font-size: 34px;
}

.section-subtitle {
    color: var(--muted);
    margin-bottom: 22px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.module-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
}

.module-tag {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 12px;
    font-weight: 900;
}

.module-card h3 {
    margin: 14px 0 4px;
    font-size: 23px;
}

.module-zh {
    color: var(--muted);
    font-weight: 800;
}

.module-card p {
    color: var(--muted);
    line-height: 1.55;
}

.practice-panel {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.practice-panel h1 {
    margin: 14px 0 4px;
}

.practice-panel h2 {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 22px;
}

.placeholder-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    padding: 20px;
    margin: 24px 0;
}

footer {
    max-width: 1180px;
    margin: 20px auto 40px;
    padding: 0 28px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 32px;
    }

    .hero h1 {
        font-size: 38px;
    }

    .topbar {
        padding: 0 18px;
    }

    nav a {
        margin-left: 12px;
    }
}

/* ================================
   Mobile UI Optimization
   Target: phones and small tablets
   ================================ */

@media (max-width: 768px) {
    body {
        background: #f7f8fc;
    }

    .topbar {
        height: auto;
        min-height: 64px;
        padding: 14px 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .brand span {
        font-size: 22px;
    }

    .brand small {
        font-size: 11px;
    }

    nav {
        width: 100%;
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    nav a {
        margin-left: 0;
        white-space: nowrap;
        font-size: 14px;
        padding: 8px 10px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.1);
    }

    main {
        padding: 18px 14px;
    }

    .hero {
        min-height: auto;
        grid-template-columns: 1fr;
        padding: 28px 20px;
        border-radius: 22px;
        gap: 22px;
    }

    .eyebrow {
        font-size: 11px;
        letter-spacing: 0.08em;
    }

    .hero h1 {
        font-size: 34px;
        line-height: 1.08;
        margin: 10px 0 14px;
    }

    .hero p {
        font-size: 16px;
        line-height: 1.55;
    }

    .hero-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 22px;
    }

    .primary-btn,
    .secondary-btn {
        width: 100%;
        text-align: center;
        padding: 13px 16px;
        border-radius: 14px;
        font-size: 15px;
    }

    .hero-card {
        padding: 20px;
        border-radius: 18px;
    }

    .hero-card h3 {
        font-size: 22px;
    }

    .hero-card ul {
        padding-left: 20px;
        margin-bottom: 0;
    }

    .hero-card li {
        font-size: 14px;
        line-height: 1.45;
    }

    .section {
        margin-top: 24px;
    }

    .section h1,
    .section h2 {
        font-size: 28px;
        line-height: 1.15;
    }

    .section-subtitle {
        font-size: 15px;
        line-height: 1.5;
        margin-bottom: 18px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .module-card {
        border-radius: 18px;
        padding: 20px;
        box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    }

    .module-card:hover {
        transform: none;
    }

    .module-tag {
        font-size: 11px;
        padding: 5px 8px;
    }

    .module-card h3 {
        font-size: 21px;
        margin-top: 12px;
    }

    .module-zh {
        font-size: 15px;
    }

    .module-card p {
        font-size: 15px;
        line-height: 1.5;
    }

    .practice-panel {
        border-radius: 20px;
        padding: 22px;
    }

    .practice-panel h1 {
        font-size: 28px;
    }

    .practice-panel h2 {
        font-size: 19px;
    }

    .placeholder-box {
        padding: 18px;
        border-radius: 14px;
    }

    footer {
        margin: 12px auto 28px;
        padding: 0 16px;
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
        text-align: center;
    }
}

/* Extra-small phones */
@media (max-width: 420px) {
    .topbar {
        padding: 12px 14px;
    }

    main {
        padding: 14px 10px;
    }

    .hero {
        padding: 24px 18px;
        border-radius: 20px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .hero p {
        font-size: 15px;
    }

    .hero-card {
        padding: 18px;
    }

    .section h1,
    .section h2 {
        font-size: 25px;
    }

    .module-card {
        padding: 18px;
    }

    .module-card h3 {
        font-size: 20px;
    }

    .practice-panel {
        padding: 20px;
    }
}

.sentence-builder-app h3 {
    margin-top: 24px;
    margin-bottom: 10px;
}

.sb-toolbar {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 18px 0;
    flex-wrap: wrap;
}

.sb-toolbar select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
}

.small-btn,
.primary-action,
.secondary-action {
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 800;
    cursor: pointer;
}

.small-btn {
    background: #eef2ff;
    color: #4338ca;
}

.sb-prompt {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    font-weight: 700;
    color: #334155;
}

.chunk-zone {
    min-height: 76px;
    padding: 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.answer-zone {
    background: #eef2ff;
    border-color: #818cf8;
}

.chunk {
    border: 1px solid #cbd5e1;
    background: white;
    color: #172033;
    border-radius: 999px;
    padding: 10px 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.chunk:hover {
    transform: translateY(-1px);
}

.sb-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.primary-action {
    background: #2563eb;
    color: white;
}

.secondary-action {
    background: #e5e7eb;
    color: #111827;
}

.result-box {
    margin-top: 22px;
    border-radius: 18px;
    padding: 18px;
    line-height: 1.55;
}

.result-box.correct {
    background: #ecfdf5;
    border: 1px solid #86efac;
}

.result-box.incorrect {
    background: #fff7ed;
    border: 1px solid #fdba74;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .chunk-zone {
        min-height: 96px;
        align-items: flex-start;
    }

    .chunk {
        width: 100%;
        border-radius: 14px;
        text-align: left;
    }

    .sb-actions {
        flex-direction: column;
    }

    .primary-action,
    .secondary-action,
    .small-btn {
        width: 100%;
    }
}

.auth-panel {
    max-width: 560px;
    margin: 0 auto;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.auth-form label {
    font-weight: 800;
    color: #334155;
}

.auth-form input,
.auth-form select {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
    background: white;
}

.auth-message {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.auth-message.success {
    background: #ecfdf5;
    border: 1px solid #86efac;
    color: #166534;
}

.auth-message.error {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.auth-note {
    margin-top: 20px;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .auth-panel {
        margin: 0;
    }

    .auth-form input,
    .auth-form select,
    .auth-form button {
        width: 100%;
    }
}

.projection-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.projection-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.projection-header h2 {
    margin: 6px 0 4px;
    color: #172033;
}

.projection-status {
    color: #64748b;
    font-weight: 700;
    margin: 0;
}

.projection-overall {
    text-align: right;
    background: #eef2ff;
    border-radius: 18px;
    padding: 16px 18px;
    min-width: 220px;
}

.projection-overall span {
    display: block;
    font-size: 1.3rem;
    font-weight: 900;
    color: #1e3a8a;
}

.projection-overall small {
    color: #475569;
    font-weight: 700;
}

.projection-legacy,
.projection-message,
.projection-coverage {
    color: #334155;
    line-height: 1.55;
}

.projection-message {
    background: #f8fafc;
    border-left: 4px solid #818cf8;
    border-radius: 12px;
    padding: 12px 14px;
}

.projection-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.projection-section-row {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 14px;
    background: #f8fafc;
}

.projection-section-row > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #172033;
    margin-bottom: 10px;
}

.coverage-bar-wrap {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.coverage-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 999px;
}

.projection-section-row small {
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 768px) {
    .projection-header {
        flex-direction: column;
    }

    .projection-overall {
        width: 100%;
        text-align: left;
    }

    .projection-sections {
        grid-template-columns: 1fr;
    }
}

.visual-engagement {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 14px 18px;
    margin: 18px 0 22px;
}

.streak-display,
.credit-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-icons {
    font-size: 1.55rem;
    letter-spacing: 2px;
    line-height: 1;
}

.streak-icons.broken {
    margin-left: 6px;
}

.coin-icon {
    font-size: 1.55rem;
}

.credit-number {
    font-size: 1.45rem;
    font-weight: 950;
    color: #172033;
}

.visual-engagement .engagement-label {
    font-size: 0.82rem;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .visual-engagement {
        flex-direction: column;
        align-items: flex-start;
    }

    .streak-icons {
        font-size: 1.35rem;
    }
}

.visual-engagement {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 14px 18px;
    margin: 18px 0 22px;
}

.streak-display,
.credit-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.streak-icons {
    font-size: 1.55rem;
    letter-spacing: 2px;
    line-height: 1;
}

.streak-icons.broken {
    margin-left: 6px;
}

.coin-icon {
    font-size: 1.55rem;
}

.credit-number {
    font-size: 1.45rem;
    font-weight: 950;
    color: #172033;
}

.visual-engagement .engagement-label {
    font-size: 0.82rem;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    .visual-engagement {
        flex-direction: column;
        align-items: flex-start;
    }

    .streak-icons {
        font-size: 1.35rem;
    }
}

.visual-engagement {
    overflow: hidden;
}

.streak-display {
    flex: 1;
    min-width: 0;
}

.streak-icons {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    max-width: 100%;
}

.streak-icons.broken {
    display: none;
}

.account-nav {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.avatar-menu {
    position: relative;
}

.avatar-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #eef2ff;
    color: #1e3a8a;
    font-weight: 950;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-button:hover {
    background: #dbeafe;
}

.avatar-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 160px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    padding: 8px;
    z-index: 1000;
}

.avatar-dropdown a,
.avatar-dropdown button {
    width: 100%;
    display: block;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: white;
    color: #172033;
    font-weight: 800;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.avatar-dropdown a:hover,
.avatar-dropdown button:hover {
    background: #f1f5f9;
}

.account-box {
    margin-top: 20px;
}

.account-profile {
    display: flex;
    gap: 18px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
}

.account-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 950;
}

.account-login-btn {
    display: inline-block;
    text-decoration: none;
    margin-top: 12px;
}

@media (max-width: 768px) {
    .avatar-dropdown {
        right: auto;
        left: 0;
    }

    .account-profile {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Account navigation and account page */

.account-nav {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.account-cluster {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 900;
}

.avatar-menu {
    position: relative;
}

.avatar-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #eef2ff;
    color: #1e3a8a;
    font-weight: 950;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-button:hover {
    background: #dbeafe;
}

.avatar-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 230px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    padding: 10px;
    z-index: 1000;
}

.avatar-dropdown-header {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
}

.avatar-dropdown-header small {
    display: block;
    color: #64748b;
    margin-top: 2px;
}

.avatar-small {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

.avatar-dropdown a,
.avatar-dropdown button {
    width: 100%;
    display: block;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: white;
    color: #172033;
    font-weight: 800;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.avatar-dropdown a:hover,
.avatar-dropdown button:hover {
    background: #f1f5f9;
}

.account-page-header {
    margin-bottom: 22px;
}

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

.account-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
}

.account-card-header h3 {
    margin: 0;
    color: #172033;
}

.account-card-header p {
    margin: 6px 0 16px;
    color: #64748b;
    line-height: 1.5;
}

.account-profile.compact {
    align-items: center;
}

.account-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 950;
    flex: 0 0 auto;
}

.account-profile {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
    color: #334155;
}

.metric-row strong {
    color: #172033;
    text-align: right;
}

.credit-big {
    display: flex;
    align-items: baseline;
    gap: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 12px;
}

.credit-big span {
    font-size: 1.5rem;
}

.credit-big strong {
    font-size: 2rem;
    color: #9a3412;
}

.credit-big small {
    color: #9a3412;
    font-weight: 800;
}

.account-note {
    margin-top: 14px;
    background: #f8fafc;
    border-left: 4px solid #818cf8;
    border-radius: 12px;
    padding: 12px;
    color: #475569;
    line-height: 1.5;
}

.danger-action {
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 900;
    cursor: pointer;
}

.danger-action:hover {
    background: #fecaca;
}

@media (max-width: 768px) {
    .account-grid {
        grid-template-columns: 1fr;
    }

    .avatar-dropdown {
        right: 0;
        min-width: 220px;
    }

    .nav-credit-pill {
        display: none;
    }

    .account-profile {
        flex-direction: column;
    }
}

/* Clean account navigation and account dashboard patch */

.account-nav {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.account-cluster {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    border-radius: 999px;
    padding: 7px 10px;
    font-weight: 900;
}

.avatar-menu {
    position: relative;
}

.avatar-button {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #eef2ff;
    color: #1e3a8a;
    font-weight: 950;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 230px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.16);
    padding: 10px;
    z-index: 1000;
}

.avatar-dropdown-header {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 8px;
}

.avatar-dropdown-header small {
    display: block;
    color: #64748b;
    margin-top: 2px;
}

.avatar-small {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 8px 0;
}

.avatar-dropdown a,
.avatar-dropdown button {
    width: 100%;
    display: block;
    text-align: left;
    padding: 10px 12px;
    border: none;
    background: white;
    color: #172033;
    font-weight: 800;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.avatar-dropdown a:hover,
.avatar-dropdown button:hover {
    background: #f1f5f9;
}

.account-page-header {
    margin-bottom: 22px;
}

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

.account-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    padding: 22px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
}

.account-card-header h3 {
    margin: 0;
    color: #172033;
}

.account-card-header p {
    margin: 6px 0 16px;
    color: #64748b;
    line-height: 1.5;
}

.account-profile {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.account-profile.compact {
    align-items: center;
}

.account-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e3a8a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 950;
    flex: 0 0 auto;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 0;
    color: #334155;
}

.metric-row strong {
    color: #172033;
    text-align: right;
}

.credit-big {
    display: flex;
    align-items: baseline;
    gap: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 12px;
}

.credit-big span {
    font-size: 1.5rem;
}

.credit-big strong {
    font-size: 2rem;
    color: #9a3412;
}

.credit-big small {
    color: #9a3412;
    font-weight: 800;
}

.account-note {
    margin-top: 14px;
    background: #f8fafc;
    border-left: 4px solid #818cf8;
    border-radius: 12px;
    padding: 12px;
    color: #475569;
    line-height: 1.5;
}

.danger-action {
    border: none;
    border-radius: 12px;
    padding: 11px 16px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 900;
    cursor: pointer;
}

.danger-action:hover {
    background: #fecaca;
}

@media (max-width: 768px) {
    .account-grid {
        grid-template-columns: 1fr;
    }

    .nav-credit-pill {
        display: none;
    }

    .account-profile {
        flex-direction: column;
    }
}

.voice-practice-app {
    max-width: 900px;
    margin: 0 auto;
}

.voice-prompt-card {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    margin: 20px 0;
}

.voice-prompt-card strong {
    color: #334155;
}

.voice-prompt-card p {
    margin-bottom: 0;
    font-size: 1.08rem;
    line-height: 1.6;
}

.recording-console {
    border: 1px solid #e5e7eb;
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
    margin-top: 18px;
}

.recording-status {
    font-weight: 900;
    color: #64748b;
    margin-bottom: 10px;
}

.recording-status.recording {
    color: #dc2626;
}

.recording-status.complete {
    color: #166534;
}

.recording-status.error {
    color: #991b1b;
}

.recording-status.uploading {
    color: #1e3a8a;
}

.recording-timer {
    font-size: 3rem;
    font-weight: 950;
    color: #172033;
    letter-spacing: 0.04em;
    margin-bottom: 18px;
}

.recording-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.record-btn,
.stop-btn {
    border: none;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 900;
    cursor: pointer;
}

.record-btn {
    background: #2563eb;
    color: white;
}

.stop-btn {
    background: #fee2e2;
    color: #991b1b;
}

.record-btn:disabled,
.stop-btn:disabled,
.primary-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.recording-note {
    color: #64748b;
    font-size: 0.92rem;
    margin-top: 14px;
    line-height: 1.5;
}

.audio-preview {
    margin-top: 22px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 20px;
    padding: 20px;
}

.audio-preview audio {
    width: 100%;
    margin: 8px 0 16px;
}

.upload-result {
    margin-top: 22px;
    border-radius: 18px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.upload-result.success {
    background: #ecfdf5;
    border-color: #86efac;
}

.upload-result.error {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.upload-result a {
    color: #2563eb;
    font-weight: 800;
}

@media (max-width: 768px) {
    .recording-timer {
        font-size: 2.4rem;
    }

    .recording-actions button {
        width: 100%;
    }
}

.admin-page {
    max-width: 1180px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr));
    gap: 14px;
    margin: 22px 0;
}

.admin-stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.admin-stat-card span {
    display: block;
    color: #64748b;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.admin-stat-card strong {
    font-size: 2rem;
    color: #172033;
}

.admin-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 18px;
}

.admin-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
    overflow-x: auto;
    margin-bottom: 18px;
}

.admin-card h2 {
    margin-top: 0;
    font-size: 1.2rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.admin-table th {
    text-align: left;
    color: #475569;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e5e7eb;
    padding: 10px 8px;
}

.admin-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 10px 8px;
    vertical-align: top;
}

.admin-table a {
    color: #2563eb;
    font-weight: 800;
}

.admin-search {
    display: flex;
    gap: 10px;
    margin: 18px 0;
}

.admin-search input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 1rem;
}

@media (max-width: 900px) {
    .admin-stats-grid,
    .admin-two-column {
        grid-template-columns: 1fr;
    }

    .admin-header {
        flex-direction: column;
    }
}

.admin-login-card {
    max-width: 460px;
    margin: 40px auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08);
}

.admin-login-form {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.admin-login-form label {
    font-weight: 800;
    color: #334155;
}

.admin-login-form input {
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 1rem;
}

.nav-inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.nav-link-button {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.nav-link-button:hover {
    text-decoration: underline;
}

.nav-inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.nav-link-button {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.nav-link-button:hover {
    text-decoration: underline;
}

.nav-inline-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.nav-link-button {
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    padding: 0;
}

.nav-link-button:hover {
    text-decoration: underline;
}

.admin-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.release-note-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.release-note-title {
    margin: 6px 0 10px;
    font-size: 1.45rem;
}

.release-note-summary {
    margin: 0 0 12px;
    color: #334155;
    line-height: 1.6;
}

.release-note-list {
    margin: 0 0 16px;
    padding-left: 20px;
    color: #334155;
    line-height: 1.6;
}

.admin-settings-form {
    display: grid;
    gap: 12px;
    max-width: 420px;
    margin-top: 18px;
}

.admin-settings-form label {
    font-weight: 900;
    color: #334155;
}

.admin-settings-form input {
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 1rem;
}

.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 20px;
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.admin-form label {
  display: block;
  font-weight: 600;
  margin-top: 14px;
  margin-bottom: 6px;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
  width: 100%;
  padding: 9px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.blank-row {
  display: grid;
  grid-template-columns: 1.3fr 0.8fr 0.9fr 0.8fr 0.6fr 1.4fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.help-text {
  color: #6b7280;
  font-size: 0.92rem;
}

.form-actions {
  margin-top: 24px;
}

.word-preview {
  padding: 32px;
}

.test-header {
  border-top: 5px solid #115e59;
  border-bottom: 1px solid #222;
  padding: 8px 0;
  margin-bottom: 26px;
  color: #444;
}

.preview-instruction {
  text-align: center;
  margin: 36px 0 130px;
  font-weight: 500;
}

.preview-passage {
  font-size: 1.15rem;
  line-height: 1.55;
}

.inline-blank {
  display: inline-block;
  min-width: 42px;
  background: #d1d5db;
  padding: 0 6px;
  margin: 0 2px;
  letter-spacing: 1px;
}

.word-completion-page {
  max-width: 1100px;
  margin: 0 auto;
}

.word-completion-card {
  padding: 28px;
}

.wc-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.wc-progress {
  color: #6b7280;
  font-size: 0.95rem;
}

.wc-instructions {
  text-align: center;
  margin: 28px 0 64px;
  font-size: 1.12rem;
}

.wc-passage {
  font-size: 1.16rem;
  line-height: 1.75;
  margin-bottom: 28px;
}

.wc-inline-word {
  display: inline-flex;
  align-items: baseline;
  background: #eef2f7;
  border-radius: 6px;
  padding: 0 4px;
  margin: 0 2px;
}

.wc-prefix,
.wc-suffix {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.wc-blank-input {
  width: auto;
  min-width: 34px;
  max-width: 110px;
  border: none;
  border-bottom: 2px solid #6b7280;
  background: #d1d5db;
  text-align: center;
  margin: 0 2px;
  padding: 2px 4px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.wc-blank-input.correct {
  background: #dcfce7;
  border-bottom-color: #15803d;
}

.wc-blank-input.incorrect {
  background: #fee2e2;
  border-bottom-color: #b91c1c;
}

.wc-feedback {
  margin: 24px 0;
  padding: 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.wc-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

.module-status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.module-status-pill.ready {
    background: #dcfce7;
    color: #166534;
}

.module-status-pill.most_developed {
    background: #dbeafe;
    color: #1d4ed8;
}

.module-status-pill.coming_soon {
    background: #e5e7eb;
    color: #4b5563;
}

.module-card-most_developed {
    border: 2px solid rgba(37, 99, 235, 0.45);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.12);
}

.module-card-disabled {
    opacity: 0.48;
    filter: grayscale(1);
    cursor: not-allowed;
    background: #f3f4f6;
    border-style: dashed;
}

.module-card-disabled:hover {
    transform: none;
    box-shadow: none;
}

.disabled-action {
    color: #6b7280;
    cursor: not-allowed;
    font-weight: 700;
}

/* Module readiness/status styling */
.module-status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    margin-bottom: 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.module-status-pill.ready {
    background: #dcfce7;
    color: #166534;
}

.module-status-pill.most_developed {
    background: #dbeafe;
    color: #1d4ed8;
}

.module-status-pill.coming_soon {
    background: #e5e7eb;
    color: #4b5563;
}

.module-card-most_developed {
    border: 2px solid rgba(37, 99, 235, 0.45);
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.12);
}

.module-card-disabled {
    opacity: 0.48;
    filter: grayscale(1);
    cursor: not-allowed;
    background: #f3f4f6;
    border-style: dashed;
}

.module-card-disabled:hover {
    transform: none;
    box-shadow: none;
}

.disabled-action {
    color: #6b7280;
    cursor: not-allowed;
    font-weight: 700;
}

/* Homepage module card status styling */
.module-chip {
    display: inline-flex;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 14px;
}

.module-zh {
    margin-top: -4px;
    margin-bottom: 18px;
    color: #64748b;
    font-weight: 700;
    font-size: 1rem;
}

.module-card-most_developed {
    border: 2px solid rgba(79, 70, 229, 0.28);
    box-shadow: 0 18px 42px rgba(79, 70, 229, 0.12);
}

.module-card-disabled {
    opacity: 0.46;
    filter: grayscale(1);
    cursor: not-allowed;
    background: #f3f4f6;
    border-style: dashed;
}

.module-card-disabled:hover {
    transform: none;
    box-shadow: none;
}

.module-card-disabled .module-chip {
    background: #e5e7eb;
    color: #6b7280;
}

.module-coming-soon {
    display: inline-flex;
    width: fit-content;
    padding: 4px 10px;
    margin-left: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 0.76rem;
    font-weight: 800;
}

.practice-status-strip {
    margin-top: 20px;
    padding: 14px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    max-width: 1020px;
}

.streak-display,
.credit-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.status-label {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.status-muted {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 700;
}

@media (max-width: 720px) {
    .practice-status-strip {
        border-radius: 18px;
        flex-direction: column;
        align-items: flex-start;
    }
}

.word-completion-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-selector-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 800;
}

.mode-selector {
    min-width: 170px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #111827;
    font-weight: 700;
}

.topic-dashboard-card {
    margin: 20px 0;
    padding: 20px;
    border-radius: 22px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.topic-dashboard-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.recommended-topic-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 16px;
    margin: 12px 0 16px;
    border-radius: 18px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
}

.recommended-topic-card.hidden {
    display: none;
}

.recommended-topic-card h3 {
    margin: 4px 0;
}

.recommended-topic-card p {
    margin: 0;
    color: #475569;
}

.topic-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.topic-filter-pill {
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 7px 12px;
    background: #f8fafc;
    cursor: pointer;
    font-weight: 700;
    color: #334155;
}

.topic-filter-pill.active {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.topic-cloud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-height: 72px;
}

.topic-loading {
    color: #64748b;
    font-weight: 700;
}

.topic-pill {
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    position: relative;
}

.topic-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.10);
}

.topic-pill.selected {
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.14);
}

.topic-pill.recommended {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.topic-name {
    display: block;
    font-weight: 900;
}

.topic-meta {
    display: block;
    font-size: 0.78rem;
    opacity: 0.82;
}

.topic-status-text {
    display: block;
    font-size: 0.72rem;
    margin-top: 2px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topic-size-small {
    font-size: 0.86rem;
}

.topic-size-medium {
    font-size: 1rem;
    padding: 12px 17px;
}

.topic-size-large {
    font-size: 1.13rem;
    padding: 14px 20px;
}

.topic-status-unattempted {
    background: #f8fafc;
}

.topic-status-needs_review {
    background: #fee2e2;
}

.topic-status-developing {
    background: #fef3c7;
}

.topic-status-strong {
    background: #dcfce7;
}

.topic-heat-hot::after {
    content: "🔥";
    position: absolute;
    top: -8px;
    right: 8px;
    font-size: 1rem;
}

.selected-topic-strip {
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: center;
}

@media (max-width: 720px) {
    .topic-dashboard-header,
    .recommended-topic-card {
        flex-direction: column;
        align-items: stretch;
    }
}

.topic-dashboard-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.topic-map-body {
    overflow: hidden;
    transition: max-height 0.22s ease, opacity 0.18s ease, margin-top 0.18s ease;
    max-height: 900px;
    opacity: 1;
}

.topic-map-body.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.word-completion-controls {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

@media (max-width: 720px) {
    .topic-dashboard-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}

.word-completion-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    align-items: stretch;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.metric-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 14px 18px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.metric-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.metric-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-pill strong {
    font-size: 1.12rem;
    letter-spacing: 0.02em;
}

@media (max-width: 900px) {
    .word-completion-metrics {
        grid-template-columns: repe
    }
}

@media (max-width: 560px) {
    .word-completion-metrics {
        grid-template-columns: 1fr;
    }
}

.word-blank-input.answer-key-visible {
    background: #eef2ff;
    border-color: #6366f1;
    color: #111827;
    font-weight: 800;
}

/* TopAce powered footer */
.topace-powered-footer {
  margin-top: 48px;
  padding: 28px 20px 34px;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(248, 250, 252, 0.72);
}

.topace-powered-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #64748b;
  font-size: 0.92rem;
}

.topace-powered-inner a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.topace-powered-inner img {
  height: 24px;
  width: auto;
  display: block;
}

.topace-footer-product {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.45;
  text-align: center;
}

.topace-footer-product div:first-child {
  font-weight: 700;
  color: #334155;
}

.topace-footer-product div:nth-child(2) {
  color: #64748b;
  font-size: 0.9rem;
}

.topace-footer-version {
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 600;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin: 18px 0 20px;
  flex-wrap: wrap;
}

.auth-tab {
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: #ffffff;
  color: #475569;
  border-radius: 999px;
  padding: 9px 15px;
  font-weight: 700;
  cursor: pointer;
}

.auth-tab.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.auth-tab-panel.hidden,
.hidden {
  display: none !important;
}

/* Account navigation */
#accountNav {
  display: inline-flex;
  align-items: center;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  padding: 6px 8px 6px 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.account-avatar {
  font-size: 0.9rem;
  opacity: 0.9;
}

.account-label {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.92rem;
}

.account-logout-button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-weight: 700;
  cursor: pointer;
}

.account-logout-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.account-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.account-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-radius: 999px;
    padding: 6px 10px 6px 7px;
    cursor: pointer;
    font-weight: 700;
    max-width: 220px;
}

.account-chip:hover {
    background: rgba(255, 255, 255, 0.18);
}

.account-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    font-weight: 800;
    flex: 0 0 auto;
}

.account-label {
    max-width: 140px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.account-caret {
    opacity: 0.78;
    font-size: 11px;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 180px;
    background: #ffffff;
    color: #111827;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    padding: 8px;
    z-index: 2000;
}

.account-dropdown.hidden {
    display: none;
}

.account-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    color: #111827;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.account-dropdown-item:hover {
    background: #f3f4f6;
}

.account-dropdown-button {
    font-family: inherit;
}

.account-login-link {
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 18px;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    background: #e5e7eb;
    flex: 1;
}


.profile-shell {
  max-width: 760px;
  margin: 68px auto 84px;
  padding: 0 24px;
}

.profile-card {
  background: #fff;
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

.profile-card h1 {
  margin: 12px 0 10px;
  font-size: 32px;
  color: #172033;
}

.profile-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

.profile-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: #25324a;
}

.profile-form input {
  border: 1px solid #d9e0ec;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
}

.profile-form input:disabled {
  background: #f4f6fb;
  color: #718096;
}

.phone-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
}

.profile-message {
  min-height: 22px;
  color: #52627a;
  font-weight: 700;
}

.profile-message.error {
  color: #dc2626;
}

.profile-message.success {
  color: #16a34a;
}

.profile-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
  text-decoration: none;
  border: 0;
  cursor: pointer;
}

.primary-btn {
  background: #2563eb;
  color: #fff;
}

.secondary-btn {
  background: #eef2ff;
  color: #1d4ed8;
}

@media (max-width: 640px) {
  .phone-row {
    grid-template-columns: 1fr;
  }

  .profile-card {
    padding: 24px;
  }
}

/* Listen & Repeat context visual and mobile layout */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.voice-practice-app {
    width: 100%;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

.voice-prompt-card,
.recording-console,
.audio-preview,
.upload-result {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: hidden;
}

.listen-repeat-visual {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 9;
    margin: 0 0 18px;
    border-radius: 18px;
    overflow: hidden;
    background: #eef4fb;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}

.listen-repeat-visual img,
#contextImage {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    box-sizing: border-box;
}

.prompt-audio-block,
#promptAudio {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.playback-speed-control {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
}

.speed-option {
    min-width: 0;
    min-height: 36px;
    padding: 0 8px;
    border: 1px solid rgba(37, 99, 235, 0.28);
    border-radius: 8px;
    background: #ffffff;
    color: #1d4ed8;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

.speed-option.active {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
}

@media (max-width: 640px) {
    .section {
        width: 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .practice-panel.voice-practice-app {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 14px;
        padding-right: 14px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .voice-prompt-card,
    .recording-console,
    .audio-preview,
    .upload-result {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .listen-repeat-visual {
        width: 100%;
        max-width: 100%;
        aspect-ratio: 4 / 3;
        margin-left: 0;
        margin-right: 0;
        border-radius: 14px;
    }
}


/* Listen & Repeat next item area */
#nextItemArea {
    justify-content: center;
    margin-top: 18px;
}
/* TOEFL-style Listening choice modules */
.toefl-listening-app {
    max-width: 980px;
    min-height: 520px;
    margin: 0 auto;
    background: #ffffff;
    color: #111827;
}

.listening-engagement {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    background: #ffffff;
}

.listening-stat-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.listening-set-summary {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.88);
}

.listening-set-summary-panel {
    position: relative;
    width: min(560px, 100%);
    padding: 28px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 22px 80px rgba(15, 23, 42, 0.18);
    text-align: center;
    animation: summary-pop 360ms ease-out;
}

.listening-set-summary-panel h2 {
    margin: 8px 0 20px;
    font-size: 28px;
}

.listening-summary-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0 24px;
}

.listening-summary-stats div {
    min-width: 0;
    padding: 12px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
}

.listening-summary-stats strong,
.listening-summary-stats span {
    display: block;
}

.listening-summary-stats strong {
    font-size: 22px;
    color: #111827;
}

.listening-summary-stats span {
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-burst {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.22) 0 6px, transparent 7px),
        radial-gradient(circle at 78% 26%, rgba(16, 185, 129, 0.22) 0 7px, transparent 8px),
        radial-gradient(circle at 34% 74%, rgba(245, 158, 11, 0.24) 0 6px, transparent 7px),
        radial-gradient(circle at 82% 72%, rgba(239, 68, 68, 0.20) 0 5px, transparent 6px);
    animation: summary-burst 900ms ease-out both;
}

@keyframes summary-pop {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes summary-burst {
    from {
        opacity: 0;
        transform: scale(0.88);
    }
    35% {
        opacity: 1;
    }
    to {
        opacity: 0.65;
        transform: scale(1.06);
    }
}

.toefl-progress-line {
    height: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-bottom: 1px solid #111827;
    font-size: 15px;
    color: #3f4652;
}

.toefl-listening-stage {
    display: grid;
    grid-template-columns: minmax(240px, 38%) minmax(360px, 1fr);
    gap: 56px;
    padding: 48px 64px 56px;
    align-items: start;
}

.toefl-speaker-pane {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 350px;
}

.toefl-speaker-pane img {
    width: min(250px, 100%);
    height: 340px;
    object-fit: contain;
    object-position: center top;
    display: block;
}

.toefl-question-pane {
    padding-top: 2px;
    min-width: 0;
}

.toefl-question-pane h1 {
    margin: 0 0 18px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 500;
    letter-spacing: 0;
}

.toefl-audio-row {
    min-height: 42px;
    margin-bottom: 8px;
}

.toefl-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid #9ca3af;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.toefl-icon-btn:hover {
    background: #f3f4f6;
}

.toefl-choice-list {
    display: grid;
    gap: 16px;
    margin-top: 4px;
}

.toefl-choice {
    display: grid;
    grid-template-columns: 24px 30px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    width: 100%;
    font-size: 16px;
    line-height: 1.4;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
}

.toefl-choice:hover,
.toefl-choice.selected {
    background: #f5f7fb;
}

.toefl-choice input {
    width: 20px;
    height: 20px;
    margin: 1px 0 0;
    accent-color: #111827;
}

.toefl-choice-letter {
    font-weight: 600;
    color: #111827;
}

.toefl-choice-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.toefl-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.toefl-actions .primary-action,
.toefl-actions .secondary-action {
    min-width: 104px;
    border-radius: 8px;
}

.toefl-actions .primary-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.toefl-feedback {
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
}

.toefl-feedback p {
    margin: 8px 0 0;
    color: #374151;
    line-height: 1.45;
}

.toefl-feedback.correct {
    border-color: #86efac;
    background: #f0fdf4;
}

.toefl-feedback.incorrect {
    border-color: #fecaca;
    background: #fef2f2;
}

.hidden {
    display: none !important;
}

@media (max-width: 720px) {
    .toefl-listening-app {
        min-height: auto;
    }

    .toefl-listening-stage {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 28px 18px 36px;
    }

    .toefl-speaker-pane {
        min-height: 220px;
    }

    .toefl-speaker-pane img {
        width: min(210px, 70vw);
    }

    .listening-summary-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
