/* 保守性向上のための案内: 未使用CSSや重複スタイルは定期的に整理・削除してください。 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: -apple-system,BlinkMacSystemFont,'Segoe UI','Noto Sans JP',Roboto,sans-serif;
    background: linear-gradient(135deg,#2c1810 0%,#1a1a1a 50%,#0a0a0a 100%);
    min-height: 100vh;
    padding: 8px;
    margin: 0;
    color: #333
}

.container {
    max-width: 420px;
    margin: 0 auto;
    background: #fafafa;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15),0 0 0 1px rgba(255,255,255,0.05);
    overflow: hidden;
    backdrop-filter: blur(20px)
}

.header {
    background: linear-gradient(135deg,#2c2c2c 0%,#1a1a1a 100%);
    color: #fff;
    padding: 24px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg,#5B00FF,#7A00FF,#B000FF,#E000FF,#FF003C,#FF4500,#FF6A00,#FF9500) 1
}

.header h1 {
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3)
}

.header .subtitle {
    font-size: 13px;
    opacity: 0.85;
    font-weight: 500;
    letter-spacing: 0.3px
}

.header .tagline {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    font-style: italic
}

.search-box {
    padding: 18px 20px;
    background: #f8f9fb;
    border-bottom: 1px solid #e5e5e5
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    font-weight: 500
}

.search-input:focus {
    outline: none;
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231,76,60,0.1),0 4px 12px rgba(0,0,0,0.1)
}

.search-input::placeholder {
    color: #888;
    font-weight: 400
}

.word-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-bottom: 20px;
    margin-top: 0
}

.word-list::-webkit-scrollbar {
    width: 6px
}

.word-list::-webkit-scrollbar-track {
    background: #f1f1f1
}

.word-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px
}

.word-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8
}

.word-item {
    padding: 18px 22px;
    border-bottom: 1px solid #f0f1f3;
    background: #fff;
    transition: all 0.2s ease;
    position: relative
}

.word-item:hover {
    background: #f9f9fb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06)
}

.word-item:last-child {
    border-bottom: none
}

.word-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px
}

.word-info {
    display: flex;
    align-items: center;
    flex-grow: 1
}

.word-number {
    background: linear-gradient(135deg,#2c3e50 0%,#34495e 100%);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1)
}

.word-title {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    flex-grow: 1;
    margin-left: 18px;
    letter-spacing: 0.3px
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-left: 15px
}

.word-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.word-checkbox:hover {
    border-color: #27ae60;
    background: #f8fff8
}

.word-checkbox.checked {
    background: linear-gradient(135deg,#27ae60,#2ecc71);
    border-color: #27ae60
}

.word-checkbox.checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    color: white;
    font-size: 14px;
    font-weight: bold
}

.word-item.completed {
    opacity: 0.6;
    background: #f8f9fa
}

.word-item.completed .word-title {
    color: #6c757d
}

.progress-bar {
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 20px
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg,#5B00FF,#7A00FF,#B000FF,#E000FF,#FF003C,#FF4500,#FF6A00,#FF9500);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%
}

.audio-section {
    margin-bottom: 16px
}

.section-title {
    font-size: 13px;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center
}

.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    margin-right: 8px;
    border-radius: 2px
}

.section-title.word-section::before {
    background: linear-gradient(135deg,#3498db,#2980b9)
}

.section-title.sentence-section::before {
    background: linear-gradient(135deg,#e74c3c,#c0392b)
}

.audio-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px
}

.audio-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 85px;
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.2px;
    backdrop-filter: blur(10px)
}

.word-btn {
    background: linear-gradient(135deg,#ecf7ff 0%,#d6efff 100%);
    color: #2980b9;
    border: 2px solid rgba(52,152,219,0.2);
    box-shadow: 0 2px 8px rgba(52,152,219,0.15)
}

.word-btn:hover {
    background: linear-gradient(135deg,#d6efff 0%,#bee3ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.25);
    border-color: rgba(52,152,219,0.4)
}

.sentence-btn {
    background: linear-gradient(135deg,#ffebee 0%,#ffcdd2 100%);
    color: #c0392b;
    border: 2px solid rgba(231,76,60,0.2);
    box-shadow: 0 2px 8px rgba(231,76,60,0.15)
}

.sentence-btn:hover {
    background: linear-gradient(135deg,#ffcdd2 0%,#ffbdd2 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231,76,60,0.25);
    border-color: rgba(231,76,60,0.4)
}

.audio-btn:active {
    transform: translateY(0)
}

.audio-btn.playing {
    animation: playing-pulse 1.2s infinite;
    box-shadow: 0 0 20px rgba(52,152,219,0.4)!important
}

.sentence-btn.playing {
    box-shadow: 0 0 20px rgba(231,76,60,0.4)!important
}

.audio-btn.slow-mode::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4M12,6V12L16,14L15,15.5L10.5,13V6H12Z"/><circle cx="18" cy="6" r="2" fill="%23f39c12"/><text x="18" y="8" text-anchor="middle" font-size="8" font-weight="bold" fill="white">0.7x</text></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 1;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3)
}

@keyframes playing-pulse {
    0% {
        transform: translateY(-2px) scale(1);
        opacity: 1
    }

    50% {
        transform: translateY(-3px) scale(1.02);
        opacity: 0.8
    }

    100% {
        transform: translateY(-2px) scale(1);
        opacity: 1
    }
}

.loading {
    text-align: center;
    padding: 50px 20px;
    color: #666
}

.spinner {
    border: 3px solid #f0f0f0;
    border-top: 3px solid #e74c3c;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px
}

@keyframes spin {
    0% {
        transform: rotate(0deg)
    }

    100% {
        transform: rotate(360deg)
    }
}

.controls {
    padding: 16px 20px;
    background: linear-gradient(135deg,#f8f9fb 0%,#f0f1f5 100%);
    border-top: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 120px
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #e74c3c;
    border-radius: 50%;
    cursor: pointer
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #e74c3c;
    border-radius: 50%;
    cursor: pointer;
    border: none
}

.mode-controls {
    display: flex;
    gap: 4px
}

.control-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    background: #fff;
    border: 1px solid #ddd;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap
}

.control-btn:hover {
    background: #f0f0f0
}

.control-btn.active {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c
}

.audio-group {
    display: flex;
    align-items: center;
    gap: 4px
}

.styled-audio-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 0
}

.play-btn {
    background: linear-gradient(135deg,#3498db,#2980b9);
    color: white
}

.play-btn:hover {
    background: linear-gradient(135deg,#2980b9,#1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52,152,219,0.4)
}

.play-btn:active {
    transform: translateY(0)
}

.stop-btn {
    background: linear-gradient(135deg,#e74c3c,#c0392b);
    color: white
}

.stop-btn:hover {
    background: linear-gradient(135deg,#c0392b,#a93226);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231,76,60,0.4)
}

.stop-btn:active {
    transform: translateY(0)
}

.styled-audio-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none
}

.styled-audio-btn.active {
    animation: audio-playing-pulse 1.5s infinite
}

@keyframes audio-playing-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15)
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 15px rgba(52,152,219,0.5)
    }

    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.15)
    }
}

.stats {
    text-align: center;
    padding: 12px 20px;
    background: linear-gradient(135deg,#f0f1f5 0%,#e8e9ef 100%);
    color: #666;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px
}

.learning-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    display: none
}

.audio-btn.loading {
    position: relative
}

.audio-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite
}

.focus-mode .word-item.completed {
    display: none
}

.chapter-selector {
    padding: 15px 20px;
    background: #f8f9fb;
    border-bottom: 1px solid #e5e5e5
}

.chapter-buttons-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 0;
    scrollbar-width: none;
    -ms-overflow-style: none
}

.chapter-buttons-container::-webkit-scrollbar {
    display: none
}

.chapter-btn {
    min-width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #2c3e50;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0
}

.chapter-btn:hover {
    border-color: #e74c3c;
    background: #fff5f5;
    transform: translateY(-2px)
}

.chapter-btn.active {
    background: linear-gradient(135deg,#e74c3c,#c0392b);
    border-color: #e74c3c;
    color: white;
    box-shadow: 0 4px 12px rgba(231,76,60,0.3)
}

.chapter-btn.all-chapters {
    min-width: 60px;
    font-size: 10px;
    text-align: center
}

.chapter-info {
    display: none;
    padding: 10px 0 0 0;
    font-size: 12px;
    color: #666;
    text-align: center
}

.chapter-info.visible {
    display: block
}

.word-item .chapter-label {
    display: none;
}

.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg,#f0f1f5 0%,#e8e9ef 100%);
    color: #666;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.2px
}

.progress-text {
    font-size: 11px;
    color: #27ae60;
    font-weight: 600
}

.chapter-list {
    margin: 20px 0;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1)
}

.chapter-item {
    padding: 15px 20px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.chapter-item:hover {
    background: rgba(255,255,255,0.12);
    cursor: pointer;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1)
}

.chapter-item:last-child {
    margin-bottom: 0
}

.chapter-info-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column
}

.chapter-title-row {
    display: flex;
    align-items: center;
    margin-bottom: 4px
}

.chapter-number {
    background: linear-gradient(135deg,#e74c3c,#c0392b);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
    margin-right: 15px;
    box-shadow: 0 2px 6px rgba(231,76,60,0.3)
}

.chapter-name {
    font-size: 16px;
    font-weight: 600;
    color: #ecf0f1
}

.chapter-details {
    font-size: 12px;
    color: #bdc3c7;
    margin-left: 65px;
    margin-top: 2px
}

.chapter-controls {
    display: flex;
    align-items: center;
    gap: 10px
}

.chapter-progress-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 80px
}

.chapter-progress-text {
    font-size: 10px;
    color: #27ae60;
    font-weight: 600
}

.chapter-progress-bar {
    width: 20px;
    height: 20px;
    cursor: pointer;
    position: relative;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-top: 0;
    height: 100%;
    background: linear-gradient(90deg,#27ae60,#2ecc71);
    border-radius: 2px;
    transition: width 0.3s ease
}

.chapter-progress-percentage {
    font-size: 10px;
    color: #95a5a6;
    font-weight: 500
}

.chapter-play-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg,#3498db,#2980b9);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(52,152,219,0.3)
}

.chapter-play-btn:hover {
    background: linear-gradient(135deg,#2980b9,#1f5f8b);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52,152,219,0.4)
}

.chapter-play-btn:active {
    transform: translateY(0)
}

.chapter-play-btn.playing {
    background: linear-gradient(135deg,#e74c3c,#c0392b);
    animation: chapter-playing-pulse 1.5s infinite
}

.chapter-play-btn.paused {
    background: linear-gradient(135deg,#f39c12,#d68910)
}

@keyframes chapter-playing-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(231,76,60,0.3)
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 15px rgba(231,76,60,0.5)
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(231,76,60,0.3)
    }
}

@media (max-width: 480px) {
    body {
        padding:4px
    }

    .container {
        margin: 0;
        border-radius: 12px;
        min-height: calc(100vh - 8px)
    }

    .header {
        padding: 20px 18px
    }

    .header h1 {
        font-size: 24px
    }

    .search-box {
        padding: 15px 18px
    }

    .word-item {
        padding: 16px 18px
    }

    .word-title {
        font-size: 18px;
        margin-left: 15px
    }

    .word-number {
        padding: 5px 12px;
        font-size: 11px;
        min-width: 55px
    }

    .audio-btn {
        font-size: 13px;
        padding: 9px 15px;
        min-width: 75px
    }

    .section-title {
        font-size: 12px
    }
}

@media (max-width: 360px) {
    .audio-buttons {
        gap:8px
    }

    .audio-btn {
        font-size: 12px;
        padding: 8px 12px;
        min-width: 70px
    }
}
