/* ======================= */
/* Enhanced Writing Interface - schrijven.css */
/* ======================= */

:root {
    --animation-duration: 0.5s;
    --transition-ease: cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.08), 0 6px 6px rgba(0, 0, 0, 0.12);
    --card-hover-shadow: 0 14px 28px rgba(0, 0, 0, 0.15), 0 10px 10px rgba(0, 0, 0, 0.12);
    --glow-effect: 0 0 10px rgba(255, 103, 0, 0.4);
    --editor-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.1);
  }
  
  /* Main Container Styles */
  .writing-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s var(--transition-ease) forwards;
  }
  
  /* Page Header */
  .page-header {
    background: linear-gradient(135deg, var(--primary-color), #ff8533);
    color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 40px;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--transition-ease);
  }
  
  .page-header:hover {
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-2px);
  }
  
  .page-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 60%);
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
  }
  
  .header-subtitle {
    opacity: 0.95;
    margin-top: 8px;
    font-weight: 300;
    font-size: 1.1em;
  }
  
  /* Content Wrapper */
  .content-wrapper {
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 40px;
    transform: translateY(0);
    transition: all 0.4s var(--transition-ease);
    position: relative;
  }
  
  .content-wrapper:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
  }
  
  /* Instructions Panel */
  .instructions-panel {
    margin-bottom: 30px;
    animation: fadeIn 0.6s var(--transition-ease);
    transition: all 0.3s var(--transition-ease);
  }
  
  .instructions-panel.hidden {
    opacity: 0;
    transform: translateY(-20px);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  
  .tips-section {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    transition: transform 0.3s var(--transition-ease);
  }
  
  .tips-section h3 {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
    font-weight: 600;
  }
  
  .tips-section h3::after {
    content: '';
    position: absolute;
    left: 25%;
    bottom: -10px;
    height: 3px;
    width: 50%;
    background: var(--primary-color);
    border-radius: 3px;
  }
  
  /* Tips Grid */
  .tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 25px;
  }
  
  .tip-card {
    background: white;
    padding: 25px 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.35s var(--transition-bounce);
    position: relative;
    z-index: 1;
    overflow: hidden;
  }
  
  .tip-card::before {
    content: '';
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 103, 0, 0.1), rgba(255, 143, 0, 0.05));
    transform: scaleX(0);
    transform-origin: 0 50%;
    transition: transform 0.6s var(--transition-ease);
    border-radius: var(--border-radius);
  }
  
  .tip-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--card-hover-shadow);
  }
  
  .tip-card:hover::before {
    transform: scaleX(1);
  }
  
  .tip-icon {
    font-size: 2.2em;
    margin-bottom: 15px;
    color: var(--primary-color);
    transition: transform 0.3s var(--transition-bounce);
  }
  
  .tip-card:hover .tip-icon {
    transform: scale(1.15);
  }
  
  .tip-card h4 {
    font-weight: 600;
    margin-bottom: 10px;
    transition: color 0.3s var(--transition-ease);
  }
  
  .tip-card:hover h4 {
    color: var(--primary-color);
  }
  
  /* Exercise Settings */
  .exercise-settings {
    margin-top: 35px;
    padding: 20px;
    border-radius: var(--border-radius);
    background: linear-gradient(to right, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.97));
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s var(--transition-ease);
  }
  
  .exercise-settings:hover {
    transform: translateY(-3px);
  }
  
  .level-selector {
    margin-bottom: 25px;
    transition: all 0.3s var(--transition-ease);
  }
  
  .level-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #444;
  }
  
  .level-selector select {
    width: 100%;
    max-width: 300px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1em;
    margin-top: 8px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6700' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    transition: all 0.3s var(--transition-ease);
  }
  
  .level-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.15);
  }
  
  .level-selector select:hover {
    border-color: #ccc;
  }
  
/* Verbeterde laadanimatie voor schrijven.css */

/* Laadanimatie container */
.loading-state {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: white;
    padding: 30px 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 300px;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  
  .loading-state.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  
  /* Niet verborgen wanneer het geen .hidden klasse heeft */
  .loading-state:not(.hidden) {
    transform: scale(1);
    opacity: 1;
  }
  
  /* Geavanceerde laadanimatie */
  .loader-fancy {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
  }
  
  .loader-pencil {
    position: absolute;
    left: 0;
    top: 0;
    width: 80px;
    height: 80px;
    animation: pencil-animation 2s infinite ease-in-out;
  }
  
  .loader-pencil:before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 12px;
    height: 80px;
    background: var(--primary-color);
    border-radius: 6px;
  }
  
  .loader-pencil:after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 20px solid var(--primary-color-darker);
  }
  
  .loader-paper {
    position: absolute;
    left: 15px;
    top: 15px;
    width: 50px;
    height: 50px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 2px;
    animation: paper-animation 2s infinite ease-in-out;
    opacity: 0.8;
  }
  
  .loader-line {
    position: absolute;
    left: 20px;
    height: 2px;
    background: #aaa;
    animation: line-appear 2s infinite;
  }
  
  .loader-line:nth-child(1) {
    top: 25px;
    width: 20px;
  }
  
  .loader-line:nth-child(2) {
    top: 35px;
    width: 30px;
  }
  
  .loader-line:nth-child(3) {
    top: 45px;
    width: 15px;
  }
  
  /* Animatie voor de pen */
  @keyframes pencil-animation {
    0%, 100% {
      transform: translateY(-10px) rotate(-45deg);
    }
    50% {
      transform: translateY(5px) rotate(-45deg);
    }
  }
  
  /* Animatie voor het papier */
  @keyframes paper-animation {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.05);
    }
  }
  
  /* Animatie voor de regels op het papier */
  @keyframes line-appear {
    0%, 100% {
      opacity: 0.2;
    }
    50% {
      opacity: 0.8;
    }
  }
  
  /* Bericht onder de laadanimatie */
  .loading-message {
    font-size: 1.1em;
    color: #333;
    margin-top: 10px;
    font-weight: 500;
  }
  
  .loading-submessage {
    font-size: 0.9em;
    color: #666;
    margin-top: 8px;
  }
  
  /* Progressbar onder de animatie */
  .loader-progress {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    margin-top: 15px;
    overflow: hidden;
    position: relative;
  }
  
  .loader-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%; /* Start op 0% */
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease; /* Voeg transitie toe, maar geen animatie */
  }
  
  /* Animatie voor de voortgangsbalk */
  @keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 75%; }
    100% { width: 95%; }
  }
  
  .loading-indicator {
    z-index: 9999;
    background: rgba(255, 255, 255, 0.97);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--card-shadow);
  }
  
  .loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 103, 0, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    margin-bottom: 15px;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  @keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
  }
  
  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  /* Loading Retry Message */
  .loading-retry {
    font-size: 0.9em;
    color: #666;
    margin-top: 12px;
    opacity: 0;
    animation: fadeIn 0.3s var(--transition-ease) forwards 0.5s;
  }
  
  .loading-state p {
    margin: 12px 0;
    color: #333;
  }
  
  /* Exercise Container */
  .exercise-container {
    display: block;
    margin-top: 40px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s var(--transition-ease);
    position: relative;
  }
  
  .exercise-container:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
  }
  
  /* Exercise Content Styling */
  .exercise-content {
    margin-bottom: 30px;
    transition: all 0.3s var(--transition-ease);
  }
  
  .exercise-header {
    margin-bottom: 20px;
    position: relative;
  }
  
  .exercise-header h3 {
    font-weight: 600;
    color: #333;
    position: relative;
    display: inline-block;
  }
  
  .exercise-header h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
  }
  
  .exercise-context {
    margin: 22px 0;
    padding: 20px 25px;
    background: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    border-radius: var(--border-radius);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--transition-ease);
  }
  
  .exercise-context:hover {
    background: #f1f3f5;
    transform: translateX(5px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
  }
  
  .exercise-context::before {
    content: '〈 Context 〉';
    font-size: 0.75em;
    position: absolute;
    top: 8px;
    right: 15px;
    color: rgba(0, 0, 0, 0.2);
    font-weight: 500;
  }
  
  .exercise-instructions {
    margin: 22px 0;
    font-weight: 500;
    color: #444;
    line-height: 1.6;
    position: relative;
    padding-left: 20px;
    border-left: 4px solid rgba(255, 103, 0, 0.3);
    transition: all 0.3s var(--transition-ease);
  }
  
  .exercise-instructions:hover {
    border-left-color: var(--primary-color);
    transform: translateX(3px);
  }
  
  .exercise-requirements,
  .exercise-criteria {
    margin: 22px 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    transition: all 0.3s var(--transition-ease);
  }
  
  .exercise-requirements:hover,
  .exercise-criteria:hover {
    background: #f1f3f5;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  }
  
  .exercise-requirements h4,
  .exercise-criteria h4 {
    margin-bottom: 15px;
    font-weight: 600;
    color: #444;
  }
  
  .exercise-requirements ul,
  .exercise-criteria ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
  }
  
  .exercise-requirements li,
  .exercise-criteria li {
    padding: 8px 10px 8px 35px;
    position: relative;
    margin-bottom: 8px;
    transition: all 0.2s var(--transition-ease);
    border-radius: 4px;
  }
  
  .exercise-requirements li:hover,
  .exercise-criteria li:hover {
    background: rgba(255, 103, 0, 0.05);
    transform: translateX(3px);
  }
  
  .exercise-requirements li:before,
  .exercise-criteria li:before {
    content: "✓";
    font-weight: bold;
    color: var(--primary-color);
    position: absolute;
    left: 10px;
    transition: transform 0.2s var(--transition-bounce);
  }
  
  .exercise-requirements li:hover:before,
  .exercise-criteria li:hover:before {
    transform: scale(1.2);
  }
  
  .word-count-requirement {
    display: inline-block;
    margin: 15px 0;
    padding: 8px 16px;
    background: rgba(255, 103, 0, 0.1);
    border-radius: 20px;
    font-weight: 500;
    color: var(--primary-color);
    transition: all 0.3s var(--transition-ease);
  }
  
  .word-count-requirement:hover {
    background: rgba(255, 103, 0, 0.15);
    transform: scale(1.05);
  }
  
  /* Editor Container */
  .editor-container {
    margin-top: 35px;
    position: relative;
    transition: all 0.3s var(--transition-ease);
  }
  
  .editor-container::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: linear-gradient(to right, transparent, rgba(255, 103, 0, 0.5), transparent);
    border-radius: 3px;
  }
  
  .rich-text-editor {
    min-height: 350px;
    padding: 25px;
    border: 2px solid #e5e5e5;
    border-radius: var(--border-radius);
    background: white;
    font-family: inherit;
    line-height: 1.7;
    color: #333;
    overflow-y: auto;
    transition: all 0.3s var(--transition-ease);
    box-shadow: var(--editor-shadow);
  }
  
  .rich-text-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.1);
  }
  
  .rich-text-editor:empty::before {
    content: 'Begin hier met schrijven...';
    color: #aaa;
    font-style: italic;
  }
  
  /* Writing Tools */
  .writing-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s var(--transition-ease);
  }
  
  .writing-tools:hover {
    background: #f1f3f5;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
  }
  
  .tool-buttons {
    display: flex;
    gap: 8px;
  }
  
  .tool-button {
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s var(--transition-bounce);
    position: relative;
    overflow: hidden;
  }
  
  .tool-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 103, 0, 0.1);
    transform: scale(0);
    border-radius: 50%;
    transition: all 0.4s var(--transition-ease);
  }
  
  .tool-button:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  }
  
  .tool-button:hover::after {
    transform: scale(2);
    opacity: 0;
  }
  
  .tool-button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
  }
  
  /* Word Counter */
  .word-counter {
    font-size: 0.95em;
    color: #555;
    font-weight: 500;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    transition: all 0.3s var(--transition-ease);
  }
  
  .word-counter:hover {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  }
  
  /* Action Buttons */
  .action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .btn {
    padding: 12px 20px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s var(--transition-ease);
    position: relative;
    overflow: hidden;
    font-size: 1em;
  }
  
  .btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0);
    border-radius: 50%;
    transition: all 0.5s var(--transition-ease);
  }
  
  .btn:hover::after {
    transform: scale(2.5);
    opacity: 0;
  }
  
  .btn.primary {
    background: var(--primary-color);
    color: white;
  }
  
  .btn.primary:hover {
    background: var(--primary-color-darker);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(255, 103, 0, 0.3);
  }
  
  .btn.primary:active {
    transform: translateY(-1px);
  }
  
  .btn.secondary {
    background: #f1f3f5;
    color: #555;
  }
  
  .btn.secondary:hover {
    background: #e9ecef;
    color: #333;
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  }
  
  /* Feedback Container */
  .feedback-container {
    margin-top: 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s var(--transition-ease);
  }
  
  .feedback-container:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
  }
  
  .feedback-header {
    margin-bottom: 25px;
    text-align: center;
  }
  
  .feedback-header h3 {
    font-weight: 600;
    color: #333;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
  }
  
  .feedback-header h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 50%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
  }
  
  .feedback-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin: 30px 0;
  }
  
  .feedback-section {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s var(--transition-ease);
    position: relative;
    overflow: hidden;
  }
  
  .feedback-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), transparent);
  }
  
  .feedback-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }
  
  .feedback-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 600;
    position: relative;
    display: inline-block;
  }
  
  .feedback-section h4::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 103, 0, 0.2);
    border-radius: 2px;
  }
  
  .feedback-content {
    line-height: 1.7;
    color: #444;
  }
  
  .feedback-score {
    margin-top: 25px;
    padding: 12px 25px;
    background: linear-gradient(to right, rgba(255, 103, 0, 0.1), rgba(255, 143, 0, 0.05));
    border-radius: 30px;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-block;
    transition: all 0.3s var(--transition-bounce);
  }
  
  .feedback-score:hover {
    transform: scale(1.05);
    box-shadow: var(--glow-effect);
  }
  
  /* Auto-save Notification */
  .auto-save-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #28a745;
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s var(--transition-ease);
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
  }
  
  .auto-save-notification.show {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Primary Button */
  .primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s var(--transition-ease);
    position: relative;
    overflow: hidden;
    font-size: 1.05em;
    box-shadow: 0 4px 6px rgba(255, 103, 0, 0.2);
  }
  
  .primary-button .button-icon {
    transition: transform 0.3s var(--transition-bounce);
  }
  
  .primary-button:hover {
    background: var(--primary-color-darker);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(255, 103, 0, 0.3);
  }
  
  .primary-button:hover .button-icon {
    transform: scale(1.2);
  }
  
  .primary-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(255, 103, 0, 0.2);
  }
  
  .primary-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0);
    border-radius: 50%;
    transition: all 0.5s var(--transition-ease);
  }
  
  .primary-button:hover::after {
    transform: scale(2.5);
    opacity: 0;
  }
  
  .primary-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }
  
  .primary-button:disabled::after {
    display: none;
  }
  
  /* Progress Indicator */
  .progress-indicator {
    margin-top: 40px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    transition: all 0.3s var(--transition-ease);
    opacity: 0;
    transform: translateY(20px);
  }
  
  .progress-indicator:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
  }
  
  .progress-indicator:hover {
    background: #f1f3f5;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  }
  
  .progress-indicator p {
    font-weight: 600;
    margin-bottom: 15px;
    color: #444;
  }
  
  .progress-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
  }
  
  .stat-item {
    padding: 15px;
    background: white;
    border-radius: var(--border-radius);
    min-width: 150px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s var(--transition-ease);
  }
  
  .stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
  }
  
  .stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
  }
  
  .stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--primary-color);
  }
  
  /* Recovery Modal */
  .modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    padding: 30px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--transition-ease);
    max-width: 400px;
    width: 90%;
    text-align: center;
  }
  
  .modal.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
  }
  
  .modal p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
  }
  
  .modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
  }
  
  /* Error Boundary */
  .error-boundary {
    padding: 20px;
    margin: 20px 0;
    background: #fff0f0;
    border-left: 4px solid #ff4444;
    border-radius: var(--border-radius);
    display: none;
    box-shadow: 0 3px 8px rgba(255, 68, 68, 0.1);
    position: relative;
    transition: all 0.3s var(--transition-ease);
    transform: translateY(10px);
    opacity: 0;
  }
  
  .error-boundary.show {
    display: block;
    animation: fadeInUp 0.3s var(--transition-ease) forwards;
  }
  
  .error-boundary p {
    color: #d32f2f;
    margin: 0;
    line-height: 1.5;
  }
  
  /* Responsive Design */
  @media (max-width: 768px) {
    .writing-container {
      padding: 15px;
      margin: 1rem auto;
    }
    
    .content-wrapper {
      padding: 25px 20px;
    }
    
    .page-header {
      padding: 25px 15px;
    }
    
    .feedback-sections {
      grid-template-columns: 1fr;
    }
    
    .writing-tools {
      flex-direction: column;
      gap: 12px;
    }
    
    .tool-buttons {
      width: 100%;
      justify-content: center;
    }
    
    .exercise-requirements li,
    .exercise-criteria li {
      padding: 8px 8px 8px 30px;
    }
    
    .action-buttons {
      flex-direction: column;
      align-items: center;
    }
    
    .btn {
      width: 100%;
      max-width: 300px;
    }
    
    .tips-grid {
      gap: 15px;
    }
    
    .stat-item {
      flex: 1 0 40%;
    }
  }
  
  @media (max-width: 480px) {
    .tool-button {
      width: 35px;
      height: 35px;
    }
    
    .content-wrapper {
      padding: 20px 15px;
    }
    
    .exercise-context,
    .exercise-instructions,
    .exercise-requirements,
    .exercise-criteria {
      padding: 15px;
    }
    
    .stat-item {
      flex: 1 0 100%;
    }
  }
  
  /* Additional animations */
  @keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(255, 103, 0, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 103, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 103, 0, 0); }
  }
  
  @keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  
  @keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }
  
  /* Animated Feedback Effects */
  .feedback-container:not(.hidden) .feedback-section:nth-child(1) {
    animation: slideInLeft 0.4s var(--transition-ease) forwards 0.1s;
  }
  
  .feedback-container:not(.hidden) .feedback-section:nth-child(2) {
    animation: slideInLeft 0.4s var(--transition-ease) forwards 0.2s;
  }
  
  .feedback-container:not(.hidden) .feedback-section:nth-child(3) {
    animation: slideInRight 0.4s var(--transition-ease) forwards 0.3s;
  }
  
  .feedback-container:not(.hidden) .feedback-section:nth-child(4) {
    animation: slideInRight 0.4s var(--transition-ease) forwards 0.4s;
  }
  
  /* Additional styling for better focus states and accessibility */
  .form-control:focus,
  .rich-text-editor:focus,
  .btn:focus,
  .tool-button:focus,
  .primary-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.3);
  }
  
  /* Improve focus visibility for keyboard navigation */
  *:focus-visible {
    outline: 3px solid rgba(255, 103, 0, 0.5);
    outline-offset: 2px;
  }

/* Game Intermezzo Styling - Verbeterde responsiveness */
.game-intermezzo {
    position: relative;
    padding: 20px;
    margin: 20px auto;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: all 0.3s ease;
    max-width: 95%;
    overflow: visible; /* Zorg dat inhoud zichtbaar blijft */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-intermezzo-container {
    position: relative;
    width: 100%;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 640 / 480; /* Behoud aspect ratio */
    max-height: 60vh; /* Maximum hoogte van 60% viewhoogte */
    overflow: visible;
}

#intermezzoGameCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    background-color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.game-start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    z-index: 10;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

/* Responsieve aanpassingen specifiek voor mobiel */
@media (max-width: 768px) {
    .game-intermezzo {
        padding: 10px;
        margin: 10px auto;
        max-width: 98%;
    }
    
    .game-intermezzo-header h3 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }
    
    .intermezzo-subtitle {
        font-size: 0.9rem;
    }
    
    .game-intermezzo-container {
        max-height: 50vh; /* Kleiner op mobiel */
    }
    
    .game-start-overlay h4 {
        font-size: 1.1rem;
    }
    
    .game-start-overlay p {
        font-size: 0.9rem;
    }
    
    .start-snake-button {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .game-controls-mini {
        flex-direction: column;
        margin-top: 10px;
    }
    
    /* Zorg dat de controls beter op kleine schermen passen */
    .arrow {
        width: 30px;
        height: 30px;
        font-size: 1rem;
        margin: 3px;
    }
}

/* Zorgt dat er geen ongewenste scroll is tijdens het spelen */
body.snake-game-active {
    overflow: auto !important; /* We willen juist wel kunnen scrollen naar het spel */
}

/* Verbeterde game controls voor betere leesbaarheid */
.game-controls-mini {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Pulse animatie voor feedback knop */
@keyframes pulse-attention {
    0% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(66, 133, 244, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(66, 133, 244, 0);
        transform: scale(1);
    }
}

.pulse-attention {
    animation: pulse-attention 1.5s infinite;
}

/* Mindfulness intermezzo stijlen */
#mindful-intermezzo {
    background-color: #f5f8ff;
    border-radius: 15px;
    padding: 2rem;
    margin: 2rem 0;
    transition: all 0.5s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.meditation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.breathing-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transform: scale(1);
    transition: transform 4s cubic-bezier(0.51, 0.84, 0.32, 1.19);
    box-shadow: 0 0 30px rgba(108, 142, 251, 0.5);
    margin: 2rem 0;
}

.circle-text {
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.meditation-instruction {
    font-style: italic;
    color: #667;
    margin-top: 1rem;
}

.feedback-button {
    margin-top: 2rem;
    transition: all 0.3s ease;
}

.feedback-button:disabled {
    opacity: 0.7;
    cursor: wait;
}

.feedback-button.ready-pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(108, 142, 251, 0.7);
    }
    
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(108, 142, 251, 0);
    }
    
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(108, 142, 251, 0);
    }
}

/* Verbeterde feedback container stijlen */
#feedback-container {
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin: 2rem 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.feedback-header {
    background-color: #f5f7fa;
    padding: 1.5rem;
    border-bottom: 1px solid #eaeef3;
}

.feedback-content {
    padding: 2rem;
}

.feedback-scores {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.score-item {
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    margin: 1rem auto;
}

.score-pill {
    background-color: #f0f3f9;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    display: inline-block;
    font-weight: 600;
    margin-top: 1rem;
}

.feedback-general,
.feedback-grammar,
.feedback-vocabulary,
.feedback-strengths,
.feedback-improvements {
    margin-bottom: 2rem;
    background-color: #f9fafc;
    padding: 1.5rem;
    border-radius: 10px;
}

.feedback-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feedback-grammar,
.feedback-vocabulary {
    flex: 1;
    min-width: 300px;
}

.feedback-strengths-improvements {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.feedback-strengths,
.feedback-improvements {
    flex: 1;
    min-width: 300px;
}

/* Verbeterde stijlen voor meditation intermezzo */
.meditation-audio {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.audio-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(108, 142, 251, 0.3);
}

.audio-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(108, 142, 251, 0.5);
}

.meditation-actions {
    margin-top: 25px;
    text-align: center;
}

.breathing-exercise {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

/* Verbeterde animatie voor breathing circle */
@keyframes breathingInSlow {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(108, 142, 251, 0.3); }
    100% { transform: scale(1.3); box-shadow: 0 0 40px rgba(108, 142, 251, 0.5); }
}

@keyframes breathingOutSlow {
    0% { transform: scale(1.3); box-shadow: 0 0 40px rgba(108, 142, 251, 0.5); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(108, 142, 251, 0.3); }
}

.breathing-circle {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transform: scale(1);
    box-shadow: 0 0 20px rgba(108, 142, 251, 0.3);
    transition: all 4s cubic-bezier(0.51, 0.84, 0.32, 1.19);
    margin: 2rem 0;
}

/* Audio controls en states */
.audio-toggle.audio-error {
    background: linear-gradient(135deg, #e57373, #ef5350);
    animation: pulse 2s infinite;
}

.audio-toggle.click-to-play {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.8; }
}

/* Stille modus voor audiobediening */
.audio-toggle.silent-mode {
    background: linear-gradient(135deg, #9e9e9e, #757575);
    opacity: 0.7;
}

.audio-toggle.silent-mode:hover {
    opacity: 1;
    background: linear-gradient(135deg, #757575, #616161);
}

/* Verbeterde animatie voor de ademhalingscirkel */
.breathing-circle {
    transition: transform 4s cubic-bezier(0.5, 0, 0.5, 1), 
                box-shadow 4s cubic-bezier(0.5, 0, 0.5, 1);
}

.breathing-circle[data-phase="inhale"],
.breathing-circle[data-phase="hold"] {
    transform: scale(1.3);
    box-shadow: 0 0 40px rgba(108, 142, 251, 0.5);
}

.breathing-circle[data-phase="exhale"] {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(108, 142, 251, 0.3);
}

.circle-text {
    transition: opacity 0.5s ease;
}