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

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --bg-main: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-dark: #111827;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-highlight: #fef3c7;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1920px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--bg-main);
    border-bottom: 2px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.header-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.slide-counter {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.timer {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.btn-timing-checker {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-timing-checker:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.slide-container {
    background: var(--bg-main);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.slide-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
}

.slide-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.script-container {
    background: var(--bg-main);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 300px);
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.script-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-toggle:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.btn-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.script-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    line-height: 2;
    font-size: 1.125rem;
}

.script-content.auto-scroll {
    scroll-behavior: smooth;
}

.sentence {
    display: inline;
    padding: 0.25rem 0;
    transition: background-color 0.3s ease, opacity 0.2s ease;
    cursor: pointer;
    border-radius: 4px;
}

.sentence:hover {
    background-color: #e0e7ff;
    opacity: 0.9;
}

.sentence.active {
    background-color: var(--text-highlight);
    font-weight: 600;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}

.sentence.active:hover {
    background-color: #fde68a;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.controls {
    background: var(--bg-main);
    border-top: 2px solid var(--border);
    padding: 1.5rem 2rem;
    position: sticky;
    bottom: 0;
    z-index: 100;
    box-shadow: 0 -2px 8px var(--shadow);
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    max-width: 1600px;
    margin: 0 auto 1rem;
}

.playback-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-control {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.btn-control:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
    transform: scale(1.05);
}

.btn-play {
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    box-shadow: 0 4px 12px var(--shadow-lg);
}

.btn-play:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.progress-container {
    flex: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.progress-bar::-webkit-slider-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.2);
}

.progress-bar::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.progress-bar::-moz-range-thumb:hover {
    background: var(--primary-dark);
    transform: scale(1.2);
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.speed-control label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.speed-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

.speed-select:hover {
    border-color: var(--primary);
}

.slide-nav {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    max-width: 1600px;
    margin: 0 auto;
}

.slide-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 48px;
    height: 48px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.slide-btn:hover {
    background: var(--primary-light);
    color: white;
    border-color: var(--primary-light);
}

.slide-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.shortcuts-help {
    position: fixed;
    bottom: 200px;
    right: 2rem;
    z-index: 200;
}

.btn-help {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--shadow-lg);
    transition: all 0.2s;
}

.btn-help:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.shortcuts-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px var(--shadow-lg);
    min-width: 300px;
}

.shortcuts-panel h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.shortcuts-panel ul {
    list-style: none;
}

.shortcuts-panel li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.shortcuts-panel kbd {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .script-container {
        max-height: 400px;
    }

    .header-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .controls-row {
        flex-direction: column;
        gap: 1rem;
    }

    .progress-container {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .header {
        padding: 0.5rem 0.75rem;
    }

    .title {
        font-size: 0.875rem;
    }

    .header-info {
        gap: 0.75rem;
    }

    .slide-counter, .timer {
        font-size: 0.75rem;
    }

    .main-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .slide-container {
        padding: 0.75rem;
        border-radius: 8px;
    }

    .script-container {
        padding: 0.75rem;
        border-radius: 8px;
        max-height: 350px;
    }

    .slide-title {
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }

    .script-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .script-header h2 {
        font-size: 1rem;
    }

    .btn-toggle {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .script-content {
        font-size: 0.95rem;
        line-height: 1.7;
        padding: 0.25rem;
    }

    .controls {
        padding: 0.5rem 0.75rem;
    }

    .controls-row {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .playback-controls {
        gap: 0.5rem;
    }

    .btn-control {
        width: 32px;
        height: 32px;
        font-size: 0.875rem;
    }

    .btn-play {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .progress-bar {
        height: 4px;
    }

    .progress-bar::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }

    .progress-bar::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }

    .speed-control {
        gap: 0.25rem;
    }

    .speed-control label {
        font-size: 0.7rem;
    }

    .speed-select {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    .slide-nav {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .slide-btn {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .shortcuts-help {
        bottom: 140px;
        right: 0.5rem;
    }

    .btn-help {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .shortcuts-panel {
        min-width: 220px;
        padding: 0.75rem;
        bottom: 50px;
    }

    .shortcuts-panel h3 {
        font-size: 0.875rem;
        margin-bottom: 0.5rem;
    }

    .shortcuts-panel li {
        font-size: 0.7rem;
        padding: 0.25rem 0;
    }

    .btn-timing-checker {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}
