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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 60px;
}

/* トップバー */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 15px;
}

.top-bar-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar .user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 0.85rem;
}

.top-bar #username-display {
    color: #ccc;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-bar .logout-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.top-bar .logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.top-bar .login-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 5px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.top-bar .login-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.top-bar-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

/* ユーザーメニュー（ドロップダウン） */
.user-menu {
    position: relative;
    margin-left: auto;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.user-menu-btn #username-display {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-arrow {
    font-size: 0.7rem;
    opacity: 0.7;
    transition: transform 0.2s;
}

.user-menu-dropdown.show + .user-menu-btn .user-menu-arrow,
.user-menu-btn:focus .user-menu-arrow {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

.user-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown .logout-btn {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 12px 16px;
    text-align: left;
    transition: background 0.2s;
    border-radius: 8px;
}

.user-menu-dropdown .logout-btn:hover {
    background: #f5f5f5;
    color: #e53935;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Level Progress */
.level-progress {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255,255,255,0.15);
    border-radius: 15px;
}

.current-level {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.current-level span {
    color: #ffd700;
}

.level-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.level-stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.level-stat-item .level-name {
    font-weight: bold;
}

.level-stat-item .level-count {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
}

/* Category Selector */
.category-selector {
    text-align: center;
    margin-bottom: 20px;
}

#category-select {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    background: white;
    color: #333;
    cursor: pointer;
    min-width: 200px;
}

/* Game Area */
.game-area {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

/* フェーズ別プログレスバーカラー */
.progress-fill.phase-learning {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.progress-fill.phase-retry {
    background: linear-gradient(90deg, #FF9800, #FFC107);
}

.progress-fill.phase-test {
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.progress-fill.phase-final {
    background: linear-gradient(90deg, #9C27B0, #E91E63);
}

.progress-fill.phase-reverse {
    background: linear-gradient(90deg, #00BCD4, #009688);
}

.progress-fill.phase-review {
    background: linear-gradient(90deg, #FF5722, #FF7043);
}

.progress-text {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.phase-text {
    text-align: center;
    background: #667eea;
    color: #fff;
    font-size: 0.95rem;
    font-weight: bold;
    margin-bottom: 20px;
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    width: 100%;
}

/* Question Card */
.question-card {
    text-align: center;
    margin-bottom: 30px;
}

.japanese-text {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 500;
}

.english-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.english-text {
    font-size: 1.8rem;
    color: #667eea;
    font-weight: bold;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
}

.english-text .correct {
    color: #4CAF50;
}

.english-text .incorrect {
    color: #f44336;
    text-decoration: underline;
}

.english-text .remaining {
    color: #ccc;
}

.english-text .hidden-char {
    color: #ddd;
    letter-spacing: 4px;
}

.english-text .char-placeholder {
    color: #ccc;
    letter-spacing: 2px;
    text-decoration: underline;
}

.english-text .tilde-char {
    color: #667eea;
}

.english-text .hint-char {
    color: #999;
}

.english-text .typing {
    color: #888;
}

.english-text .answer-reveal {
    color: #f44336;
    animation: fadeIn 0.3s ease;
}

.english-text .answer-display {
    font-size: 1.5rem;
    color: #333;
}

.english-text .answer-display.correct {
    color: #4caf50;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sound-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-btn:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.sound-btn:active {
    transform: scale(0.95);
}

/* Hint Area */
.hint-area {
    margin-top: 15px;
}

.hint-btn {
    padding: 8px 20px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: transparent;
    color: #667eea;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    background: #667eea;
    color: white;
}

.hint-text {
    display: block;
    margin-top: 10px;
    color: #888;
    font-size: 0.95rem;
    font-style: italic;
}

/* Typing Area */
.typing-area {
    margin-bottom: 20px;
}

.typing-input {
    width: 100%;
    padding: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    font-size: 1.5rem;
    text-align: center;
    font-family: 'Courier New', monospace;
    transition: border-color 0.3s ease;
    outline: none;
}

.typing-input::placeholder {
    color: #ccc;
}

.typing-input:focus {
    border-color: #667eea;
}

.typing-input.correct {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.typing-input.incorrect {
    border-color: #f44336;
    background: #ffebee;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.feedback {
    text-align: center;
    margin-top: 15px;
    font-size: 1.2rem;
    min-height: 30px;
}

.feedback.success {
    color: #4CAF50;
}

.feedback.error {
    color: #f44336;
}

.feedback small {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.review-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.control-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    background: #f0f0f0;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.control-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.control-btn.primary:hover {
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 20px;
}

.stat-item {
    text-align: center;
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

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

/* Modal Base */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

/* Result Modal */
.result-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.result-modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: modalIn 0.3s ease;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.result-stats {
    margin-bottom: 30px;
}

.result-stats p {
    font-size: 1.2rem;
    margin: 10px 0;
    color: #333;
}

/* Review Banner */
.review-banner {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(255, 152, 0, 0.6); }
}

.review-icon {
    font-size: 1.5rem;
}

.review-message {
    font-weight: 500;
}

.review-start-btn {
    padding: 8px 20px;
    border: 2px solid white;
    border-radius: 20px;
    background: transparent;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.review-start-btn:hover {
    background: white;
    color: #f57c00;
}

/* Dashboard Panel */
.dashboard-panel {
    background: rgba(255,255,255,0.15);
    border-radius: 15px;
    margin-top: 20px;
    color: white;
    overflow: hidden;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
}

.dashboard-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.dashboard-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.dashboard-toggle.collapsed {
    transform: rotate(-90deg);
}

.dashboard-content {
    padding: 20px;
    transition: max-height 0.3s ease;
}

.dashboard-content.collapsed {
    display: none;
}

/* ストリーク表示 */
.streak-display {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    color: white;
}

.streak-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.streak-icon {
    font-size: 2rem;
    animation: fireFlicker 0.5s infinite alternate;
}

@keyframes fireFlicker {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.streak-count {
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.streak-label {
    font-size: 1.2rem;
    opacity: 0.9;
}

.streak-max {
    font-size: 0.85rem;
    opacity: 0.8;
}


.dashboard-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dashboard-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.dashboard-section h4 {
    font-size: 0.9rem;
    margin-bottom: 12px;
    opacity: 0.9;
    font-weight: 500;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h4 {
    margin-bottom: 0;
}

.practice-difficult-btn {
    background: linear-gradient(135deg, #e91e63, #f06292);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.practice-difficult-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.4);
}

/* リスニングモード */
.listening-description {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 12px;
}

.listening-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.listening-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.listening-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 15px rgba(102, 126, 234, 0.4);
}

.listening-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#stop-listening-btn {
    background: linear-gradient(135deg, #f44336, #e91e63);
}

.listening-status {
    font-size: 0.85rem;
    opacity: 0.8;
}

.listening-status.playing {
    color: #4CAF50;
    animation: statusPulse 1s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.listening-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.listening-option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.listening-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.listening-option select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
    font-size: 0.85rem;
}

.history-stats {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    flex-wrap: wrap;
}

.history-item {
    text-align: center;
}

.history-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.history-value {
    font-size: 1.4rem;
    font-weight: bold;
}

/* Progress Overview */
.progress-overview {
    margin-top: 15px;
}

.progress-bar-large {
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
}

.progress-segment {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-segment.mastered {
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
}

.progress-segment.learning {
    background: linear-gradient(90deg, #2196F3, #03A9F4);
}

.progress-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-item .dot.mastered {
    background: #4CAF50;
}

.legend-item .dot.learning {
    background: #2196F3;
}

.legend-item .dot.unlearned {
    background: rgba(255,255,255,0.3);
}

/* Stage Distribution */
.stage-distribution {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.stage-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 40px;
    justify-content: flex-end;
}

.stage-bar-fill {
    width: 100%;
    max-width: 30px;
    background: rgba(255,255,255,0.3);
    border-radius: 5px 5px 0 0;
    transition: height 0.5s ease;
    min-height: 5px;
}

.stage-bar-fill.stage-0 { background: #9e9e9e; }
.stage-bar-fill.stage-1 { background: #f44336; }
.stage-bar-fill.stage-2 { background: #ff9800; }
.stage-bar-fill.stage-3 { background: #ffeb3b; }
.stage-bar-fill.stage-4 { background: #8bc34a; }
.stage-bar-fill.stage-5 { background: #4CAF50; }
.stage-bar-fill.stage-6 { background: #2196F3; }

.stage-label {
    font-size: 0.7rem;
    margin-top: 5px;
    opacity: 0.8;
}

.stage-count {
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 5px;
}

/* Difficult Words Summary */
.difficult-words-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.difficult-word-chip {
    background: rgba(233, 30, 99, 0.3);
    border: 1px solid rgba(233, 30, 99, 0.5);
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.difficult-word-chip .word {
    font-weight: bold;
}

.difficult-word-chip .count {
    opacity: 0.8;
    font-size: 0.7rem;
}

/* すごく苦手な単語用のスタイル */
.difficult-word-chip.very-difficult {
    background: rgba(244, 67, 54, 0.4);
    border: 1px solid rgba(244, 67, 54, 0.7);
}

.very-difficult-section h4 {
    color: #ff6b6b;
}

.practice-difficult-btn.very-difficult {
    background: linear-gradient(135deg, #f44336, #e91e63);
}

.practice-difficult-btn.very-difficult:hover {
    background: linear-gradient(135deg, #e53935, #d81b60);
}

.no-data {
    opacity: 0.6;
    font-size: 0.85rem;
}

.next-review {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
    opacity: 0.9;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

/* Legacy History Panel (keep for compatibility) */
.history-panel {
    background: rgba(255,255,255,0.15);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    color: white;
}

.history-panel h3 {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Spaced Repetition Badge */
.sr-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
}

.sr-badge.new {
    background: #4CAF50;
    color: white;
}

.sr-badge.review {
    background: #ff9800;
    color: white;
}

.sr-badge.stage-1 { background: #f44336; }
.sr-badge.stage-2 { background: #ff9800; }
.sr-badge.stage-3 { background: #ffeb3b; color: #333; }
.sr-badge.stage-4 { background: #8bc34a; }
.sr-badge.stage-5 { background: #4CAF50; }
.sr-badge.mistake { background: #e91e63; color: white; }

/* 間違えやすい単語の強調表示 */
.question-card.difficult-word {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    border: 2px solid #e91e63;
    animation: difficultPulse 2s infinite;
}

@keyframes difficultPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.3); }
    50% { box-shadow: 0 0 15px 5px rgba(233, 30, 99, 0.2); }
}

.question-card.difficult-word .sr-badge.mistake {
    font-size: 0.85rem;
    padding: 5px 12px;
    animation: badgeShake 0.5s ease;
}

/* コンボ表示 */
.combo-display {
    display: inline-block;
    margin: 0 8px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    animation: comboPop 0.3s ease;
}

.combo-display.combo-normal {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: white;
}

.combo-display.combo-super {
    background: linear-gradient(135deg, #FF9800, #FFC107);
    color: white;
    animation: comboPop 0.3s ease, comboGlow 1s infinite;
}

.combo-display.combo-mega {
    background: linear-gradient(135deg, #f44336, #E91E63);
    color: white;
    animation: comboPop 0.3s ease, comboGlow 0.5s infinite, comboShake 0.3s infinite;
}

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

@keyframes comboGlow {
    0%, 100% { box-shadow: 0 0 5px currentColor; }
    50% { box-shadow: 0 0 20px currentColor, 0 0 30px currentColor; }
}

@keyframes comboShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* 習得演出 */
.mastered-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    padding: 30px 50px;
    border-radius: 25px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 15px 50px rgba(255,165,0,0.5);
    animation: masteredPop 0.6s ease;
}

.mastered-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: masteredTrophy 0.5s ease infinite alternate;
}

@keyframes masteredTrophy {
    0% { transform: scale(1) rotate(-5deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}

.mastered-text {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.mastered-word {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.mastered-badge {
    font-size: 1rem;
    background: rgba(0,0,0,0.1);
    padding: 8px 20px;
    border-radius: 20px;
    display: inline-block;
}

@keyframes masteredPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.15); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.mastered-effect.fade-out {
    animation: masteredFade 0.5s ease forwards;
}

@keyframes masteredFade {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2); }
}

/* 紙吹雪 */
.confetti {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    z-index: 9998;
    pointer-events: none;
    animation: confettiFall 2s ease forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* コンボエフェクト（画面中央） */
.combo-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    z-index: 9999;
    pointer-events: none;
    animation: comboEffectPop 0.5s ease;
}

.combo-effect.super {
    font-size: 3rem;
    color: #FF9800;
    animation: comboEffectPop 0.5s ease, comboEffectGlow 0.8s infinite;
}

.combo-effect.mega {
    font-size: 3.5rem;
    color: #f44336;
    animation: comboEffectPop 0.5s ease, comboEffectGlow 0.4s infinite, comboEffectShake 0.2s infinite;
}

.combo-effect.fade-out {
    animation: comboEffectFade 0.3s ease forwards;
}

@keyframes comboEffectPop {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes comboEffectGlow {
    0%, 100% { text-shadow: 2px 2px 4px rgba(0,0,0,0.3), 0 0 10px currentColor; }
    50% { text-shadow: 2px 2px 4px rgba(0,0,0,0.3), 0 0 30px currentColor, 0 0 50px currentColor; }
}

@keyframes comboEffectShake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-3deg); }
    75% { transform: translate(-50%, -50%) rotate(3deg); }
}

@keyframes comboEffectFade {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5) translateY(-30px); }
}

/* Settings Button */
.settings-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.settings-btn:hover {
    opacity: 1;
}

header {
    position: relative;
}

/* Settings Modal */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.settings-modal.show {
    display: flex;
}

.settings-content {
    background: white;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.settings-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.3rem;
}

.settings-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 5px;
}

.settings-close:hover {
    color: #333;
}

.settings-body {
    padding: 20px 25px;
}

.setting-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
}

.setting-section h3 {
    color: #667eea;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.setting-item label {
    color: #333;
    font-size: 1rem;
}

.setting-item.danger label {
    color: #f44336;
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-value {
    min-width: 50px;
    text-align: right;
    color: #667eea;
    font-weight: bold;
}

/* Range Slider */
input[type="range"] {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: #667eea;
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Reset Button */
.reset-btn {
    padding: 8px 16px;
    border: 2px solid #f44336;
    border-radius: 20px;
    background: transparent;
    color: #f44336;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    background: #f44336;
    color: white;
}

.settings-footer {
    padding: 15px 25px;
    border-top: 1px solid #eee;
    text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
        padding-top: 50px;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .level-progress {
        padding: 10px;
        margin-bottom: 15px;
    }

    .current-level {
        font-size: 0.95rem;
    }

    .level-stats {
        gap: 8px;
        font-size: 0.75rem;
    }

    .game-area {
        padding: 20px 15px;
        border-radius: 15px;
    }

    .japanese-text {
        font-size: 1.1rem;
        line-height: 1.5;
    }

    .english-text {
        font-size: 1.3rem;
    }

    .english-display {
        flex-direction: column;
        gap: 10px;
    }

    .sound-btn {
        padding: 8px 12px;
        font-size: 1rem;
    }

    .typing-input {
        font-size: 1.1rem;
        padding: 12px;
        border-radius: 10px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .control-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .hint-btn {
        padding: 10px 25px;
        font-size: 0.95rem;
    }

    .stats {
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px;
    }

    .stat-item {
        flex: 1 1 40%;
        min-width: 70px;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .history-panel {
        padding: 15px;
    }

    .history-stats {
        gap: 10px;
    }

    .history-item {
        flex: 1 1 40%;
    }

    .history-label {
        font-size: 0.8rem;
    }

    .history-value {
        font-size: 1.2rem;
    }

    .sr-badge {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .review-banner {
        padding: 12px 15px;
        flex-direction: column;
        text-align: center;
    }

    .review-message {
        font-size: 0.9rem;
    }

    .phase-text {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    /* モーダルのモバイル対応 */
    .modal-content {
        padding: 25px 20px;
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
    }

    .settings-content {
        width: 95%;
        max-height: 85vh;
    }

    .settings-header {
        padding: 15px;
    }

    .settings-body {
        padding: 15px;
    }

    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .setting-control {
        width: 100%;
        justify-content: space-between;
    }

    input[type="range"] {
        flex: 1;
        width: 100%;
    }

    /* トップバーのモバイル対応 */
    .top-bar {
        height: 45px;
        padding: 0 10px;
    }

    .top-bar-content {
        gap: 5px;
    }

    .top-bar #username-display {
        max-width: 100px;
        font-size: 0.8rem;
    }

    .top-bar .login-btn {
        font-size: 0.8rem;
        padding: 4px 10px;
    }

    .top-bar-btn {
        font-size: 1rem;
        padding: 4px;
    }
}

/* 小さいスマホ対応 */
@media (max-width: 380px) {
    header h1 {
        font-size: 1.4rem;
    }

    .japanese-text {
        font-size: 1rem;
    }

    .english-text {
        font-size: 1.1rem;
    }

    .typing-input {
        font-size: 1rem;
        padding: 10px;
    }

    .stat-item {
        flex: 1 1 100%;
    }
}

/* Header Buttons */
.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

header {
    position: relative;
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 0.9rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(255, 99, 99, 0.5);
}

/* Login Modal */
.login-modal-content {
    max-width: 400px;
}

.auth-form {
    padding: 20px 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-error {
    background: #ffe0e0;
    color: #c00;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.auth-buttons {
    margin-bottom: 20px;
}

.auth-buttons .control-btn {
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.auth-switch {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

.link-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

.link-btn:hover {
    color: #764ba2;
}

/* Word List Button */
.word-list-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.word-list-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Word List Modal */
.word-list-modal-content {
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.word-list-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.word-list-stats .stat {
    text-align: center;
}

.word-list-stats .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.word-list-stats .stat-label {
    font-size: 0.8rem;
    color: #666;
}

.word-list-filter {
    margin-bottom: 15px;
}

.word-list-filter select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.word-list-container {
    flex: 1;
    overflow-y: auto;
    max-height: 50vh;
}

.word-list-empty {
    text-align: center;
    color: #999;
    padding: 40px;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.word-item:hover {
    background: #f9f9f9;
}

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

.word-info {
    flex: 1;
}

.word-english {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
}

.word-japanese {
    font-size: 0.9rem;
    color: #666;
    margin-top: 2px;
}

.word-meta {
    text-align: right;
    font-size: 0.8rem;
    color: #999;
}

.word-stage {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.word-stage.stage-1 { background: #e3f2fd; color: #1976d2; }
.word-stage.stage-2 { background: #e8f5e9; color: #388e3c; }
.word-stage.stage-3 { background: #fff3e0; color: #f57c00; }
.word-stage.stage-4 { background: #fce4ec; color: #c2185b; }
.word-stage.stage-5 { background: #f3e5f5; color: #7b1fa2; }
.word-stage.stage-6 { background: #e8f5e9; color: #2e7d32; }

.word-next-review {
    display: block;
}

.word-learned-date {
    display: block;
    margin-top: 2px;
}

/* Word List Page */
.wordlist-page {
    max-width: 900px;
    padding-bottom: 40px;
}

.wordlist-page header {
    margin-bottom: 25px;
}

/* サマリーカード */
.wordlist-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.summary-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.summary-card .summary-icon {
    font-size: 2.5rem;
}

.summary-card .summary-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.summary-card .summary-label {
    font-size: 0.85rem;
    color: #666;
}

.summary-card.total { border-left: 4px solid #667eea; }
.summary-card.mastered { border-left: 4px solid #4CAF50; }
.summary-card.learning { border-left: 4px solid #2196F3; }
.summary-card.accuracy { border-left: 4px solid #FF9800; }

/* グラフエリア */
.wordlist-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.chart-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.chart-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #333;
}

.chart-wrapper {
    height: 200px;
    position: relative;
}

/* フィルターバー */
.wordlist-filter-bar {
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.filter-select {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 設定ページ用セレクトボックス */
.setting-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 10px 40px 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: linear-gradient(to bottom, #fff, #fafafa);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    color: #333;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.setting-select:hover {
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.15);
}

.setting-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.setting-select option {
    padding: 10px;
    background: white;
    color: #333;
}

.filter-search {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 0.9rem;
    min-width: 200px;
    transition: border-color 0.3s;
}

.filter-search:focus {
    outline: none;
    border-color: #667eea;
}

/* 単語リストコンテナ */
.wordlist-page .word-list-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    max-height: none;
    overflow: visible;
}

/* 単語アイテム - 新デザイン */
.word-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    gap: 15px;
}

.word-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.word-item:last-child {
    margin-bottom: 0;
}

/* ステージインジケーター（円形） */
.word-stage-indicator {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
    flex-shrink: 0;
}

.word-stage-indicator.stage-1 { background: linear-gradient(135deg, #ff6b6b, #ee5a5a); }
.word-stage-indicator.stage-2 { background: linear-gradient(135deg, #ffa94d, #ff922b); }
.word-stage-indicator.stage-3 { background: linear-gradient(135deg, #ffd43b, #fab005); }
.word-stage-indicator.stage-4 { background: linear-gradient(135deg, #69db7c, #51cf66); }
.word-stage-indicator.stage-5 { background: linear-gradient(135deg, #38d9a9, #20c997); }
.word-stage-indicator.mastered { background: linear-gradient(135deg, #74c0fc, #4dabf7); }

/* 単語コンテンツ */
.word-content {
    flex: 1;
    min-width: 0;
}

.word-content .word-english {
    font-size: 1.15rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.word-content .word-japanese {
    font-size: 0.9rem;
    color: #888;
}

/* 単語統計 */
.word-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 60px;
}

.word-accuracy {
    font-size: 1rem;
    font-weight: bold;
}

.word-accuracy.high { color: #40c057; }
.word-accuracy.medium { color: #fd7e14; }
.word-accuracy.low { color: #fa5252; }

.word-mistakes {
    font-size: 0.75rem;
    color: #868e96;
}

/* 復習情報 */
.word-review-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    min-width: 90px;
}

.word-stage-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.word-stage-badge.stage-1 { background: #ff6b6b; }
.word-stage-badge.stage-2 { background: #ffa94d; }
.word-stage-badge.stage-3 { background: #ffd43b; color: #333; }
.word-stage-badge.stage-4 { background: #69db7c; }
.word-stage-badge.stage-5 { background: #38d9a9; }
.word-stage-badge.mastered { background: #74c0fc; }

.word-next-review {
    font-size: 0.75rem;
    color: #868e96;
}

/* 発音ボタン */
.word-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.word-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.word-play-btn:active {
    transform: scale(0.95);
}

/* 空状態 */
.word-list-empty {
    text-align: center;
    padding: 50px 20px;
    color: #666;
}

.word-list-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

.word-list-empty .empty-text {
    font-size: 1.1rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .wordlist-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .wordlist-charts {
        grid-template-columns: 1fr;
    }

    .wordlist-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select, .filter-search {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .wordlist-summary {
        grid-template-columns: 1fr;
    }

    .summary-card {
        padding: 15px;
    }

    .summary-card .summary-icon {
        font-size: 2rem;
    }

    .summary-card .summary-value {
        font-size: 1.5rem;
    }

    /* 単語アイテムのモバイル対応 */
    .word-item {
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 10px;
    }

    .word-stage-indicator {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }

    .word-content {
        flex: 1 1 calc(100% - 60px);
    }

    .word-stats {
        order: 4;
        flex-direction: row;
        min-width: auto;
        gap: 10px;
    }

    .word-review-info {
        order: 5;
        flex-direction: row;
        min-width: auto;
        gap: 8px;
    }

    .word-play-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chart Container */
.chart-container {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
}

.chart-container canvas {
    max-height: 200px;
}

.chart-period-tabs {
    display: flex;
    gap: 5px;
}

.period-tab {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.period-tab:hover {
    background: rgba(255,255,255,0.3);
}

.period-tab.active {
    background: rgba(255,255,255,0.9);
    color: #667eea;
}

/* ==================== */
/* リスニングページ */
/* ==================== */

.listening-page {
    max-width: 700px;
    padding-bottom: 40px;
}

.listening-page header {
    margin-bottom: 25px;
}

/* 再生中表示 */
.listening-now-playing {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    color: white;
    margin-bottom: 25px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
}

.now-playing-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.now-playing-content {
    margin-bottom: 20px;
}

.now-playing-japanese {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.now-playing-english {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.now-playing-progress {
    font-size: 1rem;
    opacity: 0.8;
}

/* コントロールパネル */
.listening-control-panel {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.control-button {
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-button.prev,
.control-button.next {
    width: 50px;
    height: 50px;
    background: #f0f0f0;
    font-size: 1.2rem;
}

.control-button.prev:hover,
.control-button.next:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.control-button.play {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-size: 2rem;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.control-button.play:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.progress-slider-container {
    padding: 0 10px;
}

.progress-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: #e0e0e0;
    border-radius: 4px;
    outline: none;
}

.progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* 設定パネル */
.listening-settings-panel,
.listening-filter-panel {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.listening-settings-panel h3,
.listening-filter-panel h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #333;
}

.setting-row,
.filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.setting-row:last-child,
.filter-row:last-child {
    border-bottom: none;
}

.setting-row label:first-child,
.filter-row label:first-child {
    font-size: 0.95rem;
    color: #555;
}

.speed-buttons {
    display: flex;
    gap: 8px;
}

.speed-btn {
    padding: 6px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s;
}

.speed-btn:hover {
    border-color: #667eea;
}

.speed-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.interval-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.interval-control input[type="range"] {
    width: 120px;
}

#interval-value {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: bold;
    min-width: 45px;
}

.word-count-display {
    text-align: center;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 0.95rem;
    color: #666;
}

#filtered-count {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2rem;
}

/* プレイリスト */
.listening-playlist {
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9ff;
    cursor: pointer;
}

.playlist-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.playlist-toggle-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #666;
    transition: transform 0.3s;
}

.playlist-content {
    max-height: 400px;
    overflow-y: auto;
}

.playlist-content.collapsed {
    display: none;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    gap: 15px;
}

.playlist-item:hover {
    background: #f8f9ff;
}

.playlist-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-left: 3px solid #667eea;
}

.playlist-index {
    width: 30px;
    height: 30px;
    background: #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #666;
    flex-shrink: 0;
}

.playlist-item.active .playlist-index {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.playlist-japanese {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
}

.playlist-english {
    flex: 1;
    font-size: 0.95rem;
    color: #667eea;
    font-weight: 500;
}

.playlist-stage {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.playlist-stage.stage-1 { background: #ff6b6b; }
.playlist-stage.stage-2 { background: #ffa94d; }
.playlist-stage.stage-3 { background: #ffd43b; color: #333; }
.playlist-stage.stage-4 { background: #69db7c; }
.playlist-stage.stage-5 { background: #38d9a9; }
.playlist-stage.stage-6 { background: #74c0fc; }

.playlist-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* リスニングページのレスポンシブ */
@media (max-width: 600px) {
    .listening-now-playing {
        padding: 30px 20px;
    }

    .now-playing-japanese {
        font-size: 1.5rem;
    }

    .now-playing-english {
        font-size: 1.8rem;
    }

    .main-controls {
        gap: 15px;
    }

    .control-button.play {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }

    .control-button.prev,
    .control-button.next {
        width: 45px;
        height: 45px;
    }

    .speed-buttons {
        flex-wrap: wrap;
        gap: 5px;
    }

    .speed-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .interval-control input[type="range"] {
        width: 80px;
    }

    .playlist-item {
        padding: 10px 15px;
        gap: 10px;
    }

    .playlist-japanese,
    .playlist-english {
        font-size: 0.85rem;
    }
}

/* ====== Settings Page ====== */
.settings-page header {
    margin-bottom: 30px;
}

.settings-panel {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.settings-page .settings-section {
    padding: 25px;
    border-bottom: 1px solid #f0f0f0;
}

.settings-page .settings-section:last-of-type {
    border-bottom: none;
}

.settings-page .settings-section h3 {
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.settings-page .setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f5f5f5;
}

.settings-page .setting-item:last-child {
    border-bottom: none;
}

.settings-page .setting-item label {
    color: #333;
    font-size: 1rem;
}

.settings-page .setting-item.danger label {
    color: #f44336;
}

.danger-section h3 {
    color: #f44336 !important;
    border-bottom-color: #f44336 !important;
}

/* お休み設定の説明文 */
.setting-description {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 15px 0;
    line-height: 1.4;
}

/* 曜日チェックボックス */
.weekday-checkboxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.weekday-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.weekday-checkbox input[type="checkbox"] {
    display: none;
}

.weekday-checkbox span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    background: #fff;
    transition: all 0.2s;
}

.weekday-checkbox input[type="checkbox"]:checked + span {
    background: #4CAF50;
    border-color: #4CAF50;
    color: #fff;
}

.weekday-checkbox:hover span {
    border-color: #4CAF50;
}

.settings-actions {
    padding: 20px 25px;
    background: #f9f9f9;
    text-align: center;
}

.settings-actions .control-btn {
    min-width: 200px;
    padding: 15px 40px;
    font-size: 1.1rem;
}

@media (max-width: 600px) {
    .settings-page .settings-section {
        padding: 20px 15px;
    }

    .settings-page .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .settings-page .setting-control {
        width: 100%;
        justify-content: flex-end;
    }
}
