*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f0f4f8;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #333;
    margin: 0;
}

/* Layout */
#controls, #app {
    width: 100%;
    max-width: 1200px;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

#app {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Progress bar */
#progress-bar {
    max-width: 1170px;
    height: 10px;
    background-color: #e0e0e0;
    margin-bottom: 20px;
    border-radius: 5px;
    overflow: hidden;
    width: 97%;
}

#progress {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

#progress.quiz-mode { background-color: #4CAF50; }
#progress.progress-mode { background-color: #3498db; }

/* Completion indicator */
#app::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    border: 40px solid transparent;
    border-top: 0;
    transition: border-right-color 0.3s ease;
}

#app.completed::after { border-right-color: #4CAF50; }

/* Goals container */
#goals-container {
    display: grid;
    grid-template-columns: 5fr 4fr 5fr;
    gap: 5px;
    align-items: start;
    margin-top: 20px;
    width: 100%;
}

.goal-container { display: flex; flex-direction: column; gap: 20px; }

/* Tactic and quiz input */
#tactic-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

#tactic, #quiz-input {
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    width: 100%;
    max-width: 300px;
    margin: 10px 0 5px 0;
}

#tactic {
    color: #fff;
    background-color: #007bffDD;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    clip-path: polygon(0 0, 15px 50%, 0 100%, calc(100% - 20px) 100%, 100% 50%, calc(100% - 20px) 0);
}

#tactic span {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 18px;
    z-index: 1;
    margin-left: 18px;
    margin-right: 10px;
}

#quiz-input {
    color: #333;
    padding: 10px 15px;
    border: 2px solid #007bff;
    border-radius: 5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    height: 45px;
}

#quiz-input:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

#quiz-input.correct { border-color: #28a745; background-color: #d4edda; }
#quiz-input.incorrect { border-color: #dc3545; background-color: #f8d7da; }

#quiz-feedback {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin: 5px 0 10px 0;
    min-height: 20px;
}

/* Goals */
.goal {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.goal-content { white-space: pre-wrap; }

.horizontal-bar {
    border-top: 1px solid #6c757d;
    margin: 10px 0;
}

/* Buttons and select */
button, select {
    font-size: 16px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button {
    background-color: #007bff;
    color: #ffffff;
}

button:hover { background-color: #0056b3; }

select {
    background-color: #ffffff;
    color: #333;
    width: 200px;
}

/* Specific button styles */
#prev-next-container {
    display: flex;
    align-items: center;
}

#prev-example, #next-example {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #007bff;
    border: none;
    cursor: pointer;
}

#prev-example svg, #next-example svg {
    width: 24px;
    height: 24px;
}

#prev-example:hover, #next-example:hover {
    background-color: #0056b3; /* darker shade for hover effect */
}

#prev-example {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    margin-right: 2px;
}

#next-example {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

button.quiz-mode { box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); background-color: #0056b3; }

#reset-progress:hover { background-color: #dc3545; }

/* Context and explanation */
#explanation {
    background-color: #e9ecef;
    padding: 15px 20px;
    margin: 20px auto;
    font-size: 18px;
    font-style: italic;
    text-align: center;
    line-height: 1.6;
    border-radius: 999px;
    max-width: 700px;
}

#context { 
    border-left: 4px solid #007bff; 
    display: none;
    background-color: #f8f9fa;
    padding: 10px 15px;
    margin: 20px 0;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Responsive styles */
@media (max-width: 768px) {
    body { padding: 5px; }
    #controls { gap: 5px; margin-bottom: 10px; }
    button, select { font-size: 14px; padding: 5px 10px; }
    select { width: auto; }
    #prev-example, #next-example { 
        width: 30px; 
        height: 30px;
    }
    #prev-example svg, #next-example svg {
        width: 18px;
        height: 18px;
    }
    #app { padding: 10px; }
    #goals-container { grid-template-columns: 1fr; gap: 10px; margin: 0; }
    .goal { padding: 10px; font-size: 12px; margin: 0; }
    #tactic, #quiz-input { font-size: 16px; height: 40px; margin: 0; }
    #explanation, #context { font-size: 12px; padding: 10px; margin: 10px 0; }
    #explanation { border-radius: 20px; }
    #progress-bar { height: 5px; margin-bottom: 10px; width: 90%; }
    #app::after { border-width: 0 20px 20px 0; }
}

/* Reset option in difficulty select */
#difficulty option.reset-option { background-color: #dc3545; color: white; }