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

body {
    font-family: 'Poppins', 'Noto Sans JP', sans-serif;
    background: linear-gradient(135deg, #3b41c5 0%, #a981bb 49%, #ffc8a9 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    padding: 57px 30px 30px 30px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    max-width: 900px;
    width: 100%;
}

.app-shell {
    position: relative;
}

.level-selector {
    display: none;
    position: absolute;
    top: 64px;
    left: 30px;
    z-index: 210;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: min(292px, calc(100% - 60px));
    margin: 0;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 44px rgba(31, 38, 135, 0.18);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.level-current-btn {
    display: inline-flex;
    position: absolute;
    top: 20px;
    left: 76px;
    z-index: 210;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    max-width: 112px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    color: #4a4f86;
    font-size: 13px;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 10px 22px rgba(47, 62, 112, 0.14);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.level-current-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(47, 62, 112, 0.18);
}

.level-current-caret {
    color: #7a85d9;
    font-size: 11px;
    line-height: 1;
}

body.level-selector-open .level-selector {
    display: grid;
}

.level-btn {
    background: white;
    color: #555;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.2);
}

.level-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.level-selector .level-btn,
.level-selector .wordbook-opener-btn {
    justify-content: center;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 12px;
}

/* Independent class for Wordbook Opener to avoid JS conflicts */
.wordbook-opener-btn {
    background: white;
    color: #555;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.wordbook-opener-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.2);
}

.wordbook-opener-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wordbook-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(circle at 88% 12%, rgba(255, 211, 103, 0.2), transparent 28%),
        linear-gradient(135deg, rgba(18, 27, 48, 0.78), rgba(59, 47, 91, 0.68));
    backdrop-filter: blur(5px);
}

.wordbook-modal-content {
    position: relative;
    width: min(480px, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: 0 18px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.74) !important;
    border-radius: 28px !important;
    background: #f8fbff !important;
    text-align: left !important;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.wordbook-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.wordbook-hero {
    margin: 0 -18px 16px;
    padding: 28px 52px 22px 26px;
    border-radius: 28px 28px 0 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 36%),
        linear-gradient(135deg, #1f2d4d, #5367d4);
    color: #fff;
}

.wordbook-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.wordbook-title {
    margin: 13px 0 5px;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.25;
    display: flex;
    align-items: center;
}

.wordbook-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.wordbook-list {
    display: grid;
    gap: 10px;
}

.wordbook-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 78px;
    padding: 13px 14px;
    border: 1px solid #dfe6f2;
    border-radius: 19px;
    background:
        radial-gradient(circle at top right, rgba(85, 103, 216, 0.08), transparent 40%),
        #fff;
    color: #27324a;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 12px 26px rgba(30, 42, 68, 0.07);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.wordbook-card:hover {
    transform: translateY(-2px);
    border-color: #bdc9f6;
    box-shadow: 0 16px 32px rgba(30, 42, 68, 0.12);
}

.wordbook-card.active {
    border-color: #6577e5;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.2), transparent 42%),
        linear-gradient(135deg, #edf2ff, #ffffff);
    box-shadow: 0 16px 34px rgba(82, 100, 210, 0.18);
}

.wordbook-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    background: #f1f4ff;
    font-size: 24px;
}

.wordbook-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wordbook-copy strong {
    font-size: 15px;
    font-weight: 900;
}

.wordbook-copy small {
    color: #7d879a;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.4;
}

.wordbook-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 28px;
    padding: 0 9px;
    border: 1px solid #dbe3f7;
    border-radius: 999px;
    background: #f6f8ff;
    color: #5061cc;
    font-size: 11px;
    font-weight: 900;
}

.wordbook-note {
    margin-top: 13px;
    padding: 11px 12px;
    border: 1px dashed #d8e0ef;
    border-radius: 15px;
    background: #fff;
    color: #7d879a;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.5;
    text-align: center;
}

.file-upload-area {
    background: #f8f9fa;
    border: 2px dashed #667eea;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.file-upload-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.file-upload-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.file-info {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

/* Progress Bar & Title Styles */


.header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.stats {
    flex: 1;
}

.points {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    white-space: nowrap;
    /* Force single line */
}

.vocab-level {
    font-size: 18px;
    color: #666;
    margin-top: 5px;
}

.vocab-level-display {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.play-time {
    font-size: 14px;
    color: #999;
    margin-top: 3px;
}

.mode-buttons {
    display: flex;
    gap: 10px;
}

@media (min-width: 769px) {
    .mode-buttons {
        transform: translateY(20px);
    }
}

.mode-btn {
    background: #e0e0e0;
    color: #2f3a52;
    border: 1px solid transparent;
    padding: 8px 15px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.08;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 90px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 10px 22px rgba(31, 36, 90, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

.mode-count {
    font-size: 12px;
    opacity: 0.92;
    margin-top: 0;
    font-weight: 800;
}

.mode-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 28px rgba(31, 36, 90, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

.mode-btn.unlearned {
    background: linear-gradient(180deg, #8fc9f4, #78b9ea);
    border-color: rgba(75, 142, 205, 0.42);
    color: #183b5f;
}

.mode-btn.learned {
    background: linear-gradient(180deg, #41c875, #29a95d);
    border-color: rgba(33, 139, 76, 0.42);
    color: white;
}

.mode-btn.perfect {
    background: linear-gradient(180deg, #ffd84a, #f2bd19);
    border-color: rgba(196, 142, 0, 0.38);
    color: #493600;
}

.mode-btn.weak {
    background: linear-gradient(180deg, #ff6b5d, #ea4b42);
    border-color: rgba(190, 53, 44, 0.42);
    color: white;
}

.stat-item.perfect {
    background: #fff9c4;
}

.mode-btn.active {
    transform: translateY(-1px);
    box-shadow:
        0 16px 32px rgba(31, 36, 90, 0.18),
        inset 0 0 0 2px rgba(255, 255, 255, 0.72),
        inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.mode-btn:disabled,
.mode-btn.disabled {
    opacity: 0.72;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(34%) saturate(0.75);
}

.mode-btn span {
    white-space: nowrap;
    /* Prevent text wrapping */
}

.random-notice {
    font-size: 11px;
    color: #999;
    margin-right: 10px;
}

.app-picto {
    position: relative;
    display: inline-grid;
    place-items: center;
    color: currentColor;
    line-height: 1;
}

.app-picto::before,
.app-picto::after {
    content: '';
    position: absolute;
    box-sizing: border-box;
}

.title-picto {
    width: 28px;
    height: 28px;
    margin-right: 9px;
    vertical-align: -6px;
}

.inline-picto,
.button-picto {
    width: 16px;
    height: 16px;
    margin-right: 7px;
    vertical-align: -3px;
}

.icon-compass::before {
    width: 72%;
    height: 72%;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.icon-compass::after {
    width: 40%;
    height: 40%;
    background: currentColor;
    clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
    transform: rotate(38deg);
}

.icon-chart::before {
    width: 70%;
    height: 62%;
    bottom: 18%;
    background:
        linear-gradient(to top, currentColor 48%, transparent 48%) 0 100% / 25% 100% no-repeat,
        linear-gradient(to top, currentColor 72%, transparent 72%) 50% 100% / 25% 100% no-repeat,
        linear-gradient(to top, currentColor 100%, transparent 100%) 100% 100% / 25% 100% no-repeat;
}

.icon-log::before {
    width: 62%;
    height: 74%;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.icon-log::after {
    width: 40%;
    height: 2px;
    background: currentColor;
    box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

.icon-crown::before {
    width: 74%;
    height: 52%;
    background: currentColor;
    clip-path: polygon(0 38%, 24% 10%, 50% 38%, 76% 10%, 100% 38%, 90% 100%, 10% 100%);
}

.icon-book::before {
    width: 68%;
    height: 70%;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.icon-book::after {
    width: 2px;
    height: 58%;
    left: 42%;
    background: currentColor;
}

.icon-refresh::before {
    width: 70%;
    height: 70%;
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-radius: 50%;
}

.icon-refresh::after {
    width: 7px;
    height: 7px;
    right: 17%;
    top: 18%;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(22deg);
}

.icon-diamond::before {
    width: 58%;
    height: 58%;
    border: 2px solid currentColor;
    transform: rotate(45deg);
    border-radius: 3px;
}

.icon-mail::before {
    width: 70%;
    height: 52%;
    border: 2px solid currentColor;
    border-radius: 3px;
}

.icon-mail::after {
    width: 48%;
    height: 48%;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-14%) rotate(-45deg);
}

.icon-target::before {
    width: 76%;
    height: 76%;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px rgba(83, 96, 118, 0.12);
}

.icon-target::after {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
}

.icon-route::before {
    width: 70%;
    height: 44%;
    border: 2px solid currentColor;
    border-left: 0;
    border-bottom: 0;
    border-radius: 0 8px 0 0;
}

.icon-route::after {
    width: 5px;
    height: 5px;
    left: 12%;
    bottom: 18%;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 11px -8px 0 currentColor;
}

.icon-plus::before,
.icon-plus::after {
    width: 70%;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
}

.icon-plus::after {
    transform: rotate(90deg);
}

.icon-phone::before {
    width: 58%;
    height: 78%;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.icon-phone::after {
    width: 4px;
    height: 4px;
    bottom: 14%;
    background: currentColor;
    border-radius: 50%;
}

.add-words-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.add-words-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.auto-mode-container {
    display: flex;
    align-items: center;
    gap: 5px;
    /* Reduced gap */
    padding: 5px 8px;
    /* Compact padding */
    background: transparent;
    /* Transparent as requested */
    border: none;
    /* Border removed */
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
    /* Ensure alignment in flex/grid */
    justify-content: center;
}

.auto-mode-container:hover {
    background: #e9ecef;
}

/* PC/Global Toggle Layout */
.toggle-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    /* Or auto? Mode buttons below are flex row on PC? */
    /* PC Mode Buttons are display: flex; gap: 10px; (Line 213) */
    /* So we want Toggles to align similarly? */
    margin-bottom: 10px;
    justify-content: flex-end;
    /* Right align on PC */
}

.auto-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid #9c27b0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.auto-checkbox.checked {
    background: #9c27b0;
}

.auto-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.auto-label {
    font-size: 11px;
    /* Compact font */
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.study-mode-card {
    background: #fff;
    border: 1px solid #eceff7;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
}

.study-auto-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.study-mode-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
}

.study-mode-card-desc {
    margin-top: 3px;
    font-size: 11px;
    color: #8a92a6;
    line-height: 1.4;
}

.study-auto-toggle {
    flex-shrink: 0;
    background: #f8faff;
    border: 1px solid #e2e7fb;
    padding: 6px 10px;
}

.study-mode-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 197, 84, 0.18), transparent 28%),
        linear-gradient(135deg, rgba(18, 29, 52, 0.76), rgba(34, 45, 78, 0.68));
    backdrop-filter: blur(5px);
}

.study-mode-modal-content {
    position: relative;
    width: min(590px, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: 0 18px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.72) !important;
    border-radius: 28px !important;
    background: #f8fbff !important;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.study-mode-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin: 0 -18px 16px;
    padding: 28px 52px 22px 26px;
    border-radius: 28px 28px 0 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, #202945, #5868ca);
    color: #fff;
    text-align: left;
}

.study-mode-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.study-mode-title {
    margin: 13px 0 5px;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.25;
    display: flex;
    align-items: center;
}

.study-mode-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.study-mode-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.17);
    color: #fff;
}

.study-mode-guide {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.study-mode-guide span {
    min-height: 40px;
    padding: 10px 11px;
    border: 1px solid #e4eaf5;
    border-radius: 15px;
    background: #fff;
    color: #667086;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.5;
}

.study-mode-card {
    border: 1px solid #dfe6f2;
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 12px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(30, 42, 68, 0.07);
}

.study-auto-card {
    border-color: #d9e8ff;
    background:
        radial-gradient(circle at top right, rgba(85, 103, 216, 0.08), transparent 36%),
        #fff;
}

.study-mode-card-title {
    color: #26324a;
    font-size: 14px;
    font-weight: 900;
}

.study-mode-card-desc {
    margin-top: 4px;
    color: #7d879a;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}

.study-mode-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.study-mode-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid #e2e7fb;
    border-radius: 999px;
    background: #f5f7ff;
    color: #7d879a;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
}

.study-mode-switch-btn {
    width: 100%;
    min-height: 42px;
    margin-bottom: 11px;
    border: 1px solid #cfd7f2;
    border-radius: 14px;
    background: #f5f7ff;
    color: #4b5fc9;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.study-review-level-block {
    padding-top: 11px;
    border-top: 1px dashed #e2e8f2;
}

.study-mode-mini-title {
    margin-bottom: 8px;
    color: #536076;
    font-size: 12px;
    font-weight: 900;
    display: flex;
    align-items: center;
}

.study-review-level-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.study-review-level-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #dbe2f4;
    border-radius: 999px;
    background: #fff;
    color: #42506b;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.study-review-level-chip input {
    accent-color: #5567d8;
}

.study-pos-card {
    margin-bottom: 0;
}

.pos-filter-container.study-pos-filter-container {
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    border: none;
    background: transparent;
}

.study-pos-filter-container .pos-checkbox-item {
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid #dfe6f2;
    border-radius: 999px;
    background: #f9fbff;
    color: #42506b;
    font-size: 12px;
    font-weight: 850;
}

.study-pos-filter-container .pos-checkbox-item:hover {
    background: #eef3ff;
}

.study-pos-filter-container .pos-checkbox-item input {
    accent-color: #5567d8;
}

.pos-filter-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.pos-checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s;
}

.pos-checkbox-item:hover {
    background: #e9ecef;
}

.pos-checkbox-item input[type="checkbox"] {
    cursor: pointer;
}



.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.cards-section {
    flex: 1;
}

.cards-area {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.card {
    flex: 1;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.97));
    border: 1px solid rgba(210, 218, 237, 0.95);
    border-radius: 20px;
    padding: 40px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 240px;
    position: relative;
    box-shadow:
        0 16px 34px rgba(35, 48, 78, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.25);
    /* Border highlight on hover */
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.25), inset 0 0 0 2px #667eea;
}

.card:active {
    transform: translateY(-2px);
}

.card-label {
    position: absolute;
    top: 15px;
    font-size: 14px;
    color: #667eea;
    font-weight: bold;
}

.card-content {
    font-size: 36px;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.meaning-card .card-content {
    font-size: 20px;
    line-height: 1.4;
}

.card-back {
    display: none;
}

.card.flipped .card-front {
    display: none;
}

.card.flipped .card-back {
    display: block;
}

#reviewProgressWrap {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.95)) !important;
    border: 1px solid rgba(210, 218, 237, 0.92) !important;
    border-radius: 16px !important;
    padding: 10px 12px !important;
    box-shadow:
        0 6px 14px rgba(35, 48, 78, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

#reviewQueuePreview {
    padding: 2px 2px 4px !important;
}

.review-queue-chip,
.review-queue-more {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.review-queue-chip {
    border: 1px solid #d8e1f3;
    background: linear-gradient(180deg, #ffffff, #f6f9ff);
    color: #42506c;
    box-shadow: 0 3px 8px rgba(40, 55, 90, 0.06);
}

.review-queue-chip.is-head {
    border-color: #f2a53a;
    background: linear-gradient(180deg, #fff8ed, #ffffff);
    box-shadow:
        0 0 0 2px rgba(242, 165, 58, 0.14) inset,
        0 4px 10px rgba(166, 103, 20, 0.10);
}

.review-queue-more {
    border: 1px dashed #c5cee4;
    background: rgba(255, 255, 255, 0.68);
    color: #6f7b90;
}

.review-queue-empty {
    font-size: 12px;
    color: #667085;
    font-weight: 700;
}

.example-area {
    background:
        linear-gradient(135deg, #fff8dd, #fffdf4);
    border: 1px solid rgba(239, 199, 0, 0.78);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 0 12px 26px rgba(143, 111, 0, 0.08);
}

.speaker-btn {
    background: linear-gradient(135deg, #667eea, #7b8ff0);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    flex-shrink: 0;
    box-shadow: 0 10px 22px rgba(102, 126, 234, 0.23);
}

.speaker-btn:hover {
    filter: brightness(1.02);
    transform: translateY(-1px);
}

.speaker-icon {
    position: relative;
    width: 20px;
    height: 18px;
    display: block;
}

.speaker-icon::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    width: 13px;
    height: 14px;
    background: currentColor;
    clip-path: polygon(0 35%, 34% 35%, 78% 0, 78% 100%, 34% 65%, 0 65%);
}

.speaker-icon::after {
    content: '';
    position: absolute;
    right: 1px;
    top: 3px;
    width: 8px;
    height: 12px;
    border: 2px solid currentColor;
    border-left: 0;
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
    opacity: 0.9;
}

.undo-btn {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(213, 221, 237, 0.95);
    border-radius: 12px;
    padding: 7px 12px;
    cursor: pointer;
    color: #7a8499;
    font-size: 12px;
    font-weight: 900;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.undo-btn:hover {
    background: #fff;
    border-color: rgba(185, 196, 219, 0.98);
    transform: translateY(-1px);
}

.undo-btn:disabled {
    opacity: 0.48;
    cursor: default;
    transform: none;
}

.undo-icon {
    width: 12px;
    height: 12px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    border-radius: 2px;
}

.example-text {
    flex: 1;
    min-width: 0;
}

.example-label {
    font-size: 11px;
    color: #9a6d00;
    font-weight: 900;
    margin-bottom: 4px;
}

.example-sentence {
    font-size: 14px;
    color: #2f3546;
    line-height: 1.5;
}

.character-area {
    width: 200px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
}

.character {
    font-size: 80px;
    margin: 20px 0;
}

.character-title {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.character-level {
    font-size: 14px;
    color: #666;
}

.no-words {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 18px;
}

.coin-popup {
    position: fixed;
    top: 30px;
    left: 200px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.6);
    z-index: 1000;
    animation: popupSlide 0.6s ease-out;
    pointer-events: none;
}

@keyframes popupSlide {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }

    50% {
        transform: translateX(10px);
        opacity: 1;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.review-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #4caf50;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    z-index: 5;
}

.word-ipa {
    margin-top: 8px;
    font-size: 18px;
    line-height: 1.3;
    color: #5f6f94;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-align: center;
    word-break: break-word;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.character.working .card.working {
    animation: bounce 0.5s ease-in-out;
}

/* ... previous styles ... */
.character-area,
.vocab-level,
.play-time {
    display: none !important;
}

/* New generic small button style */
.icon-btn {
    background: #f0f0f0;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    color: #666;
}

.icon-btn:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.simple-switch-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 200;
}

.other-menu-button {
    background: linear-gradient(180deg, #ffffff, #f7f9ff);
    border: 1px solid rgba(133, 145, 176, 0.28);
    width: 42px;
    height: 42px;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(47, 62, 112, 0.13);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.other-menu-button:hover {
    transform: translateY(-1px);
    border-color: rgba(102, 126, 234, 0.36);
    box-shadow: 0 14px 30px rgba(47, 62, 112, 0.18);
}

.other-menu-icon-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    width: 22px;
    height: 22px;
}

.other-menu-icon-grid div {
    background: #3f4b66;
    border-radius: 3px;
}

.other-menu-caption {
    font-size: 10px;
    color: #7b8397;
    font-weight: 800;
    text-align: center;
    margin-top: 3px;
}

.other-menu-dropdown {
    display: none;
    position: absolute;
    top: 60px;
    left: 15px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    box-shadow: 0 22px 54px rgba(30, 41, 59, 0.18);
    width: 232px;
    z-index: 201;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.9);
    backdrop-filter: blur(10px);
}

.other-menu-item {
    padding: 13px 14px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.72);
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    transition: background 0.14s ease, transform 0.14s ease;
}

.other-menu-item:hover {
    background: #f7f9ff;
    transform: translateX(2px);
}

.other-menu-item:last-child {
    border-bottom: none;
}

.other-menu-section-title {
    padding: 10px 14px 6px;
    background: linear-gradient(180deg, #f8faff, #f3f6fc);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    color: #8a92a6;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.other-menu-section-title:first-child {
    border-top: none;
}

.other-menu-item.external:hover {
    background: #f5fbff;
}

.other-menu-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: #f1f5ff;
    color: #5366ad;
}

.other-menu-label {
    font-size: 14px;
    font-weight: 800;
    color: #2f3a52;
}

.other-menu-label.external {
    color: #2c5a87;
}

.header-profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
    cursor: pointer;
    overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-profile-initials {
    position: relative;
    display: block;
    width: 18px;
    height: 18px;
    font-weight: bold;
    color: #888;
    font-size: 0;
}

.header-profile-initials::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 5px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.header-profile-initials::after {
    content: "";
    position: absolute;
    left: 2px;
    bottom: 1px;
    width: 12px;
    height: 7px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 999px 999px 0 0;
}

.header-profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.announcement-btn {
    position: relative;
}

.top-icon-btn {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(133, 145, 176, 0.28);
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #f7f9ff);
    color: #4f5f82;
    box-shadow: 0 10px 22px rgba(47, 62, 112, 0.13);
    font-size: 0;
}

.top-icon-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(102, 126, 234, 0.36);
    background: linear-gradient(180deg, #ffffff, #eef3ff);
    box-shadow: 0 14px 28px rgba(47, 62, 112, 0.18);
}

.top-icon-svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vertical-dots-icon,
.vertical-dots-icon::before,
.vertical-dots-icon::after {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.vertical-dots-icon {
    position: relative;
}

.vertical-dots-icon::before,
.vertical-dots-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.vertical-dots-icon::before {
    top: -7px;
}

.vertical-dots-icon::after {
    top: 7px;
}

.announcement-dot {
    display: none;
    position: absolute;
    top: 2px;
    right: 2px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ff4757;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.announcement-card {
    border: 1px solid #dfe7ff;
    border-radius: 12px;
    padding: 14px;
    background: #f6f8ff;
}

.announcement-meta {
    color: #667085;
    font-size: 11px;
    margin-bottom: 6px;
}

.announcement-title {
    color: #333;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.announcement-body {
    color: #344054;
    font-size: 13px;
    line-height: 1.65;
}

.announcement-modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10008;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.announcement-modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    max-width: 90%;
    width: 420px;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    position: relative;
}

.announcement-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.announcement-heading {
    margin: 0 0 16px 0;
    color: #333;
    text-align: center;
    font-size: 18px;
}

.update-modal-picto {
    width: 42px;
    height: 42px;
    margin: 0 auto 12px;
    color: #5567d8;
    border-radius: 15px;
    background: #eef3ff;
}

.announcement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Help Modal Design Variants */
.help-modal {
    background: rgba(20, 25, 42, 0.58) !important;
    backdrop-filter: blur(4px);
}

.help-modal-content {
    width: min(450px, 92vw) !important;
    max-width: 92vw !important;
    text-align: left !important;
    position: relative !important;
}

.help-version-wrap {
    position: absolute;
    top: 17px;
    left: 18px;
}

.help-version {
    font-size: 11px;
    color: #a7afc0;
    font-weight: 700;
}

.help-share-btn {
    position: absolute;
    top: 14px;
    right: 54px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 999px;
    padding: 7px 12px;
    background: #5567d8;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(85, 103, 216, 0.22);
}

.help-heading {
    margin: 4px 0 4px;
    color: #2f3a52;
    text-align: center;
    font-size: 22px;
    font-weight: 900;
}

.help-subheading {
    margin: 0 0 18px;
    color: #8a92a6;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
}

.help-list-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.help-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e7ebf5;
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.help-list-item:hover {
    transform: translateY(-1px);
    border-color: #cfd7f2;
    box-shadow: 0 12px 24px rgba(47, 62, 112, 0.1);
}

.help-list-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 12px;
    background: #f1f5ff;
    color: #5366ad;
}

.help-list-copy {
    min-width: 0;
}

.help-list-title {
    color: #2f3a52;
    font-size: 13px;
    font-weight: 900;
}

.help-list-desc {
    margin-top: 3px;
    color: #69748b;
    font-size: 11px;
    line-height: 1.4;
}

.help-profile-icon {
    border-color: rgba(128, 144, 200, 0.28);
    background: #eef3ff;
    color: #5366ad;
    box-shadow: inset 0 0 0 1px rgba(123, 142, 190, 0.12);
}

.help-footer {
    text-align: center;
    margin-top: 20px;
}

.help-note-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 12px 22px;
    border-radius: 999px;
    background: #00a982;
    color: white;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(0, 169, 130, 0.2);
}

.help-tune .help-modal-content {
    background: linear-gradient(180deg, #ffffff, #f8faff) !important;
    padding: 26px !important;
    border: 1px solid #e8edf7 !important;
    border-radius: 22px !important;
    box-shadow: 0 24px 64px rgba(24, 32, 56, 0.22) !important;
}

.help-redesign .help-modal-content {
    width: min(520px, 94vw) !important;
    background:
        radial-gradient(circle at top left, rgba(255, 204, 128, 0.28), transparent 38%),
        linear-gradient(180deg, #172033 0%, #263654 43%, #edf3fb 43.2%, #f7faff 100%) !important;
    padding: 30px !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 28px !important;
    box-shadow: 0 28px 80px rgba(14, 21, 38, 0.34) !important;
    overflow: hidden;
}

.help-redesign .help-version {
    color: rgba(255, 255, 255, 0.58);
}

.help-redesign .modal-close-btn {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.help-redesign .help-share-btn {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    box-shadow: none;
}

.help-redesign .help-heading {
    margin-top: 20px;
    color: #fff;
    text-align: left;
    font-size: 28px;
}

.help-redesign .help-subheading {
    width: 70%;
    margin: 0 0 28px;
    color: rgba(255, 255, 255, 0.76);
    text-align: left;
    font-size: 13px;
}

.help-redesign .help-list-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 11px;
}

.help-redesign .help-list-item {
    min-height: 96px;
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
    border: 1px solid rgba(197, 208, 229, 0.95);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 30px rgba(28, 39, 63, 0.14);
}

.help-redesign .help-list-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: #e9efff;
    box-shadow: inset 0 0 0 1px rgba(123, 142, 190, 0.12);
}

.help-redesign .help-footer {
    margin-top: 18px;
    text-align: left;
}

.help-redesign .help-note-link {
    width: 100%;
    background: linear-gradient(135deg, #00a982, #35c7a0);
    box-shadow: 0 14px 28px rgba(0, 169, 130, 0.23);
}

/* Purchase Modal */
.purchase-modal {
    background: rgba(14, 21, 38, 0.64) !important;
    backdrop-filter: blur(4px);
}

.purchase-modal-content {
    width: min(440px, 94vw) !important;
    max-width: 94vw !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.62) !important;
    border-radius: 28px !important;
    background: #f8fbff !important;
    overflow: hidden;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.purchase-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.17);
    color: #fff;
}

.purchase-hero {
    padding: 30px 28px 26px;
    text-align: left;
    background:
        radial-gradient(circle at top right, rgba(255, 210, 132, 0.36), transparent 36%),
        linear-gradient(135deg, #172033, #30446a);
    color: white;
}

.purchase-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.purchase-title {
    margin: 14px 0 8px;
    color: #fff;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
}

.purchase-faq-mark {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: #eef3ff;
    color: #5366ad;
    font-weight: 900;
}

.purchase-lead {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
}

.purchase-legal-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 14px 18px 12px;
    min-height: 18px;
    font-size: 11px;
    font-weight: 900;
}

.purchase-legal-row a {
    color: #8a6f52;
    font-size: 10px;
    text-decoration: underline;
}

.purchase-primary-link,
.purchase-secondary-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.purchase-primary-link {
    gap: 12px;
    margin: 0 18px 12px;
    padding: 15px;
    border-radius: 18px;
    background: linear-gradient(135deg, #5567d8, #7d8cf0);
    color: #fff;
    box-shadow: 0 18px 34px rgba(85, 103, 216, 0.27);
}

.purchase-link-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 20px;
}

.purchase-link-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: left;
}

.purchase-link-copy strong {
    font-size: 16px;
    font-weight: 900;
}

.purchase-link-copy small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 11px;
    font-weight: 700;
}

.purchase-secondary-link {
    gap: 9px;
    margin: 0 18px 9px;
    padding: 12px 13px;
    border-radius: 15px;
    background: #fff;
    font-size: 13px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(32, 43, 70, 0.07);
}

.purchase-secondary-link small {
    margin-left: auto;
    color: #7da58c;
    font-size: 10px;
    font-weight: 900;
}

.purchase-note-link {
    border: 1px solid #cdebd9;
    color: #15865c;
}

.purchase-qa-link {
    border: 1px solid #dde3ef;
    color: #5f6c83;
}

.purchase-promo-panel {
    margin: 16px 18px 18px;
    padding-top: 14px;
    border-top: 1px solid #e4eaf5;
}

.purchase-promo-title {
    margin-bottom: 8px;
    color: #546176;
    text-align: left;
    font-size: 12px;
    font-weight: 900;
}

.purchase-promo-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.purchase-promo-input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dbe2ee;
    border-radius: 12px;
    background: #fff;
    color: #26324a;
    font-size: 14px;
}

.purchase-promo-input:focus {
    outline: none;
    border-color: #9ca9f4;
    box-shadow: 0 0 0 3px rgba(85, 103, 216, 0.12);
}

.purchase-promo-btn {
    padding: 11px 14px;
    border: none;
    border-radius: 12px;
    background: #00a982;
    color: white;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
}

/* Learning Log Modal */
.learning-log-modal {
    background: rgba(14, 21, 38, 0.64) !important;
    backdrop-filter: blur(4px);
}

.learning-log-modal-content {
    width: min(430px, 94vw) !important;
    max-width: 94vw !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.62) !important;
    border-radius: 28px !important;
    background: #f7fbf5 !important;
    overflow: hidden;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.learning-log-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.17);
    color: #fff;
}

.learning-log-hero {
    padding: 28px 26px 22px;
    text-align: left;
    background:
        radial-gradient(circle at top right, rgba(248, 210, 103, 0.24), transparent 36%),
        linear-gradient(135deg, #19342d, #26745c);
    color: white;
}

.learning-log-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.learning-log-title {
    margin: 13px 0 5px;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.25;
    display: flex;
    align-items: center;
}

.learning-log-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.learning-log-diagnosis {
    margin: 14px 18px 0;
}

.learning-log-diagnosis:empty {
    min-height: 92px;
    border: 1px dashed #cfd9c9;
    border-radius: 22px;
    background: #fff;
}

.vocab-diagnosis-card {
    margin-bottom: 18px;
    padding: 18px 16px 15px;
    border: 1px solid #dce8d4;
    border-radius: 22px;
    background:
        radial-gradient(circle at top right, rgba(0, 169, 130, 0.08), transparent 38%),
        #fff;
    box-shadow: 0 14px 30px rgba(30, 68, 52, 0.08);
    text-align: center;
}

.vocab-diagnosis-card.is-locked {
    background:
        radial-gradient(circle at top right, rgba(85, 103, 216, 0.10), transparent 38%),
        #fff;
}

.vocab-diagnosis-label {
    margin-bottom: 5px;
    color: #6b8178;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.vocab-diagnosis-total {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    color: #243247;
    font-size: 30px;
    font-weight: 900;
    line-height: 1.2;
}

.vocab-diagnosis-total-text {
    display: inline-block;
}

.vocab-diagnosis-locked-total,
.vocab-diagnosis-locked-pill,
.vocab-diagnosis-small-lock {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 900;
}

.vocab-diagnosis-locked-total {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    color: #243247;
    font-size: 30px;
}

.vocab-diagnosis-blur {
    display: inline-block;
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}

.vocab-diagnosis-eiken-row {
    margin: 5px 0 11px;
}

.vocab-diagnosis-eiken,
.vocab-diagnosis-locked-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 8px 16px rgba(32, 43, 70, 0.08);
    font-size: 13px;
}

.vocab-diagnosis-eiken-gold {
    border: 1px solid #f1c40f;
    color: #9a7100;
}

.vocab-diagnosis-eiken-silver {
    border: 1px solid #bdc3c7;
    color: #66707a;
}

.vocab-diagnosis-eiken-bronze {
    border: 1px solid #e67e22;
    color: #a74d00;
}

.vocab-diagnosis-eiken-green {
    border: 1px solid #2ecc71;
    color: #16804b;
}

.vocab-diagnosis-eiken-blue {
    border: 1px solid #3498db;
    color: #1f6f9f;
}

.vocab-diagnosis-locked-pill {
    gap: 6px;
    border: 1px dashed #bfc8e8;
    background: #f5f7ff;
    color: #4f5fa8;
}

.vocab-diagnosis-lock-icon {
    font-size: 12px;
}

.vocab-diagnosis-breakdown {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.vocab-diagnosis-breakdown.is-locked {
    margin-top: 10px;
}

.vocab-diagnosis-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 6px 4px;
    border: 1px solid #dce6df;
    border-radius: 14px;
    background: #f9fcf8;
    color: #536a60;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.2;
}

.vocab-diagnosis-chip span {
    color: #82948c;
    font-size: 10px;
    letter-spacing: 0.04em;
}

.vocab-diagnosis-chip b {
    margin-top: 4px;
    color: #26324a;
    font-size: 11px;
}

.vocab-diagnosis-small-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef2ff;
    color: #5262ad;
    font-size: 10px;
}

.vocab-diagnosis-small-lock small {
    color: inherit;
    font-size: 9px;
    letter-spacing: 0;
}

.vocab-diagnosis-small-lock span {
    color: inherit;
    font-size: 10px;
    letter-spacing: 0;
}

.vocab-diagnosis-premium-notice {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    margin: 10px 0 8px;
    padding: 12px 13px;
    border: 1px solid #d8ddf6;
    border-radius: 16px;
    background: linear-gradient(135deg, #f5f7ff, #ffffff);
    color: #33405d;
    text-align: left;
    box-shadow: 0 10px 20px rgba(60, 76, 128, 0.08);
    cursor: pointer;
}

.vocab-diagnosis-premium-title {
    color: #33405d;
    font-size: 12px;
    font-weight: 900;
}

.vocab-diagnosis-premium-copy {
    color: #70809a;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
}

.vocab-diagnosis-premium-cta {
    align-self: flex-start;
    margin-top: 2px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #5567d8;
    color: #fff;
    font-size: 10px;
    font-weight: 900;
}

.vocab-diagnosis-note {
    margin-top: 10px;
    color: #8d9a94;
    text-align: right;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
}

/* Profile Modal */
.profile-modal {
    background: rgba(14, 21, 38, 0.64) !important;
    backdrop-filter: blur(4px);
}

.profile-modal-content {
    width: min(430px, 94vw) !important;
    max-width: 94vw !important;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.62) !important;
    border-radius: 28px !important;
    background: #f8fbff !important;
    overflow: hidden;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.profile-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.17);
    color: #fff;
}

.profile-hero {
    padding: 28px 26px 22px;
    text-align: left;
    background:
        radial-gradient(circle at top right, rgba(111, 230, 194, 0.22), transparent 36%),
        linear-gradient(135deg, #172033, #30446a);
    color: white;
}

.profile-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.profile-title {
    margin: 13px 0 5px;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.25;
}

.profile-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.profile-login-notice {
    margin: 14px 18px 0;
    padding: 12px 13px;
    border: 1px solid #ffe1bf;
    border-radius: 15px;
    background: #fff8ee;
    color: #95550f;
    text-align: left;
}

.profile-login-notice strong,
.profile-login-notice span {
    display: block;
}

.profile-login-notice strong {
    font-size: 12px;
    font-weight: 900;
}

.profile-login-notice span {
    margin-top: 4px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
}

.profile-user-card,
.profile-sync-card {
    margin: 14px 18px 0;
    padding: 18px;
    border: 1px solid #dfe6f2;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(30, 42, 68, 0.08);
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 82px;
    height: 82px;
    margin: 0 auto 11px;
    overflow: hidden;
    border: 4px solid #fff;
    border-radius: 50%;
    background: linear-gradient(135deg, #edf3ff, #e7fff7);
    box-shadow: 0 14px 28px rgba(30, 42, 68, 0.14);
}

.profile-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-initials {
    font-size: 32px;
}

.profile-user-name {
    color: #26324a;
    font-size: 18px;
    font-weight: 900;
}

.profile-user-email {
    margin: 4px 0 10px;
    color: #7a8498;
    font-size: 12px;
    font-weight: 700;
}

.profile-plan-tag {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    margin-bottom: 14px;
    padding: 5px 14px;
    border-radius: 999px;
    background: #95a5a6;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.profile-promo-form,
.profile-sync-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.profile-promo-form {
    margin-bottom: 12px;
}

.profile-promo-input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #dbe2ee;
    border-radius: 12px;
    background: #fff;
    color: #26324a;
    font-size: 13px;
}

.profile-promo-input:focus {
    outline: none;
    border-color: #9ca9f4;
    box-shadow: 0 0 0 3px rgba(85, 103, 216, 0.12);
}

.profile-promo-btn,
.profile-sync-save-btn,
.profile-sync-load-btn,
.profile-auth-btn,
.profile-purchase-btn {
    cursor: pointer;
    font-weight: 900;
}

.profile-promo-btn {
    padding: 11px 13px;
    border: none;
    border-radius: 12px;
    background: #00a982;
    color: white;
    font-size: 13px;
}

.profile-purchase-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    border: 1px solid #cfd7f2;
    border-radius: 14px;
    background: #f5f7ff;
    color: #4b5fc9;
    font-size: 13px;
}

.profile-sync-card {
    background: #eef4ff;
}

.profile-sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #26324a;
    font-size: 13px;
    font-weight: 900;
}

.profile-sync-header #profileLastSync {
    color: #6c7890;
    font-size: 11px;
}

.profile-sync-save-btn,
.profile-sync-load-btn {
    flex: 1;
    min-height: 38px;
    border-radius: 12px;
    font-size: 12px;
}

.profile-sync-save-btn {
    border: none;
    background: #5567d8;
    color: #fff;
}

.profile-sync-load-btn {
    border: 1px solid #c3cdf4;
    background: #fff;
    color: #4b5fc9;
}

.profile-sync-note {
    margin-top: 7px;
    color: #778299;
    text-align: center;
    font-size: 10px;
    font-weight: 700;
}

.profile-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 36px);
    min-height: 46px;
    margin: 16px 18px 0;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #5567d8, #7d8cf0);
    color: white;
    font-size: 14px;
}

.profile-auth-btn.profile-auth-logout {
    background: linear-gradient(135deg, #e2504b, #f27c72);
}

.profile-login-incentive {
    margin: 8px 18px 18px;
    color: #7d879a;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 420px) {
    #leaderboardModal.leaderboard-modal {
        padding: 10px;
    }

    #leaderboardModal .leaderboard-modal-content {
        width: min(420px, 96vw);
        max-height: calc(100vh - 20px);
        padding: 0 13px 13px !important;
        border-radius: 22px !important;
    }

    .leaderboard-hero {
        margin: 0 -13px 12px;
        padding: 22px 46px 17px 20px;
        border-radius: 22px 22px 0 0;
    }

    .leaderboard-title {
        margin-top: 10px;
        font-size: 22px;
    }

    .leaderboard-subtitle {
        font-size: 11px;
    }

    .leaderboard-state-card,
    .leaderboard-name-card {
        padding: 15px;
        border-radius: 17px;
    }

    .ranking-list {
        max-height: 360px;
    }

    .ranking-item {
        padding: 10px 11px;
        font-size: 13px;
    }

    .wordbook-modal {
        padding: 10px;
    }

    .wordbook-modal-content {
        width: min(420px, 96vw);
        max-height: calc(100vh - 20px);
        padding: 0 13px 13px !important;
        border-radius: 22px !important;
    }

    .wordbook-hero {
        margin: 0 -13px 12px;
        padding: 22px 46px 17px 20px;
        border-radius: 22px 22px 0 0;
    }

    .wordbook-title {
        margin-top: 10px;
        font-size: 22px;
    }

    .wordbook-subtitle {
        font-size: 11px;
    }

    .wordbook-card {
        min-height: 70px;
        padding: 11px 12px;
        gap: 10px;
        border-radius: 17px;
    }

    .wordbook-icon {
        width: 40px;
        height: 40px;
        border-radius: 13px;
        font-size: 22px;
    }

    .wordbook-copy strong {
        font-size: 14px;
    }

    .wordbook-badge {
        min-width: 42px;
        font-size: 10px;
    }

    .study-mode-modal {
        padding: 10px;
    }

    .study-mode-modal-content {
        width: min(420px, 96vw);
        max-height: calc(100vh - 20px);
        padding: 0 13px 13px !important;
        border-radius: 22px !important;
    }

    .study-mode-hero {
        margin: 0 -13px 12px;
        padding: 22px 46px 17px 20px;
        border-radius: 22px 22px 0 0;
    }

    .study-mode-title {
        margin-top: 10px;
        font-size: 22px;
    }

    .study-mode-subtitle {
        font-size: 11px;
    }

    .study-mode-guide {
        gap: 6px;
        margin-bottom: 10px;
    }

    .study-mode-guide span {
        min-height: 34px;
        padding: 8px 9px;
        font-size: 10px;
    }

    .study-mode-card {
        padding: 13px;
        margin-bottom: 10px;
        border-radius: 17px;
    }

    .study-mode-card-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    .study-mode-status-pill {
        padding: 3px 8px;
        font-size: 10px;
    }

    .study-review-level-chip,
    .study-pos-filter-container .pos-checkbox-item {
        min-height: 30px;
        padding: 6px 9px;
        font-size: 11px;
    }

    .help-redesign .help-list-container {
        grid-template-columns: 1fr;
    }

    .help-redesign .help-subheading {
        width: 100%;
    }
}

.header-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 200;
}

.file-info-small {
    font-size: 12px;
    color: #888;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* RPG Styles */
/* New Stats Position (Top Left) */
.stats-absolute {
    position: absolute;
    top: 15px;
    left: 20px;
    z-index: 100;
    transform: scale(0.8);
    transform-origin: top left;
}

/* RPG Stage (Now Inline in Header) */
.rpg-inline {
    position: relative;
    width: 140px;
    height: 100px;
    /* Keep the character clear of the top-left navigation cluster on desktop. */
    top: 53px;
    left: 40px;
}

.pixel-art {
    width: 50px;
    /* Reduced further to 50px to prevent clipping */
    height: 64px;
    background-image: url('assets/char_sprite.png?v=17');
    background-size: 300px 256px;
    /* Explicit size: 6 cols * 50px, 4 rows * 64px */
    image-rendering: pixelated;
    transform: scaleX(-1) scale(2.5);
    /* Flip horizontally to face Right, Scale 2.5 */
    transform-origin: center;
}

/* Frames: 0px to -300px via steps(6) */
@keyframes sprite-play {
    from {
        background-position-x: 0px;
    }

    to {
        background-position-x: -300px;
    }
}

/* Rows */
.anim-idle {
    background-position-y: 0px;
    animation: sprite-play 1.2s steps(6) infinite;
}

.anim-attack {
    background-position-y: -64px;
    /* 2nd Row */
    animation: sprite-play 0.8s steps(6) infinite;
    transform: scaleX(1) scale(2.5);
    /* Flip back to face opposite of Idle */
}

.anim-cheer {
    background-position-y: -128px;
    /* 3rd Row */
    animation: sprite-play 0.8s steps(6) infinite;
    transform: scaleX(1) scale(2.2);
    /* Flip back to face opposite of Idle */
}

.anim-slime {
    background-position-y: -192px;
    /* 4th Row */
    animation: sprite-play 0.8s steps(6) infinite;

    position: absolute;
    left: 80px;
    /* To the right of the hero */
    top: 20px;
    filter: hue-rotate(0deg);
}



.taking-damage {
    animation: flash 0.2s infinite;
}

@keyframes flash {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }

    100% {
        opacity: 1;
    }
}

/* Filter Compact Styles */
.pos-filter-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
    /* Allow scroll on very small screens, but aim for single line */
    white-space: nowrap;
}

.pos-filter-container.study-pos-filter-container {
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
}

.filter-label {
    font-weight: bold;
    font-size: 14px;
    color: #555;
    margin-right: 5px;
}

.pos-checkbox-item {
    font-size: 13px;
    /* Smaller font */
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    /* Tight gap between box and text */
}

/* --- MOBILE RESPONSIVE STYLES --- */
@media (max-width: 768px) {
    body {
        padding: 20px 0px;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 15px 10px;
        padding-top: 90px;
        margin: 0 auto;
    }

    .header-controls {
        gap: 5px !important;
    }

    .cards-area {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .card {
        width: 100%;
        min-height: 160px;
    }

    .card .card-content {
        font-size: 28px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        margin-top: 0px;
    }

    .header>div:last-child {
        width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: flex-start !important;
        position: relative;
    }

    .auto-mode-container {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: 8px;
        padding: 5px;
        gap: 5px;
        cursor: pointer;
        box-sizing: border-box;
        min-height: 40px;
    }

    #autoModeToggle {
        position: relative;
        left: 0;
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        min-width: 150px;
        margin-top: 10px;
        margin-left: 0;
        margin-right: 5px;
    }

    .mode-btn {
        flex: unset;
        width: auto;
        min-width: unset;
        height: 50px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }

    .mode-count {
        font-size: 11px;
    }

    .rpg-inline {
        position: absolute;
        bottom: -20px;
        right: auto;
        top: auto;
        left: 30px;
        transform: scale(0.8);
        transform-origin: bottom left;
        margin-bottom: 0;
        z-index: 50;
        pointer-events: none;
    }

    .stats-absolute {
        transform: scale(0.85);
        top: 10px;
        left: 10px;
        transform-origin: top left;
        z-index: 100;
        width: auto;
    }

    .level-selector {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 3px;
        padding-right: 0px;
        overflow-x: auto;
        padding-bottom: 5px;
        position: absolute;
        top: 70px;
        right: 5px;
        width: auto;
        max-width: 100%;
        margin: 0;
    }

    .level-selector .level-btn {
        padding: 4px 8px;
        font-size: 11px;
        white-space: nowrap;
        min-width: unset;
    }

    .container {
        width: 95%;
        padding: 15px;
        padding-top: 95px;
        margin: 0 auto;
    }

    .level-selector .level-btn,
    .level-selector .wordbook-opener-btn {
        padding: 3px 6px;
        font-size: 10px;
        white-space: nowrap;
        min-width: unset;
    }

    .level-selector .wordbook-opener-btn {
        padding-left: 2px;
        padding-right: 2px;
    }

    .header {
        margin-bottom: 5px;
    }

    .pos-filter-container {
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }

    .simple-switch-container {
        position: absolute !important;
        top: 5px !important;
        left: 10px !important;
    }

}

/* Trial Overlay Styles */
.trial-overlay {
    position: fixed;
    top: 0;
    /* Added top:0 to ensure full coverage */
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 20px;
}

.trial-content {
    background: #2d3436;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: 400px;
}

.trial-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #ff7675;
    font-weight: bold;
}

.trial-message {
    margin-bottom: 30px;
    line-height: 1.6;
    color: #dfe6e9;
}

.unlock-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #636e72;
    background: #b2bec3;
    color: #2d3436;
    font-size: 16px;
    text-align: center;
}

.unlock-btn {
    background: #0984e3;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.unlock-btn:hover {
    background: #74b9ff;
}

.trial-links {
    margin-top: 20px;
    font-size: 14px;
    color: #b2bec3;
}

.trial-links a {
    color: #74b9ff;
    text-decoration: none;
}

/* Trial Timer UI */
.trial-timer {
    font-size: 14px;
    color: #ff7675;
    font-weight: bold;
    background: rgba(255, 118, 117, 0.1);
    padding: 5px 10px;
    border-radius: 12px;
    border: 1px solid #ff7675;
    display: none;
    /* Hidden by default, shown if trial is active */
    white-space: nowrap;
    pointer-events: none;
}

@media (max-width: 768px) {
    .trial-timer {
        font-size: 12px;
        /* reduced from 14px (~15% smaller) */
        padding: 4px 8px;
        /* slightly tighter padding */
    }
}

/* Character Level "Chocon" Display */
.char-level-display {
    position: absolute;
    top: -20px;
    /* Float above */
    right: 0px;
    /* Centered visually above right-aligned character */
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    color: #667eea;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 10;
    white-space: nowrap;
    pointer-events: none;
    /* Animation for cute float */
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}


/* Leaderboard Styles */
.ranking-btn {
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    border: 1px solid #e67e22;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 10px;
    /* Adjusted to 10px */
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center text */
    width: 102px;
    /* Fixed width */
    box-sizing: border-box;
    gap: 5px;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    transition: all 0.2s;
}

.ranking-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.leaderboard-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid #e5e9f5;
    border-radius: 14px;
    background: #f6f8fd;
}

.lb-tab {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    color: #8a92a6;
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.lb-tab.active {
    color: #2f3a52;
    background: #fff;
    box-shadow: 0 8px 18px rgba(47, 62, 112, 0.12);
}

.ranking-list {
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    padding-right: 4px;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    padding: 12px 13px;
    margin-bottom: 8px;
    border: 1px solid #edf0f7;
    border-radius: 14px;
    background: #fff;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(47, 62, 112, 0.05);
}

.ranking-item.is-me {
    background: linear-gradient(135deg, #eef3ff, #ffffff);
    border-color: #bdc9ff;
    font-weight: bold;
}

.rank-num {
    display: inline-grid;
    place-items: center;
    min-width: 32px;
    height: 32px;
    border-radius: 11px;
    background: #f2f5fb;
    font-weight: bold;
    color: #556179;
}

.rank-num.top3 {
    color: #8a5b00;
    background: #fff2cc;
    font-size: 15px;
}

.rank-name {
    flex: 1;
    color: #2f3a52;
    font-weight: 750;
}

#leaderboardModal.leaderboard-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 202, 79, 0.2), transparent 30%),
        linear-gradient(135deg, rgba(18, 28, 50, 0.78), rgba(88, 61, 96, 0.7));
    backdrop-filter: blur(5px);
}

#leaderboardModal .leaderboard-modal-content {
    position: relative;
    width: min(520px, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: 0 18px 18px !important;
    border: 1px solid rgba(255, 255, 255, 0.74) !important;
    border-radius: 28px !important;
    background: #f8fbff !important;
    text-align: left !important;
    box-shadow: 0 30px 86px rgba(16, 25, 45, 0.34) !important;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 12px;
    background: #f2f4f8;
    color: #788195;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.modal-close-btn:hover {
    background: #e9edf5;
    color: #2f3a52;
}

.subtle-action-btn {
    position: absolute;
    top: 15px;
    left: 15px;
    border: 1px solid #dbe1ef;
    border-radius: 999px;
    padding: 5px 10px;
    background: #fff;
    color: #68738a;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(47, 62, 112, 0.08);
}

.leaderboard-close-btn {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.leaderboard-rename-btn {
    top: 14px;
    left: auto;
    right: 58px;
    z-index: 2;
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.92);
    color: #4d5ec6;
}

.leaderboard-hero {
    margin: 0 -18px 16px;
    padding: 28px 52px 22px 26px;
    border-radius: 28px 28px 0 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 36%),
        linear-gradient(135deg, #242b45, #5a66c9);
    color: #fff;
}

.leaderboard-kicker {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.84);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.leaderboard-title {
    margin: 13px 0 5px;
    color: #fff;
    font-size: 25px;
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.leaderboard-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.leaderboard-state-card,
.leaderboard-name-card {
    padding: 18px;
    border: 1px solid #dfe6f2;
    border-radius: 20px;
    background: #fff;
    text-align: center;
    box-shadow: 0 12px 26px rgba(30, 42, 68, 0.07);
}

.leaderboard-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
    border-radius: 17px;
    background: #f1f4ff;
    font-size: 26px;
}

.leaderboard-state-title {
    color: #26324a;
    font-size: 16px;
    font-weight: 900;
}

.leaderboard-version {
    margin: 7px 0 0;
    color: #8a92a6;
    font-size: 11px;
    font-weight: 800;
}

.leaderboard-state-copy {
    margin: 9px auto 16px;
    color: #7d879a;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.6;
}

.leaderboard-login-btn {
    min-width: 160px;
}

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

.leaderboard-loading {
    padding: 16px;
    color: #8a92a6;
    font-size: 12px;
    font-weight: 800;
}

.leaderboard-name-input {
    width: min(260px, 100%);
    margin-top: 4px;
}

.leaderboard-name-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

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

.primary-action-btn {
    background: linear-gradient(135deg, #5567d8, #6c7df0);
    color: white;
    box-shadow: 0 10px 22px rgba(85, 103, 216, 0.22);
}

.secondary-action-btn {
    margin-left: 8px;
    background: #eef1f7;
    color: #657086;
}

.soft-input {
    padding: 11px 12px;
    border: 1px solid #dfe5f2;
    border-radius: 12px;
    width: 72%;
    text-align: center;
    background: #fbfcff;
    color: #2f3a52;
    font-weight: 700;
}

.rank-score {
    font-weight: bold;
    color: #667eea;
}

/* WELCOME LP STYLES */
.welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 20000;
    /* Highest priority */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 20px;
}

.welcome-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease-out;
}

.welcome-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

.welcome-title {
    font-size: 28px;
    font-weight: 900;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.welcome-desc {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
    opacity: 0.9;
}

.welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.install-btn {
    background: #fff;
    color: #667eea;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.install-btn:hover {
    transform: scale(1.02);
    background: #f8f9fa;
}

.browser-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.browser-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.divider {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 10px;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.invite-message {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 215, 0, 0.5);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



@media (max-width: 768px) {
    .pc-only {
        display: none !important;
    }
}

/* Mobile app-canvas: keep the rich brand header without wasting space on an outer frame. */
@media (max-width: 768px) {
    body {
        align-items: stretch;
        padding: 0;
        background: #f8faff;
    }

    .container {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        margin: 0;
        padding: 12px 8px calc(16px + env(safe-area-inset-bottom));
        padding-top: calc(78px + env(safe-area-inset-top));
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        overflow-x: hidden;
    }

    .container::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 212px;
        pointer-events: none;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 42%),
            linear-gradient(140deg, #4f46c7 0%, #6d5cc7 56%, #7b69c7 100%);
        z-index: 0;
    }

    .container::after {
        content: "";
        position: absolute;
        top: 188px;
        left: 0;
        right: 0;
        bottom: 0;
        pointer-events: none;
        border-radius: 0;
        background:
            linear-gradient(180deg, rgba(248, 250, 255, 0.98), #ffffff 36%);
        box-shadow: 0 -10px 30px rgba(34, 41, 92, 0.1);
        z-index: 0;
    }

    .header,
    #reviewProgressWrap,
    .cards-area,
    .example-area {
        position: relative;
        z-index: 1;
    }

    .simple-switch-container,
    .header-controls,
    .level-current-btn,
    .level-selector {
        z-index: 2;
    }

    .simple-switch-container {
        top: calc(8px + env(safe-area-inset-top)) !important;
        left: 8px !important;
    }

    .other-menu-caption {
        color: rgba(255, 255, 255, 0.88);
        text-shadow: 0 1px 4px rgba(41, 42, 92, 0.28);
    }

    .header-controls {
        top: calc(8px + env(safe-area-inset-top));
        right: 8px;
    }

    .icon-btn,
    .other-menu-button,
    .header-profile-icon {
        border-color: rgba(255, 255, 255, 0.8);
        background: rgba(255, 255, 255, 0.86);
        box-shadow: 0 12px 24px rgba(34, 38, 96, 0.22);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .trial-timer {
        background: rgba(255, 255, 255, 0.84);
        box-shadow: 0 10px 20px rgba(146, 42, 90, 0.16);
    }

    .level-selector {
        display: none;
        position: absolute;
        top: calc(54px + env(safe-area-inset-top));
        right: 10px;
        left: 10px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: auto;
        max-width: none;
        margin: 0;
        padding: 10px;
        border: 1px solid rgba(255, 255, 255, 0.72);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 18px 38px rgba(28, 33, 83, 0.22);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        mask-image: none;
        -webkit-mask-image: none;
    }

    .level-selector .level-btn,
    .level-selector .wordbook-opener-btn {
        justify-content: center;
        min-height: 38px;
        border: 1px solid rgba(101, 116, 233, 0.18);
        background: rgba(248, 250, 255, 0.94);
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .level-selector .level-btn.active,
    .level-selector .wordbook-opener-btn.active {
        border-color: rgba(102, 126, 234, 0.5);
        background: #7165ea;
        color: #ffffff;
        box-shadow: 0 10px 20px rgba(102, 126, 234, 0.24);
    }

    body.level-selector-open .level-selector {
        display: grid;
    }

    .level-current-btn {
        display: inline-flex;
        position: absolute;
        top: calc(14px + env(safe-area-inset-top));
        left: 62px;
        align-items: center;
        gap: 6px;
        min-height: 28px;
        max-width: 72px;
        padding: 4px 10px;
        border: 1px solid rgba(255, 255, 255, 0.74);
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.88);
        color: #4a4f86;
        font-size: 11px;
        font-weight: 900;
        white-space: nowrap;
        box-shadow: 0 9px 20px rgba(34, 38, 96, 0.17);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        cursor: pointer;
    }

    .level-current-caret {
        color: #7a85d9;
        font-size: 10px;
        line-height: 1;
    }

    .header {
        min-height: 101px;
        margin: 2px 0 0;
        padding: 0 0 4px;
    }

    .rpg-inline {
        left: 30px;
        bottom: -5px;
    }

    .header>div:last-child {
        align-items: stretch !important;
    }

    .right-controls-container {
        width: min(176px, 48vw) !important;
        align-self: flex-end !important;
    }

    .mode-buttons {
        gap: 8px;
        margin: 4px 0 0;
        transform: translateY(-10px);
    }

    .mode-btn {
        height: 50px;
        border-radius: 14px;
        box-shadow: 0 12px 24px rgba(31, 36, 90, 0.16);
    }

    #reviewProgressWrap {
        margin: 14px 0 10px !important;
    }

    .cards-area {
        gap: 16px;
        margin-top: -8px;
        margin-bottom: 16px;
    }

    .card {
        min-height: 162px;
        border: 1px solid rgba(205, 216, 238, 0.98);
        border-radius: 24px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 252, 255, 0.96));
        box-shadow:
            0 20px 42px rgba(35, 48, 78, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
    }

    .card-label {
        top: 14px;
        padding: 0 10px;
        border-radius: 999px;
        background: rgba(239, 244, 255, 0.88);
        color: #6174e9;
        font-size: 13px;
    }

    .card-content {
        color: #202839;
    }

    .word-ipa {
        color: #536388;
    }

    .example-area {
        border-width: 1px;
        border-radius: 18px;
        background:
            linear-gradient(135deg, #fff8dd, #fffdf4);
        box-shadow: 0 12px 26px rgba(143, 111, 0, 0.08);
    }

    .example-text {
        min-width: 0;
    }

    .speaker-btn {
        box-shadow: 0 8px 18px rgba(102, 126, 234, 0.2);
    }

    .undo-btn {
        position: static;
        flex-shrink: 0;
        align-self: center;
        min-width: 70px;
        border-radius: 10px;
        background: rgba(248, 250, 252, 0.82);
        box-shadow: 0 8px 18px rgba(30, 41, 59, 0.08);
    }

}

@media (max-width: 360px) {
    .right-controls-container {
        width: 164px !important;
    }

    .mode-buttons {
        gap: 6px;
    }

    .mode-btn {
        height: 48px;
        font-size: 11px;
    }

}
