* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body {
    font-family: -apple-system, BlMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #fefefe;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    overflow: hidden;
    justify-content: flex-start;
    box-sizing: border-box;
    /* 强制隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

html {
    overflow: hidden;
    /* 强制隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Chrome/Safari/Opera 隐藏滚动条 */
::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.header {
    width: 100%;
    max-width: 400px;
    margin-bottom: 15px;
    color: #5a5a5a;
    background: rgba(40,40,40,0.03);
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    padding: 12px 16px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

.last-word {
    padding: 8px 0;
    text-align: left;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 50px;
    visibility: visible;
}

.last-word.hidden {
    opacity: 0;
}

.last-word-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.last-word-english {
    font-size: 18px;
    font-weight: 600;
}

.last-word-chinese {
    font-size: 15px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.last-word-type {
    display: inline-block;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 8px;
}

.settings-btn {
    background: transparent;
    border: none;
    color: #5a5a5a;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    align-self: stretch;
}

.stats {
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(40,40,40,0.03);
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px 20px;
    color: #5a5a5a;
    font-size: 16px;
    margin-top: 10px;
    position: relative;
    overflow: visible;
}

#progress-display {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.confetti-effect {
    position: absolute;
    left: calc(50% + 50px);
    top: 50%;
    transform: translateY(-50%);
}

.container {
    width: 100%;
    max-width: 400px;
    height: calc(100vh - 180px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.quiz-card {
    width: 100%;
    background: rgba(40,40,40,0.03);
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.word-section {
    text-align: center;
}

.word {
    font-size: 48px;
    font-weight: bold;
    color: #0a0a0a;
    margin-bottom: 8px;
}

.word-type {
    font-size: 16px;
    color: #5a5a5a;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.word.placeholder {
    color: transparent;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 14px;
    margin-bottom: 8px;
}

.word-type.placeholder {
    color: transparent;
    background: #e0e0e0;
    opacity: 0.5;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

.option-btn.placeholder {
    color: transparent;
    background: #f5f5f5;
    border-color: #e0e0e0;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    width: 100%;
    padding: 18px 20px;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    font-size: 18px;
    color: #2a2a2a;
    background: rgba(40,40,40,0.03);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
}

.option-btn:focus {
    outline: none;
    border-color: #e8e8e8 !important;
    background: rgba(40,40,40,0.03) !important;
    box-shadow: none;
}

.option-btn:focus-visible {
    outline: none;
    border-color: #e8e8e8;
    background: rgba(40,40,40,0.03);
    box-shadow: none;
}

.option-btn:hover {
    border-color: #d5d5d5;
    background: rgba(40,40,40,0.05);
}

.option-btn:active {
    transform: scale(0.98);
}

.option-btn:disabled {
    opacity: 0.7;
}

/* 正确答案 - 立即显示，无过渡 */
.option-btn.correct,
.option-btn.correct:focus,
.option-btn.correct:hover,
.option-btn.correct:active {
    border-color: #4ade80 !important;
    background: #dcfce7 !important;
    color: #166534 !important;
    transition: none !important;
    box-shadow: none !important;
}

/* 错误答案 - 立即显示，无过渡 */
.option-btn.incorrect,
.option-btn.incorrect:focus,
.option-btn.incorrect:hover,
.option-btn.incorrect:active {
    border-color: #f87171 !important;
    background: #fee2e2 !important;
    color: #991b1b !important;
    transition: none !important;
    box-shadow: none !important;
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    display: none;
    gap: 12px;
}

.loading-spinner.show {
    display: flex;
}

.loading-spinner span {
    display: none;
}

.empty-state {
    text-align: center;
    color: #2a2a2a;
    padding: 40px 20px;
}

.empty-state.hidden {
    display: none;
}

.empty-state h2 {
    font-size: 32px;
    margin-bottom: 20px;
}

.empty-state p {
    font-size: 18px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.restart-btn {
    display: block;
    margin: 25px auto 0;
    padding: 14px 32px;
    background: #2a2a2a;
    color: white;
    border: 1px solid #d5d5d5;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.restart-btn:hover {
    background: #3a3a3a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.restart-btn:active {
    transform: translateY(0);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    z-index: 100;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #ffffff;
    border: 1px solid #d5d5d5;
    border-radius: 16px;
    width: 90%;
    max-width: 360px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #2a2a2a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #5a5a5a;
    cursor: pointer;
    padding: 4px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-label {
    font-size: 14px;
    color: #5a5a5a;
    margin-bottom: 8px;
    display: block;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d5d5d5;
    border-radius: 8px;
    font-size: 16px;
    background: #fefefe;
}

.modal-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d5d5d5;
    border-radius: 8px;
    font-size: 16px;
    background: #fefefe;
}

.modal-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.modal-btn-primary {
    background: #2a2a2a;
    color: white;
}

/* ========== 礼花庆祝效果 ========== */
.confetti-effect {
    font-size: 18px;
    font-weight: bold;
    color: #9C27B0;
    opacity: 0;
}

.confetti-effect.show {
    animation: confettiPop 1s ease-out forwards;
}

@keyframes confettiPop {
    0% { opacity: 0; transform: translateY(-50%) scale(0) rotate(0deg); }
    25% { opacity: 1; transform: translateY(-50%) scale(1.4) rotate(15deg); }
    50% { transform: translateY(-50%) scale(1.1) rotate(-10deg); }
    75% { transform: translateY(-50%) scale(1.2) rotate(5deg); }
    100% { opacity: 0; transform: translateY(-50%) translateY(-30px) scale(1) rotate(0deg); }
}

/* 礼花粒子 */
.confetti-effect::before,
.confetti-effect::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    opacity: 0;
}

.confetti-effect::before {
    background: #ff6b6b;
    left: -15px;
    top: 5px;
}

.confetti-effect::after {
    background: #48dbfb;
    right: -15px;
    top: 5px;
}

.confetti-effect.show::before {
    animation: confettiLeft 0.6s ease-out 0.1s forwards;
}

.confetti-effect.show::after {
    animation: confettiRight 0.6s ease-out 0.1s forwards;
}

@keyframes confettiLeft {
    0% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(-15px, -15px) scale(1.5) rotate(180deg); }
}

@keyframes confettiRight {
    0% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translate(15px, -15px) scale(1.5) rotate(-180deg); }
}