:root {
    --ink: #12201f;
    --ink-soft: #2f433f;
    --muted: #5d726c;
    --paper: #f3f6f2;
    --paper-2: #e7eee8;
    --teal: #0f766e;
    --teal-deep: #114e4a;
    --amber: #c7941a;
    --amber-soft: #f0d89a;
    --line: rgba(18, 32, 31, 0.12);
    --shadow: 0 18px 50px rgba(17, 40, 37, 0.08);
    --radius: 18px;
    --container: 1120px;
    --font-display: "Syne", sans-serif;
    --font-body: "Manrope", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(15, 118, 110, 0.16), transparent 60%),
        radial-gradient(900px 500px at 90% 0%, rgba(199, 148, 26, 0.14), transparent 55%),
        linear-gradient(180deg, #f7faf7 0%, var(--paper) 45%, #eef4ef 100%);
    min-height: 100vh;
    line-height: 1.6;
}

.bg-atmosphere {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(18, 32, 31, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 32, 31, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 80%);
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

a {
    color: var(--teal-deep);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--teal);
}

img,
svg {
    max-width: 100%;
    display: block;
}

.container {
    width: min(var(--container), calc(100% - 2.5rem));
    margin-inline: auto;
}

.site-header {
    position: relative;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(243, 246, 242, 0.82);
    border-bottom: 1px solid transparent;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.site-header.is-scrolled {
    border-bottom-color: var(--line);
    background: rgba(243, 246, 242, 0.94);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.7rem;
    background:
        linear-gradient(145deg, var(--teal) 0%, var(--teal-deep) 55%, var(--amber) 120%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    position: relative;
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: 0.55rem 0.45rem auto auto;
    width: 0.85rem;
    height: 0.85rem;
    border-right: 2px solid rgba(255, 255, 255, 0.9);
    border-bottom: 2px solid rgba(255, 255, 255, 0.9);
    transform: rotate(-45deg);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text strong {
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: -0.03em;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.78rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-link {
    text-decoration: none;
    color: var(--ink-soft);
    padding: 0.55rem 0.85rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.is-active {
    color: var(--ink);
    background: rgba(15, 118, 110, 0.08);
}

.nav-cta {
    background: var(--ink);
    color: #f7faf7 !important;
}

.nav-cta:hover {
    background: var(--teal-deep);
}

.progress-rail {
    height: 3px;
    background: rgba(18, 32, 31, 0.06);
}

.progress-rail-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--teal), var(--amber));
    transition: width 0.45s ease;
}

.hero {
    min-height: calc(100vh - 5rem);
    display: grid;
    align-items: end;
    position: relative;
    overflow: hidden;
}

.hero-media {
    position: absolute;
    inset: 0;
}

.hero-diagram {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: heroDrift 18s ease-in-out infinite alternate;
}

.hero-copy {
    position: relative;
    z-index: 2;
    padding: 18vh 0 4.5rem;
    color: #f8fafc;
    max-width: 760px;
    margin-left: max(calc((100% - var(--container)) / 2), 1.25rem);
    margin-right: auto;
    width: min(760px, calc(100% - 2.5rem));
}

.brand-kicker,
.eyebrow {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.78rem;
    margin: 0 0 1rem;
}

.brand-kicker {
    color: var(--amber-soft);
}

.eyebrow {
    color: var(--teal);
}

.eyebrow a {
    color: inherit;
    text-decoration: none;
}

.hero h1,
.page-hero h1,
.section-title,
.cta-band h2 {
    font-family: var(--font-display);
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin: 0;
}

.hero h1 {
    font-size: clamp(2.6rem, 6vw, 4.8rem);
    max-width: 11ch;
    text-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.hero-lead,
.page-lead,
.section-lead {
    font-size: 1.12rem;
    max-width: 42rem;
}

.hero-lead {
    color: rgba(248, 250, 252, 0.9);
    margin: 1.2rem 0 1.8rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 14px;
    padding: 0.9rem 1.35rem;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: #f8fafc;
    color: var(--teal-deep);
}

.btn-primary:hover {
    background: var(--amber-soft);
    color: var(--ink);
}

.btn-ghost {
    background: rgba(248, 250, 252, 0.12);
    color: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(248, 250, 252, 0.35);
}

.btn-ghost:hover {
    background: rgba(248, 250, 252, 0.2);
    color: #fff;
}

.page-hero .btn-primary,
.lesson-aside .btn-primary,
.lesson-complete .btn-primary,
.cta-band .btn-primary {
    background: var(--ink);
    color: #f7faf7;
}

.page-hero .btn-primary:hover,
.lesson-aside .btn-primary:hover,
.lesson-complete .btn-primary:hover,
.cta-band .btn-primary:hover {
    background: var(--teal-deep);
    color: #fff;
}

.page-hero .btn-ghost {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}

.btn-block {
    width: 100%;
}

.section {
    padding: 5rem 0;
}

.section-alt {
    background: linear-gradient(180deg, rgba(231, 238, 232, 0.7), rgba(243, 246, 242, 0.2));
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 0.8rem;
}

.section-lead,
.page-lead {
    color: var(--muted);
    margin: 0 0 2rem;
}

.page-hero {
    padding: 4.5rem 0 1rem;
}

.page-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    margin-bottom: 0.9rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.profile-item,
.module-stats div,
.aside-block,
.cta-band,
.timeline-item {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.profile-item {
    padding: 1.2rem 1.25rem;
}

.profile-item dt {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.profile-item dd {
    margin: 0;
    font-weight: 700;
    font-size: 1.05rem;
}

.outcome-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.9rem;
    counter-reset: outcome;
}

.outcome-list li {
    counter-increment: outcome;
    padding: 1.15rem 1.2rem 1.15rem 4.2rem;
    border-top: 1px solid var(--line);
    position: relative;
    font-size: 1.12rem;
    font-weight: 600;
}

.outcome-list li::before {
    content: counter(outcome, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 1.15rem;
    font-family: var(--font-display);
    color: var(--teal);
    font-weight: 700;
}

.module-list,
.lesson-list {
    display: grid;
    gap: 0.75rem;
}

.module-row,
.lesson-row,
.pager-link {
    display: grid;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.62);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.module-row {
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 1.2rem 1.3rem;
    align-items: center;
}

.module-row:hover,
.lesson-row:hover,
.pager-link:hover {
    transform: translateY(-2px);
    border-color: rgba(15, 118, 110, 0.35);
    background: rgba(255, 255, 255, 0.9);
}

.module-num,
.lesson-num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--teal);
    font-weight: 700;
}

.module-body,
.lesson-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.module-body strong,
.lesson-body strong {
    font-size: 1.12rem;
}

.module-body span,
.module-meta,
.lesson-hours {
    color: var(--muted);
    font-size: 0.95rem;
}

.module-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.module-stats div {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
}

.module-stats strong {
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
}

.module-stats span {
    color: var(--muted);
}

.lesson-row {
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    padding: 1.05rem 1.2rem;
    align-items: center;
}

.lesson-check {
    display: none;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    background: rgba(15, 118, 110, 0.14);
    color: var(--teal-deep);
    flex-shrink: 0;
}

.lesson-done-label {
    display: none;
    color: var(--teal);
    font-size: 0.82rem;
    font-weight: 700;
}

.lesson-row.is-done {
    background: rgba(15, 118, 110, 0.08);
    border-color: rgba(15, 118, 110, 0.28);
}

.lesson-row.is-done .lesson-num {
    display: none;
}

.lesson-row.is-done .lesson-check {
    display: inline-flex;
}

.lesson-row.is-done .lesson-done-label {
    display: inline;
}

.timeline {
    display: grid;
    gap: 1.2rem;
}

.timeline-item {
    padding: 1.4rem 1.5rem;
}

.timeline-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.timeline-item h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    margin: 0 0 0.6rem;
    font-size: 1.7rem;
}

.timeline-item h2 a {
    color: inherit;
    text-decoration: none;
}

.lesson-index {
    list-style: none;
    padding: 0;
    margin: 1.2rem 0 0;
    display: grid;
    gap: 0.45rem;
}

.lesson-index li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--line);
}

.lesson-index a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    font-weight: 600;
}

.lesson-index-check {
    display: none;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    background: rgba(15, 118, 110, 0.14);
    color: var(--teal-deep);
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.lesson-index-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--muted);
    white-space: nowrap;
}

.lesson-index-item.is-done a {
    color: var(--teal-deep);
}

.lesson-index-item.is-done .lesson-index-check {
    display: inline-flex;
}

.lesson-index-item.is-done .lesson-done-label {
    display: inline;
}

.lesson-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.5rem;
    align-items: start;
}

.lesson-main {
    display: grid;
    gap: 1.25rem;
    min-width: 0;
}

.lesson-hero-title {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem 1rem;
    margin-bottom: 0.9rem;
}

.lesson-hero-title h1 {
    margin: 0;
    flex: 1 1 16rem;
}

.lesson-status-badge {
    margin: 0.35rem 0 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.lesson-status-badge[data-state="done"] {
    color: var(--teal-deep);
    border-color: rgba(15, 118, 110, 0.28);
    background: rgba(15, 118, 110, 0.1);
}

.lesson-status-badge[data-state="done"]::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--teal);
}

.lesson-complete {
    padding: 1.35rem 1.3rem 1.4rem;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    background:
        linear-gradient(145deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.78) 42%),
        rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
}

.lesson-complete h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    font-size: 1.45rem;
    margin: 0 0 0.55rem;
}

.lesson-complete-kicker {
    margin: 0 0 0.35rem;
    color: var(--teal-deep);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lesson-complete-text {
    margin: 0 0 1.1rem;
    color: var(--ink-soft);
}

.lesson-complete-done-head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.35rem;
}

.lesson-complete-check {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(15, 118, 110, 0.14);
    color: var(--teal-deep);
}

.lesson-complete.is-just-done .lesson-complete-check {
    animation: completePop 0.45s ease;
}

.lesson-complete-actions {
    display: grid;
    gap: 0.65rem;
}

.lesson-complete-next-title {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    opacity: 0.82;
    margin-top: 0.15rem;
}

.lesson-complete .btn-primary,
.aside-block .btn-primary {
    flex-direction: column;
    gap: 0.1rem;
}

.btn-text {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    padding: 0.35rem 0;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.btn-text:hover {
    color: var(--teal-deep);
}

.btn-text-block {
    width: 100%;
    text-align: center;
}

.aside-done-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.9rem;
    color: var(--teal-deep);
    font-weight: 700;
}

.aside-done-icon {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 118, 110, 0.14);
    font-size: 0.8rem;
}

@keyframes completePop {
    0% {
        transform: scale(0.7);
        opacity: 0.4;
    }
    60% {
        transform: scale(1.08);
        opacity: 1;
    }
    100% {
        transform: scale(1);
    }
}

.prose {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    padding: clamp(1.3rem, 3vw, 2.2rem);
}

.prose h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    margin: 1.8rem 0 0.7rem;
    font-size: 1.55rem;
}

.prose h2:first-child {
    margin-top: 0;
}

.prose p,
.prose li {
    color: var(--ink-soft);
}

.prose ul,
.prose ol {
    padding-left: 1.2rem;
}

.prose pre {
    background: #163532;
    color: #e7f5f1;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    overflow-x: auto;
    font-size: 0.92rem;
}

.prose code {
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.92em;
}

.prose :not(pre) > code {
    background: rgba(15, 118, 110, 0.1);
    padding: 0.1em 0.35em;
    border-radius: 0.35em;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.prose th,
.prose td {
    border-top: 1px solid var(--line);
    text-align: left;
    padding: 0.7rem 0.4rem;
    vertical-align: top;
}

.callout {
    margin: 1.4rem 0;
    padding: 1rem 1.1rem;
    border-left: 3px solid var(--amber);
    background: rgba(199, 148, 26, 0.1);
    border-radius: 0 12px 12px 0;
}

.lesson-figure {
    margin: 0 0 1.6rem;
    padding: 0;
}

.lesson-figure-trigger {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    border-radius: 16px;
}

.lesson-figure-trigger:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

.lesson-figure img {
    width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
}

.lesson-figure figcaption {
    margin-top: 0.7rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(10, 22, 20, 0.88);
    backdrop-filter: blur(4px);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-dialog {
    position: relative;
    width: min(100%, 1100px);
    max-height: calc(100vh - 2rem);
    display: grid;
    gap: 0.75rem;
    justify-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 5rem);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.lightbox-caption {
    margin: 0;
    color: rgba(247, 250, 247, 0.9);
    text-align: center;
    font-size: 0.95rem;
    max-width: 40rem;
}

.lightbox-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.lightbox-close:hover {
    background: #fff;
}

.lightbox-close:focus-visible {
    outline: 2px solid var(--amber-soft);
    outline-offset: 2px;
}

body.lightbox-open {
    overflow: hidden;
}

.lesson-aside {
    display: grid;
    gap: 1rem;
    position: sticky;
    top: 5.5rem;
}

.aside-block {
    padding: 1.15rem 1.15rem 1.25rem;
}

.aside-block h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin: 0 0 0.8rem;
}

.check-list {
    margin: 0 0 1rem;
    padding-left: 1.1rem;
    color: var(--ink-soft);
}

.aside-note {
    min-height: 1.2em;
    margin: 0.7rem 0 0;
    color: var(--teal);
    font-weight: 600;
    font-size: 0.92rem;
}

.aside-link {
    display: block;
    padding: 0.45rem 0;
    text-decoration: none;
    font-weight: 600;
}

.lesson-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 4rem;
}

.pager-link {
    padding: 1.1rem 1.2rem;
}

.pager-link span {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.pager-next {
    text-align: right;
}

.cta-band {
    padding: 2.2rem;
    text-align: left;
    box-shadow: var(--shadow);
}

.cta-band h2 {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    margin-bottom: 0.6rem;
}

.cta-band p {
    color: var(--muted);
    margin: 0 0 1.2rem;
    max-width: 40rem;
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 2rem 0 2.5rem;
    color: var(--muted);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-inner strong {
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.footer-inner p {
    margin: 0.35rem 0 0;
}

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease, transform 0.55s ease;
    transition-delay: var(--delay, 0ms);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes heroDrift {
    from {
        transform: scale(1.02) translate3d(0, 0, 0);
    }
    to {
        transform: scale(1.07) translate3d(-1.5%, -1%, 0);
    }
}

@media (max-width: 860px) {
    .container {
        width: min(var(--container), calc(100% - 1rem));
    }

    .section {
        padding: 3rem 0;
    }

    .page-hero {
        padding: 3rem 0 0.5rem;
    }

    .profile-grid,
    .module-stats,
    .lesson-layout,
    .lesson-pager {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .hero-copy {
        padding-top: 8rem;
        margin-left: auto;
    }

    .module-row,
    .lesson-row {
        grid-template-columns: auto 1fr;
        gap: 0.75rem;
        padding: 0.9rem 0.85rem;
    }

    .module-stats div,
    .profile-item,
    .aside-block,
    .timeline-item,
    .cta-band,
    .pager-link {
        padding: 0.9rem 0.85rem;
    }

    .prose {
        padding: 0.95rem 0.75rem;
        border-radius: 14px;
    }

    .callout {
        margin: 1.1rem 0;
        padding: 0.85rem 0.75rem;
    }

    .prose pre {
        padding: 0.85rem 0.75rem;
        border-radius: 12px;
        font-size: 0.85rem;
    }

    .outcome-list li {
        padding: 1rem 0.75rem 1rem 3.2rem;
        font-size: 1.02rem;
    }

    .module-meta,
    .lesson-hours {
        grid-column: 2;
    }

    .site-nav .nav-link:not(.nav-cta) {
        display: none;
    }

    .lesson-aside {
        position: static;
    }

    .lesson-figure {
        margin-inline: -0.25rem;
    }

    .lesson-figure img,
    .lesson-figure-trigger {
        border-radius: 12px;
    }

    .lesson-complete {
        padding: 1.05rem 0.85rem 1.15rem;
    }

    .lesson-hero-title {
        gap: 0.6rem;
        margin-bottom: 0.7rem;
    }

    .lesson-status-badge {
        margin-top: 0;
    }

    .lesson-pager {
        padding-bottom: 5.5rem;
    }

    .lightbox {
        padding: 0.5rem;
    }

    .lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }

    .lightbox-image {
        max-height: calc(100vh - 4rem);
        border-radius: 8px;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ai-chat {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 40;
    width: min(380px, calc(100vw - 1.5rem));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}

.ai-chat > * {
    pointer-events: auto;
}

.ai-chat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    border: 0;
    border-radius: 14px;
    padding: 0.85rem 1.15rem;
    background: linear-gradient(135deg, var(--teal-deep), var(--teal) 70%, #b45309);
    color: #f8fafc;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(17, 40, 37, 0.22);
    transition: transform 0.2s ease, filter 0.2s ease;
}

.ai-chat-launcher:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.ai-chat.is-open .ai-chat-launcher {
    display: none;
}

.ai-chat-launcher-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--amber-soft);
    box-shadow: 0 0 0 0 rgba(240, 216, 154, 0.7);
    animation: chatPulse 2.2s ease-out infinite;
}

.ai-chat-panel {
    display: flex;
    flex-direction: column;
    height: min(70vh, 560px);
    background: rgba(247, 250, 247, 0.97);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 22px 50px rgba(17, 40, 37, 0.18);
    overflow: hidden;
    transform-origin: bottom right;
    animation: chatIn 0.22s ease;
}

.ai-chat-panel[hidden] {
    display: none !important;
}

.ai-chat-header {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(199, 148, 26, 0.1));
    border-bottom: 1px solid var(--line);
}

.ai-chat-header strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
}

.ai-chat-header p {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.ai-chat-header-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ai-chat-new {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}

.ai-chat-new:hover {
    color: var(--ink);
    border-color: rgba(15, 118, 110, 0.35);
}

.ai-chat-new[hidden] {
    display: none;
}

.ai-chat-history-btn {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.55);
    color: var(--ink-soft);
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.ai-chat-history-btn:hover,
.ai-chat-history-btn[aria-expanded="true"] {
    color: var(--ink);
    border-color: rgba(15, 118, 110, 0.35);
    background: rgba(15, 118, 110, 0.08);
}

.ai-chat-history-icon {
    width: 0.9rem;
    height: 0.7rem;
    display: block;
    background:
        linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) 0 50% / 100% 1.5px no-repeat,
        linear-gradient(currentColor, currentColor) 0 100% / 70% 1.5px no-repeat;
}

.ai-chat-history {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    max-height: 42%;
    min-height: 8rem;
}

.ai-chat-history[hidden] {
    display: none !important;
}

.ai-chat-history-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-chat-history-search {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.45rem 0.65rem;
    font: inherit;
    font-size: 0.86rem;
    background: #fff;
    color: var(--ink);
}

.ai-chat-history-search:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: rgba(15, 118, 110, 0.4);
}

.ai-chat-history-close {
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
}

.ai-chat-history-list {
    overflow-y: auto;
    display: grid;
    gap: 0.35rem;
    align-content: start;
}

.ai-chat-history-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    padding: 0.35rem 0.15rem;
}

.ai-chat-history-empty[hidden] {
    display: none;
}

.ai-chat-history-item {
    border: 1px solid transparent;
    background: rgba(15, 118, 110, 0.05);
    color: var(--ink);
    text-align: left;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.35;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    cursor: pointer;
}

.ai-chat-history-item:hover {
    border-color: rgba(15, 118, 110, 0.25);
    background: rgba(15, 118, 110, 0.1);
}

.ai-chat-history-item.is-active {
    border-color: rgba(15, 118, 110, 0.4);
    background: rgba(15, 118, 110, 0.14);
}

.ai-chat-history-item-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-chat-close {
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: grid;
    gap: 0.7rem;
    align-content: start;
}

.ai-msg {
    max-width: 95%;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
    line-height: 1.45;
}

.ai-msg-assistant {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}

.ai-msg-user {
    justify-self: end;
    background: rgba(15, 118, 110, 0.12);
    color: var(--ink);
}

.ai-msg.is-pending {
    color: var(--muted);
    font-style: italic;
}

.ai-msg.is-error {
    border-color: rgba(180, 60, 40, 0.35);
    background: rgba(180, 60, 40, 0.08);
    color: #7a2e1f;
}

.ai-msg-md {
    white-space: normal;
}

.ai-msg-md > :first-child {
    margin-top: 0;
}

.ai-msg-md > :last-child {
    margin-bottom: 0;
}

.ai-msg-md p,
.ai-msg-md ul,
.ai-msg-md ol,
.ai-msg-md blockquote,
.ai-msg-md pre,
.ai-msg-md .ai-md-table-wrap {
    margin: 0.55em 0;
}

.ai-msg-md h1,
.ai-msg-md h2,
.ai-msg-md h3,
.ai-msg-md h4 {
    margin: 0.7em 0 0.35em;
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
}

.ai-msg-md h1 { font-size: 1.15rem; }
.ai-msg-md h2 { font-size: 1.08rem; }
.ai-msg-md h3,
.ai-msg-md h4 { font-size: 1rem; }

.ai-msg-md ul,
.ai-msg-md ol {
    padding-left: 1.2rem;
}

.ai-msg-md li + li {
    margin-top: 0.25em;
}

.ai-msg-md blockquote {
    margin-left: 0;
    padding: 0.15rem 0 0.15rem 0.75rem;
    border-left: 3px solid rgba(15, 118, 110, 0.35);
    color: var(--muted);
}

.ai-msg-md a {
    color: var(--teal-deep);
}

.ai-msg-md code {
    font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.ai-msg-md :not(pre) > code {
    background: rgba(15, 118, 110, 0.1);
    padding: 0.1em 0.35em;
    border-radius: 0.35em;
}

.ai-msg-md .ai-md-pre {
    background: #163532;
    color: #e7f5f1;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.45;
}

.ai-msg-md .ai-md-pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

.ai-msg-md .ai-md-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ai-msg-md .ai-md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    line-height: 1.4;
}

.ai-msg-md .ai-md-table th,
.ai-msg-md .ai-md-table td {
    border: 1px solid var(--line);
    padding: 0.4em 0.55em;
    text-align: left;
    vertical-align: top;
}

.ai-msg-md .ai-md-table th {
    background: rgba(15, 118, 110, 0.08);
    font-weight: 650;
    color: var(--ink);
}

.ai-msg-md .ai-md-table tbody tr:nth-child(even) {
    background: rgba(15, 118, 110, 0.03);
}

.ai-chat-form {
    border-top: 1px solid var(--line);
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.72);
}

.ai-chat-form textarea {
    width: 100%;
    resize: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font: inherit;
    background: #fff;
    color: var(--ink);
}

.ai-chat-form textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.25);
    border-color: rgba(15, 118, 110, 0.45);
}

.ai-chat-form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.65rem;
}

.ai-chat-status {
    color: var(--muted);
    font-size: 0.86rem;
}

body > .ai-ask-ui {
    position: fixed !important;
    z-index: 9999 !important;
    top: 0;
    left: 0;
    display: none;
    pointer-events: none;
}

body > .ai-ask-ui.is-visible {
    display: block !important;
    pointer-events: auto;
}

.ai-ask-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    min-height: 32px;
    background: linear-gradient(135deg, var(--teal-deep), var(--teal) 72%, #b45309);
    color: #f8fafc;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(17, 40, 37, 0.2);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ai-ask-btn:active {
    filter: brightness(1.08);
}

.ai-ask-btn-dot {
    width: 0.35rem;
    height: 0.35rem;
    border-radius: 50%;
    background: var(--amber-soft);
    flex-shrink: 0;
}

@keyframes chatPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(240, 216, 154, 0.65);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(240, 216, 154, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(240, 216, 154, 0);
    }
}

@keyframes chatIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 860px) {
    body.ai-chat-open {
        overflow: hidden;
    }

    .ai-chat {
        right: 0.75rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        width: auto;
    }

    .ai-chat.is-open {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: auto;
        height: auto;
        max-height: none;
        align-items: stretch;
        gap: 0;
        z-index: 60;
        pointer-events: auto;
    }

    .ai-chat.is-open .ai-chat-panel {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border: 0;
        box-shadow: none;
        transform: none;
        animation: none;
        background: var(--paper);
        padding:
            env(safe-area-inset-top, 0px)
            env(safe-area-inset-right, 0px)
            env(safe-area-inset-bottom, 0px)
            env(safe-area-inset-left, 0px);
    }

    .ai-chat.is-open .ai-chat-header {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .ai-chat.is-open .ai-chat-header strong {
        font-size: 0.95rem;
    }

    .ai-chat.is-open .ai-chat-header p {
        margin: 0.1rem 0 0;
        font-size: 0.78rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .ai-chat.is-open .ai-chat-new {
        font-size: 0.72rem;
        padding: 0.4rem 0.55rem;
    }

    .ai-chat.is-open .ai-chat-history-btn {
        width: 1.75rem;
        height: 1.75rem;
        border-radius: 8px;
    }

    .ai-chat.is-open .ai-chat-history {
        max-height: 38%;
        padding: 0.6rem 0.75rem;
    }

    .ai-chat.is-open .ai-chat-close {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 1.35rem;
    }

    .ai-chat.is-open .ai-chat-messages {
        padding: 0.65rem 0.75rem;
        gap: 0.5rem;
    }

    .ai-chat.is-open .ai-msg {
        max-width: 100%;
        padding: 0.55rem 0.7rem;
        border-radius: 0;
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .ai-chat.is-open .ai-msg-md .ai-md-pre {
        border-radius: 0;
        padding: 0.55rem 0.65rem;
        font-size: 0.82rem;
    }

    .ai-chat.is-open .ai-msg-md .ai-md-table {
        font-size: 0.84em;
    }

    .ai-chat.is-open .ai-msg-md .ai-md-table th,
    .ai-chat.is-open .ai-msg-md .ai-md-table td {
        padding: 0.3em 0.4em;
    }

    .ai-chat.is-open .ai-chat-form {
        padding: 0.6rem 0.75rem;
        flex-shrink: 0;
    }

    .ai-chat.is-open .ai-chat-form textarea {
        border-radius: 0;
        padding: 0.55rem 0.7rem;
        font-size: 0.9rem;
    }

    .ai-chat.is-open .ai-chat-form-actions {
        margin-top: 0.45rem;
        gap: 0.5rem;
    }

    .ai-chat.is-open .ai-chat-form-actions .btn {
        border-radius: 0;
        padding: 0.55rem 0.9rem;
        font-size: 0.9rem;
    }

    .ai-chat.is-open .ai-chat-status {
        font-size: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero-diagram,
    .reveal,
    .btn,
    .module-row,
    .lesson-row,
    .pager-link,
    .ai-chat-launcher,
    .ai-chat-launcher-dot,
    .ai-chat-panel,
    .ai-ask-btn,
    .lesson-complete-check {
        animation: none !important;
        transition: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}


/* Laravel extras: auth nav, cases, points */
.nav-points {
    font-size: 0.9rem;
    color: var(--teal-deep);
    font-weight: 600;
    white-space: nowrap;
}
.nav-logout { display: inline; margin: 0; }
.nav-logout button {
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}
.lesson-cases { margin: 2rem 0; }
.lesson-cases h2 {
    font-family: var(--font-display);
    margin-bottom: 1rem;
}
.case-list { display: grid; gap: 0.85rem; }
.case-card {
    display: grid;
    gap: 0.35rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.6);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.case-card:hover {
    border-color: rgba(15, 118, 110, 0.35);
    transform: translateY(-1px);
}
.ai-chat-points {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Optional AI assignment review (lessons & cases) */
.assignment-review {
    margin: 2rem 0 0;
    padding: clamp(1.2rem, 2.5vw, 1.8rem);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 4px);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
}

.assignment-review-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.assignment-review-head h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    margin: 0 0 0.55rem;
    font-size: 1.45rem;
}

.assignment-review-intro {
    margin: 0;
    color: var(--ink-soft);
}

.assignment-review-criteria {
    margin: 1.2rem 0 0;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.06);
}

.assignment-review-criteria h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.assignment-review-criteria ol {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--ink-soft);
}

.assignment-review-form {
    margin-top: 1.2rem;
    display: grid;
    gap: 0.75rem;
}

.assignment-review-form textarea {
    width: 100%;
    min-height: 10rem;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.assignment-review-form textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    outline-offset: 1px;
}

.assignment-review-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.assignment-review-status {
    font-size: 0.9rem;
    color: var(--muted);
}

.assignment-review-points {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.assignment-review-result {
    margin-top: 1.2rem;
}

.assignment-review-result-inner {
    margin: 0;
}

.assignment-review-result-inner h3 {
    margin-top: 0;
}

@media (max-width: 720px) {
    .assignment-review-actions .btn {
        width: 100%;
    }
}

.aside-block-term-notes .term-notes {
    margin: 0;
}

.term-notes-open {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem 0.9rem;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.term-notes-open:hover {
    border-color: rgba(15, 118, 110, 0.35);
}

.term-notes-open-count {
    display: inline-flex;
    min-width: 1.6rem;
    height: 1.6rem;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.1);
    color: var(--teal-deep);
    font-size: 0.85rem;
    font-weight: 700;
}

.term-notes-modal {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.term-notes-modal[hidden] {
    display: none;
}

.term-notes-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 22, 20, 0.72);
    backdrop-filter: blur(4px);
}

.term-notes-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 720px);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    border-radius: calc(var(--radius) + 4px);
    background: #f7faf7;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.term-notes-modal-close {
    position: sticky;
    top: 0.75rem;
    float: right;
    margin: 0.75rem 0.75rem 0 0;
    z-index: 2;
    width: 2.5rem;
    height: 2.5rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--ink);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.term-notes-modal-close:hover {
    background: #fff;
}

.term-notes-modal-body {
    padding: clamp(1.1rem, 2.5vw, 1.6rem);
    clear: both;
}

.term-notes-kicker {
    margin: 0 0 0.35rem;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.term-notes-head h2 {
    font-family: var(--font-display);
    letter-spacing: -0.03em;
    margin: 0 0 0.55rem;
    font-size: 1.45rem;
}

.term-notes-intro {
    margin: 0;
    color: var(--ink-soft);
}

.term-notes-ai-actions {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.term-notes-ai-hint {
    margin: 0.55rem 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.term-notes-draft {
    margin-top: 1.2rem;
    padding: 0.95rem 1rem;
    border: 1px dashed rgba(15, 118, 110, 0.35);
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.05);
}

.term-notes-draft-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.85rem;
}

.term-notes-draft-head h3 {
    margin: 0;
    font-size: 1rem;
}

.term-notes-draft-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 0.9rem;
}

.term-notes-draft-list {
    display: grid;
    gap: 0.75rem;
}

.term-note-card-draft {
    background: rgba(255, 255, 255, 0.92);
}

.term-notes-list {
    margin-top: 1.2rem;
    display: grid;
    gap: 0.85rem;
}

.term-notes-empty {
    margin: 0;
    color: var(--muted);
}

.term-note-card {
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.term-note-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.term-note-card-title {
    display: grid;
    gap: 0.15rem;
    min-width: 0;
}

.term-note-card-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.term-note-pronunciation {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.term-note-card-actions {
    display: flex;
    gap: 0.75rem;
}

.term-note-card-body {
    margin: 0.75rem 0 0;
    display: grid;
    gap: 0.55rem;
}

.term-note-card-body div {
    display: grid;
    gap: 0.15rem;
}

.term-note-card-body dt {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.term-note-card-body dd {
    margin: 0;
    color: var(--ink-soft);
}

.term-notes-chips {
    margin-top: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.term-notes-chip {
    display: inline-flex;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.08);
    color: var(--teal-deep);
    font-size: 0.8rem;
}

.term-notes-form {
    margin-top: 1.2rem;
    display: grid;
    gap: 0.9rem;
}

.term-notes-fields {
    display: grid;
    gap: 0.75rem;
}

.term-notes-fields label {
    display: grid;
    gap: 0.35rem;
}

.term-notes-fields span {
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.term-notes-fields input,
.term-notes-fields textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.term-notes-fields textarea {
    resize: vertical;
    min-height: 4.5rem;
}

.term-notes-fields input:focus,
.term-notes-fields textarea:focus {
    outline: 2px solid rgba(15, 118, 110, 0.35);
    outline-offset: 1px;
}

.term-notes-lessons {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    background: rgba(15, 118, 110, 0.04);
}

.term-notes-lessons summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--ink-soft);
}

.term-notes-lessons-hint {
    margin: 0.65rem 0 0.75rem;
    font-size: 0.88rem;
    color: var(--muted);
}

.term-notes-lessons-grid {
    display: grid;
    gap: 1rem;
}

.term-notes-lesson-group h3 {
    margin: 0 0 0.4rem;
    font-size: 0.9rem;
}

.term-notes-lesson-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.35rem;
}

.term-notes-lesson-group label {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.term-notes-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

.term-notes-status {
    font-size: 0.9rem;
    color: var(--muted);
}

.term-notes-status.is-error {
    color: #9b1c1c;
}

body.term-notes-modal-open {
    overflow: hidden;
}

@media (max-width: 720px) {
    .term-notes-actions .btn {
        width: 100%;
    }

    .term-notes-modal {
        padding: 0.5rem;
    }

    .term-notes-modal-dialog {
        max-height: calc(100vh - 1rem);
    }
}
