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

/* 姓名設定模態視窗樣式 */
.name-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 6000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(3px);
}

.name-modal.active {
    opacity: 1;
    visibility: visible;
}

.name-modal-content {
    background: white;
    border: 3px solid #000000;
    box-shadow: 12px 12px 0px #000000;
    padding: 2.5rem;
    max-width: 760px;
    width: min(95%, 760px);
    max-height: min(90vh, 760px);
    position: relative;
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.name-modal.active .name-modal-content {
    transform: scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 40px;
    height: 40px;
    border: 2px solid #000000;
    background: #FFFFFF;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 3px 3px 0px #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.close-modal-btn:hover {
    background: rgb(255, 217, 0);
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #000000;
}

.close-modal-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000000;
}

.name-modal-header {
    text-align: left;
    margin-bottom: 2rem;
    border-bottom: 2px solid #000000;
    padding-bottom: 1.5rem;
    padding-right: 3rem;
}

.step-indicator {
    display: none;
    gap: 0.5rem;
    margin-top: 1rem;
}

.step-dot {
    width: 12px;
    height: 12px;
    border: 2px solid #000000;
    border-radius: 999px;
    background: #FFFFFF;
    transition: background 0.2s ease, transform 0.2s ease;
}

.name-modal-content.step-mode .step-indicator {
    display: flex;
}

.name-modal-content[data-active-step="identity"] .step-dot[data-step="identity"],
.name-modal-content[data-active-step="theme"] .step-dot[data-step="theme"] {
    background: rgb(255, 217, 0);
    transform: translateY(-1px);
}

.name-modal-header h2 {
    font-size: 1.6rem;
    font-weight: bold;
    color: #000000;
    margin-bottom: 0.5rem;
    font-family: 'Roboto Mono', monospace;
}

.name-modal-header p {
    font-size: 1rem;
    color: #666666;
    font-family: 'Roboto Mono', monospace;
}

.name-modal-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.name-modal-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.name-modal-content.step-mode .name-modal-scroll {
    display: block;
    margin-bottom: 0;
}

.name-modal-scroll:focus-visible {
    outline: none;
}

.name-modal-scroll::-webkit-scrollbar {
    width: 8px;
}

.name-modal-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.form-step {
    display: block;
}

.name-modal-content.step-mode .form-step {
    display: none;
}

.name-modal-content.step-mode[data-active-step="identity"] .form-step[data-form-step="identity"],
.name-modal-content.step-mode[data-active-step="theme"] .form-step[data-form-step="theme"] {
    display: block;
}

.identity-settings,
.theme-settings {
    border: 2px solid #000000;
    background: #fafafa;
    padding: 1.5rem;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
}

.identity-settings {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-title {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #000000;
    margin-bottom: 0.75rem;
}

.theme-hint {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: #444444;
    margin-bottom: 1rem;
    line-height: 1.4;
}

#user-name-input {
    border: 2px solid #000000;
    padding: 1rem;
    font-size: 1.1rem;
    font-family: 'Roboto Mono', monospace;
    background: #FFFFFF;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
    text-align: center;
    font-weight: bold;
}

#user-name-input:focus {
    outline: none;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.2);
    background: #fffef0;
}

.privacy-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.privacy-details {
    border: 2px solid #000000;
    padding: 1rem;
    background: #FFFFFF;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.08);
    cursor: pointer;
}

.privacy-details summary {
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    font-size: 1rem;
    list-style: none;
}

.privacy-details summary::-webkit-details-marker {
    display: none;
}

.privacy-details summary::marker {
    content: '';
}

.privacy-details[open] {
    background: #fffef0;
}

.privacy-details[open] summary {
    margin-bottom: 0.75rem;
}

.name-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid #000000;
    background: #FFFFFF;
}

.name-buttons .btn-primary,
.name-buttons .btn-secondary {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    font-family: 'Roboto Mono', monospace;
    border: 2px solid #000000;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 3px 3px 0px #000000;
}

.name-buttons .btn-primary {
    background: rgb(255, 217, 0);
    color: #000000;
}

.name-buttons .btn-secondary {
    background: #FFFFFF;
    color: #000000;
}

.name-buttons .btn-secondary,
.name-buttons #next-step-btn {
    display: none;
}

.name-buttons .btn-primary:hover,
.name-buttons .btn-secondary:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px #000000;
}

.name-buttons .btn-primary:active,
.name-buttons .btn-secondary:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000000;
}

.name-buttons button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: 1px 1px 0px #000000;
}

.name-modal-content.step-mode .name-buttons {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.name-modal-content.step-mode .btn-secondary,
.name-modal-content.step-mode #next-step-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.name-modal-content.step-mode[data-active-step="identity"] #save-name-btn {
    display: none;
}

.name-modal-content.step-mode[data-active-step="theme"] #next-step-btn {
    display: none;
}

.name-modal-content.step-mode[data-active-step="identity"] .name-buttons {
    justify-content: flex-end;
}

.name-modal-content.step-mode[data-active-step="identity"] .btn-secondary {
    display: none;
}

/* 隱私聲明樣式 */
.privacy-details p {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: #333333;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.privacy-details ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.privacy-details li {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #555555;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.privacy-note {
    font-size: 0.8rem;
    color: #666666;
    font-style: italic;
    border-top: 1px solid #cccccc;
    padding-top: 0.5rem;
    margin-top: 0.75rem;
}

.consent-checkbox {
    padding-top: 0.75rem;
    border-top: 1px solid #eeeeee;
}

.consent-checkbox label {
    display: flex;
    align-items: center;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: #333333;
    cursor: pointer;
    line-height: 1.4;
}

.consent-checkbox input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 18px;
    height: 18px;
    border: 2px solid #000000;
    background: #FFFFFF;
    cursor: pointer;
}

.consent-checkbox input[type="checkbox"]:checked {
    background: rgb(255, 217, 0);
}

.checkmark {
    flex: 1;
}

.level-system {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(280px, calc(100vw - 2rem));
    isolation: isolate;
    overflow: visible;
}

.level-system > :not(.level-electric-frame) {
    position: relative;
    z-index: 2;
}

.level-electric-frame {
    position: absolute;
    inset: -20px;
    border-radius: 0;
    pointer-events: none;
    z-index: 1;
    display: block;
}

.level-electric-frame::before {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 0;
    border: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow:
        0 0 18px rgba(255, 217, 0, 0.45),
        0 0 8px rgba(0, 168, 255, 0.35);
    opacity: 0.8;
    animation: electricGlow 2.6s ease-in-out infinite;
}

.level-electric-frame svg {
    width: 100%;
    height: 100%;
    display: block;
}

.electric-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 3;
}

.electric-spark {
    fill: none;
    stroke: url(#electricGradient);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 120 780;
    stroke-dashoffset: 0;
    filter: drop-shadow(0 0 8px rgba(255, 217, 0, 0.75));
    animation: electricCurrent 2.4s linear infinite;
}

.electric-spark.secondary {
    stroke: url(#electricGradientAlt);
    stroke-dasharray: 90 780;
    stroke-dashoffset: -220;
    animation: electricCurrentAlt 3.1s linear infinite;
    opacity: 0.65;
    filter: drop-shadow(0 0 10px rgba(0, 168, 255, 0.7));
}

.level-toggle {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    justify-content: center;
    padding: 0.9rem 1rem;
    border: 3px solid #000000;
    background: #ffffff;
    box-shadow: 8px 8px 0px #000000;
    font-family: 'Roboto Mono', monospace;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: left;
    position: relative;
    z-index: 3;
    pointer-events: auto;
}

.level-toggle:hover {
    transform: translate(-1px, -1px);
    box-shadow: 10px 10px 0px #000000;
}

.level-toggle:active {
    transform: translate(1px, 1px);
    box-shadow: 5px 5px 0px #000000;
}


.level-system.expanded .level-toggle {
    background: #fff9d6;
    box-shadow: 10px 10px 0px #000000;
}

.level-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    color: #000000;
}

.toggle-icon {
    font-size: 1.2rem;
}

.toggle-title {
    font-size: 1.1rem;
}

.level-toggle-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #333333;
}

.toggle-progress-bar {
    flex: 1;
    height: 10px;
    border: 2px solid #000000;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
}

.toggle-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #FFD900 0%, #FF8A00 100%);
    transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.toggle-xp {
    min-width: 85px;
    text-align: right;
    font-weight: bold;
}

.level-panel {
    display: none;
    position: relative;
    margin-top: 0.5rem;
    z-index: 2;
}

.level-system.expanded .level-panel {
    display: block;
}

.level-panel::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 24px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-left: 3px solid #000000;
    border-top: 3px solid #000000;
    transform: rotate(45deg);
    z-index: 1;
}

.level-card {
    background: #ffffff;
    border: 3px solid #000000;
    box-shadow: 12px 12px 0px #000000;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.level-card-header h2 {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
    display: block;
    width: 100%;
    text-align: center;
}

.level-subtitle {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    color: #444444;
    text-align: center;
}

.level-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.level-stat {
    flex: 1 1 200px;
    border: 2px solid #000000;
    padding: 1rem;
    background: #fafafa;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Roboto Mono', monospace;
}

.level-stat[data-role="level-stat"].level-up {
    animation: levelGlow 0.9s ease-out;
}

.toggle-xp.gain {
    animation: textPulse 0.8s ease-out;
}

.stat-label {
    font-size: 0.9rem;
    color: #555555;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #000000;
}

.stat-separator,
.stat-total {
    font-size: 1rem;
    font-weight: bold;
    color: #000000;
}

.xp-progress {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-family: 'Roboto Mono', monospace;
}

.xp-bar {
    width: 100%;
    height: 18px;
    border: 2px solid #000000;
    background: #f0f0f0;
    position: relative;
    overflow: hidden;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.15);
}

.xp-bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #FFD900 0%, #FF8A00 100%);
    transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.xp-bar-fill.gain,
.toggle-progress-fill.gain {
    animation: xpPulse 0.8s ease-out;
}

.xp-summary {
    font-size: 1rem;
    font-weight: bold;
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    text-align: center;
    width: 100%;
    justify-content: center;
}

.xp-summary.max-level {
    color: #d62828;
}

.xp-summary .xp-divider {
    opacity: 0.7;
}

.xp-summary.max-level .xp-divider,
.xp-summary.max-level #xp-requirement {
    display: none;
}

.xp-summary.max-level::after {
    content: '（已達等級上限，請新增卡牌。）';
    margin-left: 0.4rem;
    font-size: 0.85rem;
    font-weight: normal;
}

.xp-total {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    background: #fff9d6;
    border: 2px solid #000000;
    padding: 0.75rem 1rem;
    box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .level-system {
        width: min(240px, calc(100vw - 2rem));
        left: 0.5rem;
        top: 0.75rem;
    }

    .level-electric-frame {
        inset: -16px;
    }

    .level-toggle {
        box-shadow: 6px 6px 0px #000000;
    }

    .level-card {
        padding: 1.5rem;
        box-shadow: 8px 8px 0px #000000;
    }

    .level-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .level-stat {
        flex: 1 1 auto;
    }
}

@keyframes electricCurrent {
    to { stroke-dashoffset: -900; }
}

@keyframes electricCurrentAlt {
    to { stroke-dashoffset: -1120; }
}

@keyframes electricGlow {
    0%, 100% {
        opacity: 0.7;
        box-shadow:
            0 0 14px rgba(255, 217, 0, 0.35),
            0 0 6px rgba(0, 168, 255, 0.28);
    }
    45% {
        opacity: 0.95;
        box-shadow:
            0 0 24px rgba(255, 217, 0, 0.6),
            0 0 12px rgba(0, 168, 255, 0.45);
    }
}

@keyframes confettiBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(var(--angle, 0deg)) scale(0.6);
    }
    45% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform:
            translate(
                calc(-50% + var(--dx, 0px)),
                calc(-120% + var(--dy, -80px))
            )
            rotate(calc(var(--angle, 0deg) + 360deg))
            scale(1.1);
    }
}

@keyframes correctCelebrate {
    0% { transform: scale(1); box-shadow: 2px 2px 0px #000000; }
    35% { transform: scale(1.05); box-shadow: 4px 4px 0px rgba(76, 175, 80, 0.6); }
    100% { transform: scale(1); box-shadow: 2px 2px 0px #000000; }
}

@keyframes questionGlow {
    0% { color: #000000; text-shadow: none; }
    50% { color: #1b5e20; text-shadow: 0 0 12px rgba(76, 175, 80, 0.6); }
    100% { color: #000000; text-shadow: none; }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

@keyframes xpPulse {
    0% { box-shadow: 0 0 0 rgba(255, 217, 0, 0.0); }
    45% { box-shadow: 0 0 20px rgba(255, 217, 0, 0.65); }
    100% { box-shadow: 0 0 0 rgba(255, 217, 0, 0.0); }
}

@keyframes levelGlow {
    0% { background: #fafafa; box-shadow: inset 0 0 0 rgba(255, 217, 0, 0); }
    50% { background: #fff4b8; box-shadow: inset 0 0 18px rgba(255, 217, 0, 0.45); }
    100% { background: #fafafa; box-shadow: inset 0 0 0 rgba(255, 217, 0, 0); }
}

@keyframes textPulse {
    0% { color: #333333; }
    50% { color: #000000; transform: scale(1.05); }
    100% { color: #333333; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .level-electric-frame::before,
    .electric-spark {
        animation: none !important;
    }
}

.theme-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.theme-option {
    padding: 1rem;
    border: 2px solid #000000;
    background: #FFFFFF;
    cursor: pointer;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    font-size: 1rem;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    outline: none;
}

.theme-option:hover,
.theme-option:focus-visible {
    background: #FFD900;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px rgba(0,0,0,0.3);
}

.theme-option:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.theme-option.active {
    background: #00FFB8;
    border-color: #000000;
}

.theme-icon {
    font-size: 2rem;
}

.theme-info h4 {
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.theme-info p {
    font-size: 0.9rem;
    color: #444444;
    font-weight: normal;
}

.name-buttons {
    margin-top: 1.5rem;
}

@media (max-width: 640px) {
    .name-modal-content {
        padding: 1.75rem;
        max-height: calc(100vh - 1.5rem);
    }

    .level-toggle .toggle-xp {
        display: none;
    }

    .level-system:not(.expanded) {
        width: min(120px, calc((100vw - 2rem) / 2));
    }

    .close-modal-btn {
        top: 1rem;
        right: 1rem;
    }

    .identity-settings,
    .theme-settings {
        padding: 1.25rem;
    }

    .theme-options {
        gap: 0.75rem;
    }

    .theme-option {
        flex-direction: column;
        align-items: flex-start;
    }

    .name-modal-content.step-mode .name-modal-scroll {
        margin-right: 0;
        padding-right: 0;
    }

    #user-name-input {
        padding: 0.85rem;
        font-size: 1rem;
    }

    .privacy-details {
        padding: 0.75rem;
    }

    .name-modal-content.step-mode .name-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

/* 編輯姓名按鈕樣式 */
.edit-name-btn {
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border: 2px solid #000000;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Roboto Mono', monospace;
}

.edit-name-btn:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px rgba(0,0,0,0.3);
    background: #FFD900;
}

.edit-name-btn:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

/* 主標題區域調整 */
.main-header {
    position: relative;
}

/* 頭部控制按鈕區域 */
.header-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 4001;
}

/* 排行榜連結樣式 */
.ranking-link {
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border: 2px solid #000000;
    text-decoration: none;
    color: #000000;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.2);
    border-radius: 0;
    font-family: 'Roboto Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranking-link:hover {
    transform: translateY(-1px);
    box-shadow: 3px 3px 0px rgba(0,0,0,0.3);
    background: #FFD900;
    text-decoration: none;
    color: #000000;
}

/* 響應式設計 - 頭部控制按鈕 */
@media (max-width: 768px) {
    .header-controls {
        top: 0.5rem;
        right: 0.5rem;
        gap: 0.25rem;
    }
    
    .edit-name-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .ranking-link {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

#main-title {
    transition: all 0.3s ease;
}

#main-title .title-line {
    display: inline;
}

#main-title .title-line:not(:last-child)::after {
    content: " ";
}

@media (max-width: 640px) {
    #main-title {
        line-height: 1.35;
    }

    #main-title .title-line {
        display: block;
    }

    #main-title .title-line + .title-line {
        margin-top: 0.2rem;
    }

    #main-title .title-line:not(:last-child)::after {
        content: "";
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .name-modal-content {
        padding: 2rem;
        margin: 1rem;
    }

    .name-modal-content.step-mode .name-buttons {
        flex-wrap: wrap;
    }
}

/* 測驗介面樣式 */
.quiz-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(3px);
}

.quiz-overlay.active {
    opacity: 1;
    visibility: visible;
}

.quiz-container {
    background: white;
    border: 3px solid #000000;
    box-shadow: 8px 8px 0px #000000;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-overlay.active .quiz-container {
    transform: scale(1);
}

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #000000;
    padding-bottom: 1rem;
}

.quiz-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #000000;
    margin-bottom: 0.5rem;
}

.quiz-progress {
    font-size: 1rem;
    color: #666666;
    font-weight: bold;
}

.quiz-question {
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    color: #000000;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-option {
    background: white;
    border: 2px solid #000000;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    box-shadow: 2px 2px 0px #000000;
}

.quiz-option:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px #000000;
    background: #f8f8f8;
}

.quiz-option.selected {
    background: #e3f2fd;
    border-color: #2196f3;
}

.quiz-option.correct {
    background: #e8f5e8;
    border-color: #4caf50;
}

.quiz-option.incorrect {
    background: #ffebee;
    border-color: #f44336;
}

.quiz-option.correct.celebrate {
    animation: correctCelebrate 0.75s ease-out;
}

.quiz-question {
    position: relative;
}

.quiz-question.quiz-celebrate .question-text {
    animation: questionGlow 0.75s ease-out;
}

.quiz-question.quiz-error .question-text {
    animation: incorrectShake 0.4s ease;
}

.quiz-celebration {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 5;
}

.quiz-celebration .celebration-particle {
    position: absolute;
    width: 6px;
    height: 14px;
    background: linear-gradient(180deg, #ffed4a 0%, #ff8a00 60%, rgba(0, 168, 255, 0.9) 100%);
    border-radius: 2px;
    transform-origin: center -12px;
    opacity: 0;
    animation: confettiBurst 0.9s ease-out forwards;
}

.quiz-celebration .celebration-particle:nth-child(odd) {
    background: linear-gradient(180deg, #00c4ff 0%, #6c63ff 100%);
}

.quiz-celebration .celebration-particle:nth-child(even) {
    background: linear-gradient(180deg, #ff7eb3 0%, #ffb677 100%);
}

.quiz-explanation {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f8f8;
    border: 1px solid #000000;
    border-left: 4px solid #ff6b6b;
    display: none;
}

.quiz-explanation.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.explanation-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #000000;
}

.quiz-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #000000;
}

.quiz-btn {
    background: #000000;
    color: white;
    border: 2px solid #000000;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 2px 2px 0px #666666;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.quiz-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px #666666;
}

.quiz-btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: 2px 2px 0px #999999;
}

.quiz-btn.primary {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-color: #4caf50;
}

.quiz-btn.secondary {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #ff9800;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .quiz-container {
        padding: 1.5rem;
        width: 95%;
    }
    
    .quiz-title {
        font-size: 1.3rem;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .quiz-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .quiz-btn {
        width: 100%;
    }
}

/* 卡片放大互動效果 */
.card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.28s;
    cursor: pointer;
    backdrop-filter: blur(2px);
    will-change: opacity;
    contain: layout paint;
}

.card-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s;
}

.learning-card.enlarged {
    width: min(600px, 90vw);
    transform: translateZ(0);
    transform-origin: center center;
    z-index: 1001;
    cursor: default;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 12px 12px 0px #000000;
    will-change: transform, opacity;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.learning-card.enlarged:hover {
    transform: translateZ(0);
    box-shadow: 12px 12px 0px #000000;
}

.learning-card.enlarged.card-flip-in {
    animation: cardFlipIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.learning-card.enlarged.card-flip-out {
    animation: cardFlipOut 0.45s cubic-bezier(0.55, 0, 0.45, 1) forwards;
}

@keyframes cardFlipIn {
    0% {
        transform: rotateY(-12deg) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes cardFlipOut {
    0% {
        transform: rotateY(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: rotateY(12deg) scale(0.9);
        opacity: 0;
    }
}

.learning-card.enlarged .card-title {
    font-size: 1.6rem;
    transition: font-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-card.enlarged .card-subtitle {
    font-size: 1.2rem;
    transition: font-size 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-card.enlarged .card-description {
    font-size: 1.1rem;
    line-height: 1.6;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-card.enlarged .card-analogy {
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 1.2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-card.enlarged .card-category {
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-card.enlarged .card-level {
    font-size: 0.9rem;
    padding: 0.4rem 1rem;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 測驗按鈕樣式（針對放大卡片，置於右上方黑色lv元素下方） */
.learning-card.enlarged .quiz-button {
    position: absolute;
    top: 105px; /* 位於黑色lv元素下方 */
    right: 15px;
    width: auto;
    min-width: 80px;
    margin: 0;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border: 2px solid #000000;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000000;
    transition: all 0.2s ease;
    border-radius: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    z-index: 10;
}

.learning-card.enlarged .quiz-button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px #000000;
    background: linear-gradient(135deg, #ff5252, #ff4444);
}

.learning-card.enlarged .quiz-button:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000000;
}

/* 測驗結果標示 - 簡潔直覺的視覺設計 */
.quiz-result {
    position: absolute;
    top: 35px;
    right: -15px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 3px solid #000000;
    box-shadow: 3px 3px 0px #000000;
    z-index: 15;
    animation: resultPop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* 成功狀態 - 使用純粹的視覺符號 */
.quiz-result.excellent {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000000;
    border-color: #000000;
}

.quiz-result.good {
    background: linear-gradient(135deg, #4CAF50, #45A049);
    color: #ffffff;
    border-color: #000000;
}

.quiz-result.passed {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #ffffff;
    border-color: #000000;
}

/* 需要重考狀態 */
.quiz-result.retry {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: #ffffff;
    border-color: #000000;
    animation: pulseRetry 2s infinite;
}

/* 懸停效果 */
.quiz-result:hover {
    transform: scale(1.1);
    box-shadow: 4px 4px 0px #000000;
}

/* 脈衝動畫 - 提示重考 */
@keyframes pulseRetry {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* 彈出動畫 - 更流暢的效果 */
@keyframes resultPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.15) rotate(-45deg);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* 防止背景滾動 */
body.card-enlarged {
    overflow: hidden;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .learning-card.enlarged {
        width: min(600px, 90vw);
        transform: translateZ(0);
        max-height: 85vh;
        margin: 1rem;
        animation: cardEnlargeMobile 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }
}

@media (max-width: 480px) {
    .learning-card.enlarged {
        width: min(300px, 92vw);
    }
}

@keyframes cardEnlargeMobile {
    0% {
        transform: scale(0.98) translateZ(0);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) translateZ(0);
        opacity: 1;
    }
}

.learning-card.enlarged .card-title {
    font-size: 1.4rem;
}

.learning-card.enlarged .card-subtitle {
    font-size: 1.1rem;
}

.learning-card.enlarged .card-description {
    font-size: 1rem;
}

.learning-card.enlarged .card-analogy {
    font-size: 1rem;
}

/* 基本樣式設定 */
body {
    font-family: 'Roboto Mono', monospace, 'Courier New', monospace;
    background-color: #9d9c9c; /* 調整為白灰色 */
    color: #000000;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 標題樣式 */
h1, h2, h3 {
    font-weight: bold;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
}

h2 {
    font-size: 1.8rem;
    border: 2px solid #000000;
    padding: 0.5rem 1rem;
    background-color: rgb(255, 217, 0);
    box-shadow: 4px 4px 0px #000000;
    display: inline-block;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

/* Header 樣式 */
.main-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 3px solid #000000;
    background-color: #ffffff;
}

.main-header p {
    font-size: 1.1rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Main Content 樣式 */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Section 通用樣式 */
section {
    margin-bottom: 3rem;
    padding: 2rem;
    border: 2px solid #000000;
    box-shadow: 6px 6px 0px #000000;
    background-color: #ffffff;
}

/* Prompt Section 樣式 */
.prompt-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* 輸入框與圖示容器 */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    margin: 1rem 0;
}

.input-icon {
    position: absolute;
    left: 12px;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.input-with-icon:hover .input-icon {
    opacity: 0.8;
}

.input-with-icon .term-input {
    padding-left: 45px; /* 為圖示留出空間 */
    margin: 0; /* 移除預設 margin */
}

#prompt-text,
.term-input { /* 將 .term-input 加入樣式 */
    width: 100%;
    padding: 1rem;
    border: 2px solid #000000;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    background-color: #f8f8f8;
    box-shadow: 2px 2px 0px #000000;
}

.term-input {
    height: 40px; /* 為單行輸入框設定固定高度 */
    resize: none; /* 單行輸入框不允許垂直調整大小 */
}

#prompt-text {
    height: 200px;
}

/* Import Section 樣式 */
.import-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#json-input {
    width: 100%;
    height: 150px;
    padding: 1rem;
    border: 2px solid #000000;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    box-shadow: 2px 2px 0px #000000;
}

#json-input:focus {
    outline: none;
    border-color: rgb(255, 217, 0);
    box-shadow: 2px 2px 0px rgb(255, 217, 0);
}

/* 按鈕樣式 */
.action-btn {
    padding: 1rem 2rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    background-color: rgb(255, 217, 0);
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000000;
    transition: all 0.1s ease;
    align-self: flex-start;
}

.action-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000000;
}

.action-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px #000000;
}

/* Filter Section 樣式 */
.filter-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.level-filters, .category-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    background-color: #ffffff;
    color: #000000;
    border: 2px solid #000000;
    cursor: pointer;
    box-shadow: 2px 2px 0px #000000;
    transition: all 0.1s ease;
}

.filter-btn:hover {
    background-color: #f0f0f0;
}

.filter-btn.active {
    background-color: rgb(255, 217, 0);
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px #000000;
}

/* Cards Section 樣式 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

/* 卡片樣式 */
#cards-container {
    perspective: 1400px;
}

.learning-card {
    border: 2px solid #000000;
    box-shadow: 4px 4px 0px #000000;
    background-color: #ffffff;
    padding: 1.5rem;
    position: relative;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    will-change: transform, box-shadow;
    transform: translateZ(0);
}

.learning-card:hover {
    transform: translate(-4px, -6px);
    box-shadow: 10px 12px 0px #000000;
}

/* 卡片標籤樣式 */
.card-category {
    position: absolute;
    top: -2px;
    left: -2px;
    background-color: rgb(255, 217, 0);
    color: #000000;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: bold;
    border: 2px solid #000000;
    border-top: none;
    border-left: none;
}

.card-level {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: #000000;
    color: #ffffff;
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    font-weight: bold;
    border: 2px solid #000000;
    border-top: none;
    border-right: none;
    z-index: 5; /* 設定較低的層級，讓測驗結果標示能顯示在上方 */
}

/* 卡片內容樣式 */
.card-content {
    margin-top: 2rem;
}

.card-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #000000;
}

.card-subtitle {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #666666;
    font-style: italic;
}

.card-details {
    margin-top: 1.25rem;
}

.toggle-details-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #ffffff;
    border: 1px solid #000000;
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toggle-details-btn:hover,
.toggle-details-btn.expanded {
    background-color: rgb(255, 217, 0);
    color: #000000;
    transform: translateY(-1px);
}

.card-details-content {
    margin-top: 1rem;
}

.card-detail-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #333333;
    margin-bottom: 0.4rem;
}

.card-detail-block + .card-detail-block {
    margin-top: 1rem;
}

.card-description {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.card-analogy {
    font-size: 0.9rem;
    padding: 1rem;
    background-color: #f8f8f8;
    border: 1px solid #000000;
    border-left: 4px solid rgb(255, 217, 0);
    font-style: italic;
    margin-bottom: 1rem;
}

.card-analogy::before {
    content: "💡 ";
    font-style: normal;
}

/* 刪除按鈕樣式 */
.card-actions {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.edit-btn,
.delete-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-btn:hover {
    background-color: rgb(255, 217, 0);
    color: #000000;
    transform: scale(1.1);
}

.delete-btn:hover {
    background-color: #ff4444;
    color: #ffffff;
    transform: scale(1.1);
}

/* Empty State 樣式 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #666666;
    font-style: italic;
    border: 2px dashed #cccccc;
    margin-top: 2rem;
}

.empty-state.hidden {
    display: none;
}

/* Footer 樣式 */
.main-footer {
    text-align: center;
    padding: 2rem;
    border-top: 2px solid #000000;
    background-color: #f8f8f8;
    font-size: 0.9rem;
}

/* 社群連結區塊樣式 */
.social-links-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
}

.social-links-section h3 {
    font-size: 1.2rem;
    font-weight: bold;
    color: #000000;
    margin-bottom: 1.5rem;
    font-family: 'Roboto Mono', monospace;
}

.social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 2px solid #000000;
    box-shadow: 3px 3px 0px #000000;
    text-decoration: none;
    color: #000000;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 0;
}

.social-link:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px #000000;
}

.social-link:active {
    transform: translate(3px, 3px);
    box-shadow: 0px 0px 0px #000000;
}

.social-link.threads {
    background: linear-gradient(135deg, #000000, #333333);
    color: #ffffff;
}

.social-link.threads:hover {
    background: linear-gradient(135deg, #333333, #555555);
}

.social-link.facebook {
    background: #1877f2;
    color: #ffffff;
}

.social-link.facebook:hover {
    background: #166fe5;
}

.social-link.instagram {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
    color: #ffffff;
}

.social-link.instagram:hover {
    background: linear-gradient(135deg, #7c3aed, #e11d48, #f59e0b);
}

.social-link.line {
    background: #00c300;
    color: #ffffff;
    cursor: default;
}

.social-link.line:hover {
    background: #00b300;
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px #000000;
}

.social-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* 響應式設計 - 社群連結 */
@media (max-width: 768px) {
    .social-links {
        flex-direction: column;
        gap: 1rem;
    }
    
    .social-link {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
    
    .social-links-section {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    section {
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .filter-container {
        gap: 1rem;
    }
    
    .filter-buttons {
        gap: 0.3rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .action-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .learning-card {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
}

/* 按鈕組樣式 */
.button-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* 箭頭圖標樣式 */
.arrow-icon {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.arrow-icon:hover {
    opacity: 1;
}

/* Gemini 按鈕樣式 */
.gemini-btn {
    padding: 1rem 2rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 25%, #fbbc05 50%, #ea4335 75%, #9c27b0 100%);
    color: #ffffff;
    border: 2px solid #000000;
    cursor: pointer;
    box-shadow: 4px 4px 0px #000000;
    transition: all 0.1s ease;
    position: relative;
    overflow: hidden;
}

.gemini-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gemini-btn:hover::before {
    opacity: 1;
}

.gemini-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000000;
}

.gemini-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px #000000;
}

/* 隱藏類別 */
.hidden {
    display: none !important;
}

/* 編輯彈窗樣式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #ffffff;
    border: 4px solid #000000;
    box-shadow: 8px 8px 0px #000000;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    font-family: 'Roboto Mono', monospace;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #000000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgb(255, 217, 0);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #ff4444;
    color: #ffffff;
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #000000;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #000000;
    background-color: #ffffff;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: rgb(255, 217, 0);
    box-shadow: 0 0 0 2px rgba(255, 217, 0, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid #000000;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: #f5f5f5;
}

.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border: 2px solid #000000;
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.btn-primary {
    background-color: rgb(255, 217, 0);
    color: #000000;
    box-shadow: 4px 4px 0px #000000;
}

.btn-primary:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000000;
}

.btn-primary:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px #000000;
}

.btn-secondary {
    background-color: #ffffff;
    color: #000000;
    box-shadow: 4px 4px 0px #000000;
}

.btn-secondary:hover {
    background-color: #f0f0f0;
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px #000000;
}

.btn-secondary:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px #000000;
}

/* 響應式設計 - 編輯彈窗 */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

/* 匯出功能樣式 */
.export-section {
    background: white;
    border: 3px solid black;
    box-shadow: 8px 8px 0px black;
    margin: 2rem 0;
    padding: 2rem;
}

.export-section h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: black;
}

.export-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.export-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.export-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgb(255, 217, 0);
    border: 3px solid black;
    box-shadow: 4px 4px 0px black;
    padding: 0.75rem 1.5rem;
    font-family: 'Roboto Mono', monospace;
    font-weight: bold;
    font-size: 0.9rem;
    color: black;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    align-self: flex-start;
}

.export-btn:hover {
    background: rgb(255, 200, 0);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0px black;
}

.export-btn:active {
    transform: translate(4px, 4px);
    box-shadow: 0px 0px 0px black;
}

.export-icon {
    flex-shrink: 0;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .export-section {
        margin: 1rem 0;
        padding: 1.5rem;
    }
    
    .export-btn {
        width: 100%;
        justify-content: center;
        align-self: stretch;
    }
}
/* 無障礙：使用者偏好減少動效時，關閉動畫 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
