@import url('brand.css');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap');

/* Shared application interface. Screen-only: printed lesson/poster layouts stay intact. */
@media screen {
  :root {
    --ink: #123f3d;
    --ink-2: #092e2d;
    --paper: #f6faf8;
    --cream: #eaf3ef;
    --mint: #b3e5d3;
    --coral: #b94332;
    --muted: #516b67;
    --line: #d7e6df;
    --shadow: 0 16px 44px rgba(13, 55, 48, .09);
    --ui-radius: 20px;
    --ui-font: Manrope, 'Segoe UI', Arial, sans-serif;
    --heading-font: 'Source Serif 4', Georgia, serif;
  }
  body { background: radial-gradient(ellipse at 95% 0, #dcefe6 0, transparent 48rem), #f3f7f5; font-family: var(--ui-font); }
  h1, h2, h3, h4 { text-wrap: balance; }
  h1, h2 { font-family: var(--heading-font); font-weight: 700; line-height: 1.15; letter-spacing: -.025em; }
  h3, h4 { font-family: var(--ui-font); font-weight: 750; }
  h1 { font-size: clamp(2.1rem, 4vw, 3.8rem); }
  h2 { font-size: clamp(1.65rem, 2.7vw, 2.6rem); }
  button, input, select, textarea { font-family: var(--ui-font); }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid #237b66; outline-offset: 4px;
  }
  input[type=radio], input[type=checkbox] { accent-color: #21715d; flex-shrink: 0; width: 18px; height: 18px; }
  button:disabled { opacity: .55; cursor: not-allowed; }
  .site-header {
    min-height: 80px; height: 80px; padding-inline: max(1.25rem, calc((100vw - 1280px) / 2));
    background: rgba(10, 48, 46, .97); color: #f6fcf9; border-bottom: 1px solid #39635a;
    box-shadow: 0 4px 20px #092e2d18; gap: 1.25rem;
  }
  .brand { flex-shrink: 0; }
  .brand-mark { border-radius: 12px; background: #ed836e; color: #153b36; box-shadow: none; }
  .brand strong { letter-spacing: .12em; }
  .brand small { color: #b3e5d3; }
  .top-nav { gap: 1.5rem; }
  .site-header :is(.site-nav, .veg-nav, .language-header-links) {
    display: flex; flex-wrap: wrap; align-items: center; gap: .55rem 1.1rem; font-size: .8rem; font-weight: 700;
  }
  .site-header nav a { padding-block: .5rem; }
  .site-header nav a:hover { color: #b3e5d3; }
  /* Reading templates use a separate header, including a plain-text brand. */
  .reading-header {
    position: sticky; top: 0; z-index: 30; min-height: 80px;
    padding: 1rem max(1.25rem, calc((100vw - 1280px) / 2));
    background: #0d3936; color: #f6fcf9; border-bottom: 1px solid #39635a;
  }
  .reading-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; flex-wrap: wrap; }
  .reading-header .brand > span:last-child { font-size: .9rem; font-weight: 800; letter-spacing: .12em; line-height: 1.2; }
  .reading-header-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .8rem; font-size: .75rem; }
  .reading-header-meta .badge { background: #24564c; border: 1px solid #477568; color: #e3f2ec; }
  .reading-header-meta .nav-back-link { padding: .35rem 0; }
  .reading-header-meta span.badge { background: transparent; border: 0; padding: 0; border-radius: 0; }
  .reading-header-meta a.badge { padding: .35rem .6rem; border-radius: 6px; }
  .reading-header-meta a.badge:hover { background: #346b5e; }
  #unit-navigation { scroll-margin-top: 160px; }
  /* Companion navigation: styled consistently across reading, grammar, and quiz pages. */
  body main :is(.nav-bar-companion, div:has(> a.material-open), div:has(> a.study-link), .test-study-links) { gap: .5rem !important; display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; margin-block: 1rem 1.5rem; }
  body main :is(.study-link, .nav-bar-companion > a, div:has(> a.material-open) > a, .test-study-links > a) {
    background: #f6faf8 !important; color: #123f3d !important;
    border: 1px solid #bacfc5 !important; border-radius: 10px !important; box-shadow: none !important;
    min-height: 38px; padding: .45rem .8rem !important;
    font-size: .78rem !important; font-weight: 700 !important; line-height: 1.4; white-space: normal;
    text-decoration: none !important;
    max-width: 100%; overflow-wrap: anywhere;
    display: inline-flex; align-items: center; gap: .45rem;
    transition: all .2s ease;
  }
  body main :is(.study-link, .nav-bar-companion > a, div:has(> a.material-open) > a, .test-study-links > a):hover {
    background: #e3f0e9 !important; border-color: #629882 !important; color: #092e2d !important;
    transform: translateY(-1px);
  }
  body main :is(.nav-bar-companion > a.active, .test-study-links > a.active) {
    background: #dcece3 !important; border-color: #629882 !important; font-weight: 800 !important;
  }
  /* Modern Audio Buttons & Clean Speaker Icon */
  .btn-speak-word {
    display: inline-flex !important; align-items: center; justify-content: center;
    width: 30px !important; min-width: 30px !important; height: 30px !important; min-height: 30px !important;
    padding: 0 !important; border-radius: 50% !important;
    border: 1px solid #b8d9cc !important; background: #eaf5f0 !important;
    color: transparent !important; /* Hide raw ◖ glyph */
    cursor: pointer; vertical-align: middle; line-height: 0 !important; font-size: 0 !important;
    position: relative; transition: all .2s ease; margin-left: 4px;
    box-shadow: 0 2px 5px rgba(18, 63, 61, .06);
  }
  .btn-speak-word:hover {
    background: #b3e5d3 !important; border-color: #55967f !important;
    transform: scale(1.08); box-shadow: 0 3px 8px rgba(18, 63, 61, .14);
  }
  .btn-speak-word::before {
    content: ""; display: inline-block; width: 14px; height: 14px; background-color: #123f3d;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'%3E%3C/polygon%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'%3E%3C/path%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'%3E%3C/path%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'%3E%3C/polygon%3E%3Cpath d='M15.54 8.46a5 5 0 0 1 0 7.07'%3E%3C/path%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14'%3E%3C/path%3E%3C/svg%3E") no-repeat center / contain;
  }
  .btn-listen-para, .audio-btn-inline {
    display: inline-flex; align-items: center; gap: .45rem;
    background: #f6faf8; border: 1px solid #bacfc5; border-radius: 10px;
    padding: .45rem .85rem; font-size: .8rem; font-weight: 700; color: #123f3d;
    transition: all .2s ease; cursor: pointer;
  }
  .btn-listen-para:hover, .audio-btn-inline:hover {
    background: #e3f0e9; border-color: #629882;
  }
  .speaker-icon { width: 15px; height: 15px; flex-shrink: 0; vertical-align: middle; stroke: currentColor; fill: none; }
  /* Legacy Turkish Template Normalization */
  body :is(.v-card, .v-btn-speak, .filter-btn, .nav-pill, .toolbar-row) { border-radius: 12px; }
  body .v-card { border-color: var(--line); background: #ffffff; box-shadow: 0 4px 16px rgba(18, 63, 61, .05); }
  body .filter-btn { border-color: #bacfc5; background: #f6faf8; color: var(--ink); min-height: 38px; font-weight: 700; }
  body .filter-btn.active { background: var(--ink); color: #ffffff; border-color: var(--ink); }
  body .v-btn-speak { border-color: #bacfc5; background: #f6faf8; color: var(--ink); min-height: 38px; font-weight: 700; border-radius: 10px; }
  body .v-btn-speak:hover { background: #e3f0e9; border-color: #629882; }

  .menu-toggle { color: #f6fcf9; background: #204f49; border-color: #53786c; border-radius: 12px; }
  .button, .btn-primary, .btn-secondary, .btn-listen-para, .audio-btn-inline,
  .reading-tools button, .quiz-actions button, .vocab-actions button, .step-btn, .p-btn,
  .veg-tools button, .exercise-tools button, .retry, .btn {
    border-radius: 12px; min-height: 44px; font-weight: 750;
  }
  .button, .btn-primary, .quiz-actions .grade { background: #b94332; color: #fff; box-shadow: 0 5px 14px #b9433220; }
  .button:hover, .btn-primary:hover, .quiz-actions .grade:hover { background: #963427; }
  .btn-secondary { background: #ffffff; color: var(--ink); border: 1px solid #bacfc5; }
  .btn-secondary:hover { background: #e3f0e9; border-color: #629882; }
  .button-light { background: #b3e5d3; color: #123f3d; }
  .button-light:hover { background: #d3f0e4; color: #123f3d; }
  .button-small { min-height: 44px; }
  body :is(.exercise-tools, .quiz-actions, .exercise-actions) {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
    padding-inline: .625rem; gap: .75rem;
  }
  body :is(.exercise-tools, .quiz-actions, .exercise-actions) > button {
    max-width: 100%; white-space: normal; overflow-wrap: anywhere;
  }
  .hero {
    min-height: 610px; background: radial-gradient(ellipse at 90% 20%, #2d685a 0, transparent 65%), #0d3936;
    color: #f8fcfa; gap: 4rem; padding-block: 4.5rem;
  }
  .hero h1 { font-size: clamp(2.5rem, 4.5vw, 4.6rem); }
  .hero h1 em, .final-cta h2 em { color: #b3e5d3; font-style: normal; }
  .hero-copy > p { color: #d2e7df; }
  .hero .eyebrow, .hero .hero-stats span { color: #c1ded3; }
  .hero .text-link { border-color: #a4cec0; }
  .hero-stats { gap: 2.5rem; border-color: #426b60; }
  .hero-stats strong { font-family: var(--ui-font); font-size: 1.6rem; }
  .hero-panel { color: #123f3d; border-radius: 28px; transform: none; border: 1px solid #9fcaba; box-shadow: 0 30px 80px #001c2b55; }
  .hero-panel::before { display: none; }
  .sample-card, .mini-grid > div { border-radius: 14px; }
  .sample-icon { border-radius: 12px; }
  .progress { border-radius: 8px; overflow: hidden; }
  .intro, .languages-section, .level-section { padding-block: 4.5rem; }
  .intro { gap: 5vw; }
  .intro .accent-copy { font-family: var(--ui-font); font-size: 1.2rem; }
  .features { gap: 1px; }
  .features article { min-height: 280px; padding: 2.5rem 1.5rem; }
  .features h3 { font-family: var(--ui-font); margin-top: 1.5rem; }
  .language-grid { border: 0; gap: 1.1rem; }
  .language-card { border: 1px solid var(--line); border-radius: var(--ui-radius); background: #fff; min-height: 215px; box-shadow: 0 4px 16px #123f3d05; }
  .language-card:hover { background: #fff; border-color: #8ac5b0; box-shadow: var(--shadow); }
  .language-card h3 { font-family: var(--ui-font); font-size: 1.5rem; }
  .level-tags span { border: 0; border-radius: 7px; background: #eaf3ef; font-size: .7rem; padding: .25rem .55rem; }
  .language-hero { background: linear-gradient(120deg, #0d3936, #245e50); color: #fff; padding-block: 3.5rem; gap: 2rem; }
  .language-hero h1 { font-size: clamp(2.5rem, 5vw, 4.4rem); }
  .language-hero .breadcrumb { color: #c7e0d5; }
  .language-symbol { color: #b3e5d3; font-family: var(--ui-font); font-size: clamp(3rem, 8vw, 7rem); }
  .level-section-head h2 { font-size: clamp(1.8rem, 3vw, 2.8rem); }
  .level-tab { border-radius: 12px; min-width: 76px; min-height: 48px; }
  .level-tab.active, .level-tab:hover { background: #123f3d; border-color: #123f3d; }
  .learning-panel { border-radius: 26px; box-shadow: var(--shadow); padding: 2rem; }
  .panel-heading h3 { font-family: var(--ui-font); font-size: 1.35rem; }
  /* Modern Multi-Colored 7 Pillars Architecture */
  .material-grid { gap: 1.15rem; }
  
  /* Pillar Theme Palettes */
  /* Pillar 01: Reading (Ocean Blue) */
  .material-card:is([data-pillar="01"], [data-title="Κατανόηση κειμένου"], [data-category="Reading"]) {
    --pillar-accent: #2563eb;
    --pillar-badge-bg: #eff6ff;
    --pillar-badge-color: #1d4ed8;
    --pillar-badge-border: #bfdbfe;
    --pillar-hover-border: #60a5fa;
    --pillar-hover-glow: rgba(37, 99, 235, 0.16);
    --pillar-active-border: #2563eb;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #f0f7ff 100%);
  }

  /* Pillar 02: Vocabulary (Emerald Green) - Crisp, elegant & distinct */
  .material-card:is([data-pillar="02"], [data-title="Λεξιλόγιο"], [data-category="Vocabulary"]) {
    --pillar-accent: #059669;
    --pillar-badge-bg: #ecfdf5;
    --pillar-badge-color: #047857;
    --pillar-badge-border: #a7f3d0;
    --pillar-hover-border: #34d399;
    --pillar-hover-glow: rgba(5, 150, 105, 0.16);
    --pillar-active-border: #059669;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #f0fdf4 100%);
  }

  /* Pillar 03: Grammar (Royal Amethyst / Purple) */
  .material-card:is([data-pillar="03"], [data-title="Γραμματική"], [data-category="Grammar"]) {
    --pillar-accent: #7c3aed;
    --pillar-badge-bg: #f5f3ff;
    --pillar-badge-color: #6d28d9;
    --pillar-badge-border: #ddd6fe;
    --pillar-hover-border: #a78bfa;
    --pillar-hover-glow: rgba(124, 58, 237, 0.16);
    --pillar-active-border: #7c3aed;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #faf5ff 100%);
  }

  /* Pillar 04: Interactive Exercises (Warm Amber / Tangerine) */
  .material-card:is([data-pillar="04"], [data-title="Διαδραστικές ασκήσεις"], [data-category="Interactive exercises"]) {
    --pillar-accent: #ea580c;
    --pillar-badge-bg: #fff7ed;
    --pillar-badge-color: #c2410c;
    --pillar-badge-border: #fed7aa;
    --pillar-hover-border: #fb923c;
    --pillar-hover-glow: rgba(234, 88, 12, 0.16);
    --pillar-active-border: #ea580c;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #fffaf5 100%);
  }

  /* Pillar 05: Educational Posters (Radiant Berry / Rose) */
  .material-card:is([data-pillar="05"], [data-title="Εκπαιδευτικές αφίσες"], [data-category="Posters"]) {
    --pillar-accent: #db2777;
    --pillar-badge-bg: #fdf2f8;
    --pillar-badge-color: #be185d;
    --pillar-badge-border: #fbcfe8;
    --pillar-hover-border: #f472b6;
    --pillar-hover-glow: rgba(219, 39, 119, 0.16);
    --pillar-active-border: #db2777;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #fdf4f9 100%);
  }

  /* Pillar 06: Role Play (Electric Teal / Cyan) */
  .material-card:is([data-pillar="06"], [data-title="Role Play"], [data-category="Role Play"]) {
    --pillar-accent: #0891b2;
    --pillar-badge-bg: #ecfeff;
    --pillar-badge-color: #0e7490;
    --pillar-badge-border: #a5f3fc;
    --pillar-hover-border: #22d3ee;
    --pillar-hover-glow: rgba(8, 145, 178, 0.16);
    --pillar-active-border: #0891b2;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #f0fdfa 100%);
  }

  /* Pillar 07: TEST (Crimson Ruby) */
  .material-card:is([data-pillar="07"], [data-title="TEST"], [data-category="Tests"], .material-card-wide) {
    --pillar-accent: #dc2626;
    --pillar-badge-bg: #fef2f2;
    --pillar-badge-color: #b91c1c;
    --pillar-badge-border: #fecaca;
    --pillar-hover-border: #f87171;
    --pillar-hover-glow: rgba(220, 38, 38, 0.16);
    --pillar-active-border: #dc2626;
    --pillar-active-bg: linear-gradient(150deg, #ffffff 0%, #fff5f5 100%);
  }

  /* Card Base Styling */
  .material-card {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    padding: 1.4rem 1.4rem 1.3rem;
    min-width: 0;
    cursor: pointer;
    text-align: left;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
    box-shadow: 0 4px 16px rgba(15, 45, 44, 0.04);
    display: flex;
    flex-direction: column;
  }

  /* Top accent color bar */
  .material-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--pillar-accent, #059669);
    opacity: 0.85;
    transition: height 0.2s ease, opacity 0.2s ease;
  }

  /* Card Number Badge (01, 02, etc.) */
  .material-card b {
    width: 44px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: var(--pillar-badge-bg, #ecfdf5);
    color: var(--pillar-badge-color, #047857);
    border: 1px solid var(--pillar-badge-border, transparent);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 1.15rem;
    transition: all 0.22s ease;
  }

  .material-card strong {
    font-family: var(--ui-font);
    font-size: 1.12rem;
    font-weight: 800;
    color: #0f2d2c;
    line-height: 1.25;
    letter-spacing: -0.015em;
    transition: color 0.2s ease;
  }

  .material-card span {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
    margin-top: 0.35rem;
  }

  /* Card Hover */
  .material-card:hover {
    border-color: var(--pillar-hover-border, #34d399);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px var(--pillar-hover-glow, rgba(5, 150, 105, 0.16));
  }
  .material-card:hover::before {
    height: 5px;
    opacity: 1;
  }
  .material-card:hover strong {
    color: var(--pillar-accent, #0f2d2c);
  }

  /* ACTIVE STATE - Highly distinct, glowing & unmistakable */
  .material-card.active {
    border-color: var(--pillar-active-border, #059669);
    border-width: 2px;
    background: var(--pillar-active-bg, #f0fdf4);
    box-shadow: 0 14px 34px var(--pillar-hover-glow, rgba(5, 150, 105, 0.2)), 0 0 0 1px var(--pillar-active-border, #059669);
    transform: translateY(-2px);
  }
  .material-card.active::before {
    height: 6px;
    opacity: 1;
  }
  .material-card.active b {
    background: var(--pillar-accent, #059669);
    color: #ffffff;
    border-color: var(--pillar-accent, #059669);
    box-shadow: 0 4px 12px var(--pillar-hover-glow, rgba(5, 150, 105, 0.3));
    transform: scale(1.05);
  }
  .material-card.active strong {
    color: var(--pillar-accent, #0f2d2c);
  }
  .material-card.active::after {
    content: "● Επιλεγμένο";
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #ffffff;
    color: var(--pillar-accent, #059669);
    border: 1px solid var(--pillar-badge-border, #a7f3d0);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    animation: badgePop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body[data-language="greek"] .material-card.active::after {
    content: "● Selected";
  }
  @keyframes badgePop {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
  }

  /* Wide Card 07 adjustments */
  .material-card-wide {
    padding: 1.4rem 1.8rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .material-card-wide b {
    margin-bottom: 0;
  }
  .material-card-wide .pill-badge {
    background: #dc2626;
    color: #ffffff !important;
  }

  /* Modern Material Detail Panel */
  .material-detail {
    border-radius: 22px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-left: 6px solid var(--detail-accent, #059669);
    padding: 2rem 2.2rem;
    box-shadow: 0 16px 44px rgba(15, 45, 44, 0.08);
    position: relative;
    overflow: hidden;
  }
  .material-detail::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--detail-accent, #059669) 0%, transparent 80%);
  }

  .material-detail[data-active-pillar="01"] { --detail-accent: #2563eb; --detail-badge-bg: #eff6ff; --detail-badge-color: #1d4ed8; }
  .material-detail[data-active-pillar="02"] { --detail-accent: #059669; --detail-badge-bg: #ecfdf5; --detail-badge-color: #047857; }
  .material-detail[data-active-pillar="03"] { --detail-accent: #7c3aed; --detail-badge-bg: #f5f3ff; --detail-badge-color: #6d28d9; }
  .material-detail[data-active-pillar="04"] { --detail-accent: #ea580c; --detail-badge-bg: #fff7ed; --detail-badge-color: #c2410c; }
  .material-detail[data-active-pillar="05"] { --detail-accent: #db2777; --detail-badge-bg: #fdf2f8; --detail-badge-color: #be185d; }
  .material-detail[data-active-pillar="06"] { --detail-accent: #0891b2; --detail-badge-bg: #ecfeff; --detail-badge-color: #0e7490; }
  .material-detail[data-active-pillar="07"] { --detail-accent: #dc2626; --detail-badge-bg: #fef2f2; --detail-badge-color: #b91c1c; }

  .material-detail h4 {
    font-family: var(--ui-font);
    font-size: 1.35rem;
    font-weight: 800;
    color: #0f2d2c;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.5rem;
  }
  .material-detail h4::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--detail-accent, #059669);
    box-shadow: 0 0 0 3px var(--detail-badge-bg, #ecfdf5);
  }
  .material-detail p {
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 1.35rem;
  }

  /* Detail Action Buttons (Material Open Links) */
  .material-detail a.material-open {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.8rem 1.25rem;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    margin-top: 0;
    margin-right: 0.5rem;
    margin-bottom: 0.65rem;
  }
  .material-detail a.material-open span {
    color: var(--detail-accent, #059669);
    font-size: 1rem;
    font-weight: 800;
    transition: transform 0.2s ease;
  }
  .material-detail a.material-open:hover {
    background: #ffffff;
    color: var(--detail-accent, #059669);
    border-color: var(--detail-accent, #059669);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  }
  .material-detail a.material-open:hover span {
    transform: translateX(4px);
  }
  .material-card-tag, .test-sub-pill, .test-sub-box { border-radius: 12px; }
  .enterprise-card { border-radius: 24px; }
  .enterprise-button { border-radius: 12px; min-height: 48px; }
  .student-benefit { padding-block: 4rem; }
  .benefit-copy h2 { font-size: clamp(2rem, 3.5vw, 3.5rem); }
  .final-cta { padding-block: 4rem; }
  .final-cta h2 { font-size: clamp(2rem, 4vw, 3.6rem); }
  /* Shared lesson workspace, across all languages and all seven modules. */
  body :is(.reading-main, .veg-main, .exercise-main, .grammar-main, .roleplay-main, .poster-main,
    .body-main, .family-main, .food-main, .numbers-main, .calendar-main, .greetings-main,
    .colors-main, .color-main, .profession-main, .time-main, .personal-main, .alphabet-main,
    .countries-main, .cnl-main, .belongings-main, .colors-page, .reading-container, .reading-page-layout, .vocab-main) {
    width: 100%; max-width: 1280px; margin-inline: auto; padding: 2.5rem clamp(1rem, 3vw, 2.5rem) 3rem;
  }
  body main > * { min-width: 0; }
  body main :is(h1, .reading-hero h1, .veg-heading h1, .exercise-heading h1, .grammar-hero h1, .roleplay-hero h1) {
    font-family: var(--ui-font); font-size: clamp(1.9rem, 3.5vw, 3.3rem); line-height: 1.2;
  }
  body main h1 em { font-family: var(--ui-font); font-style: normal; font-size: .55em; line-height: 1.5; }
  body :is(.reading-hero, .veg-heading, .exercise-heading) { gap: 2rem; padding-bottom: 2rem; align-items: start; }
  body :is(.reading-progress, .veg-progress, .exercise-score) {
    background: linear-gradient(125deg, #12443d, #22634e); border: 1px solid #447b64; border-radius: 20px; box-shadow: 0 12px 24px #123f3d18;
  }
  body :is(.reading-progress, .veg-progress, .exercise-score) strong { font-family: var(--ui-font); }
  body .reading-nav { top: 80px; border: 1px solid var(--line); border-radius: 16px; padding: .7rem; margin-block: 1rem; background: #f6faf8f5; box-shadow: 0 4px 16px #123f3d08; }
  body :is(.reading-nav a, .exercise-nav a, .nav-pill, .verb-levels a) {
    border-radius: 10px; min-height: 44px; padding: .65rem .9rem; font-size: .8rem; display: inline-flex; align-items: center;
  }
  body .reading-nav a:focus-visible { outline-offset: 1px; }
  body :is(.nav-pill.active, .verb-levels a[aria-current=page]) { background: #123f3d; color: #fff; border-color: #123f3d; }
  body .reading-section { padding-block: 2.5rem; scroll-margin-top: 180px; }
  body .reading-section > h2 { font-size: clamp(1.5rem, 2.6vw, 2.4rem); }
  body :is(.quiz-head, .reading-tools, .veg-tools) { gap: 1rem; }
  body :is(.quiz-head h2, .questions-section h2) { font-size: clamp(1.5rem, 2.6vw, 2.4rem); margin-bottom: .75rem; }
  body .quiz-score { border-radius: 14px; padding: .5rem 1rem; background: #e1f1e8; font-family: var(--ui-font); font-size: 1.5rem; white-space: nowrap; }
  body :is(.story-card, .story-paragraph, .guide-box, .scenario-card, .step-card, .exercise-section,
    .vocab-card, .veg-card, .reading-pattern, .question-card, .test-stats-card, .student-info-card,
    .result-dashboard, .practice-box, .cue-box, .veg-note, .follow-up article) {
    border-radius: var(--ui-radius); box-shadow: 0 5px 20px #123f3d08; overflow-wrap: break-word;
  }
  body :is(.story-card, .story-paragraph, .guide-box, .scenario-card, .step-card, .question-card) { background-color: #fff; }
  body :is(.veg-card, .vocab-card) { overflow: hidden; }
  body :is(.alphabet-card, .belonging-card, .body-card, .calendar-card, .color-card, .dialogue-card,
    .fruit-card, .greetings-card, .profession-card, .time-card) { border-radius: 18px; box-shadow: 0 5px 20px #123f3d08; }
  body :is(.alphabet-card, .belonging-card, .body-card, .calendar-card, .color-card,
    .fruit-card, .greetings-card, .profession-card, .time-card) { overflow: hidden; }
  body :is(.veg-word, .vocab-card h3, .story-card h3, .reading-pattern strong, .guide-box h2, .scenario-card h2) { font-family: var(--ui-font); }
  body :is(.glossary, .reading-sidebar, .narrative-glossary, .glossary-sidebar) { border-radius: 16px; background: #e7f2ec; top: 100px; }
  body :is(.glossary, .reading-sidebar, .narrative-glossary, .glossary-sidebar) :is(h3, h4, .glossary-title) { font-family: var(--ui-font); }
  body :is(.quiz-list, #questions-list, #questions-container, .questions-list) { max-width: 960px; margin-inline: auto; gap: 1.2rem; }
  body :is(.quiz-question, .question) { min-width: 0; border-radius: 18px; padding: 1.4rem; background: #fff; box-shadow: 0 5px 20px #123f3d07; }
  body :is(.quiz-question, .question) legend { max-width: 100%; font-size: 1rem; line-height: 1.6; padding-inline: .45rem; }
  body :is(.quiz-options label, .option-label, .choice) {
    min-height: 48px; border-radius: 12px; background: #f5f9f6; border: 1px solid #dce7e0; padding: .8rem 1rem;
  }
  body :is(.quiz-options label, .option-label, .choice):hover { background: #eaf4ed; border-color: #7dbba3; }
  body :is(.quiz-options label, .option-label, .choice):has(input:checked) { background: #ddf1e6; border-color: #21715d; box-shadow: inset 0 0 0 1px #21715d; }
  body :is(.quiz-question.correct, .question.correct, .question-card.evaluated-correct) { background: #f0faf4; border-color: #31855c; }
  body :is(.quiz-question.incorrect, .question.incorrect, .question-card.evaluated-wrong) { background: #fff5f2; border-color: #b94332; }
  body .option-label:is(.is-correct, .is-wrong) { padding-inline-end: 6rem; }
  body .option-label.is-correct::after { content: '✓ Σωστό'; }
  body .option-label.is-wrong::after { content: '✕ Λάθος'; }
  body[data-language=greek] .option-label.is-correct::after { content: '✓ Correct'; }
  body[data-language=greek] .option-label.is-wrong::after { content: '✕ Incorrect'; }
  body :is(.selected-words, .word-bank, .paradigm-card) { border-radius: 12px; }
  body .rules-table { display: block; overflow-x: auto; max-width: 100%; border-radius: 12px; }
  body .rules-table th { background: #e4f0e9; }
  body :is(.g-section, .poster-canvas, .poster-block) { min-width: 0; border-radius: 20px; }
  body :is(.g-section h2, .poster-block h2) { font-family: var(--ui-font); }
  body :is(.paradigm-table, .matrix-table, .p-table) { display: block; max-width: 100%; overflow-x: auto; }
  body .cards-toolbar { flex-wrap: wrap; }
  body .test-hero { background: #e4f0e9; padding-bottom: 3.5rem; }
  body .test-hero h1 { font-family: var(--ui-font); font-size: clamp(1.9rem, 3.2vw, 3rem); }
  body .test-stats-card { background: #fff; }
  body .test-container { max-width: 1000px; }
  body .babylonia-auth-card { border-radius: 24px; box-shadow: 0 24px 80px #092e2d44; }
  body .babylonia-auth-card input:not([type=checkbox]) { border-radius: 12px; min-height: 48px; }
  body :is(.unlock-card, .login-card, .stat-card, .data-card, .dashboard-card) { border-radius: 20px; box-shadow: var(--shadow); }
  body .admin-header { background: #0d3936; color: #f6fcf9; border-color: #39635a; }
  body .admin-header .brand { color: #f6fcf9; }
  body .admin-header .brand-text small { color: #b3e5d3; }
  /* Dock rules use body specificity because the existing navigation loads its CSS dynamically. */
  body .b-stepper-dock { left: max(1rem, calc((100vw - 1160px) / 2)); right: max(1rem, calc((100vw - 1160px) / 2)); bottom: 12px; border: 1px solid #c3ddd1; border-radius: 20px; background: #f8fcf9f5; box-shadow: 0 8px 36px #092e2d26; padding: .7rem; }
  body .b-stepper-btn { min-height: 44px; border-radius: 12px; }
  body .b-stepper-next { background: #b94332; border-color: #b94332; }
  body .b-stepper-center { background: #e2f2e9; }
  body .b-stepper-spacer { height: calc(110px + env(safe-area-inset-bottom, 0px)); }
  body .b-stepper-drawer-card { border-radius: 24px; }
  body .b-drawer-item a { min-height: 48px; border-radius: 12px; }
  @media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero-panel { max-width: 620px; width: 100%; }
    .top-nav { background: #123f3d; border-color: #477c67; border-radius: 16px; }
    .top-nav a { border-color: #477c67; }
    .top-nav a:last-child { color: #b3e5d3; }
    .top-nav a:hover { background: #245c4d; }
    body .reading-nav { top: 80px; }
    body :is(.reading-hero, .veg-heading) { grid-template-columns: 1fr; }
    body :is(.story-layout, .reading-layout, .reading-content-layout, .story-container, .narrative-layout, .reading-page-layout) { grid-template-columns: 1fr; }
    body :is(.glossary, .reading-sidebar, .narrative-glossary, .glossary-sidebar) { position: static; }
    .language-symbol { text-align: start; }
  }
  @media (max-width: 600px) {
    .reading-header { padding: .9rem .625rem; }
    .reading-header-inner { gap: .75rem; }
    .reading-header-meta { width: 100%; font-size: .7rem; }
    .site-header { height: auto; min-height: 80px; padding: .9rem 1rem; flex-wrap: wrap; }
    .site-header :is(.site-nav, .veg-nav, .language-header-links) { font-size: .75rem; flex-direction: row; }
    .site-header nav a { overflow-wrap: anywhere; }
    .brand strong { font-size: .8rem; }
    .brand small { font-size: .53rem; }
    .hero { padding: 2.5rem 1.25rem; }
    .hero h1 { font-size: 2.4rem; }
    .hero-stats { flex-wrap: wrap; gap: 1.2rem; margin-top: 2rem; }
    .language-hero { padding-block: 2.5rem; }
    .language-symbol { font-size: clamp(2.5rem, 12vw, 4rem); }
    .intro, .languages-section, .level-section { padding-block: 2.5rem; }
    .learning-panel { padding: 1rem; border-radius: 20px; }
    .level-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
    .level-tab { flex: 1; padding-inline: .8rem; }
    body :is(.reading-main, .veg-main, .exercise-main, .grammar-main, .roleplay-main, .poster-main) { padding: 1.5rem 1rem 2rem; }
    body .reading-nav { position: static; gap: .5rem; }
    body .reading-nav a { flex: 1 1 140px; }
    body .poster-canvas { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
    body .poster-block { padding: 1rem; }
    body :is(.reading-layout, .reading-page-layout, .narrative-layout) { grid-template-columns: minmax(0, 1fr); }
    body :is(.reading-sidebar, .narrative-block, .block-header) { min-width: 0; }
    body .block-header { flex-wrap: wrap; gap: .6rem; }
    body :is(.quiz-question, .question, .question-card, .guide-box, .step-card) { padding: 1rem; }
    body .quiz-head { flex-direction: column; align-items: start; }
    body .quiz-score { font-size: 1.1rem; }
    body :is(.quiz-options label, .option-label, .choice) { padding: .75rem; }
    body .test-stats-info { flex-wrap: wrap; gap: 1rem; }
    body .b-stepper-dock { left: .5rem; right: .5rem; bottom: max(.5rem, env(safe-area-inset-bottom, 0px)); padding: .5rem; border-radius: 16px; }
    body .b-stepper-inner { gap: .35rem; }
    body .b-stepper-btn { font-size: .72rem; padding-inline: .6rem; }
    body .b-stepper-side { gap: .25rem; flex: 1; }
    body .b-stepper-side .b-stepper-btn { min-width: 0; max-width: 100%; overflow: hidden; gap: .25rem; }
    body .b-stepper-side .b-btn-label-short { display: block !important; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    body .b-stepper-center { flex-shrink: 0; }
    body .b-stepper-center .b-step-dots { display: none; }
    .site-header .site-nav { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
    .site-header .site-nav a { font-size: .72rem; }
  }
}
@media screen and (max-width: 600px) {
  body :is(.site-header, .reading-header) { transition: transform .2s ease; }
  body :is(.site-header, .reading-header).mobile-header-hidden { transform: translateY(-100%); pointer-events: none; }
  /* Edge-to-edge mobile layout. Vertical spacing remains unchanged. */
  body { padding-inline: 0; }
  body :is(.unlock-card, .login-wrapper, #admin-dashboard) { width: 100%; max-width: 100%; margin-inline: 0; padding-inline: .625rem; border-radius: 0; }
  body #admin-dashboard { padding-inline: 0; }
  body #admin-dashboard .card-box { margin-inline: 0; padding-inline: .625rem; border-radius: 0; }
  body .level-section,
  body .language-hero,
  body .learning-panel,
  body .test-container,
  body :is(.reading-main, .veg-main, .exercise-main, .grammar-main, .roleplay-main, .poster-main,
    .body-main, .family-main, .food-main, .numbers-main, .calendar-main, .greetings-main,
    .colors-main, .color-main, .profession-main, .time-main, .personal-main, .alphabet-main,
    .countries-main, .cnl-main, .belongings-main, .colors-page, .reading-container, .reading-page-layout, .vocab-main) {
    padding-inline: 0;
    margin-inline: 0;
    width: 100%;
    max-width: 100%;
  }
  body .learning-panel { border-inline: 0; border-radius: 0; }
  body .material-grid { column-gap: 0; }
  body .material-card { border-inline: 0; border-radius: 0; padding-inline: .625rem; }
  body .material-card-wide { padding-inline: .625rem; }
  body .panel-heading { padding-inline: .625rem; }
  body .level-section-head, body .language-hero > *, body main > .breadcrumb { padding-inline: .625rem; }
  body :is(.exercise-section, .poster-canvas, .g-section, .reading-section, .story-section, .vocab-section, .questions-section) {
    padding-inline: 0; margin-inline: 0; border-inline: 0; border-radius: 0;
  }
  body :is(.guide-box, .scenario-card, .step-card, .story-card, .story-paragraph,
    .quiz-question, .question, .question-card, .poster-block, .practice-box, .cue-box,
    .glossary, .test-stats-card, .student-info-card, .result-dashboard,
    .vocab-card, .veg-card, .body-card, .calendar-card, .color-card, .belonging-card,
    .time-card, .fruit-card, .greetings-card, .profession-card, .alphabet-card,
    .reading-pattern, .follow-up article) {
    margin-inline: 0; border-inline: 0; border-radius: 0;
  }
  body :is(.guide-box, .scenario-card, .step-card, .story-card, .story-paragraph,
    .quiz-question, .question, .question-card, .poster-block, .practice-box, .cue-box,
    .glossary, .test-stats-card, .student-info-card, .result-dashboard,
    .vocab-card-body, .reading-pattern, .follow-up article) { padding-inline: .625rem; }
  body :is(.quiz-list, #questions-list, #questions-container, .questions-list,
    .vocab-grid, .veg-grid, .body-grid, .calendar-grid, .pattern-list,
    .dialogue-steps, .questions, .poster-canvas) { column-gap: 0; }
  body :is(.quiz-question, .question) { margin-inline: 0; min-inline-size: 0; }
  body :is(.veg-flip, .body-card__front, .calendar-card summary) { padding-inline: .625rem; }
  /* Introductory text needs a reading inset; lesson cards remain edge-to-edge. */
  body :is(.roleplay-hero, .grammar-hero, .vocab-hero, .lesson-hero,
    .alphabet-hero, .belongings-hero, .calendar-hero, .colors-hero, .time-hero,
    .reading-hero, .test-hero, .exercise-heading, .body-heading,
    .cards-heading, .greetings-heading, .veg-heading, .section-intro) {
    padding-inline: .625rem;
  }
  body main > :is(h1, h2, p, .module-tag, .section-number) { padding-inline: .625rem; }
  body main :is(.section-header, .section-heading, .quiz-head, .reading-tools) { padding-inline: .625rem; }
  body main :is(.reading-section, .story-section, .vocab-section, .questions-section, .exercise-section) > :is(h1, h2, h3, p, .eyebrow, .section-number) { padding-inline: .625rem; }
  body main :is(.nav-bar-companion, div:has(> a.material-open)) { padding-inline: .625rem; }
  body main :is(div, nav, p, section):has(> a.study-link) { padding-inline: .625rem; min-width: 0; max-width: 100%; }
  body main > a.study-link { display: inline-block; margin-inline: .625rem; max-width: calc(100% - 1.25rem); }
  body main :is(.exercise-nav, .reading-nav) { padding-inline: .625rem; min-width: 0; max-width: 100%; }
  body main :is(.exercise-nav, .reading-nav) > a { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  /* Toolbars whose text otherwise touches the screen edge. */
  body main :is(.veg-tools, .color-tools, .cards-toolbar) { padding-inline: .625rem; }
  /* Header links: one swipeable row instead of a multi-row grid. */
  .site-header .site-nav {
    display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 1.1rem; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .site-header .site-nav::-webkit-scrollbar { display: none; }
  .site-header .site-nav a { flex: 0 0 auto; white-space: nowrap; overflow-wrap: normal; }
  /* Module companion pills: one swipeable chip row; mobile-header.js centres the active chip. */
  body main .nav-bar-companion {
    position: relative; flex-wrap: nowrap !important; justify-content: flex-start !important;
    overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; padding-block: .25rem;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  body main .nav-bar-companion::-webkit-scrollbar { display: none; }
  body main .nav-bar-companion > a { flex: 0 0 auto; white-space: nowrap !important; max-width: none !important; overflow-wrap: normal !important; scroll-snap-align: center; }
  /* Quiz choices: full-width rows are easier to tap than wrapped inline chips. */
  body main label.choice { display: flex; width: 100%; }

  /* Mobile stacked card view for 4-column grammar rules tables */
  body .rules-table,
  body .rules-table tbody,
  body .rules-table tr,
  body .rules-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  body .rules-table thead {
    display: none;
  }
  body .rules-table tr {
    margin-bottom: .85rem;
    padding: .9rem 1rem;
    background: #ffffff;
    border: 1px solid #dce7e0;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(18, 63, 61, 0.04);
  }
  body .rules-table td {
    padding: .35rem 0;
    border: none;
    font-size: .88rem;
    line-height: 1.5;
  }
  body .rules-table td:first-child {
    font-size: .95rem;
    font-weight: 800;
    color: var(--ink, #123f3d);
    border-bottom: 1px solid #edf4f1;
    padding-bottom: .45rem;
    margin-bottom: .4rem;
  }
  body .rules-table td:nth-child(2) {
    display: inline-block;
    width: auto;
    margin-right: .5rem;
  }
  body .rules-table td:nth-child(3) {
    display: inline-block;
    width: auto;
    font-weight: 750;
    color: #0d4239;
  }
  body .rules-table td:last-child {
    margin-top: .45rem;
    padding-top: .5rem;
    border-top: 1px dashed #dce7e0;
    color: #3b534f;
    font-size: .84rem;
    word-break: break-word;
  }
}
@media screen and (max-width: 600px) and (prefers-reduced-motion: reduce) {
  body :is(.site-header, .reading-header) { transition: none; }
}

/* Keep the established light palette unless a page explicitly opts into dark.
   OS dark preference alone cannot recolor text on lesson-specific white cards. */
@media screen and (prefers-color-scheme: dark) {
  body[data-theme="dark"] {
    background: #091d1c;
    color: #e5f1ec;
  }
  body[data-theme="dark"] :is(.story-card, .story-paragraph, .guide-box, .scenario-card, .step-card, .question-card, .vocab-card, .v-card, .test-stats-card) {
    background: #0f2c2a;
    border-color: #204b44;
    color: #e5f1ec;
  }
  body[data-theme="dark"] :is(.quiz-options label, .option-label, .choice) {
    background: #0c2624;
    border-color: #1c463f;
    color: #d8ede5;
  }
  body[data-theme="dark"] :is(.glossary, .reading-sidebar, .narrative-glossary, .glossary-sidebar, .material-detail) {
    background: #0c2927;
    border-color: #25544d;
  }
  body[data-theme="dark"] :is(.study-link, .nav-bar-companion > a, div:has(> a.material-open) > a) {
    background: #0f2f2c !important;
    color: #cbe3db !important;
    border-color: #204b44 !important;
  }
}
