/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}
body { padding: 0 16px 20px; max-width: 600px; margin: 0 auto; }

/* === Header === */
header {
    padding: 16px 0 8px;
    position: sticky; top: 0; background: #1a1a2e; z-index: 10;
}
header h1 { font-size: 22px; margin-bottom: 8px; }
nav { display: flex; gap: 8px; }
.nav-btn {
    flex: 1; padding: 8px 16px; border: 1px solid #444;
    background: transparent; color: #aaa; border-radius: 8px;
    font-size: 14px; cursor: pointer; transition: all 0.2s;
    text-align: center; display: block; text-decoration: none;
}
.nav-btn.active { background: #e94560; color: #fff; border-color: #e94560; }
.nav-btn:active { opacity: 0.7; }

/* === Cards === */
.card {
    background: #16213e; border-radius: 12px; padding: 16px;
    margin-bottom: 12px;
}
.card label {
    display: block; font-size: 13px; color: #888; margin-bottom: 8px;
}

.start-word-row {
    display: flex; align-items: center; gap: 8px;
}
.start-word-row input {
    flex: 1; text-align: center; -moz-appearance: textfield;
}
.start-word-row input::-webkit-inner-spin-button,
.start-word-row input::-webkit-outer-spin-button {
    -webkit-appearance: none; margin: 0;
}
.step-btn {
    width: 44px; height: 44px; padding: 0;
    background: #0f3460; color: #fff; border: 1px solid #444;
    border-radius: 8px; font-size: 20px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; flex-shrink: 0;
}
.step-btn:active { background: #e94560; transform: scale(0.95); }

/* === Input === */
input[type="number"] {
    width: 100%; padding: 12px; font-size: 18px;
    background: #0f3460; border: 1px solid #444; border-radius: 8px;
    color: #fff; text-align: center; outline: none;
}
input[type="number"]:focus { border-color: #e94560; }

.play-controls {
    display: flex; gap: 8px; margin-bottom: 8px;
}
.play-controls .step-btn {
    flex: 1; font-size: 16px;
}
.btn-group { display: flex; gap: 8px; }
.count-btn, .mode-btn {
    flex: 1; padding: 10px; border: 1px solid #444;
    background: #0f3460; color: #ccc; border-radius: 8px;
    font-size: 14px; cursor: pointer; transition: all 0.2s;
}
.count-btn.active, .mode-btn.active {
    background: #e94560; color: #fff; border-color: #e94560;
}
.mode-btn { font-size: 12px; }

/* === Primary Button === */
.primary-btn {
    width: 100%; padding: 16px; margin-top: 8px;
    background: #e94560; color: #fff; border: none; border-radius: 12px;
    font-size: 18px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.primary-btn:active { transform: scale(0.98); opacity: 0.9; }
.primary-btn:disabled { background: #555; cursor: not-allowed; }

.secondary-btn {
    width: 100%; padding: 14px; margin-top: 8px;
    background: transparent; color: #aaa; border: 1px solid #444; border-radius: 12px;
    font-size: 16px; cursor: pointer; transition: all 0.2s;
}

.hint { font-size: 12px; color: #666; text-align: center; margin-top: 8px; }

/* === Screens === */
.screen { padding: 8px 0; }
.hidden { display: none !important; }

/* === Playing Screen === */
.current-info {
    display: flex; justify-content: space-between; margin-bottom: 12px;
    font-size: 14px; color: #aaa;
}
.progress-bar {
    height: 6px; background: #0f3460; border-radius: 3px; overflow: hidden;
    margin-bottom: 20px;
}
.progress-fill {
    height: 100%; background: #e94560; border-radius: 3px;
    width: 0%; transition: width 0.3s;
}
.word-display {
    text-align: center; min-height: 120px; padding: 24px 20px;
    background: #16213e; border-radius: 12px; margin-bottom: 16px;
}
.word-display .word-main {
    font-size: 28px; font-weight: 700; color: #e94560; margin-bottom: 4px;
}
.word-display .word-def {
    font-size: 18px; color: #fff; line-height: 1.8;
}
.word-display .word-def .pos {
    color: #888; font-size: 14px;
}
.word-display .writing-hint {
    margin-top: 16px; font-size: 14px; color: #f0c040;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* === Review Screen === */
.word-list {
    max-height: 50vh; overflow-y: auto; margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
.word-item {
    display: flex; align-items: center; padding: 10px 12px;
    border-bottom: 1px solid #222; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.word-item:active { background: #16213e; }
.word-item .checkbox {
    width: 22px; height: 22px; border: 2px solid #555; border-radius: 4px;
    margin-right: 12px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 14px; transition: all 0.2s;
}
.word-item.wrong .checkbox {
    background: #e94560; border-color: #e94560; color: #fff;
}
.word-item .word-id {
    font-size: 12px; color: #666; width: 40px; flex-shrink: 0;
}
.word-item .word-text { font-size: 16px; font-weight: 500; flex: 1; }
.word-item .word-def {
    font-size: 12px; color: #888; text-align: right;
    max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.review-actions { display: flex; flex-direction: column; gap: 8px; }
/* === Home Button === */
.home-btn {
    width: 100%; padding: 10px; margin-top: 4px;
    background: transparent; color: #666; border: 1px solid #333; border-radius: 8px;
    font-size: 14px; cursor: pointer; transition: all 0.2s;
    text-align: center; text-decoration: none; display: block;
    font-family: inherit; -webkit-appearance: none; appearance: none;
}
.home-btn:active { background: #0f3460; color: #aaa; }
.home-btn-row {
    display: flex; gap: 8px; margin-top: 8px;
}
.home-btn-row .home-btn { margin-top: 0; flex: 1; }

/* === 辨析 Practice === */
.bx-nav-btn {
    padding: 10px 16px; background: #0f3460; color: #fff; border: 1px solid #444;
    border-radius: 8px; font-size: 15px; cursor: pointer; transition: all 0.2s;
    flex: 1; white-space: nowrap;
}
.bx-nav-btn:active { background: #e94560; }
.bx-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.bixi-def-box { margin-bottom: 14px; }
.bixi-sentence { margin-bottom: 14px; }
.bixi-choices { margin: 8px 0 14px; }
