@layer utilities {
    .content-auto { content-visibility: auto; }
    .block-shadow { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
    .game-grid { touch-action: none; }
    .line-path { pointer-events: none; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --viewport-width: 100vw;
    --viewport-height: 100dvh;
    --app-width: min(448px, 100vw);
    --app-height: 100dvh;
    --game-scale: 1;
    --island-parchment: #f7f3df;
    --island-ink: #725d42;
    --island-teal: #82d5bb;
    --island-yellow: #f7cd67;
    --island-orange: #e59266;
    --island-pink: #f8a6b2;
    --island-blue: #889df0;
    --island-green: #8ac68a;
    --island-shadow: rgba(114, 93, 66, 0.24);
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9) 0 5%, transparent 6%),
        radial-gradient(circle at 88% 14%, rgba(255, 255, 255, 0.62) 0 7%, transparent 8%),
        linear-gradient(180deg, #9be7e2 0%, #a9e5c5 46%, #f6d895 100%);
    font-family: 'Nunito', 'Zen Maru Gothic', 'Noto Sans SC', '微軟正黑體', sans-serif;
    overflow: hidden;
    width: 100vw;
    height: var(--viewport-height);
    min-height: var(--viewport-height);
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: max(0px, env(safe-area-inset-top));
    transition: background-color 0.28s ease;
}

.game-app {
    width: min(var(--app-width), 100vw);
    height: min(var(--app-height), var(--viewport-height));
    min-height: 0;
    max-width: 100vw;
    max-height: var(--viewport-height);
    margin: 0 auto;
    overflow: hidden;
    transform-origin: top center;
    box-shadow: 0 calc(18px * var(--game-scale)) calc(42px * var(--game-scale)) rgba(75, 89, 72, 0.28);
}

.animal-island-shell {
    position: relative;
    isolation: isolate;
    border-radius: 0 0 calc(30px * var(--game-scale)) calc(30px * var(--game-scale));
    background:
        radial-gradient(circle at 18% 10%, rgba(255, 255, 255, 0.8), transparent 18%),
        radial-gradient(circle at 84% 18%, rgba(247, 205, 103, 0.36), transparent 24%),
        linear-gradient(180deg, #b9efe5 0%, #e7f4bf 42%, #f7f3df 100%) !important;
    color: var(--island-ink);
}

.animal-island-shell::before {
    content: '';
    position: absolute;
    inset: calc(10px * var(--game-scale));
    z-index: -2;
    border-radius: calc(28px * var(--game-scale));
    border: calc(3px * var(--game-scale)) solid rgba(255, 255, 255, 0.72);
    pointer-events: none;
}

.animal-island-shell::after {
    content: '';
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: -2%;
    height: 24%;
    z-index: -1;
    background:
        radial-gradient(ellipse at 18% 100%, #8ac68a 0 34%, transparent 35%),
        radial-gradient(ellipse at 52% 100%, #82d5bb 0 38%, transparent 39%),
        radial-gradient(ellipse at 88% 100%, #d1da49 0 32%, transparent 33%);
    opacity: 0.48;
    pointer-events: none;
}

.island-sky-decor {
    position: absolute;
    z-index: 0;
    pointer-events: none;
}

.island-sky-cloud {
    width: calc(76px * var(--game-scale));
    height: calc(28px * var(--game-scale));
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    filter: drop-shadow(0 calc(4px * var(--game-scale)) calc(5px * var(--game-scale)) rgba(114, 93, 66, 0.08));
    animation: islandCloudFloat 9s ease-in-out infinite;
}

.island-sky-cloud::before,
.island-sky-cloud::after {
    content: '';
    position: absolute;
    bottom: 30%;
    border-radius: 999px;
    background: inherit;
}

.island-sky-cloud::before {
    left: 16%;
    width: 36%;
    height: 110%;
}

.island-sky-cloud::after {
    right: 14%;
    width: 42%;
    height: 140%;
}

.cloud-a { top: 9%; left: 5%; }
.cloud-b { top: 19%; right: 3%; transform: scale(0.72); animation-delay: -3.5s; }

.island-leaf {
    font-size: calc(24px * var(--game-scale));
    opacity: 0.7;
    animation: islandLeafDrift 5.8s ease-in-out infinite;
}

.leaf-a { top: 15%; left: 10%; animation-delay: -1s; }
.leaf-b { top: 30%; right: 9%; animation-delay: -3s; }

.game-board-area {
    padding: calc(12px * var(--game-scale)) !important;
    min-height: 0;
    z-index: 1;
}

#gameContainer {
    padding: calc(16px * var(--game-scale));
    border-radius: calc(28px * var(--game-scale));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(247, 243, 223, 0.76)),
        repeating-linear-gradient(45deg, rgba(114, 93, 66, 0.05) 0 8px, transparent 8px 16px);
    border: calc(3px * var(--game-scale)) solid rgba(255, 255, 255, 0.72);
    box-shadow:
        0 calc(14px * var(--game-scale)) 0 rgba(114, 93, 66, 0.2),
        0 calc(22px * var(--game-scale)) calc(34px * var(--game-scale)) rgba(114, 93, 66, 0.2),
        inset 0 0 0 calc(2px * var(--game-scale)) rgba(247, 205, 103, 0.34);
}

.game-footer {
    padding-top: calc(16px * var(--game-scale)) !important;
    padding-bottom: max(calc(16px * var(--game-scale)), env(safe-area-inset-bottom)) !important;
    font-size: calc(14px * var(--game-scale)) !important;
}

body.theme-aqua {
    background-color: #36C2C2;
}

body.theme-aqua .bg-game-bg {
    background-color: #36C2C2;
}

body.theme-senior {
    background-color: #F3E7D3;
}

body.theme-senior .bg-game-bg {
    background: linear-gradient(180deg, #F8EEDC 0%, #E9D7B8 100%);
}

body.theme-game {
    background:
        radial-gradient(circle at 18% 8%, rgba(228, 180, 88, 0.18), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(35, 180, 155, 0.2), transparent 32%),
        linear-gradient(160deg, #081A22 0%, #12372F 48%, #1E2A20 100%);
}

body.theme-game .bg-game-bg {
    background:
        linear-gradient(180deg, rgba(5, 18, 25, 0.86) 0%, rgba(14, 54, 47, 0.88) 58%, rgba(31, 41, 27, 0.92) 100%),
        radial-gradient(circle at 50% 4%, rgba(244, 201, 119, 0.14), transparent 35%);
}

.word-block {
    background:
        radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.82), transparent 28%),
        linear-gradient(145deg, color-mix(in srgb, var(--block-color, #82d5bb) 72%, #fff 28%), var(--block-color, #82d5bb));
    color: #5b4630;
    transition: transform 0.15s ease, opacity 0.15s ease, top 0.3s ease, left 0.3s ease, background-color 0.24s ease, color 0.24s ease, box-shadow 0.24s ease, filter 0.24s ease;
    will-change: transform, opacity;
    cursor: pointer;
    user-select: none;
    contain: layout paint style;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62);
    border-radius: calc(18px * var(--game-scale)) !important;
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.7);
    border-bottom: calc(7px * var(--game-scale)) solid rgba(114, 93, 66, 0.22);
    box-shadow:
        0 calc(8px * var(--game-scale)) 0 rgba(114, 93, 66, 0.18),
        0 calc(14px * var(--game-scale)) calc(22px * var(--game-scale)) rgba(114, 93, 66, 0.2),
        inset 0 calc(2px * var(--game-scale)) 0 rgba(255, 255, 255, 0.7);
}

.word-block:hover {
    filter: saturate(1.08) brightness(1.03);
    transform: translateY(calc(-2px * var(--game-scale)));
}

body.theme-aqua .word-block {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #fff;
    color: #333;
    border: none;
    border-bottom: 4px solid rgba(0, 0, 0, 0.18);
    font-family: 'PingFang SC', '蘋方-簡', 'Microsoft YaHei', '微軟正黑體', sans-serif;
    text-shadow: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.12), inset 0 -2px 4px rgba(0, 0, 0, 0.08);
}

.word-block.selected {
    transform: translateY(calc(-4px * var(--game-scale))) scale(1.12) rotate(-1deg);
    z-index: 10;
    box-shadow:
        0 calc(10px * var(--game-scale)) 0 rgba(114, 93, 66, 0.2),
        0 0 0 calc(5px * var(--game-scale)) rgba(247, 205, 103, 0.72),
        0 0 calc(22px * var(--game-scale)) rgba(130, 213, 187, 0.68),
        inset 0 calc(2px * var(--game-scale)) 0 rgba(255, 255, 255, 0.86);
}

body.theme-aqua .word-block.selected {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.24), 0 0 0 4px rgba(255, 255, 255, 0.95), inset 0 -2px 4px rgba(0, 0, 0, 0.08);
}

body.theme-senior .word-block {
    background: #FFF8EA;
    color: #2F2A22;
    border-radius: 8px;
    border: 2px solid rgba(121, 85, 43, 0.22);
    border-bottom: 5px solid rgba(121, 85, 43, 0.32);
    font-family: 'PingFang SC', 'Microsoft YaHei', '微軟正黑體', sans-serif;
    font-weight: 900;
    text-shadow: none;
    box-shadow: 0 8px 18px rgba(91, 64, 32, 0.18), 0 3px 6px rgba(91, 64, 32, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.theme-senior .word-block.selected {
    box-shadow: 0 8px 18px rgba(91, 64, 32, 0.22), 0 0 0 4px rgba(211, 143, 48, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

body.theme-game .word-block {
    background: linear-gradient(145deg, #F7E8BE 0%, #E8C872 48%, #C99034 100%);
    color: #14221D;
    border-radius: 10px;
    border: 1px solid rgba(255, 236, 174, 0.74);
    border-bottom: 5px solid rgba(103, 72, 25, 0.52);
    font-family: 'PingFang SC', 'Noto Serif TC', 'Microsoft YaHei', '微軟正黑體', sans-serif;
    font-weight: 900;
    text-shadow: 0 1px 0 rgba(255, 248, 221, 0.64);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(243, 205, 121, 0.18), inset 0 1px 0 rgba(255, 252, 235, 0.78), inset 0 -4px 8px rgba(89, 57, 17, 0.16);
}

body.theme-game .word-block.selected {
    transform: scale(1.15);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.34), 0 0 0 4px rgba(255, 215, 128, 0.82), 0 0 18px rgba(54, 211, 178, 0.46), inset 0 1px 0 rgba(255, 252, 235, 0.86);
}

.word-block.matching {
    animation: matchPulse 0.4s ease forwards;
}

@keyframes matchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); opacity: 0; }
}

.sentence-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: calc(12px * var(--game-scale)) calc(24px * var(--game-scale));
    border-radius: calc(12px * var(--game-scale));
    font-size: calc(18px * var(--game-scale));
    z-index: 999;
    animation: sentencePop 1.2s ease forwards;
    white-space: nowrap;
}

@keyframes sentencePop {
    0% { opacity: 0; transform: translate(-50%, -60%); }
    30% { opacity: 1; transform: translate(-50%, -50%); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

.firework-particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1000;
    animation: explode 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes explode {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; }
}

.star-particle {
    position: absolute;
    font-size: calc(24px * var(--game-scale));
    pointer-events: none;
    z-index: 1000;
    transition: all 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
    text-shadow: 0 0 5px rgba(255,255,0,0.8);
}

.theme-toggle-button {
    position: fixed;
    left: max(calc(14px * var(--game-scale)), env(safe-area-inset-left));
    bottom: max(calc(14px * var(--game-scale)), env(safe-area-inset-bottom));
    z-index: 1200;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: calc(9px * var(--game-scale)) calc(14px * var(--game-scale));
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    font-size: calc(14px * var(--game-scale));
    font-weight: 900;
    letter-spacing: 1px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(8px);
}

.theme-toggle-button:active {
    transform: scale(0.96);
}

body.theme-aqua .theme-toggle-button {
    background: rgba(255, 255, 255, 0.92);
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.32);
    box-shadow: 0 8px 18px rgba(0, 82, 82, 0.24);
}

body.theme-senior .theme-toggle-button {
    background: #6F4E2E;
    color: #FFF8EA;
    border-color: rgba(255, 248, 234, 0.78);
    box-shadow: 0 8px 18px rgba(91, 64, 32, 0.28);
}

body.theme-game .theme-toggle-button {
    background: linear-gradient(135deg, rgba(12, 45, 39, 0.94), rgba(188, 126, 35, 0.92));
    color: #FFF5CF;
    border-color: rgba(255, 224, 147, 0.76);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34), 0 0 16px rgba(215, 166, 73, 0.22);
}

body.theme-aqua .status-bar,
body.theme-aqua .progress-panel {
    background: rgba(0, 0, 0, 0.18) !important;
}

body.theme-senior .status-bar,
body.theme-senior .progress-panel {
    background: rgba(111, 78, 46, 0.16) !important;
    border-color: rgba(111, 78, 46, 0.22);
}

body.theme-game .status-bar,
body.theme-game .progress-panel {
    background: rgba(4, 16, 20, 0.42) !important;
    border-color: rgba(236, 195, 105, 0.22);
    box-shadow: inset 0 -1px 0 rgba(255, 232, 164, 0.08);
}

body.theme-senior .status-left,
body.theme-senior .status-score-label,
body.theme-senior .progress-header {
    color: #5F452C;
}

body.theme-senior .status-timer,
body.theme-senior .status-score-value {
    color: #2F2A22;
}

body.theme-game .status-left,
body.theme-game .status-score-label,
body.theme-game .progress-header {
    color: #BFECE1;
}

body.theme-game .status-timer,
body.theme-game .status-score-value {
    color: #FFE7A3;
    text-shadow: 0 0 10px rgba(244, 201, 119, 0.3);
}

body.theme-senior .task-progress-bar {
    background: rgba(111, 78, 46, 0.18);
    box-shadow: inset 0 1px 3px rgba(91, 64, 32, 0.18);
}

body.theme-senior .task-progress-fill {
    background: linear-gradient(90deg, #8C6B3F, #D89A3A);
}

body.theme-game .task-progress-bar {
    background: rgba(3, 15, 18, 0.52);
    border: 1px solid rgba(236, 195, 105, 0.18);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.52), 0 0 12px rgba(22, 163, 144, 0.12);
}

body.theme-game .task-progress-fill {
    background: linear-gradient(90deg, #2DD4BF, #F0C66E, #F59E0B);
    box-shadow: 0 0 14px rgba(240, 198, 110, 0.36);
}

body.theme-aqua .text-gray-500 {
    color: rgba(255, 255, 255, 0.78) !important;
}

body.theme-senior .text-gray-500 {
    color: #6F4E2E !important;
}

body.theme-game .text-gray-500 {
    color: rgba(210, 238, 231, 0.78) !important;
}

.game-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    z-index: 2000;
    padding: calc(16px * var(--game-scale));
}

.game-modal.hidden {
    display: none;
}

.game-modal-card {
    width: min(calc(360px * var(--game-scale)), 100%);
    max-width: calc(360px * var(--game-scale));
    border-radius: calc(18px * var(--game-scale));
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(10, 10, 10, 0.95);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
    color: #fff;
    padding: calc(22px * var(--game-scale));
    text-align: center;
}

.error-text {
    color: #ff7675;
    line-height: 1.7;
}

.task-modal-card {
    max-width: calc(388px * var(--game-scale));
    max-height: calc(var(--viewport-height) - calc(32px * var(--game-scale)));
    overflow-y: auto;
    padding: calc(20px * var(--game-scale));
    text-align: left;
}

.task-modal-kicker {
    color: #9ca3af;
    font-size: calc(13px * var(--game-scale));
    text-align: center;
    margin-bottom: calc(4px * var(--game-scale));
}

.task-modal-title {
    color: #fff;
    font-weight: 800;
    font-size: calc(24px * var(--game-scale));
    text-align: center;
    margin-bottom: calc(14px * var(--game-scale));
    letter-spacing: 1px;
}

.task-main-card {
    border-radius: calc(14px * var(--game-scale));
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: calc(14px * var(--game-scale));
    margin-bottom: calc(14px * var(--game-scale));
}

.task-main-label {
    color: #facc15;
    font-size: calc(15px * var(--game-scale));
    font-weight: 800;
    margin-bottom: calc(6px * var(--game-scale));
}

.task-main-desc {
    color: #fff;
    font-size: calc(15px * var(--game-scale));
    line-height: 1.55;
}

.result-modal-card {
    width: min(calc(430px * var(--game-scale)), calc(100vw - calc(24px * var(--game-scale))));
    max-width: calc(430px * var(--game-scale));
    padding: calc(24px * var(--game-scale));
}

.result-modal-title {
    font-size: calc(28px * var(--game-scale));
    margin-bottom: calc(18px * var(--game-scale));
}

.result-summary-card {
    padding: calc(16px * var(--game-scale));
    margin-bottom: calc(18px * var(--game-scale));
    background: radial-gradient(circle at top left, rgba(45, 212, 191, 0.18), transparent 42%), rgba(255, 255, 255, 0.085);
}

.result-summary-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(28px * var(--game-scale));
    margin-bottom: calc(12px * var(--game-scale));
    font-size: calc(17px * var(--game-scale));
    text-align: center;
}

.result-stat-list {
    display: flex;
    flex-direction: column;
    gap: calc(10px * var(--game-scale));
}

.result-stat-row {
    display: grid;
    grid-template-columns: calc(42px * var(--game-scale)) 1fr auto;
    align-items: center;
    gap: calc(10px * var(--game-scale));
    padding: calc(11px * var(--game-scale));
    border-radius: calc(14px * var(--game-scale));
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(15, 23, 42, 0.48);
}

.result-stat-icon {
    width: calc(42px * var(--game-scale));
    height: calc(42px * var(--game-scale));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(13px * var(--game-scale));
    color: #111827;
    background: linear-gradient(135deg, #2dd4bf, #facc15);
    box-shadow: 0 0 14px rgba(45, 212, 191, 0.24);
    font-size: calc(17px * var(--game-scale));
}

.result-stat-main {
    min-width: 0;
}

.result-stat-label,
.result-stat-hint {
    display: block;
}

.result-stat-label {
    color: #fff;
    font-size: calc(15px * var(--game-scale));
    font-weight: 800;
    line-height: 1.25;
}

.result-stat-hint {
    margin-top: calc(3px * var(--game-scale));
    color: rgba(209, 213, 219, 0.82);
    font-size: calc(11px * var(--game-scale));
    line-height: 1.25;
}

.result-stat-value {
    color: #fde68a;
    font-size: calc(20px * var(--game-scale));
    font-weight: 900;
    white-space: nowrap;
    text-align: right;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.22);
}

.task-main-source,
.task-source {
    color: #9ca3af;
    font-size: calc(11px * var(--game-scale));
    margin-top: calc(5px * var(--game-scale));
}

.task-special-title {
    color: #d1d5db;
    font-size: calc(13px * var(--game-scale));
    margin: calc(6px * var(--game-scale)) 0 calc(8px * var(--game-scale));
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: calc(8px * var(--game-scale));
}

.task-item {
    display: flex;
    align-items: stretch;
    gap: calc(10px * var(--game-scale));
    border-radius: calc(13px * var(--game-scale));
    padding: calc(10px * var(--game-scale));
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
}

.task-item.task-blue {
    border-color: rgba(96, 165, 250, 0.56);
    box-shadow: inset 3px 0 0 #3b82f6;
}

.task-item.task-orange {
    border-color: rgba(251, 146, 60, 0.58);
    box-shadow: inset 3px 0 0 #f97316;
}

.task-item.task-red {
    border-color: rgba(248, 113, 113, 0.72);
    box-shadow: inset 3px 0 0 #ef4444;
}

.task-index {
    width: calc(24px * var(--game-scale));
    height: calc(24px * var(--game-scale));
    flex: 0 0 calc(24px * var(--game-scale));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-weight: 800;
    font-size: calc(12px * var(--game-scale));
    margin-left: calc(2px * var(--game-scale));
}

.task-content {
    min-width: 0;
}

.task-title {
    color: #fff;
    font-weight: 800;
    font-size: calc(14px * var(--game-scale));
    margin-bottom: calc(3px * var(--game-scale));
}

.task-desc {
    color: #e5e7eb;
    font-size: calc(13px * var(--game-scale));
    line-height: 1.45;
}

.task-start-button,
.task-secondary-button {
    width: 100%;
    margin-top: calc(16px * var(--game-scale));
    border: none;
    border-radius: 999px;
    padding: calc(12px * var(--game-scale)) calc(16px * var(--game-scale));
    font-weight: 900;
    font-size: calc(15px * var(--game-scale));
}

.task-start-button {
    background: linear-gradient(135deg, #facc15, #f97316);
    color: #111827;
    box-shadow: 0 8px 18px rgba(249, 115, 22, 0.28);
}

.task-secondary-button {
    margin-top: calc(10px * var(--game-scale));
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.status-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: calc(12px * var(--game-scale));
    min-height: calc(44px * var(--game-scale));
    padding: calc(8px * var(--game-scale)) calc(16px * var(--game-scale)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    font-size: calc(14px * var(--game-scale));
    font-weight: 800;
}

.status-left {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: calc(8px * var(--game-scale));
    color: #d1d5db;
}

.menu-toggle-button {
    width: calc(32px * var(--game-scale));
    height: calc(32px * var(--game-scale));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: calc(10px * var(--game-scale));
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    font-size: calc(16px * var(--game-scale));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.menu-toggle-button:active {
    transform: scale(0.94);
}

.status-timer {
    justify-self: center;
    color: #fef3c7;
    font-size: calc(15px * var(--game-scale));
    letter-spacing: 0.3px;
}

.status-score {
    justify-self: end;
    display: inline-flex;
    align-items: baseline;
    gap: calc(6px * var(--game-scale));
}

.status-score-label {
    color: #9ca3af;
    font-size: calc(11px * var(--game-scale));
}

.status-score-value {
    color: #fff;
    font-size: calc(20px * var(--game-scale));
    font-weight: 900;
    line-height: 1;
}

.side-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1600;
    background: rgba(0, 0, 0, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.side-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.side-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1700;
    width: min(330px, 86vw);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: max(18px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(3, 7, 18, 0.98));
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.48);
    color: #fff;
    transform: translateX(-104%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.side-menu-panel.open {
    transform: translateX(0);
}

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

.side-menu-title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
}

.player-name-label {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(253, 230, 138, 0.16);
    color: #fde68a;
    font-size: 13px;
    vertical-align: middle;
}

.side-menu-subtitle {
    margin-top: 3px;
    color: #9ca3af;
    font-size: 12px;
    font-weight: 700;
}

.side-menu-close {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #f9fafb;
}

.side-menu-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.side-menu-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.07);
    color: #d1d5db;
    font-size: 14px;
    font-weight: 900;
}

.side-menu-action.active {
    color: #111827;
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    border-color: rgba(253, 230, 138, 0.72);
    box-shadow: 0 10px 24px rgba(245, 158, 11, 0.22);
}

.side-menu-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 3px;
}

.side-menu-loading,
.side-menu-empty {
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    color: #cbd5e1;
    text-align: center;
    line-height: 1.7;
    padding: 20px;
}

.side-menu-empty.compact {
    min-height: 92px;
    margin-top: 4px;
}

.side-menu-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.side-menu-summary div,
.side-menu-summary button {
    border-radius: 14px;
    padding: 10px 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.055));
    border: 1px solid rgba(255, 255, 255, 0.13);
    text-align: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 18px rgba(0, 0, 0, 0.14);
}

.side-menu-summary button {
    color: inherit;
    font-family: inherit;
}

.side-menu-summary button.active,
.vocab-all-button.active {
    background: linear-gradient(135deg, rgba(253, 230, 138, 0.92), rgba(245, 158, 11, 0.92));
    color: #111827;
    border-color: rgba(253, 230, 138, 0.72);
}

.score-date-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    border-radius: 14px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.055));
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.score-date-filter label {
    color: #d1d5db;
    font-size: 13px;
    font-weight: 900;
}

.score-date-filter input {
    min-width: 140px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    padding: 7px 8px;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.vocab-all-button {
    width: 100%;
    margin-bottom: 12px;
    border-radius: 14px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.055));
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d1d5db;
    font-size: 13px;
    font-weight: 900;
}

.score-trend-card {
    margin-bottom: 12px;
    border-radius: 18px;
    padding: 13px 12px 12px;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.2), transparent 42%), linear-gradient(180deg, rgba(255, 255, 255, 0.105), rgba(255, 255, 255, 0.055));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.score-trend-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.score-trend-head span,
.score-trend-title {
    display: block;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
}

.score-trend-head strong {
    display: block;
    margin-top: 2px;
    color: #fde68a;
    font-size: 11px;
    font-weight: 900;
}

.score-trend-head small {
    flex: 0 0 auto;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
}

.score-trend-svg {
    width: 100%;
    height: 92px;
    display: block;
    overflow: visible;
}

.score-trend-axis {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1;
}

.score-trend-line {
    fill: none;
    stroke: url(#scoreTrendGradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 5px 8px rgba(14, 165, 233, 0.24));
}

.score-trend-svg circle {
    fill: #fff7c2;
    stroke: #22d3ee;
    stroke-width: 2;
}

.score-trend-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.score-trend-meta span {
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.24);
    color: #e0f2fe;
    font-size: 11px;
    font-weight: 900;
}

.score-trend-empty {
    margin-top: 9px;
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.07);
    color: #cbd5e1;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.6;
}

.vocab-load-hint {
    margin: 12px 0 4px;
    border-radius: 999px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.07);
    color: #cbd5e1;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}

.side-menu-summary strong,
.side-menu-summary span {
    display: block;
}

.side-menu-summary strong {
    color: #fde68a;
    font-size: 18px;
    line-height: 1.1;
}

.side-menu-summary span {
    margin-top: 4px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 800;
}

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

.side-menu-record {
    border-radius: 16px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.055));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.12);
}

.record-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.record-title {
    color: #fff;
    font-size: 15px;
    font-weight: 900;
}

.record-date,
.vocab-type {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #d1d5db;
    font-size: 11px;
    font-weight: 800;
}

.vocab-type {
    color: #082f49;
    background: #bae6fd;
}

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
}

.record-meta span {
    border-radius: 999px;
    padding: 3px 7px;
    background: rgba(0, 0, 0, 0.24);
}

body.theme-aqua .menu-toggle-button,
body.theme-aqua .side-menu-close,
body.theme-aqua .side-menu-action,
body.theme-aqua .score-date-filter,
body.theme-aqua .score-date-filter input,
body.theme-aqua .vocab-all-button,
body.theme-aqua .score-trend-card,
body.theme-aqua .side-menu-summary div,
body.theme-aqua .side-menu-summary button,
body.theme-aqua .side-menu-record {
    border-color: rgba(15, 118, 110, 0.24);
}

body.theme-aqua .side-menu-panel {
    background: linear-gradient(180deg, rgba(236, 254, 255, 0.98), rgba(204, 251, 241, 0.98));
    color: #134e4a;
}

body.theme-aqua .side-menu-title,
body.theme-aqua .record-title {
    color: #134e4a;
}

body.theme-aqua .player-name-label {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}

body.theme-aqua .score-date-filter input {
    background: rgba(255, 255, 255, 0.76);
    color: #134e4a;
}

body.theme-aqua .score-trend-card,
body.theme-aqua .side-menu-summary div,
body.theme-aqua .side-menu-summary button,
body.theme-aqua .score-date-filter,
body.theme-aqua .vocab-all-button,
body.theme-aqua .side-menu-record {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(240, 253, 250, 0.58));
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.12);
}

body.theme-aqua .side-menu-summary strong,
body.theme-aqua .score-trend-head strong {
    color: #0f766e;
}

body.theme-aqua .score-trend-head span,
body.theme-aqua .score-trend-title {
    color: #134e4a;
}

body.theme-aqua .score-trend-meta span,
body.theme-aqua .record-meta span {
    background: rgba(15, 118, 110, 0.12);
    color: #115e59;
}

body.theme-aqua .side-menu-subtitle,
body.theme-aqua .side-menu-empty,
body.theme-aqua .side-menu-loading,
body.theme-aqua .record-meta,
body.theme-aqua .vocab-load-hint,
body.theme-aqua .side-menu-summary span {
    color: #0f766e;
}

body.theme-senior .menu-toggle-button {
    border-color: rgba(111, 78, 46, 0.22);
    background: rgba(255, 248, 234, 0.7);
}

body.theme-senior .side-menu-panel {
    background: linear-gradient(180deg, #FFF8EA, #E9D7B8);
    color: #2F2A22;
}

body.theme-senior .side-menu-title,
body.theme-senior .record-title {
    color: #2F2A22;
}

body.theme-senior .side-menu-subtitle,
body.theme-senior .side-menu-empty,
body.theme-senior .side-menu-loading,
body.theme-senior .record-meta,
body.theme-senior .side-menu-summary span,
body.theme-senior .score-date-filter label,
body.theme-senior .vocab-all-button,
body.theme-senior .vocab-load-hint {
    color: #6F4E2E;
}

body.theme-senior .player-name-label {
    background: rgba(111, 78, 46, 0.12);
    color: #6F4E2E;
}

body.theme-senior .score-date-filter input {
    background: rgba(255, 248, 234, 0.86);
    color: #2F2A22;
    border-color: rgba(111, 78, 46, 0.24);
}

body.theme-senior .score-trend-card,
body.theme-senior .side-menu-summary div,
body.theme-senior .side-menu-summary button,
body.theme-senior .score-date-filter,
body.theme-senior .vocab-all-button,
body.theme-senior .side-menu-record {
    background: linear-gradient(180deg, rgba(255, 248, 234, 0.9), rgba(231, 211, 176, 0.54));
    border-color: rgba(111, 78, 46, 0.2);
    box-shadow: 0 10px 22px rgba(111, 78, 46, 0.14);
}

body.theme-senior .side-menu-summary strong,
body.theme-senior .score-trend-head strong {
    color: #8C5A1D;
}

body.theme-senior .score-trend-head span,
body.theme-senior .score-trend-title {
    color: #2F2A22;
}

body.theme-senior .score-trend-head small,
body.theme-senior .score-trend-empty {
    color: #6F4E2E;
}

body.theme-senior .score-trend-meta span,
body.theme-senior .record-meta span {
    background: rgba(111, 78, 46, 0.12);
    color: #5F452C;
}

body.theme-game .menu-toggle-button {
    border-color: rgba(255, 224, 147, 0.42);
    background: rgba(240, 198, 110, 0.12);
}

body.theme-game .side-menu-panel {
    background: linear-gradient(180deg, rgba(8, 26, 34, 0.98), rgba(30, 42, 32, 0.98));
    border-right-color: rgba(255, 224, 147, 0.22);
}

body.theme-game .side-menu-action.active {
    background: linear-gradient(135deg, #2DD4BF, #F0C66E);
}

body.theme-game .score-trend-card,
body.theme-game .weekly-progress-card,
body.theme-game .side-menu-summary div,
body.theme-game .side-menu-summary button,
body.theme-game .score-date-filter,
body.theme-game .vocab-all-button,
body.theme-game .side-menu-record {
    background: radial-gradient(circle at top left, rgba(45, 212, 191, 0.16), transparent 44%), linear-gradient(180deg, rgba(255, 231, 163, 0.105), rgba(9, 30, 36, 0.42));
    border-color: rgba(255, 231, 163, 0.2);
}

.progress-panel {
    padding: calc(12px * var(--game-scale)) calc(16px * var(--game-scale)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #d1d5db;
    font-size: calc(12px * var(--game-scale));
    font-weight: 700;
    margin-bottom: calc(9px * var(--game-scale));
}

.task-progress-bar {
    position: relative;
    height: calc(14px * var(--game-scale));
    margin-top: calc(4px * var(--game-scale));
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.task-progress-fill {
    width: 0;
    height: calc(12px * var(--game-scale));
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #facc15);
    transition: width 0.35s ease;
}

.task-progress-nodes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    gap: calc(8px * var(--game-scale));
    margin-top: calc(10px * var(--game-scale));
    align-items: stretch;
}

.task-progress-nodes:empty {
    display: none;
}

.task-progress-node {
    min-height: calc(42px * var(--game-scale));
    border-radius: calc(13px * var(--game-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.72);
    color: #fff;
    font-size: clamp(10px, calc(13px * var(--game-scale)), 13px);
    font-weight: 900;
    line-height: 1.25;
    cursor: pointer;
    padding: calc(7px * var(--game-scale)) calc(8px * var(--game-scale));
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38);
    transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
}

.task-progress-placeholder {
    opacity: 0.34;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.08);
    border-style: dashed;
    box-shadow: none;
}

.task-node-hint-row {
    grid-column: 1 / -1;
    width: 100%;
    min-height: calc(34px * var(--game-scale));
    border-radius: calc(12px * var(--game-scale));
    padding: calc(8px * var(--game-scale)) calc(10px * var(--game-scale));
    background: rgba(17, 24, 39, 0.88);
    border: 1px solid rgba(250, 204, 21, 0.48);
    color: #fef3c7;
    font-size: clamp(12px, calc(14px * var(--game-scale)), 15px);
    font-weight: 900;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.32);
}

.task-progress-node.node-blue {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
}

.task-progress-node.node-orange {
    background: linear-gradient(135deg, #ea580c, #fb923c);
}

.task-progress-node.node-red {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
    border-color: rgba(254, 202, 202, 0.86);
}

body.theme-game .task-progress-node {
    border-color: rgba(255, 231, 163, 0.68);
    color: #FFF8DC;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

body.theme-game .task-progress-node.node-blue {
    background: linear-gradient(135deg, #0F766E, #14B8A6);
}

body.theme-game .task-progress-node.node-orange {
    background: linear-gradient(135deg, #A16207, #F59E0B);
}

body.theme-game .task-progress-node.node-red {
    background: linear-gradient(135deg, #8B1E1E, #D84A3A);
    border-color: rgba(255, 213, 164, 0.82);
}

.task-progress-node.near,
.task-progress-node.reached {
    animation: nodePulse 0.9s ease-in-out infinite;
}

.task-progress-node.completed {
    animation: none;
}

.task-node-prompt,
.task-node-word-pair {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-wrap: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-node-meaning-scroll {
    display: block;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.task-node-meaning-scroll span {
    display: inline-block;
    min-width: 100%;
    padding-left: 100%;
    animation: meaningScroll 8s linear infinite;
}

.task-node-keyword {
    font-size: clamp(10px, calc(12px * var(--game-scale)), 12px);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.task-node-word-pair {
    font-size: clamp(10px, calc(13px * var(--game-scale)), 13px);
    gap: calc(4px * var(--game-scale));
}

.task-node-connector {
    font-size: calc(14px * var(--game-scale));
    color: #fef3c7;
}

.task-progress-node:hover {
    transform: scale(1.04);
    filter: brightness(1.12);
}

@keyframes meaningScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

@keyframes nodePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38), 0 0 0 0 rgba(250, 204, 21, 0.55);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38), 0 0 0 8px rgba(250, 204, 21, 0);
    }
}

.task-start-button:active,
.task-secondary-button:active {
    transform: scale(0.98);
}

.weekly-progress-card {
    margin: calc(10px * var(--game-scale)) 0;
    padding: calc(12px * var(--game-scale));
    border-radius: calc(16px * var(--game-scale));
    border: 1px solid rgba(125, 211, 252, 0.26);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.84), rgba(30, 64, 175, 0.36));
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.weekly-progress-title {
    color: #bfdbfe;
    font-weight: 900;
    font-size: calc(13px * var(--game-scale));
    margin-bottom: calc(6px * var(--game-scale));
}

.weekly-progress-card p {
    color: #fef3c7;
    font-size: calc(13px * var(--game-scale));
    line-height: 1.45;
    margin-bottom: calc(10px * var(--game-scale));
}

.weekly-progress-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: calc(8px * var(--game-scale));
}

.weekly-progress-grid div {
    display: grid;
    gap: calc(3px * var(--game-scale));
    padding: calc(8px * var(--game-scale));
    border-radius: calc(12px * var(--game-scale));
    background: rgba(255, 255, 255, 0.08);
    text-align: center;
}

.weekly-progress-grid strong {
    color: #facc15;
    font-size: calc(17px * var(--game-scale));
    white-space: nowrap;
}

.weekly-progress-grid span,
.weekly-event-row span {
    color: #cbd5e1;
    font-size: calc(11px * var(--game-scale));
    font-weight: 800;
}

.weekly-event-row {
    display: flex;
    flex-wrap: wrap;
    gap: calc(6px * var(--game-scale));
    margin-top: calc(10px * var(--game-scale));
}

.weekly-event-row span {
    border-radius: 999px;
    padding: calc(4px * var(--game-scale)) calc(8px * var(--game-scale));
    background: rgba(56, 189, 248, 0.14);
    color: #dbeafe;
}

@media (max-width: 420px), (max-height: 720px) {
    .status-bar {
        min-height: calc(40px * var(--game-scale));
        font-size: calc(13px * var(--game-scale));
        gap: calc(8px * var(--game-scale));
    }

    .status-score-value {
        font-size: calc(18px * var(--game-scale));
    }

    .task-progress-bar {
        height: calc(12px * var(--game-scale));
    }

    .progress-panel {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .task-progress-bar,
    .progress-header {
        margin-left: calc(12px * var(--game-scale));
        margin-right: calc(12px * var(--game-scale));
    }

    .task-progress-nodes {
        width: 100vw;
        padding-left: calc(6px * var(--game-scale));
        padding-right: calc(6px * var(--game-scale));
        margin-left: calc((var(--app-width) - 100vw) / 2);
        margin-right: calc((var(--app-width) - 100vw) / 2);
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: calc(6px * var(--game-scale));
        margin-top: calc(8px * var(--game-scale));
    }

    .task-progress-node {
        width: 100%;
        min-width: 0;
        min-height: calc(36px * var(--game-scale));
        border-radius: calc(12px * var(--game-scale));
        font-size: clamp(10px, calc(12px * var(--game-scale)), 12px);
        padding: calc(6px * var(--game-scale)) calc(4px * var(--game-scale));
    }

    .task-node-keyword,
    .task-node-word-pair {
        font-size: calc(13px * var(--game-scale));
    }

    .sentence-popup {
        max-width: calc(var(--viewport-width) - calc(32px * var(--game-scale)));
        white-space: normal;
        text-align: center;
        font-size: calc(16px * var(--game-scale));
    }
}

@media (prefers-reduced-motion: reduce) {
    .word-block,
    .task-progress-fill,
    .task-progress-node,
    .theme-toggle-button,
    .star-particle {
        transition: none;
    }

    .word-block.matching,
    .shake,
    .task-progress-node.near,
    .task-progress-node.reached,
    .sentence-popup,
    .firework-particle {
        animation: none;
    }
}

.learning-dashboard-card,
.daily-goal-card {
    margin: calc(10px * var(--game-scale)) 0;
    padding: calc(12px * var(--game-scale));
    border-radius: calc(16px * var(--game-scale));
    border: 1px solid rgba(52, 211, 153, 0.28);
    background: linear-gradient(180deg, rgba(6, 78, 59, 0.72), rgba(15, 23, 42, 0.82));
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.learning-dashboard-card p,
.daily-goal-card p {
    color: #dcfce7;
    font-size: calc(13px * var(--game-scale));
    line-height: 1.45;
    margin: calc(8px * var(--game-scale)) 0;
}

.dashboard-actions,
.review-actions {
    display: flex;
    gap: calc(8px * var(--game-scale));
    flex-wrap: wrap;
    margin-top: calc(10px * var(--game-scale));
}

.dashboard-actions button,
.review-actions button {
    border: 0;
    border-radius: 999px;
    padding: calc(8px * var(--game-scale)) calc(12px * var(--game-scale));
    color: #06251c;
    background: linear-gradient(135deg, #86efac, #67e8f9);
    font-weight: 900;
    font-size: calc(12px * var(--game-scale));
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
}

.daily-goal-row {
    display: grid;
    gap: calc(6px * var(--game-scale));
    margin-top: calc(9px * var(--game-scale));
}

.daily-goal-row > div:first-child {
    display: flex;
    justify-content: space-between;
    color: #ecfeff;
    font-size: calc(12px * var(--game-scale));
    font-weight: 900;
}

.daily-goal-bar {
    height: calc(9px * var(--game-scale));
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.daily-goal-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #facc15, #34d399, #38bdf8);
}

.review-item-card {
    display: grid;
    gap: calc(8px * var(--game-scale));
    margin: calc(9px * var(--game-scale)) 0;
    padding: calc(12px * var(--game-scale));
    border-radius: calc(14px * var(--game-scale));
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.review-item-card strong {
    display: block;
    color: #fef3c7;
    font-size: calc(20px * var(--game-scale));
    letter-spacing: 0.08em;
}

.review-item-card span {
    color: #cbd5e1;
    font-size: calc(12px * var(--game-scale));
    font-weight: 800;
}

.learning-card-toast,
.feedback-toast {
    position: fixed;
    left: 50%;
    z-index: 70;
    width: min(calc(var(--app-width) - calc(28px * var(--game-scale))), 420px);
    transform: translateX(-50%);
    border-radius: calc(18px * var(--game-scale));
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(12px);
    animation: cardSlide 0.28s ease both;
}

.learning-card-toast {
    bottom: calc(78px * var(--game-scale));
    padding: calc(14px * var(--game-scale));
    border: 1px solid rgba(250, 204, 21, 0.42);
    background: linear-gradient(180deg, rgba(69, 26, 3, 0.9), rgba(15, 23, 42, 0.92));
    color: #fff7ed;
}

.learning-card-title {
    color: #fde68a;
    font-size: calc(12px * var(--game-scale));
    font-weight: 900;
    margin-bottom: calc(4px * var(--game-scale));
}

.learning-card-toast strong {
    display: block;
    font-size: calc(22px * var(--game-scale));
    letter-spacing: 0.12em;
}

.learning-card-toast p,
.learning-card-toast small {
    display: block;
    margin-top: calc(6px * var(--game-scale));
    color: #ffedd5;
    line-height: 1.45;
    font-size: calc(12px * var(--game-scale));
}

.feedback-toast {
    top: max(calc(54px * var(--game-scale)), env(safe-area-inset-top));
    padding: calc(10px * var(--game-scale)) calc(12px * var(--game-scale));
    background: rgba(6, 78, 59, 0.92);
    border: 1px solid rgba(134, 239, 172, 0.5);
    color: #ecfdf5;
}

.feedback-toast.error {
    background: rgba(127, 29, 29, 0.94);
    border-color: rgba(252, 165, 165, 0.55);
    color: #fff1f2;
}

.feedback-toast strong,
.feedback-toast span,
.feedback-toast small {
    display: block;
    line-height: 1.35;
}

.feedback-toast strong {
    font-size: calc(13px * var(--game-scale));
    margin-bottom: calc(3px * var(--game-scale));
}

.feedback-toast span,
.feedback-toast small {
    font-size: calc(12px * var(--game-scale));
}

.tutorial-card .task-main-card {
    margin-top: calc(10px * var(--game-scale));
}

body.theme-contrast {
    background: #000;
}

body.theme-contrast .bg-game-bg,
body.theme-contrast .game-app {
    background: #000 !important;
    color: #fff !important;
}

body.theme-contrast .word-block {
    background: #fff !important;
    color: #000 !important;
    border: 3px solid #ffff00 !important;
    text-shadow: none !important;
    box-shadow: 0 0 0 2px #000, 0 0 18px rgba(255, 255, 0, 0.42) !important;
}

body.theme-contrast .word-block.selected {
    transform: scale(1.1);
    background: #ffff00 !important;
    color: #000 !important;
    border-color: #fff !important;
}

body.theme-contrast .status-bar,
body.theme-contrast .progress-panel,
body.theme-contrast .side-menu-panel,
body.theme-contrast .game-modal-card,
body.theme-contrast .weekly-progress-card,
body.theme-contrast .learning-dashboard-card,
body.theme-contrast .daily-goal-card,
body.theme-contrast .review-item-card {
    background: #000 !important;
    color: #fff !important;
    border-color: #ffff00 !important;
}

body.theme-contrast button {
    outline: 2px solid #ffff00;
}

body.low-motion .word-block,
body.low-motion .task-progress-fill,
body.low-motion .task-progress-node,
body.low-motion .theme-toggle-button,
body.low-motion .star-particle,
body.low-motion .learning-card-toast,
body.low-motion .feedback-toast {
    transition: none !important;
}

body.low-motion .word-block.matching,
body.low-motion .shake,
body.low-motion .task-progress-node.near,
body.low-motion .task-progress-node.reached,
body.low-motion .sentence-popup,
body.low-motion .firework-particle,
body.low-motion .learning-card-toast,
body.low-motion .feedback-toast,
body.low-motion .task-node-meaning-scroll span {
    animation: none !important;
}

@keyframes cardSlide {
    from { opacity: 0; transform: translate(-50%, 12px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* 三入口語文學習模式 */
.mode-select-card {
    width: min(calc(388px * var(--game-scale)), calc(100vw - 28px));
}

.board-mode-select-card {
    width: min(calc(420px * var(--game-scale)), calc(100vw - 24px));
}

.board-mode-level-hint {
    margin-top: calc(8px * var(--game-scale));
    color: rgba(204, 251, 241, 0.82);
    font-size: calc(12px * var(--game-scale));
    font-weight: 800;
    text-align: center;
}

.board-mode-entry-grid {
    gap: calc(14px * var(--game-scale));
}

.mode-entry-grid {
    display: grid;
    gap: calc(12px * var(--game-scale));
    margin-top: calc(16px * var(--game-scale));
}

.mode-entry-card {
    display: grid;
    grid-template-columns: calc(44px * var(--game-scale)) 1fr;
    grid-template-rows: auto auto auto auto;
    gap: calc(4px * var(--game-scale)) calc(12px * var(--game-scale));
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: calc(16px * var(--game-scale));
    padding: calc(14px * var(--game-scale));
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(59, 130, 246, 0.14));
    color: #fff;
    text-align: left;
    box-shadow: 0 calc(10px * var(--game-scale)) calc(24px * var(--game-scale)) rgba(0, 0, 0, 0.24);
}

.mode-entry-card i {
    grid-row: 1 / span 4;
    width: calc(44px * var(--game-scale));
    height: calc(44px * var(--game-scale));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(250, 204, 21, 0.22);
    color: #fde68a;
    font-size: calc(22px * var(--game-scale));
}

.mode-entry-card strong {
    font-size: calc(18px * var(--game-scale));
    line-height: 1.2;
}

.mode-entry-card span {
    color: rgba(255, 255, 255, 0.76);
    font-size: calc(13px * var(--game-scale));
}

.mode-entry-card em {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    border-radius: calc(999px * var(--game-scale));
    padding: calc(4px * var(--game-scale)) calc(8px * var(--game-scale));
    background: rgba(250, 204, 21, 0.16);
    color: #fef3c7;
    font-size: calc(12px * var(--game-scale));
    font-style: normal;
    font-weight: 800;
    line-height: 1.25;
}

.mode-entry-card small {
    color: rgba(254, 240, 138, 0.88);
    font-size: calc(11px * var(--game-scale));
    line-height: 1.35;
}

.mode-entry-card.active,
.side-mode-button.active {
    border-color: rgba(250, 204, 21, 0.72);
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.3), rgba(34, 197, 94, 0.2));
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.16), 0 calc(10px * var(--game-scale)) calc(24px * var(--game-scale)) rgba(0, 0, 0, 0.25);
}

.side-menu-section-title {
    margin: calc(12px * var(--game-scale)) 0 calc(8px * var(--game-scale));
    color: rgba(255, 255, 255, 0.64);
    font-size: calc(12px * var(--game-scale));
    font-weight: 700;
    letter-spacing: 0.08em;
}

.side-mode-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(8px * var(--game-scale));
}

.side-mode-button {
    display: grid;
    place-items: center;
    gap: calc(5px * var(--game-scale));
    min-height: calc(64px * var(--game-scale));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: calc(14px * var(--game-scale));
    background: rgba(15, 23, 42, 0.68);
    color: #fff;
    font-size: calc(12px * var(--game-scale));
    font-weight: 700;
}

.side-mode-button i {
    color: #fde68a;
    font-size: calc(18px * var(--game-scale));
}

.tutorial-skip-button {
    border-color: rgba(96, 165, 250, 0.46);
    background: rgba(37, 99, 235, 0.22);
    color: #dbeafe;
}

.mode-entry-card:active {
    transform: scale(0.98);
}

.word-block.blocker-cell,
body.theme-aqua .word-block.blocker-cell,
body.theme-senior .word-block.blocker-cell,
body.theme-game .word-block.blocker-cell {
    background: linear-gradient(145deg, #1f2937, #020617) !important;
    color: rgba(255, 255, 255, 0.42);
    border: 1px dashed rgba(148, 163, 184, 0.46);
    border-bottom: 1px dashed rgba(148, 163, 184, 0.46);
    box-shadow: inset 0 0 calc(12px * var(--game-scale)) rgba(0, 0, 0, 0.56);
    cursor: not-allowed;
    pointer-events: none;
    text-shadow: none;
}

.word-block.blocker-cell::after {
    content: '';
    position: absolute;
    inset: 18%;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

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

.poem-collection-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 12px;
    color: #fff;
    background: rgba(15, 23, 42, 0.72);
    text-align: left;
}

.poem-collection-card.completed {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.24), rgba(34, 197, 94, 0.18));
    border-color: rgba(250, 204, 21, 0.48);
}

.poem-collection-card strong,
.poem-collection-card span {
    display: block;
}

.poem-collection-card span {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 12px;
}

.poem-card-stars {
    flex: 0 0 auto;
    color: #facc15;
    font-weight: 900;
}

.poem-detail-modal {
    max-height: min(78vh, calc(680px * var(--game-scale)));
    overflow-y: auto;
}

.poem-author {
    color: rgba(255, 255, 255, 0.66);
    text-align: center;
    margin-bottom: 12px;
}

.poem-detail-lines {
    display: grid;
    gap: 8px;
    margin: 14px 0;
}

.poem-detail-line {
    border-radius: 12px;
    padding: 10px 12px;
    text-align: center;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.08);
}

.poem-detail-line.locked {
    color: rgba(255, 255, 255, 0.48);
    filter: grayscale(0.4);
}

.poem-detail-line.unlocked {
    color: #fef3c7;
    background: rgba(250, 204, 21, 0.14);
}

body.theme-contrast .mode-entry-card,
body.theme-contrast .poem-collection-card,
body.theme-contrast .poem-detail-line {
    border-color: #fff;
    background: #000;
    color: #fff;
}

body.low-motion .mode-entry-card,
body.low-motion .word-block.blocker-cell {
    transition: none !important;
}

/* 入口亮色主題與點擊選字優化 */
.mode-entry-card.mode-fixed {
    background: linear-gradient(135deg, rgba(51, 65, 85, 0.92), rgba(124, 58, 237, 0.72));
    border-color: rgba(196, 181, 253, 0.68);
}

.mode-entry-card.mode-fixed i {
    color: #ddd6fe;
    background: rgba(88, 28, 135, 0.28);
}

.mode-entry-card.mode-word,
.side-mode-button.side-mode-word {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.88), rgba(59, 130, 246, 0.72));
    border-color: rgba(153, 246, 228, 0.62);
}

.mode-entry-card.mode-idiom,
.side-mode-button.side-mode-idiom {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(249, 115, 22, 0.72));
    border-color: rgba(254, 215, 170, 0.66);
}

.mode-entry-card.mode-poem,
.side-mode-button.side-mode-poem {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.88), rgba(59, 130, 246, 0.7));
    border-color: rgba(221, 214, 254, 0.62);
}

.mode-entry-card.mode-word i,
.side-mode-button.side-mode-word i { color: #ccfbf1; background: rgba(15, 118, 110, 0.28); }
.mode-entry-card.mode-idiom i,
.side-mode-button.side-mode-idiom i { color: #fff7ed; background: rgba(146, 64, 14, 0.24); }
.mode-entry-card.mode-poem i,
.side-mode-button.side-mode-poem i { color: #f5d0fe; background: rgba(88, 28, 135, 0.26); }

.mode-entry-card.active,
.side-mode-button.active {
    border-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.26), 0 calc(12px * var(--game-scale)) calc(26px * var(--game-scale)) rgba(0, 0, 0, 0.28);
}

.side-input-switcher {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: calc(8px * var(--game-scale));
}

.side-input-button {
    min-height: calc(38px * var(--game-scale));
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: calc(999px * var(--game-scale));
    background: rgba(15, 23, 42, 0.64);
    color: rgba(255, 255, 255, 0.78);
    font-size: calc(12px * var(--game-scale));
    font-weight: 900;
}

.side-input-button.active {
    border-color: rgba(134, 239, 172, 0.72);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.42), rgba(14, 165, 233, 0.34));
    color: #ecfdf5;
}

.tap-selection-hint {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px * var(--game-scale));
    transform: translateX(-50%);
    z-index: 40;
    max-width: min(calc(340px * var(--game-scale)), 92vw);
    padding: calc(7px * var(--game-scale)) calc(12px * var(--game-scale));
    border-radius: calc(999px * var(--game-scale));
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(125, 211, 252, 0.42);
    color: #e0f2fe;
    font-size: calc(12px * var(--game-scale));
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 calc(8px * var(--game-scale)) calc(20px * var(--game-scale)) rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.word-block.decoy-cell {
    opacity: 0.82;
    filter: saturate(0.85) brightness(0.96);
    border: 1px dashed rgba(254, 215, 170, 0.66);
    box-shadow: inset 0 0 calc(10px * var(--game-scale)) rgba(15, 23, 42, 0.28), 0 0 calc(12px * var(--game-scale)) rgba(249, 115, 22, 0.22);
}

.word-block.decoy-cell.selected {
    opacity: 1;
    filter: none;
}

body.low-motion .tap-selection-hint,
body.low-motion .side-input-button {
    transition: none !important;
}


/* 二字詞獨立版補充樣式 */
.word-standalone-app .status-left span {
    color: #ccfbf1;
}

.standalone-mode-badge {
    cursor: default;
    margin-bottom: calc(10px * var(--game-scale));
}

.word-standalone-app .game-footer {
    color: rgba(204, 251, 241, 0.72);
}

/* Timed 5×20 stack mode */
.energy-panel {
    border-bottom: 1px solid rgba(45, 212, 191, 0.18);
}

.energy-header {
    color: #ccfbf1;
}

.energy-progress-bar {
    overflow: hidden;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0.1) 0 9.5%, rgba(255,255,255,0.22) 9.5% 10%);
}

.energy-progress-fill {
    background: linear-gradient(90deg, #14b8a6 0%, #facc15 55%, #f97316 100%);
    box-shadow: 0 0 18px rgba(250, 204, 21, 0.28);
}

.energy-progress-nodes {
    grid-template-columns: repeat(10, minmax(0, 1fr)) !important;
    gap: calc(4px * var(--game-scale));
    margin-top: calc(7px * var(--game-scale));
}

.energy-progress-node {
    height: calc(18px * var(--game-scale));
    min-height: 0;
    border-radius: calc(6px * var(--game-scale));
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: calc(9px * var(--game-scale));
    font-weight: 900;
}

.energy-progress-node.active {
    background: linear-gradient(180deg, #2dd4bf, #0f766e);
    border-color: rgba(153, 246, 228, 0.82);
    color: #fff;
}

.energy-progress-node.multiplier-node.active,
.energy-progress-node.max-node.active {
    background: linear-gradient(180deg, #facc15, #f97316);
    border-color: rgba(254, 243, 199, 0.92);
    color: #431407;
}

.word-info-footer {
    padding-top: calc(8px * var(--game-scale)) !important;
    padding-bottom: max(calc(10px * var(--game-scale)), env(safe-area-inset-bottom)) !important;
}

.word-info-card {
    width: 100%;
    border-radius: calc(18px * var(--game-scale));
    border: 1px solid rgba(45, 212, 191, 0.28);
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(8, 47, 73, 0.62));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    padding: calc(10px * var(--game-scale)) calc(12px * var(--game-scale));
    text-align: left;
}

.word-info-kicker {
    color: #67e8f9;
    font-size: calc(11px * var(--game-scale));
    font-weight: 900;
    letter-spacing: 0.08em;
    margin-bottom: calc(3px * var(--game-scale));
}

.word-info-word {
    color: #fef3c7;
    font-size: calc(20px * var(--game-scale));
    font-weight: 900;
    letter-spacing: 0.12em;
    line-height: 1.1;
}

.word-info-meaning,
.word-info-example {
    margin-top: calc(4px * var(--game-scale));
    color: #dbeafe;
    font-size: calc(12px * var(--game-scale));
    line-height: 1.38;
}

.word-info-example {
    color: #bbf7d0;
}

.word-block.empty-cell {
    opacity: 0;
    pointer-events: none;
}

body.low-motion .energy-progress-fill,
body.low-motion .energy-progress-node,
body.low-motion .word-info-card {
    transition: none !important;
    animation: none !important;
}


/* UI optimization: hide info/toast cards and use a continuous energy bar */
.word-info-footer,
.word-info-card,
.learning-card-toast,
.feedback-toast,
.tap-selection-hint {
    display: none !important;
}

.energy-progress-bar {
    height: calc(18px * var(--game-scale));
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.82), rgba(30, 41, 59, 0.82)) !important;
    border: 1px solid rgba(153, 246, 228, 0.28);
}

.energy-progress-bar::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: rgba(255, 255, 255, 0.34);
    z-index: 2;
}

.energy-progress-fill {
    height: 100% !important;
    top: 0 !important;
    transform: none !important;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981 0%, #22d3ee 42%, #facc15 70%, #f97316 100%) !important;
    box-shadow: 0 0 18px rgba(34, 211, 238, 0.38), inset 0 1px 0 rgba(255,255,255,0.32);
}

.energy-progress-nodes {
    display: block !important;
    position: relative;
    height: calc(16px * var(--game-scale));
    margin-top: calc(4px * var(--game-scale));
}

.energy-progress-node {
    display: none !important;
}

.energy-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    color: rgba(254, 243, 199, 0.92);
    font-size: calc(10px * var(--game-scale));
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.52);
}

.energy-marker-half {
    left: 50%;
}

.energy-marker-full {
    left: 100%;
    transform: translateX(-100%);
}

.energy-star-particle {
    color: #fde68a;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.85), 0 0 18px rgba(45, 212, 191, 0.46);
    transition: transform 0.82s cubic-bezier(0.12, 0.72, 0.2, 1), opacity 0.82s ease;
    z-index: 1100;
}

.firework-particle {
    box-shadow: 0 0 10px currentColor;
}

/* Animal Island UI inspired skin: parchment cards, pill controls, soft island motion */
@keyframes islandCloudFloat {
    0%, 100% { transform: translate3d(0, 0, 0) scale(var(--cloud-scale, 1)); }
    50% { transform: translate3d(calc(10px * var(--game-scale)), calc(-4px * var(--game-scale)), 0) scale(var(--cloud-scale, 1)); }
}

@keyframes islandLeafDrift {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-8deg); }
    50% { transform: translate3d(calc(5px * var(--game-scale)), calc(8px * var(--game-scale)), 0) rotate(12deg); }
}

@keyframes islandBubblePop {
    0% { opacity: 0; transform: translate(-50%, -46%) scale(0.86); }
    24% { opacity: 1; transform: translate(-50%, -54%) scale(1.06); }
    72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -58%) scale(0.98); }
}

@keyframes islandCardRise {
    from { opacity: 0; transform: translateY(calc(18px * var(--game-scale))) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.cloud-b { --cloud-scale: 0.72; }

.status-bar,
.progress-panel {
    position: relative;
    z-index: 2;
    margin: calc(10px * var(--game-scale)) calc(12px * var(--game-scale)) 0;
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.68) !important;
    border-radius: calc(22px * var(--game-scale));
    background: rgba(247, 243, 223, 0.74) !important;
    color: var(--island-ink);
    box-shadow:
        0 calc(8px * var(--game-scale)) 0 rgba(114, 93, 66, 0.14),
        0 calc(12px * var(--game-scale)) calc(22px * var(--game-scale)) rgba(114, 93, 66, 0.12),
        inset 0 calc(2px * var(--game-scale)) 0 rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.progress-panel { margin-top: calc(8px * var(--game-scale)); }

.status-left,
.word-standalone-app .status-left span,
.status-score-label,
.progress-header,
.energy-header {
    color: color-mix(in srgb, var(--island-ink) 82%, #ffffff 18%) !important;
}

.status-timer,
.status-score-value,
.island-level-pill {
    color: #5b4630 !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.island-level-pill,
.status-score {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: calc(4px * var(--game-scale)) calc(9px * var(--game-scale));
    background: rgba(255, 255, 255, 0.48);
    box-shadow: inset 0 calc(1px * var(--game-scale)) 0 rgba(255, 255, 255, 0.8);
}

.menu-toggle-button,
.side-menu-close,
.side-input-button,
.side-menu-action,
.vocab-all-button,
.dashboard-actions button,
.review-actions button {
    border-radius: 999px;
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.66);
    background: linear-gradient(180deg, #ffffff, var(--island-parchment));
    color: var(--island-ink);
    box-shadow:
        0 calc(5px * var(--game-scale)) 0 rgba(114, 93, 66, 0.16),
        0 calc(8px * var(--game-scale)) calc(16px * var(--game-scale)) rgba(114, 93, 66, 0.16);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.menu-toggle-button:active,
.side-menu-close:active,
.side-input-button:active,
.side-menu-action:active,
.vocab-all-button:active,
.task-start-button:active,
.task-secondary-button:active,
.mode-entry-card:active {
    transform: translateY(calc(3px * var(--game-scale))) scale(0.98);
    box-shadow: 0 calc(2px * var(--game-scale)) 0 rgba(114, 93, 66, 0.18);
}

.sentence-popup {
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.84), transparent 34%),
        linear-gradient(180deg, #fffaf0, var(--island-parchment));
    color: var(--island-ink);
    border: calc(3px * var(--game-scale)) solid rgba(255, 255, 255, 0.82);
    border-bottom: calc(7px * var(--game-scale)) solid rgba(114, 93, 66, 0.2);
    border-radius: calc(999px * var(--game-scale));
    box-shadow:
        0 calc(12px * var(--game-scale)) 0 rgba(114, 93, 66, 0.16),
        0 calc(20px * var(--game-scale)) calc(34px * var(--game-scale)) rgba(114, 93, 66, 0.22);
    font-weight: 900;
    animation: islandBubblePop 1.2s ease forwards;
}

.theme-toggle-button {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.75);
    border-bottom: calc(6px * var(--game-scale)) solid rgba(114, 93, 66, 0.22);
    background: linear-gradient(180deg, #fff7c2, var(--island-yellow));
    color: #6f4e2e;
    box-shadow:
        0 calc(8px * var(--game-scale)) 0 rgba(114, 93, 66, 0.16),
        0 calc(13px * var(--game-scale)) calc(20px * var(--game-scale)) rgba(114, 93, 66, 0.22);
    backdrop-filter: none;
}

.theme-toggle-button::before { content: '🏝️ '; }

.game-modal {
    background:
        radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.48), transparent 18%),
        radial-gradient(circle at 80% 18%, rgba(247, 205, 103, 0.28), transparent 22%),
        rgba(91, 70, 48, 0.34);
    backdrop-filter: blur(10px) saturate(1.08);
}

.game-modal-card,
.task-modal-card,
.result-modal-card,
.tutorial-card,
.poem-detail-modal {
    border-radius: calc(28px * var(--game-scale));
    border: calc(3px * var(--game-scale)) solid rgba(255, 255, 255, 0.8);
    border-bottom: calc(9px * var(--game-scale)) solid rgba(114, 93, 66, 0.2);
    background:
        radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.82), transparent 28%),
        linear-gradient(180deg, #fffaf0 0%, var(--island-parchment) 100%);
    color: var(--island-ink);
    box-shadow:
        0 calc(18px * var(--game-scale)) 0 rgba(114, 93, 66, 0.14),
        0 calc(26px * var(--game-scale)) calc(50px * var(--game-scale)) rgba(114, 93, 66, 0.28),
        inset 0 calc(2px * var(--game-scale)) 0 rgba(255, 255, 255, 0.86);
    animation: islandCardRise 0.28s cubic-bezier(0.2, 0.85, 0.24, 1.12) both;
}

.task-modal-kicker,
.task-special-title,
.task-main-source,
.task-source,
.board-mode-level-hint {
    color: color-mix(in srgb, var(--island-teal) 58%, var(--island-ink) 42%);
    font-weight: 900;
}

.task-modal-title,
.result-modal-title,
.side-menu-title,
.score-trend-title,
.score-trend-head span,
.task-title,
.result-stat-label,
.record-title {
    color: var(--island-ink);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.76);
}

.task-main-card,
.task-item,
.result-summary-card,
.result-stat-row,
.score-trend-card,
.weekly-progress-card,
.learning-dashboard-card,
.daily-goal-card,
.review-item-card,
.side-menu-summary div,
.side-menu-summary button,
.side-menu-record,
.score-date-filter,
.poem-collection-card,
.poem-detail-line {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.62);
    border-radius: calc(20px * var(--game-scale));
    background: rgba(255, 255, 255, 0.46);
    color: var(--island-ink);
    box-shadow:
        0 calc(8px * var(--game-scale)) 0 rgba(114, 93, 66, 0.1),
        0 calc(12px * var(--game-scale)) calc(20px * var(--game-scale)) rgba(114, 93, 66, 0.12);
}

.task-main-label,
.result-stat-value,
.side-menu-summary strong,
.weekly-progress-grid strong,
.score-trend-head strong {
    color: #b7722b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

.task-main-desc,
.task-desc,
.result-stat-hint,
.side-menu-subtitle,
.side-menu-empty,
.side-menu-loading,
.record-meta,
.side-menu-summary span,
.weekly-progress-card p,
.weekly-progress-grid span,
.weekly-event-row span,
.review-item-card span,
.score-trend-head small,
.score-trend-empty,
.poem-author,
.poem-collection-card span {
    color: color-mix(in srgb, var(--island-ink) 78%, #ffffff 22%);
}

.task-index,
.result-stat-icon {
    background: linear-gradient(180deg, #fff7c2, var(--island-yellow));
    color: #6f4e2e;
    box-shadow: 0 calc(5px * var(--game-scale)) 0 rgba(114, 93, 66, 0.14);
}

.task-start-button,
.side-menu-action.active,
.side-input-button.active,
.mode-entry-card.active,
.vocab-all-button.active,
.side-menu-summary button.active {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.78);
    border-bottom: calc(7px * var(--game-scale)) solid rgba(114, 93, 66, 0.24);
    background: linear-gradient(180deg, #fff7c2, var(--island-yellow));
    color: #62472f;
    box-shadow:
        0 calc(9px * var(--game-scale)) 0 rgba(114, 93, 66, 0.16),
        0 calc(14px * var(--game-scale)) calc(24px * var(--game-scale)) rgba(114, 93, 66, 0.2);
}

.task-secondary-button {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.7);
    border-bottom: calc(6px * var(--game-scale)) solid rgba(114, 93, 66, 0.18);
    background: linear-gradient(180deg, #ffffff, #e8f6da);
    color: var(--island-ink);
    box-shadow: 0 calc(7px * var(--game-scale)) 0 rgba(114, 93, 66, 0.13);
}

.task-progress-bar,
.energy-progress-bar,
.daily-goal-bar {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.66) !important;
    background: rgba(255, 255, 255, 0.44) !important;
    box-shadow: inset 0 calc(2px * var(--game-scale)) calc(5px * var(--game-scale)) rgba(114, 93, 66, 0.16) !important;
}

.task-progress-fill,
.energy-progress-fill,
.daily-goal-bar i {
    background: linear-gradient(90deg, var(--island-teal), var(--island-green), var(--island-yellow), var(--island-orange)) !important;
    box-shadow: 0 0 calc(18px * var(--game-scale)) rgba(130, 213, 187, 0.46), inset 0 calc(1px * var(--game-scale)) 0 rgba(255, 255, 255, 0.55) !important;
}

.task-progress-node {
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.72);
    border-bottom: calc(5px * var(--game-scale)) solid rgba(114, 93, 66, 0.18);
    color: #5b4630;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62);
    box-shadow: 0 calc(6px * var(--game-scale)) 0 rgba(114, 93, 66, 0.14), 0 calc(10px * var(--game-scale)) calc(18px * var(--game-scale)) rgba(114, 93, 66, 0.14);
}

.task-progress-node.node-blue { background: linear-gradient(180deg, #c9f8f0, var(--island-teal)); }
.task-progress-node.node-orange { background: linear-gradient(180deg, #ffe7b0, var(--island-orange)); }
.task-progress-node.node-red { background: linear-gradient(180deg, #ffd2d8, var(--island-pink)); }
.task-node-hint-row { background: #fff7c2; color: var(--island-ink); border-color: rgba(247, 205, 103, 0.72); }
.task-node-keyword,
.task-node-connector { color: #6f4e2e; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.62); }

.side-menu-overlay { background: rgba(114, 93, 66, 0.32); backdrop-filter: blur(7px); }
.side-menu-panel {
    background:
        radial-gradient(circle at 20% 8%, rgba(255, 255, 255, 0.86), transparent 28%),
        linear-gradient(180deg, #fffaf0, var(--island-parchment));
    border-right: calc(4px * var(--game-scale)) solid rgba(255, 255, 255, 0.7);
    color: var(--island-ink);
    box-shadow: calc(18px * var(--game-scale)) 0 calc(44px * var(--game-scale)) rgba(114, 93, 66, 0.24);
}

.score-date-filter input {
    background: rgba(255, 255, 255, 0.82);
    color: var(--island-ink);
    border-color: rgba(114, 93, 66, 0.18);
}

.mode-entry-card {
    border: calc(3px * var(--game-scale)) solid rgba(255, 255, 255, 0.72);
    border-bottom: calc(8px * var(--game-scale)) solid rgba(114, 93, 66, 0.18);
    border-radius: calc(24px * var(--game-scale));
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(247, 243, 223, 0.92));
    color: var(--island-ink);
    box-shadow: 0 calc(10px * var(--game-scale)) 0 rgba(114, 93, 66, 0.12), 0 calc(16px * var(--game-scale)) calc(26px * var(--game-scale)) rgba(114, 93, 66, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.mode-entry-card:hover { transform: translateY(calc(-2px * var(--game-scale))); filter: saturate(1.04); }
.mode-entry-card.mode-word,
.side-mode-button.side-mode-word { background: linear-gradient(180deg, #d8fbf3, var(--island-teal)); }
.mode-entry-card.mode-fixed { background: linear-gradient(180deg, #eef1ff, var(--island-blue)); }
.mode-entry-card.mode-idiom,
.side-mode-button.side-mode-idiom { background: linear-gradient(180deg, #ffe7b0, var(--island-orange)); }
.mode-entry-card.mode-poem,
.side-mode-button.side-mode-poem { background: linear-gradient(180deg, #ffd2d8, var(--island-pink)); }

.mode-entry-card i {
    background: rgba(255, 255, 255, 0.55) !important;
    color: #6f4e2e !important;
    box-shadow: inset 0 calc(1px * var(--game-scale)) 0 rgba(255, 255, 255, 0.84), 0 calc(4px * var(--game-scale)) 0 rgba(114, 93, 66, 0.12);
}

.mode-entry-card span,
.mode-entry-card small,
.mode-entry-card em { color: color-mix(in srgb, var(--island-ink) 82%, #ffffff 18%); }
.mode-entry-card em { background: rgba(255, 255, 255, 0.5); }

@keyframes islandTilePop {
    0% { filter: saturate(1); }
    35% { transform: scale(1.18) rotate(-2deg); filter: saturate(1.18) brightness(1.08); }
    100% { transform: scale(0.82); filter: saturate(0.9); }
}

.word-block.matching {
    animation: matchPulse 0.4s ease forwards, islandTilePop 0.42s ease;
}

.word-block.decoy-cell {
    border-color: rgba(229, 146, 102, 0.72);
    background: linear-gradient(145deg, #ffd5b8, var(--island-orange)) !important;
}

.word-block.blocker-cell,
body.theme-aqua .word-block.blocker-cell,
body.theme-senior .word-block.blocker-cell,
body.theme-game .word-block.blocker-cell {
    background: linear-gradient(145deg, #8f7a62, #5b4630) !important;
    color: rgba(255, 250, 240, 0.48);
    border-color: rgba(255, 255, 255, 0.3);
}

body.low-motion .island-sky-cloud,
body.low-motion .island-leaf,
body.low-motion .game-modal-card,
body.low-motion .word-block.matching {
    animation: none !important;
}

/* Default 「切換」 theme refinement: flat blocks and stronger menu contrast */
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .word-block:not(.blocker-cell):not(.decoy-cell) {
    background: var(--block-color, var(--island-teal)) !important;
    color: #fdfaf8;
    text-shadow: none;
    border: calc(2px * var(--game-scale)) solid rgba(255, 255, 255, 0.42);
    border-bottom: calc(3px * var(--game-scale)) solid rgba(114, 93, 66, 0.18);
    box-shadow: 0 calc(4px * var(--game-scale)) calc(8px * var(--game-scale)) rgba(114, 93, 66, 0.14);
    filter: none;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .word-block:not(.blocker-cell):not(.decoy-cell):hover {
    transform: translateY(calc(-1px * var(--game-scale)));
    filter: none;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .word-block:not(.blocker-cell):not(.decoy-cell).selected {
    background: color-mix(in srgb, var(--block-color, var(--island-teal)) 82%, var(--island-yellow) 18%) !important;
    color: #3f2f20;
    text-shadow: none;
    transform: translateY(calc(-2px * var(--game-scale))) scale(1.06);
    box-shadow:
        0 0 0 calc(4px * var(--game-scale)) rgba(247, 205, 103, 0.58),
        0 calc(6px * var(--game-scale)) calc(12px * var(--game-scale)) rgba(114, 93, 66, 0.18);
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-panel {
    background:
        linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(247, 243, 223, 0.98)),
        radial-gradient(circle at 20% 8%, rgba(255, 255, 255, 0.86), transparent 28%);
    color: #4b3525;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-title {
    color: #3f2f20;
    text-shadow: 0 calc(2px * var(--game-scale)) 0 rgba(255, 255, 255, 0.85);
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .player-name-label {
    background: #fff7c2;
    color: #6f4e2e;
    border: 1px solid rgba(114, 93, 66, 0.16);
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-subtitle,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-section-title,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-date-filter label,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-empty,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-loading,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .vocab-load-hint,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .record-meta,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-trend-head small,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-trend-empty {
    color: #5f452c;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-summary span,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .result-stat-hint,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .poem-collection-card span {
    color: #6b5138;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-action,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-input-button,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .vocab-all-button,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-date-filter,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-record,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-summary div,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .side-menu-summary button {
    background: rgba(255, 255, 255, 0.58);
    border-color: rgba(114, 93, 66, 0.16);
    color: #4b3525;
}

body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .record-title,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-trend-title,
body:not(.theme-aqua):not(.theme-senior):not(.theme-game):not(.theme-contrast) .score-trend-head span {
    color: #3f2f20;
}
