← Mike Higgins Home
Custom Code Experiment •

French: Reflexive Verbs

Source Code View HTML / CSS / JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>French Reflexive Verbs — Flashcard Game</title>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<style>
  :root {
    --cream: #f5f0e8;
    --dark: #000000;
    --gold: #c9a84c;
    --gold-light: #e8d49a;
    --red: #e05545;
    --blue: #5b9fd4;
    --green: #3dba72;
    --card-shadow: 0 20px 60px rgba(0,0,0,0.5);
    --text-primary: #f0ece4;
    --text-muted: rgba(240,236,228,0.5);
  }

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

  body {
    background: #000000;
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
  }

  /* Decorative background */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(ellipse 60% 40% at 10% 20%, rgba(201,168,76,0.08) 0%, transparent 70%),
      radial-gradient(ellipse 50% 60% at 90% 80%, rgba(91,159,212,0.07) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  /* Dotted texture overlay */
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
  }

  header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 20px 20px;
    width: 100%;
  }

  header .label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
  }

  header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.2rem);
    color: var(--text-primary);
    line-height: 1.1;
  }

  header h1 em {
    font-style: italic;
    color: var(--blue);
  }

  header .divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    margin: 16px auto 0;
  }

  /* Progress bar */
  .progress-wrap {
    position: relative;
    z-index: 1;
    width: min(500px, 90vw);
    margin: 24px auto 0;
  }

  .progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }

  .progress-info span {
    font-size: 12px;
    color: var(--text-primary);
    opacity: 0.6;
    letter-spacing: 1px;
  }

  .progress-info .score {
    font-weight: 500;
    opacity: 1;
    color: var(--green);
  }

  .progress-bar-bg {
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
  }

  .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--blue));
    border-radius: 2px;
    transition: width 0.4s ease;
  }

  /* Mode tabs */
  .mode-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    margin: 28px auto 0;
    background: rgba(255,255,255,0.07);
    border-radius: 40px;
    padding: 5px;
    width: fit-content;
  }

  .mode-tab {
    padding: 8px 22px;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--text-primary);
    opacity: 0.5;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.25s;
  }

  .mode-tab.active {
    background: var(--gold);
    color: #000;
    opacity: 1;
  }

  /* === FLASHCARD === */
  .card-stage {
    position: relative;
    z-index: 1;
    width: min(540px, 92vw);
    margin: 36px auto 0;
    perspective: 1200px;
  }

  .card-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
  }

  .card-wrapper.flipped {
    transform: rotateY(180deg);
  }

  .card-face {
    position: absolute;
    inset: 0;
    border-radius: 20px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-shadow: var(--card-shadow);
  }

  .card-front {
    background: #111111;
    color: var(--cream);
    border: 1px solid rgba(201,168,76,0.3);
  }

  .card-front::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--blue));
    border-radius: 20px 20px 0 0;
  }

  .card-back {
    background: #1a1a1a;
    color: var(--text-primary);
    transform: rotateY(180deg);
    border: 1px solid rgba(255,255,255,0.08);
  }

  .card-tag {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
    opacity: 0.4;
  }

  .card-front .card-tag { color: var(--gold-light); }

  .card-main-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.4rem, 4vw, 2rem);
    text-align: center;
    line-height: 1.3;
  }

  .card-front .card-main-text {
    color: var(--cream);
  }

  .card-sub-text {
    font-size: 13px;
    margin-top: 12px;
    opacity: 0.5;
    text-align: center;
    font-style: italic;
  }

  .card-front .card-sub-text { color: var(--gold-light); }

  .card-flip-hint {
    position: absolute;
    bottom: 18px;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.3;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* Translation reveal */
  .translation-big {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 3.5vw, 1.7rem);
    color: var(--blue);
    text-align: center;
    line-height: 1.35;
  }

  .verb-highlight {
    display: inline-block;
    background: rgba(201,168,76,0.15);
    border-bottom: 2px solid var(--gold);
    padding: 0 4px;
    border-radius: 2px;
  }

  .example-label {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
  }

  /* Controls */
  .controls {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 14px;
    margin: 28px auto 0;
    width: min(540px, 92vw);
    justify-content: center;
    flex-wrap: wrap;
  }

  .btn {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    border-radius: 50px;
    padding: 14px 28px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .btn-wrong {
    background: rgba(192,57,43,0.1);
    color: var(--red);
    border: 1.5px solid rgba(192,57,43,0.25);
  }
  .btn-wrong:hover { background: rgba(192,57,43,0.18); transform: translateY(-2px); }

  .btn-correct {
    background: rgba(42,122,75,0.1);
    color: var(--green);
    border: 1.5px solid rgba(42,122,75,0.25);
  }
  .btn-correct:hover { background: rgba(42,122,75,0.18); transform: translateY(-2px); }

  .btn-flip {
    background: var(--gold);
    color: #000;
    flex: 1;
    max-width: 200px;
    justify-content: center;
    font-weight: 500;
  }
  .btn-flip:hover { background: #d4b05a; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,0.3); }

  .btn-shuffle {
    background: transparent;
    color: var(--text-primary);
    border: 1.5px solid rgba(255,255,255,0.15);
    opacity: 0.7;
  }
  .btn-shuffle:hover { opacity: 1; transform: translateY(-2px); }

  /* Answer buttons (hidden until flipped) */
  .answer-controls {
    display: none;
    gap: 14px;
    width: 100%;
    justify-content: center;
  }
  .answer-controls.visible { display: flex; }

  .flip-control {
    display: flex;
    gap: 14px;
    width: 100%;
    justify-content: center;
  }

  /* === QUIZ MODE === */
  .quiz-area {
    position: relative;
    z-index: 1;
    width: min(580px, 92vw);
    margin: 30px auto 0;
    display: none;
  }

  .quiz-area.active { display: block; }

  .quiz-question-card {
    background: #111111;
    border-radius: 20px;
    padding: 40px;
    border: 1px solid rgba(201,168,76,0.2);
    box-shadow: var(--card-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
  }

  .quiz-question-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--blue));
  }

  .quiz-q-label {
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 16px;
    opacity: 0.7;
  }

  .quiz-q-text {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.3rem, 4vw, 1.9rem);
    color: var(--cream);
    line-height: 1.3;
  }

  .quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
  }

  .quiz-option {
    background: #111111;
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 18px 16px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.3;
  }

  .quiz-option:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(201,168,76,0.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
  }

  .quiz-option.correct {
    background: rgba(42,122,75,0.1);
    border-color: var(--green);
    color: var(--green);
  }

  .quiz-option.wrong {
    background: rgba(192,57,43,0.08);
    border-color: var(--red);
    color: var(--red);
  }

  .quiz-option:disabled { cursor: default; }

  .quiz-feedback {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    min-height: 24px;
    font-weight: 500;
  }

  .quiz-feedback.correct { color: var(--green); }
  .quiz-feedback.wrong { color: var(--red); }

  .btn-next {
    background: var(--gold);
    color: #000;
    font-weight: 500;
    margin: 20px auto 0;
    display: none;
  }
  .btn-next.visible { display: flex; margin: 20px auto 0; }
  .btn-next:hover { background: #d4b05a; transform: translateY(-2px); }

  /* Stats bar */
  .stats-row {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 24px;
    margin: 24px auto 0;
    width: min(540px, 92vw);
    justify-content: center;
  }

  .stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #111111;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 50px;
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-primary);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  }

  .stat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
  }

  .dot-correct { background: var(--green); }
  .dot-wrong { background: var(--red); }
  .dot-remaining { background: var(--gold); }

  /* Completion screen */
  .completion {
    position: relative;
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 60px 20px;
  }

  .completion.visible { display: flex; }

  .completion-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
  }

  @keyframes bounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
  }

  .completion h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    color: var(--text-primary);
    margin-bottom: 10px;
  }

  .completion p {
    font-size: 15px;
    color: var(--text-primary);
    opacity: 0.6;
    margin-bottom: 30px;
  }

  .completion-score {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 8px;
  }

  .btn-restart {
    background: var(--gold);
    color: #000;
    font-weight: 500;
    margin-top: 10px;
  }
  .btn-restart:hover { background: #d4b05a; transform: translateY(-2px); }

  footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px 20px;
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--dark);
    opacity: 0.25;
  }

  /* Animations */
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .card-stage, .quiz-area, .controls, .stats-row, .progress-wrap {
    animation: slideUp 0.5s ease forwards;
  }

  /* Card nav */
  .card-nav {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
  }

  .nav-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.15);
    background: #111111;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  }

  .nav-btn:hover { border-color: var(--gold); transform: scale(1.1); }

  .card-counter {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    min-width: 80px;
    text-align: center;
  }

  .card-counter span { color: var(--gold); }

  @media (max-width: 480px) {
    .quiz-options { grid-template-columns: 1fr; }
    .controls { gap: 10px; }
    .btn { padding: 12px 20px; font-size: 12px; }
  }

  /* ===== INFO BUTTON ===== */
  .info-btn {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid rgba(201,168,76,0.35);
    border-radius: 50px;
    color: var(--gold);
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 9px 20px;
    cursor: pointer;
    transition: all 0.25s;
  }
  .info-btn:hover {
    background: rgba(201,168,76,0.1);
    border-color: var(--gold);
    transform: translateY(-1px);
  }
  .info-icon {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--gold);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* ===== MODAL OVERLAY ===== */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .modal-overlay.open {
    opacity: 1;
    pointer-events: all;
  }

  /* ===== MODAL BOX ===== */
  .modal {
    background: #0e0e0e;
    border: 1px solid rgba(201,168,76,0.2);
    border-radius: 24px;
    width: min(620px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,168,76,0.08);
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(201,168,76,0.2) transparent;
  }
  .modal-overlay.open .modal {
    transform: translateY(0) scale(1);
  }
  .modal::-webkit-scrollbar { width: 4px; }
  .modal::-webkit-scrollbar-track { background: transparent; }
  .modal::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 2px; }

  .modal-close {
    position: sticky;
    top: 16px;
    float: right;
    margin: 16px 16px 0 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
  }
  .modal-close:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); }

  .modal-header {
    padding: 36px 40px 28px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    clear: both;
  }
  .modal-eyebrow {
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
  }
  .modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--text-primary);
    line-height: 1.1;
    margin-bottom: 6px;
  }
  .modal-title em { color: var(--blue); font-style: italic; }
  .modal-subtitle {
    font-size: 13px;
    color: var(--text-primary);
    opacity: 0.4;
    letter-spacing: 1px;
  }

  .modal-body {
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  .modal-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: var(--gold);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
  }
  .modal-section p {
    font-size: 14px;
    color: var(--text-primary);
    opacity: 0.8;
    line-height: 1.7;
    margin-bottom: 10px;
  }
  .modal-section p:last-child { margin-bottom: 0; }
  .modal-section strong { color: var(--text-primary); opacity: 1; font-weight: 500; }
  .modal-section em { color: var(--gold-light); font-style: italic; }

  /* Pronoun table */
  .pronoun-table {
    margin-top: 14px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
  }
  .pt-header, .pt-row {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    padding: 10px 16px;
    font-size: 13px;
    gap: 8px;
    align-items: center;
  }
  .pt-header {
    background: rgba(201,168,76,0.1);
    color: var(--gold);
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
  }
  .pt-row {
    color: var(--text-primary);
    opacity: 0.8;
    border-top: 1px solid rgba(255,255,255,0.04);
  }
  .pt-row:nth-child(even) { background: rgba(255,255,255,0.02); }
  .pron {
    color: var(--blue);
    font-weight: 500;
    font-family: 'Playfair Display', serif;
    font-style: italic;
  }
  .pt-row mark {
    background: rgba(201,168,76,0.2);
    color: var(--gold-light);
    border-radius: 3px;
    padding: 0 3px;
  }

  /* Type cards */
  .type-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
  }
  .type-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 16px 20px;
  }
  .type-label {
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
  }
  .type-card p {
    font-size: 13px;
    margin-bottom: 8px !important;
    opacity: 0.6;
  }
  .type-example {
    font-family: 'Playfair Display', serif;
    font-size: 15px;
    color: var(--text-primary);
  }
  .type-example em { color: var(--gold-light); font-style: italic; }
  .type-example span {
    font-size: 12px;
    opacity: 0.5;
    font-family: 'DM Sans', sans-serif;
    margin-left: 6px;
  }

  /* Tips list */
  .tips-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
  }
  .tips-list li {
    font-size: 14px;
    color: var(--text-primary);
    opacity: 0.8;
    line-height: 1.6;
    padding-left: 20px;
    position: relative;
  }
  .tips-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-size: 18px;
    line-height: 1.3;
  }
  .tips-list li strong { color: var(--gold-light); font-weight: 500; }
  .tips-list li em { color: var(--blue); font-style: italic; }

  .modal-footer {
    padding: 0 40px 32px;
  }

  @media (max-width: 500px) {
    .modal-header, .modal-body, .modal-footer { padding-left: 24px; padding-right: 24px; }
    .pt-header, .pt-row { font-size: 11px; padding: 9px 12px; }
  }
</style>
</head>
<body>

<header>
  <div class="label">Language Learning</div>
  <h1>Verbes <em>Réfléchis</em></h1>
  <div class="divider"></div>
  <button class="info-btn" onclick="openModal()" aria-label="What is a reflexive verb?">
    <span class="info-icon">?</span> What is a reflexive verb?
  </button>
</header>

<!-- INFO MODAL -->
<div class="modal-overlay" id="modalOverlay" onclick="closeModalOutside(event)">
  <div class="modal" id="modal" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
    <button class="modal-close" onclick="closeModal()" aria-label="Close">✕</button>

    <div class="modal-header">
      <div class="modal-eyebrow">Grammar Guide</div>
      <h2 class="modal-title" id="modalTitle">Verbes <em>Réfléchis</em></h2>
      <p class="modal-subtitle">Reflexive Verbs in French</p>
    </div>

    <div class="modal-body">

      <div class="modal-section">
        <h3>What is a reflexive verb?</h3>
        <p>A reflexive verb describes an action that the subject performs <strong>on or for themselves</strong>. The action "reflects back" onto the subject — they are both the doer and the receiver of the action.</p>
        <p>In English we sometimes say <em>"I wash myself"</em> or <em>"she hurt herself"</em> — in French, this structure is built directly into the verb.</p>
      </div>

      <div class="modal-section">
        <h3>How do they work?</h3>
        <p>Reflexive verbs always appear with a <strong>reflexive pronoun</strong> that matches the subject. The infinitive form is listed with <strong>se</strong> (or <strong>s'</strong> before a vowel).</p>
        <div class="pronoun-table">
          <div class="pt-header"><span>Subject</span><span>Pronoun</span><span>Example</span></div>
          <div class="pt-row"><span>je</span><span class="pron">me / m'</span><span>je <mark>me</mark> lève</span></div>
          <div class="pt-row"><span>tu</span><span class="pron">te / t'</span><span>tu <mark>te</mark> lèves</span></div>
          <div class="pt-row"><span>il / elle</span><span class="pron">se / s'</span><span>il <mark>se</mark> lève</span></div>
          <div class="pt-row"><span>nous</span><span class="pron">nous</span><span>nous <mark>nous</mark> levons</span></div>
          <div class="pt-row"><span>vous</span><span class="pron">vous</span><span>vous <mark>vous</mark> levez</span></div>
          <div class="pt-row"><span>ils / elles</span><span class="pron">se / s'</span><span>ils <mark>se</mark> lèvent</span></div>
        </div>
      </div>

      <div class="modal-section">
        <h3>Three types to know</h3>
        <div class="type-cards">
          <div class="type-card">
            <div class="type-label">① Truly Reflexive</div>
            <p>The subject acts on themselves.</p>
            <div class="type-example">Je <em>me</em> lave. <span>— I wash myself.</span></div>
          </div>
          <div class="type-card">
            <div class="type-label">② Reciprocal</div>
            <p>Two or more people act on each other.</p>
            <div class="type-example">Ils <em>se</em> parlent. <span>— They talk to each other.</span></div>
          </div>
          <div class="type-card">
            <div class="type-label">③ Idiomatic</div>
            <p>Reflexive in French but not literally in English.</p>
            <div class="type-example">Je <em>m'</em>appelle. <span>— My name is… (lit. I call myself)</span></div>
          </div>
        </div>
      </div>

      <div class="modal-section">
        <h3>Key things to remember</h3>
        <ul class="tips-list">
          <li>In the <strong>passé composé</strong>, reflexive verbs always use <strong>être</strong> as the auxiliary: <em>Elle s'est levée.</em></li>
          <li>The past participle agrees in gender and number with the subject (in most cases).</li>
          <li>In the negative, <em>ne</em> comes before the pronoun: <em>Je <strong>ne</strong> me lève <strong>pas</strong> tôt.</em></li>
          <li>In questions, the pronoun stays with the verb: <em>Te lèves-tu tôt ?</em></li>
        </ul>
      </div>

    </div>

    <div class="modal-footer">
      <button class="btn btn-flip" onclick="closeModal()" style="max-width:100%;width:100%;justify-content:center;">Got it — start learning!</button>
    </div>
  </div>
</div>

<div class="progress-wrap">
  <div class="progress-info">
    <span id="progressText">Card 1 of 50</span>
    <span class="score" id="scoreText">✓ 0 &nbsp; ✗ 0</span>
  </div>
  <div class="progress-bar-bg">
    <div class="progress-bar-fill" id="progressFill" style="width:2%"></div>
  </div>
</div>

<div class="mode-tabs">
  <button class="mode-tab active" onclick="setMode('flashcard')">Flashcards</button>
  <button class="mode-tab" onclick="setMode('quiz')">Quiz</button>
</div>

<div class="stats-row">
  <div class="stat-pill"><div class="stat-dot dot-correct"></div><span id="correctCount">0 correct</span></div>
  <div class="stat-pill"><div class="stat-dot dot-wrong"></div><span id="wrongCount">0 incorrect</span></div>
  <div class="stat-pill"><div class="stat-dot dot-remaining"></div><span id="remainingCount">50 left</span></div>
</div>

<!-- FLASHCARD MODE -->
<div class="card-stage" id="flashcardMode">
  <div class="card-wrapper" id="cardWrapper" onclick="flipCard()">
    <div class="card-face card-front">
      <div class="card-tag">French — Tap to reveal</div>
      <div class="card-main-text" id="frenchText"></div>
      <div class="card-sub-text" id="verbHint"></div>
      <div class="card-flip-hint">↺ &nbsp; flip</div>
    </div>
    <div class="card-face card-back">
      <div class="example-label">Translation</div>
      <div class="translation-big" id="englishText"></div>
      <div class="card-sub-text" id="notesText"></div>
    </div>
  </div>
</div>

<div class="card-nav" id="cardNav">
  <button class="nav-btn" onclick="prevCard()">←</button>
  <div class="card-counter"><span id="cardNum">1</span> / 50</div>
  <button class="nav-btn" onclick="nextCard()">→</button>
</div>

<div class="controls" id="flashControls">
  <div class="flip-control" id="flipControl">
    <button class="btn btn-flip" onclick="flipCard()">Flip Card</button>
    <button class="btn btn-shuffle" onclick="shuffleCards()">⇌ Shuffle</button>
  </div>
  <div class="answer-controls" id="answerControls">
    <button class="btn btn-wrong" onclick="markAnswer(false)">✗ &nbsp;Didn't know</button>
    <button class="btn btn-correct" onclick="markAnswer(true)">✓ &nbsp;Got it!</button>
  </div>
</div>

<!-- QUIZ MODE -->
<div class="quiz-area" id="quizMode">
  <div class="quiz-question-card">
    <div class="quiz-q-label">Translate to English</div>
    <div class="quiz-q-text" id="quizQuestion"></div>
  </div>
  <div class="quiz-options" id="quizOptions"></div>
  <div class="quiz-feedback" id="quizFeedback"></div>
  <button class="btn btn-next" id="nextBtn" onclick="nextQuiz()">Next Question →</button>
</div>

<!-- COMPLETION -->
<div class="completion" id="completion">
  <div class="completion-icon">🎉</div>
  <h2>Très bien !</h2>
  <p>You've completed all 50 cards</p>
  <div class="completion-score" id="finalScore"></div>
  <p id="finalMsg"></p>
  <button class="btn btn-restart" onclick="restart()">↺ &nbsp; Start Over</button>
</div>

<footer>50 reflexive verb phrases · French Learning</footer>

<script>
const cards = [
  { fr: "Je me lève à sept heures.", en: "I get up at seven o'clock.", verb: "se lever", notes: "daily routine" },
  { fr: "Elle se brosse les dents le matin.", en: "She brushes her teeth in the morning.", verb: "se brosser", notes: "daily routine" },
  { fr: "Nous nous réveillons tôt.", en: "We wake up early.", verb: "se réveiller", notes: "daily routine" },
  { fr: "Il se douche tous les soirs.", en: "He showers every evening.", verb: "se doucher", notes: "daily routine" },
  { fr: "Tu te coiffes devant le miroir.", en: "You do your hair in front of the mirror.", verb: "se coiffer", notes: "grooming" },
  { fr: "Je me couche à minuit.", en: "I go to bed at midnight.", verb: "se coucher", notes: "daily routine" },
  { fr: "Ils s'habillent rapidement.", en: "They get dressed quickly.", verb: "s'habiller", notes: "getting ready" },
  { fr: "Elle se maquille avant de sortir.", en: "She puts on makeup before going out.", verb: "se maquiller", notes: "grooming" },
  { fr: "Nous nous promenons dans le parc.", en: "We take a walk in the park.", verb: "se promener", notes: "leisure" },
  { fr: "Je m'appelle Marie.", en: "My name is Marie.", verb: "s'appeler", notes: "introductions" },
  { fr: "Comment vous appelez-vous ?", en: "What is your name?", verb: "s'appeler", notes: "formal question" },
  { fr: "Il se sent très fatigué aujourd'hui.", en: "He feels very tired today.", verb: "se sentir", notes: "feelings" },
  { fr: "Elle se souvient de cette chanson.", en: "She remembers this song.", verb: "se souvenir", notes: "memory" },
  { fr: "Nous nous reposons après le travail.", en: "We rest after work.", verb: "se reposer", notes: "relaxation" },
  { fr: "Je me dépêche pour ne pas être en retard.", en: "I hurry so as not to be late.", verb: "se dépêcher", notes: "urgency" },
  { fr: "Ils se disputent souvent.", en: "They argue often.", verb: "se disputer", notes: "relationships" },
  { fr: "Elle s'intéresse à la musique.", en: "She is interested in music.", verb: "s'intéresser", notes: "interests" },
  { fr: "Je m'ennuie pendant les longues réunions.", en: "I get bored during long meetings.", verb: "s'ennuyer", notes: "feelings" },
  { fr: "Nous nous amusons au concert.", en: "We are having fun at the concert.", verb: "s'amuser", notes: "enjoyment" },
  { fr: "Il se plaint du mauvais temps.", en: "He complains about the bad weather.", verb: "se plaindre", notes: "complaints" },
  { fr: "Elle se trompe souvent de chemin.", en: "She often takes the wrong road.", verb: "se tromper", notes: "mistakes" },
  { fr: "Nous nous entendons bien.", en: "We get along well.", verb: "s'entendre", notes: "relationships" },
  { fr: "Je me fâche quand on me dérange.", en: "I get angry when I'm disturbed.", verb: "se fâcher", notes: "emotions" },
  { fr: "Il se rend compte de son erreur.", en: "He realises his mistake.", verb: "se rendre compte", notes: "realisation" },
  { fr: "Elle s'occupe des enfants.", en: "She takes care of the children.", verb: "s'occuper", notes: "responsibilities" },
  { fr: "Nous nous baignons dans la mer.", en: "We swim in the sea.", verb: "se baigner", notes: "leisure" },
  { fr: "Je me lave les mains avant de manger.", en: "I wash my hands before eating.", verb: "se laver", notes: "hygiene" },
  { fr: "Il s'inquiète pour sa famille.", en: "He worries about his family.", verb: "s'inquiéter", notes: "emotions" },
  { fr: "Elle se déprime facilement en hiver.", en: "She gets depressed easily in winter.", verb: "se déprimer", notes: "emotions" },
  { fr: "Nous nous installons dans le salon.", en: "We settle in the living room.", verb: "s'installer", notes: "settling in" },
  { fr: "Je me concentre sur mon travail.", en: "I concentrate on my work.", verb: "se concentrer", notes: "focus" },
  { fr: "Il se prépare pour l'examen.", en: "He prepares for the exam.", verb: "se préparer", notes: "preparation" },
  { fr: "Elles se parlent au téléphone.", en: "They talk to each other on the phone.", verb: "se parler", notes: "communication" },
  { fr: "Nous nous voyons tous les weekends.", en: "We see each other every weekend.", verb: "se voir", notes: "social" },
  { fr: "Je m'endors devant la télévision.", en: "I fall asleep in front of the television.", verb: "s'endormir", notes: "sleep" },
  { fr: "Elle se plonge dans son livre.", en: "She immerses herself in her book.", verb: "se plonger", notes: "absorption" },
  { fr: "Il se rase tous les deux jours.", en: "He shaves every two days.", verb: "se raser", notes: "grooming" },
  { fr: "Nous nous rencontrons au café.", en: "We meet at the café.", verb: "se rencontrer", notes: "social" },
  { fr: "Tu te rappelles notre voyage ?", en: "Do you remember our trip?", verb: "se rappeler", notes: "memory" },
  { fr: "Je me retrouve coincé dans la circulation.", en: "I find myself stuck in traffic.", verb: "se retrouver", notes: "situations" },
  { fr: "Elle s'adapte vite à sa nouvelle vie.", en: "She adapts quickly to her new life.", verb: "s'adapter", notes: "adaptation" },
  { fr: "Nous nous prêtons nos affaires.", en: "We lend each other our things.", verb: "se prêter", notes: "sharing" },
  { fr: "Il se casse le bras en faisant du ski.", en: "He breaks his arm while skiing.", verb: "se casser", notes: "accidents" },
  { fr: "Elle se tait pendant la réunion.", en: "She stays silent during the meeting.", verb: "se taire", notes: "silence" },
  { fr: "Nous nous habituons au bruit.", en: "We get used to the noise.", verb: "s'habituer", notes: "adaptation" },
  { fr: "Je me plains rarement.", en: "I rarely complain.", verb: "se plaindre", notes: "character" },
  { fr: "Il se bat pour ses droits.", en: "He fights for his rights.", verb: "se battre", notes: "determination" },
  { fr: "Elle se rend à Paris en train.", en: "She goes to Paris by train.", verb: "se rendre", notes: "travel" },
  { fr: "Nous nous regardons dans les yeux.", en: "We look each other in the eyes.", verb: "se regarder", notes: "connection" },
  { fr: "Je me promets de faire mieux.", en: "I promise myself to do better.", verb: "se promettre", notes: "resolution" }
];

let currentIndex = 0;
let isFlipped = false;
let correctCount = 0;
let wrongCount = 0;
let mode = 'flashcard';
let shuffled = [...cards];
let quizIndex = 0;
let quizAnswered = false;

function setMode(m) {
  mode = m;
  document.querySelectorAll('.mode-tab').forEach((t,i) => {
    t.classList.toggle('active', (i===0 && m==='flashcard') || (i===1 && m==='quiz'));
  });
  document.getElementById('flashcardMode').style.display = m==='flashcard' ? 'block' : 'none';
  document.getElementById('cardNav').style.display = m==='flashcard' ? 'flex' : 'none';
  document.getElementById('flashControls').style.display = m==='flashcard' ? 'flex' : 'none';
  document.getElementById('quizMode').classList.toggle('active', m==='quiz');
  if (m==='quiz') { quizIndex = 0; loadQuiz(); }
  else { loadCard(); }
}

function loadCard() {
  if (currentIndex >= shuffled.length) { showCompletion(); return; }
  const card = shuffled[currentIndex];
  document.getElementById('frenchText').textContent = card.fr;
  document.getElementById('verbHint').textContent = `Verb: ${card.verb}`;
  document.getElementById('englishText').innerHTML = card.en.replace(
    new RegExp(card.verb.replace('se ','').replace("s'",'').split(' ')[0], 'i'),
    m => `<span class="verb-highlight">${m}</span>`
  );
  document.getElementById('notesText').textContent = card.notes;
  document.getElementById('cardNum').textContent = currentIndex + 1;
  updateProgress();
  // Reset flip
  isFlipped = false;
  document.getElementById('cardWrapper').classList.remove('flipped');
  document.getElementById('answerControls').classList.remove('visible');
  document.getElementById('flipControl').style.display = 'flex';
}

function flipCard() {
  isFlipped = !isFlipped;
  document.getElementById('cardWrapper').classList.toggle('flipped', isFlipped);
  if (isFlipped) {
    document.getElementById('answerControls').classList.add('visible');
    document.getElementById('flipControl').style.display = 'none';
  } else {
    document.getElementById('answerControls').classList.remove('visible');
    document.getElementById('flipControl').style.display = 'flex';
  }
}

function markAnswer(correct) {
  if (correct) correctCount++; else wrongCount++;
  updateStats();
  currentIndex++;
  loadCard();
}

function nextCard() {
  if (currentIndex < shuffled.length - 1) { currentIndex++; isFlipped = false; loadCard(); }
}
function prevCard() {
  if (currentIndex > 0) { currentIndex--; isFlipped = false; loadCard(); }
}

function shuffleCards() {
  shuffled = [...cards].sort(() => Math.random() - 0.5);
  currentIndex = 0; correctCount = 0; wrongCount = 0;
  updateStats(); loadCard();
}

function updateProgress() {
  const pct = Math.max(2, ((currentIndex) / shuffled.length) * 100);
  document.getElementById('progressFill').style.width = pct + '%';
  document.getElementById('progressText').textContent = `Card ${Math.min(currentIndex+1, shuffled.length)} of ${shuffled.length}`;
}

function updateStats() {
  document.getElementById('correctCount').textContent = `${correctCount} correct`;
  document.getElementById('wrongCount').textContent = `${wrongCount} incorrect`;
  document.getElementById('remainingCount').textContent = `${Math.max(0, shuffled.length - currentIndex)} left`;
  document.getElementById('scoreText').textContent = `✓ ${correctCount}  ✗ ${wrongCount}`;
}

// QUIZ
let quizDeck = [];
function loadQuiz() {
  quizDeck = [...cards].sort(() => Math.random() - 0.5);
  quizIndex = 0; correctCount = 0; wrongCount = 0;
  showQuizQuestion();
}

function showQuizQuestion() {
  if (quizIndex >= quizDeck.length) { showCompletion(); return; }
  const card = quizDeck[quizIndex];
  document.getElementById('quizQuestion').textContent = card.fr;
  document.getElementById('quizFeedback').textContent = '';
  document.getElementById('quizFeedback').className = 'quiz-feedback';
  document.getElementById('nextBtn').classList.remove('visible');

  // Build 4 options
  let wrongOptions = cards.filter(c => c.en !== card.en).sort(() => Math.random() - 0.5).slice(0,3).map(c=>c.en);
  let options = [...wrongOptions, card.en].sort(() => Math.random() - 0.5);

  const container = document.getElementById('quizOptions');
  container.innerHTML = '';
  options.forEach(opt => {
    const btn = document.createElement('button');
    btn.className = 'quiz-option';
    btn.textContent = opt;
    btn.onclick = () => selectQuizAnswer(btn, opt, card.en);
    container.appendChild(btn);
  });

  updateProgress();
  document.getElementById('cardNum').textContent = quizIndex + 1;
  document.getElementById('progressText').textContent = `Question ${quizIndex+1} of ${quizDeck.length}`;
  document.getElementById('progressFill').style.width = Math.max(2, (quizIndex/quizDeck.length)*100) + '%';
}

function selectQuizAnswer(btn, chosen, correct) {
  if (quizAnswered) return;
  quizAnswered = true;
  document.querySelectorAll('.quiz-option').forEach(b => {
    b.disabled = true;
    if (b.textContent === correct) b.classList.add('correct');
  });
  const fb = document.getElementById('quizFeedback');
  if (chosen === correct) {
    btn.classList.add('correct');
    fb.textContent = '✓ Correct — très bien !';
    fb.className = 'quiz-feedback correct';
    correctCount++;
  } else {
    btn.classList.add('wrong');
    fb.textContent = '✗ Not quite — the correct answer is highlighted.';
    fb.className = 'quiz-feedback wrong';
    wrongCount++;
  }
  updateStats();
  document.getElementById('nextBtn').classList.add('visible');
  quizAnswered = false;
}

function nextQuiz() {
  quizIndex++;
  showQuizQuestion();
}

function showCompletion() {
  document.getElementById('flashcardMode').style.display = 'none';
  document.getElementById('cardNav').style.display = 'none';
  document.getElementById('flashControls').style.display = 'none';
  document.getElementById('quizMode').classList.remove('active');
  const comp = document.getElementById('completion');
  comp.classList.add('visible');
  const total = correctCount + wrongCount;
  const pct = total > 0 ? Math.round((correctCount/total)*100) : 0;
  document.getElementById('finalScore').textContent = pct + '%';
  const msg = pct >= 90 ? 'Excellent ! You know your reflexive verbs!' :
    pct >= 70 ? 'Bien ! Keep practising those tricky ones.' :
    pct >= 50 ? 'Pas mal. A bit more revision will help.' : 'Keep going — practice makes perfect!';
  document.getElementById('finalMsg').textContent = msg;
}

function restart() {
  currentIndex = 0; quizIndex = 0; correctCount = 0; wrongCount = 0;
  shuffled = [...cards]; quizAnswered = false;
  document.getElementById('completion').classList.remove('visible');
  updateStats();
  if (mode === 'flashcard') {
    document.getElementById('flashcardMode').style.display = 'block';
    document.getElementById('cardNav').style.display = 'flex';
    document.getElementById('flashControls').style.display = 'flex';
    loadCard();
  } else {
    document.getElementById('quizMode').classList.add('active');
    loadQuiz();
  }
}

// Keyboard navigation
document.addEventListener('keydown', e => {
  if (e.key === 'Escape') { closeModal(); return; }
  if (mode !== 'flashcard') return;
  if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); isFlipped ? markAnswer(true) : flipCard(); }
  if (e.key === 'ArrowLeft') { e.preventDefault(); isFlipped ? markAnswer(false) : prevCard(); }
  if (e.key === 'ArrowUp') flipCard();
});

function openModal() {
  document.getElementById('modalOverlay').classList.add('open');
  document.body.style.overflow = 'hidden';
}
function closeModal() {
  document.getElementById('modalOverlay').classList.remove('open');
  document.body.style.overflow = '';
}
function closeModalOutside(e) {
  if (e.target === document.getElementById('modalOverlay')) closeModal();
}

// Init
loadCard();
updateStats();
</script>
</body>
</html>