.word-overview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.18);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.word-overview-modal.is-hidden { display: none; }
.word-overview-content {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 28px 32px 18px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(var(--shadow-color), 0.18);
    position: relative;
}
.word-overview-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.word-overview-item {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text-strong);
    display: flex;
    align-items: center;
    gap: 10px;
}
.word-overview-easy { background: #e6ffe6; }
.word-overview-medium { background: #fffbe6; }
.word-overview-hard { background: #ffeaea; }
.word-overview-lapsed { background: #f5e6ff; }

/* 昨日学习报告模态框样式 */
.report-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.22);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
    padding: 0;
}
.report-modal.is-hidden { display: none; }

.report-content {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 0;
    min-width: 500px;
    max-width: 650px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(var(--shadow-color), 0.25);
    position: relative;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .report-modal {
        padding: 0;
        align-items: flex-start;
    }
    
    .report-content {
        min-width: unset;
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
}

.report-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 24px 12px;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(var(--shadow-color), 0.08) 100%);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.report-logos-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.report-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

.report-logo-note {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.08em;
    font-weight: 600;
}

@media (max-width: 768px) {
    .report-logos {
        padding: 12px 16px 10px;
        gap: 12px;
    }
    
    .report-logos-group {
        gap: 10px;
    }
    
    .report-logo {
        height: 35px;
    }
    
    .report-logo-note {
        font-size: 11px;
    }
}

.report-header {
    padding: 20px 32px 16px;
    text-align: center;
    border-bottom: 2px solid var(--surface);
}

.report-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-strong);
    margin-bottom: 8px;
}

.report-header .report-date {
    font-size: 14px;
    color: var(--muted);
}

.report-body {
    padding: 24px 32px;
}

@media (max-width: 768px) {
    .report-header {
        padding: 16px 20px 12px;
    }
    
    .report-header h3 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .report-header .report-date {
        font-size: 13px;
    }
    
    .report-body {
        padding: 20px 16px;
    }
}

.report-section {
    margin-bottom: 24px;
}

.report-section:last-child {
    margin-bottom: 0;
}

.report-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .report-section {
        margin-bottom: 20px;
    }
    
    .report-section h4 {
        font-size: 15px;
        margin-bottom: 10px;
        gap: 6px;
    }
}

.report-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

@media (max-width: 768px) {
    .report-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.stat-item {
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    transition: transform var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
}

@media (max-width: 768px) {
    .stat-item {
        padding: 14px 12px;
    }
    
    .stat-label {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .stat-value {
        font-size: 26px;
    }
}

.stat-value.success {
    color: #2ecc71;
}

.stat-value.warning {
    color: #f39c12;
}

.stat-value.info {
    color: #3498db;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.task-stat {
    background: var(--surface);
    padding: 12px;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-stat-label {
    font-size: 14px;
    color: var(--text);
}

.task-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
}

@media (max-width: 768px) {
    .task-grid {
        gap: 8px;
    }
    
    .task-stat {
        padding: 10px;
    }
    
    .task-stat-label {
        font-size: 13px;
    }
    
    .task-stat-value {
        font-size: 18px;
    }
}

.report-message {
    background: linear-gradient(135deg, rgba(var(--shadow-color), 0.08) 0%, rgba(var(--accent2), 0.08) 100%);
    padding: 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    color: var(--text-strong);
    font-size: 15px;
    line-height: 1.6;
    font-weight: 500;
}

.report-actions {
    padding: 16px 32px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .report-message {
        padding: 16px;
        font-size: 14px;
        line-height: 1.5;
    }
    
    .report-actions {
        padding: 16px 16px 20px;
        justify-content: center;
    }
}

.report-actions .btn {
    padding: 10px 24px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
}

.report-actions .btn-secondary {
    background: var(--surface);
    color: var(--text);
}

.report-actions .btn-secondary:hover {
    background: var(--surface-strong);
}

.report-actions .btn-primary {
    background: var(--primary);
    color: white;
}

.report-actions .btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--shadow-color), 0.3);
}

@media (max-width: 768px) {
    .report-actions .btn {
        padding: 12px 32px;
        font-size: 15px;
        min-width: 120px;
    }
}
:root {
    /* 基础主题变量（粉色为默认） */
    --bg: #fff9fc;
    --surface: #ffe5ef;
    --surface-strong: #ffd1e4;
    --primary: #ff8fb1;
    --primary-dark: #ff5f8d;
    --text-strong: #4a1f2d;
    --text: #6b4453;
    --muted: #c88fa3;
    --shadow-color: 255, 143, 177; /* 供阴影/高亮使用的 rgb */
    --accent2: 181, 136, 255; /* 第二强调色（用于徽章等）*/
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --transition: 0.25s ease;
}

/* 内置主题预设：蓝、黄、橙、紫。通过在 html/body 上设置 data-theme="blue|yellow|orange|purple" 切换 */
[data-theme="pink"] {
    --bg: #fff9fc;
    --surface: #ffe5ef;
    --surface-strong: #ffd1e4;
    --primary: #ff8fb1;
    --primary-dark: #ff5f8d;
    --text-strong: #4a1f2d;
    --text: #6b4453;
    --muted: #c88fa3;
    --shadow-color: 255, 143, 177;
    --accent2: 181, 136, 255;
}

[data-theme="blue"] {
    --bg: #f6fbff;
    --surface: #e8f3ff;
    --surface-strong: #d4e9ff;
    --primary: #86b9ff;
    --primary-dark: #5796f0;
    --text-strong: #103354;
    --text: #2f4d6b;
    --muted: #8aa6c2;
    --shadow-color: 134, 185, 255;
    --accent2: 120, 200, 255;
}

[data-theme="yellow"] {
    --bg: #fffdf4;
    --surface: #fff6cf;
    --surface-strong: #ffe89a;
    --primary: #ffd36a;
    --primary-dark: #f3b63a;
    --text-strong: #5a3e00;
    --text: #6b582f;
    --muted: #b79b66;
    --shadow-color: 255, 211, 106;
    --accent2: 255, 170, 90;
}

[data-theme="orange"] {
    --bg: #fff8f2;
    --surface: #ffe6d6;
    --surface-strong: #ffd3b8;
    --primary: #ffa96a;
    --primary-dark: #f07e3c;
    --text-strong: #5a2a00;
    --text: #6b432f;
    --muted: #b78366;
    --shadow-color: 255, 169, 106;
    --accent2: 255, 120, 120;
}

[data-theme="purple"] {
    --bg: #fbf7ff;
    --surface: #efe6ff;
    --surface-strong: #e0d1ff;
    --primary: #b993ff;
    --primary-dark: #8b64f0;
    --text-strong: #2e1b52;
    --text: #4b3a6b;
    --muted: #9f8ac2;
    --shadow-color: 185, 147, 255;
    --accent2: 136, 200, 255;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    min-height: 100vh;
    font-family: "Noto Sans SC", "Montserrat", sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, var(--surface), rgba(var(--shadow-color), 0.12) 45%, rgba(var(--shadow-color), 0.18) 90%);
    padding: 32px;
}

body.overlay-open {
    overflow: hidden;
}

.app-shell {
    max-width: 1100px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 35px rgba(var(--shadow-color), 0.28);
    padding: 32px 36px 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* 顶部Logo区域 */
.top-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 24px 16px;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(var(--shadow-color), 0.05) 100%);
    border-bottom: 1px solid rgba(var(--shadow-color), 0.08);
}

.top-logos-group {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.top-logo-note {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* 手机端适配 */
@media (max-width: 768px) {
    .top-logos {
        padding: 12px 16px;
        gap: 10px;
    }
    
    .top-logos-group {
        gap: 14px;
    }
    
    .top-logo {
        height: 32px;
    }
    
    .top-logo-note {
        font-size: 11px;
    }
}

header.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.hero__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
}

.user-panel {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.86);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    box-shadow: 0 10px 24px rgba(var(--shadow-color), 0.2);
    border: 1px solid rgba(var(--shadow-color), 0.25);
}

.user-panel__label {
    color: var(--muted);
    font-size: 0.9rem;
}

.user-panel__name {
    color: var(--primary-dark);
    font-weight: 700;
}

.user-panel .btn {
    background: rgba(var(--shadow-color), 0.18);
}

.user-panel .btn:hover {
    background: var(--primary);
    color: #fff;
}

.hero__content h1 {
    font-size: 2.3rem;
    color: var(--text-strong);
    margin-bottom: 8px;
}

.hero__subtitle {
    font-size: 1.05rem;
    color: var(--muted);
}

.countdown {
    min-width: 220px;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--radius-md);
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    box-shadow: 0 12px 25px rgba(var(--shadow-color), 0.35);
}

.countdown__label {
    font-size: 0.9rem;
    opacity: 0.85;
}

.countdown__timer {
    font-size: 1.8rem;
    letter-spacing: 1px;
}

main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.date-picker {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.date-status {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), 0.3);
}

.date-status--readonly {
    background: rgba(var(--shadow-color), 0.12);
    color: var(--text);
}

.date-status--planning {
    background: rgba(var(--shadow-color), 0.2);
    color: var(--primary-dark);
}

.date-picker label {
    font-weight: 600;
    color: var(--text-strong);
}

.date-picker input[type="date"] {
    padding: 10px 12px;
    border: 2px solid var(--surface-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    color: var(--text-strong);
    background: #fff;
    transition: border var(--transition), box-shadow var(--transition);
}

.date-picker input[type="date"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--shadow-color), 0.25);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.is-hidden {
    display: none !important;
}

.form-lock-message {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(var(--shadow-color), 0.12);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(150deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 12px 20px rgba(var(--shadow-color), 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 24px rgba(var(--shadow-color), 0.4);
}

.btn-secondary {
    background: var(--surface-strong);
    color: var(--text-strong);
}

.btn-secondary:hover {
    background: var(--primary);
    color: #fff;
}

.btn-text {
    background: transparent;
    color: var(--primary-dark);
    padding: 6px 10px;
}

.btn-text:hover {
    color: var(--text-strong);
}

.flashcard {
    flex: 1;
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), 0.25);
}

.flashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.flashcard h2 {
    font-size: 1rem;
    color: var(--text-strong);
}

.rate-display {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rate-display span {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.rate-display small {
    color: var(--muted);
}

.flashcard__metric {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.panel {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 20px 40px rgba(var(--shadow-color), 0.18);
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel__header h2 {
    font-size: 1.1rem;
    color: var(--text-strong);
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.form--disabled {
    opacity: 0.6;
}

.inline-form input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--surface-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    min-height: 48px;
    transition: border var(--transition), box-shadow var(--transition);
}

.inline-form .btn {
    min-width: 60px;
    height: 48px;
    padding: 0 16px;
}

.inline-form input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--shadow-color), 0.18);
}

.item-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.list-item--readonly {
    grid-template-columns: auto 1fr;
}

.list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(var(--shadow-color), 0.18);
}

.list-item__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item__text {
    color: var(--text-strong);
    font-weight: 600;
}

.list-item__meta {
    font-size: 0.82rem;
    color: var(--muted);
}

.list-item__actions {
    display: flex;
    gap: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(var(--shadow-color), 0.18);
    color: var(--primary-dark);
}

.badge-planned {
    background: rgba(var(--shadow-color), 0.18);
    color: var(--primary-dark);
}

.badge-extra {
    background: rgba(var(--accent2), 0.2);
    color: var(--primary-dark);
}

.badge-planned-today {
    background: rgba(var(--accent1), 0.2);
    color: var(--primary-dark);
}

.badge-planned-yesterday {
    background: rgba(var(--shadow-color), 0.24);
    color: var(--primary-dark);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.1rem;
    transition: color var(--transition), transform var(--transition);
}

.icon-btn:hover {
    color: var(--primary-dark);
    transform: scale(1.1);
}

.checkbox {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--muted);
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: border var(--transition), background var(--transition);
}

.checkbox:checked {
    border-color: var(--primary-dark);
    background: var(--primary);
}

.checkbox:checked::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.panel__empty {
    color: var(--muted);
    font-size: 0.95rem;
}

.carryover-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(var(--shadow-color), 0.12);
    color: var(--text-strong);
}

.carryover-box__text {
    font-size: 0.95rem;
    line-height: 1.4;
}

.carryover-box__text strong {
    color: var(--primary-dark);
}

.carryover-box__actions {
    flex-shrink: 0;
}

.charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 900px) {
    .charts {
        grid-template-columns: minmax(0, 1fr);
    }
}

.chart-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: 0 16px 32px rgba(var(--shadow-color), 0.2);
}

#forgettingHeatmap {
    width: 100% !important;
    height: 100% !important;
}

.chart-card h2 {
    font-size: 1.1rem;
    color: var(--text-strong);
    margin-bottom: 12px;
}

.chart-empty {
    display: none;
    margin-top: 16px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 18px;
    padding-top: 12px;
    border-top: 1px dashed rgba(var(--shadow-color), 0.4);
    flex-wrap: wrap;
}

.encouragement {
    flex: 1 1 100%;
    text-align: center;
    color: var(--text-strong);
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 600;
    background: linear-gradient(90deg, rgba(var(--shadow-color), 0.2), rgba(255, 255, 255, 0.2));
    padding: 10px 14px;
    border-radius: var(--radius-sm);
}

.footer-meta {
    flex: 1 1 100%;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 6px 0 4px;
}

.footer-meta a {
    color: var(--primary-dark);
    text-decoration: none;
}

.footer-meta a:hover,
.footer-meta a:focus {
    text-decoration: underline;
}

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(var(--shadow-color), 0.25);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 1000;
    transition: opacity var(--transition), visibility var(--transition);
}

.auth-overlay.is-hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.auth-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    padding: 32px 34px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 32px 64px rgba(var(--shadow-color), 0.25);
}

.auth-card h2 {
    text-align: center;
    color: var(--text-strong);
    font-size: 1.6rem;
}

.auth-card__subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-card__label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    color: var(--text-strong);
}

.auth-card__label input {
    padding: 12px 14px;
    border: 2px solid var(--surface-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border var(--transition), box-shadow var(--transition);
    background: #fff;
    color: var(--text-strong);
}

.auth-card__label input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(var(--shadow-color), 0.2);
}

/* 主题切换器 */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.theme-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    background: var(--primary);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}

.theme-dot:hover { transform: scale(1.05); }
.theme-dot[aria-pressed="true"] { outline: 2px solid var(--primary-dark); outline-offset: 2px; }

.theme-dot.is-pink { background: #ff8fb1; }
.theme-dot.is-blue { background: #86b9ff; }
.theme-dot.is-yellow { background: #ffd36a; }
.theme-dot.is-orange { background: #ffa96a; }
.theme-dot.is-purple { background: #b993ff; }

.auth-card__error {
    min-height: 20px;
    text-align: center;
    color: #d64571;
    font-size: 0.9rem;
}

.auth-card__hint {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

.auth-card .btn {
    width: 100%;
    margin-top: 6px;
}

@media (max-width: 900px) {
    body {
        padding: 16px;
    }

    .app-shell {
        padding: 24px;
    }

    header.hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero__meta {
        width: 100%;
        align-items: stretch;
        gap: 12px;
    }

    .user-panel {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .user-panel .btn {
        width: auto;
    }

    .countdown {
        width: 100%;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        width: 100%;
    }

    .relax-stage {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .game-nav-side {
        justify-self: center;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 15px;
    }

    .app-shell {
        padding: 20px;
    }

    .auth-card {
        padding: 28px 24px;
    }
}

/* Wordbook */
.word-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.word-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), 0.15);
}
.word-card__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.word-card__word { font-weight: 700; color: var(--text-strong); }
.word-card__dict { font-size: 0.8rem; color: var(--muted); }
.word-card__text {
    white-space: pre-wrap;
    color: var(--text);
    margin-top: 6px;
}
.word-card__actions { display: flex; gap: 8px; margin-top: 8px; }

.review-deck { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.review-title { font-size: 1rem; color: var(--text-strong); }
.review-empty { color: var(--muted); }
.review-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: 0 12px 24px rgba(var(--shadow-color), 0.15);
}
.review-head { font-size: 1.3rem; font-weight: 700; color: var(--text-strong); }
.review-progress {
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-dark);
}
.review-progress[data-stage="relearn"] { color: #f97316; }
.review-progress[data-stage="learning"] { color: var(--primary-dark); }
.review-progress[data-stage="long-term"] { color: #0ea5e9; }
.review-progress[data-stage="mastered"] { color: #16a34a; }
.review-meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
}
.review-meta span {
    background: rgba(var(--shadow-color), 0.14);
    color: var(--text-strong);
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 500;
}
.review-body { margin-top: 8px; color: var(--text); white-space: pre-wrap; min-height: 72px; }
.review-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-top: 12px;
}
.review-initial-actions,
.review-followup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.review-initial-actions .btn {
    flex: 1 1 30%;
}
.review-followup-actions {
    justify-content: flex-end;
}
.review-followup-actions .btn {
    min-width: 96px;
}
.review-delete {
    align-self: flex-end;
    margin-top: 4px;
}

.relax-panel {
    gap: 18px;
}

.relax-panel__header {
    gap: 12px;
}

.relax-header-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.relax-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(var(--shadow-color), 0.12);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text-strong);
}

.game-switch-label {
    min-width: 120px;
    text-align: center;
}

.game-nav-btn {
    background: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(var(--shadow-color), 0.18);
    color: var(--primary-dark);
    font-size: 1rem;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.game-nav-btn:hover,
.game-nav-btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(var(--shadow-color), 0.22);
}


.relax-stage {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.game-nav-side {
    background: transparent;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--primary-dark);
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), transform var(--transition);
}

.game-nav-side:hover,
.game-nav-side:focus {
    background: rgba(var(--shadow-color), 0.12);
    transform: translateY(-1px);
}

.relax-canvas-wrap {
    position: relative;
    background: linear-gradient(160deg, rgba(var(--shadow-color), 0.12), rgba(var(--shadow-color), 0.24));
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), 0.24), 0 20px 40px rgba(var(--shadow-color), 0.18);
    width: min(100%, 640px);
}

#relaxGameCanvas {
    display: block;
    width: 100%;
    height: auto;
    max-width: none;
    border-radius: 12px;
    background: #fff;
    touch-action: none;
}

.game-status-text {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(var(--shadow-color), 0.16);
    color: var(--text-strong);
    font-weight: 600;
    transition: opacity var(--transition);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.game-status-text.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.relax-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text);
}

.relax-desc {
    font-weight: 600;
    color: var(--text-strong);
}

.relax-help {
    font-size: 0.9rem;
    color: var(--muted);
}

.relax-dots {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.relax-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;

@media (max-width: 640px) {
    .relax-panel__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .relax-header-meta {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .game-status-text {
        max-width: 100%;
    }

    .relax-switch {
        width: 100%;
        justify-content: space-between;
    }

    .relax-stage {
        flex-direction: column;
    }
}
    background: rgba(var(--shadow-color), 0.2);
    border: none;
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
}

.relax-dot[aria-current="true"] {
    background: var(--primary-dark);
    transform: scale(1.25);
}

.relax-dot:focus {
    outline: 2px solid rgba(var(--shadow-color), 0.45);
    outline-offset: 2px;
}

.relax-touch-wrap {
    display: none;
    margin-top: 16px;
    align-items: stretch;
    justify-content: center;
    gap: 20px;
}

.relax-touch-controls {
    display: none;
    grid-template-columns: repeat(3, minmax(48px, 64px));
    grid-template-rows: repeat(3, minmax(48px, 64px));
    gap: 10px;
    justify-content: center;
    touch-action: none;
}

.relax-touch-wrap.has-directional .relax-touch-controls {
    display: grid;
}

.touch-action-wrapper {
    display: none;
    align-items: center;
    justify-content: center;
}

.relax-touch-wrap.has-action .touch-action-wrapper {
    display: flex;
}

.touch-btn {
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 14px;
    background: rgba(var(--accent2), 0.18);
    color: var(--text-strong);
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 30px rgba(var(--shadow-color), 0.18);
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
    touch-action: none;
}

.touch-btn:active {
    transform: scale(0.96);
    background: rgba(var(--accent2), 0.3);
}

.touch-btn:focus-visible {
    outline: 2px solid rgba(var(--shadow-color), 0.5);
    outline-offset: 3px;
}

.touch-btn-left {
    grid-column: 1;
    grid-row: 2;
}

.touch-btn-up {
    grid-column: 2;
    grid-row: 1;
}

.touch-btn-right {
    grid-column: 3;
    grid-row: 2;
}

.touch-btn-down {
    grid-column: 2;
    grid-row: 3;
}

.touch-btn-action {
    width: 72px;
    height: 72px;
    font-size: 18px;
    letter-spacing: 0.04em;
}

@media (pointer: coarse) {
    .relax-touch-wrap {
        display: flex;
        flex-wrap: wrap;
    }
}

@media (pointer: coarse) and (max-width: 520px) {
    .relax-touch-wrap {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}
