* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f6f6f6;
    color: #111;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

h1 {
    margin: 0 0 4px;
    font-size: 28px;
}

h2 {
    margin: 0 0 4px;
    font-size: 22px;
}

#subtitle {
    margin: 0;
    color: #555;
}

select {
    font-size: 16px;
    padding: 6px 8px;
}

button {
    font-size: 16px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}

input[type="range"] {
    width: 100%;
}

.primary-button {
    margin-top: 16px;
    padding: 10px 14px;
    background: #111;
    color: white;
}

.secondary-button {
    padding: 8px 12px;
    background: white;
    color: #111;
    border: 1px solid #ddd;
}

button:disabled {
    opacity: 0.55;
}

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: #444;
}

.concept-screen,
.start-screen,
.intro,
.controls,
.story {
    background: white;
    border-radius: 12px;
}

.concept-screen,
.start-screen {
    padding: 16px;
    margin-bottom: 20px;
}

.concept-hero {
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}

.concept-hero p {
    max-width: 720px;
    margin: 10px 0 0;
    color: #333;
    line-height: 1.5;
}

.concept-section {
    padding: 22px 0;
    border-bottom: 1px solid #eee;
    color: #333;
    line-height: 1.55;
}

.concept-section h2 {
    margin-bottom: 10px;
}

.concept-section p {
    margin: 0 0 12px;
}

.concept-section p:last-child,
.concept-section li:last-child {
    margin-bottom: 0;
}

.concept-section ul {
    margin: 0 0 12px;
    padding-left: 22px;
}

.concept-section li {
    margin-bottom: 5px;
}

.concept-actions {
    padding-top: 18px;
}

.selection-grid,
.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.story-choice {
    margin-top: 12px;
}

.selection-status {
    margin: 12px 0 0;
    color: #666;
    font-size: 14px;
}

.usage-guide {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #eee;
    color: #333;
    line-height: 1.5;
}

.usage-guide h2 {
    margin-bottom: 10px;
}

.usage-guide p {
    margin: 0 0 10px;
}

.usage-guide ul {
    margin: 0;
    padding-left: 22px;
}

.usage-guide li {
    margin-bottom: 5px;
}

.intro {
    padding: 16px;
    margin-bottom: 20px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.controls {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.range-control {
    justify-content: end;
}

.range-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

audio {
    width: 100%;
}

.story {
    padding: 20px;
}

.paragraph {
    margin-bottom: 22px;
}

.sentence {
    margin-bottom: 14px;
    cursor: pointer;
}

.translation {
    font-size: 14px;
    color: #666;
    margin-top: 3px;
}

.original {
    font-size: 22px;
    line-height: 1.7;
}

.word {
    color: #999;
    cursor: pointer;
}

.word.spoken {
    color: #111;
}

.word.current {
    color: #0067d8;
}

.word.untimed {
    cursor: default;
}

.space {
    white-space: pre;
}

.chapter-task {
    margin-top: 28px;
    padding: 18px;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    background: #fafafa;
}

.chapter-task h2 {
    margin-bottom: 6px;
}

.task-hint {
    margin: 0 0 14px;
    color: #666;
    font-size: 14px;
}

.task-prompt {
    margin: 0 0 12px;
    font-size: 17px;
    line-height: 1.5;
}

.task-answer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 22px;
    line-height: 1.7;
}

.task-input {
    min-width: 120px;
    max-width: 220px;
    padding: 6px 8px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font: inherit;
    line-height: 1.2;
}

.task-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.task-check-button {
    margin-top: 0;
}

.task-feedback {
    margin: 0;
    color: #555;
}

.task-feedback.correct {
    color: #0b6b2b;
}

.task-feedback.incorrect {
    color: #8a4b00;
}

.toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    color: #111;
}

body.hide-translations .translation {
    display: none;
}

@media (max-width: 700px) {
    .header,
    .selection-grid,
    .control-grid {
        display: block;
    }

    .selection-grid label + label,
    .control-grid label + label {
        margin-top: 12px;
    }

    .secondary-button {
        margin-top: 12px;
    }
}
