@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --ink: #17211c;
    --muted: #68756d;
    --surface: #f7f5ef;
    --paper: #fffefa;
    --line: #e5e2d9;
    --forest: #173c2c;
    --forest-2: #24583f;
    --lime: #c7f36b;
    --gold: #d5a948;
    --danger: #b75545;
    --sidebar-width: 304px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--surface);
    color: var(--ink);
    font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(199, 243, 107, .8);
    outline-offset: 2px;
}

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

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    z-index: 50;
    top: 0;
    height: 76px;
    padding: 0 28px;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr auto;
    align-items: center;
    background: #101814;
    color: #f9fbf7;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    width: max-content;
    font-family: "Manrope", sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand > span:last-child span {
    color: var(--lime);
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: var(--lime);
    color: #12271d;
    border-radius: 11px;
    font-size: 25px;
    transform: rotate(-4deg);
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.main-nav button,
.main-nav a {
    border: 0;
    background: transparent;
    color: #aab4ad;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    border-radius: 9px;
}

.main-nav .active {
    color: white;
    background: rgba(255, 255, 255, .08);
}

.header-stats {
    display: flex;
    align-items: center;
    gap: 13px;
}

.header-stats div:first-child {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.header-stats small {
    color: #829087;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.header-stats strong {
    font-size: 14px;
}

.header-stats strong span {
    color: #738077;
    font-weight: 500;
}

.header-progress {
    width: 74px;
    height: 5px;
    overflow: hidden;
    border-radius: 10px;
    background: #334039;
}

.header-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--lime);
    transition: width .3s ease;
}

.profile-button {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: 50%;
    background: #2d3b33;
    color: #e8eee9;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.workspace {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    max-width: 1600px;
    margin: 0 auto;
}

.sidebar {
    position: sticky;
    top: 76px;
    height: calc(100vh - 76px);
    display: flex;
    flex-direction: column;
    padding: 28px 18px 18px;
    border-right: 1px solid var(--line);
    background: #eeece5;
}

.sidebar-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding: 0 8px 20px;
}

.eyebrow {
    color: #768078;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.sidebar h1 {
    margin: 4px 0 0;
    font-family: "Manrope", sans-serif;
    font-size: 18px;
}

.chapter-count {
    color: #879087;
    font-size: 11px;
}

.filter-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border: 1px solid #dfdcd3;
    border-radius: 11px;
    background: #e7e4dc;
}

.filter-tabs button {
    border: 0;
    padding: 8px 4px;
    border-radius: 8px;
    background: transparent;
    color: #687169;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.filter-tabs button.active {
    background: var(--paper);
    color: var(--forest);
    box-shadow: 0 2px 8px rgba(32, 45, 37, .08);
}

.trap-list {
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #c5c4bc transparent;
}

.trap-item {
    width: 100%;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 12px;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    margin-bottom: 4px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.trap-item:hover {
    background: rgba(255, 255, 255, .55);
}

.trap-item.active {
    border-color: #d9ded6;
    background: var(--paper);
    box-shadow: 0 4px 16px rgba(33, 45, 38, .07);
}

.trap-number {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #deddd5;
    color: #6d766e;
    font-size: 10px;
    font-weight: 700;
}

.trap-item.active .trap-number {
    background: var(--forest);
    color: white;
}

.trap-item.completed .trap-number {
    background: #dcecbf;
    color: #38602a;
}

.trap-copy {
    min-width: 0;
}

.trap-copy strong,
.trap-copy small {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.trap-copy strong {
    font-size: 12px;
    line-height: 1.4;
}

.trap-copy small {
    margin-top: 2px;
    color: #858b85;
    font-size: 9px;
}

.trap-chevron {
    color: #9ca19c;
}

.random-button {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 11px;
    border: 1px solid #d5d3cb;
    border-radius: 10px;
    background: transparent;
    color: #4e5a52;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.random-button:hover {
    background: var(--paper);
}

.source-link {
    margin-top: 12px;
    color: #899089;
    font-size: 9px;
    text-align: center;
}

.content {
    min-width: 0;
    padding: 38px clamp(24px, 4vw, 66px) 64px;
}

.hero-strip {
    max-width: 1080px;
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: 0 auto 24px;
}

.hero-strip h2 {
    margin: 6px 0 6px;
    font-family: "Manrope", sans-serif;
    font-size: clamp(22px, 2.3vw, 31px);
    letter-spacing: -.035em;
}

.hero-strip p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.hero-metric {
    min-width: 100px;
    padding: 12px 16px;
    border-left: 1px solid var(--line);
    text-align: right;
}

.hero-metric span,
.hero-metric small {
    display: block;
}

.hero-metric span {
    color: var(--forest);
    font-family: "Manrope", sans-serif;
    font-size: 28px;
    font-weight: 800;
}

.hero-metric small {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.trainer-shell {
    max-width: 1080px;
    display: grid;
    grid-template-columns: minmax(380px, 620px) minmax(280px, 1fr);
    gap: clamp(24px, 4vw, 52px);
    align-items: center;
    margin: 0 auto;
    padding: clamp(18px, 3vw, 32px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: 0 18px 50px rgba(35, 46, 39, .08);
}

.board-column {
    width: 100%;
}

.board-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 34px;
    margin-bottom: 9px;
}

.board-meta.bottom {
    margin: 9px 0 0;
}

.player-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #6e786f;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.player-dot {
    width: 21px;
    height: 21px;
    border: 1px solid #d1d4cd;
    border-radius: 6px;
    background: #d5d8d2;
}

.player-chip.me .player-dot {
    border-color: #1e4634;
    background: var(--forest);
    box-shadow: inset 0 0 0 5px var(--lime);
}

.turn-label {
    padding: 5px 8px;
    border-radius: 20px;
    background: #edf2e6;
    color: #526544;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.icon-button {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

.chessboard {
    width: 100%;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-template-rows: repeat(8, minmax(0, 1fr));
    overflow: hidden;
    border: 7px solid #23382e;
    border-radius: 7px;
    background: #23382e;
    box-shadow: 0 8px 20px rgba(23, 37, 30, .18);
}

.square {
    position: relative;
    min-width: 0;
    min-height: 0;
    border: 0;
    padding: 0;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.square.light {
    background: #e8e2cf;
}

.square.dark {
    background: #789376;
}

.square.last-move::before,
.square.hinted::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(208, 235, 83, .45);
}

.square.hinted::before {
    background: rgba(255, 214, 89, .52);
}

.square:hover::after {
    content: "";
    position: absolute;
    inset: 3px;
    border: 2px solid rgba(255, 255, 255, .34);
}

.piece {
    position: relative;
    z-index: 2;
    font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", serif;
    font-size: clamp(30px, 4.7vw, 58px);
    line-height: 1;
    user-select: none;
    filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .18));
}

.white-piece {
    color: #fffdf3;
    text-shadow: -1px -1px 0 #27382f, 1px -1px 0 #27382f, -1px 1px 0 #27382f, 1px 1px 0 #27382f;
}

.black-piece {
    color: #1a2a22;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .15);
}

.selection-ring {
    position: absolute;
    z-index: 3;
    inset: 7%;
    border: 3px solid var(--lime);
    border-radius: 50%;
    pointer-events: none;
}

.hint-dot {
    position: absolute;
    z-index: 4;
    width: 22%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(30, 62, 44, .52);
    pointer-events: none;
}

.coord {
    position: absolute;
    z-index: 5;
    color: rgba(27, 54, 39, .72);
    font-size: clamp(7px, .75vw, 10px);
    font-weight: 800;
    pointer-events: none;
}

.coord.file {
    right: 3px;
    bottom: 2px;
}

.coord.rank {
    top: 2px;
    left: 3px;
}

.square.dark .coord {
    color: rgba(239, 242, 223, .82);
}

.lesson-panel {
    min-width: 0;
}

.lesson-topline,
.line-progress-header,
.moves-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.difficulty {
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.difficulty.easy {
    background: #e3efcc;
    color: #48652f;
}

.difficulty.medium {
    background: #fae7b5;
    color: #795b15;
}

.difficulty.hard,
.difficulty.scary {
    background: #f5d2c9;
    color: #8b4034;
}

.difficulty.bullet {
    background: #d8e8ee;
    color: #315e6d;
}

.difficulty.variant {
    background: #e7dcef;
    color: #654676;
}

.lesson-panel h2 {
    margin: 9px 0 8px;
    font-family: "Manrope", sans-serif;
    font-size: clamp(22px, 2.2vw, 30px);
    line-height: 1.15;
    letter-spacing: -.04em;
}

.lesson-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lesson-tags span {
    padding: 5px 7px;
    border: 1px solid #e3e4dc;
    border-radius: 6px;
    color: #6d756e;
    font-size: 8px;
    font-weight: 600;
}

.lesson-tags .variant-tag {
    border-color: #d8c9e2;
    color: #654676;
    background: #f7f1fa;
}

.instruction-card {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 11px;
    align-items: center;
    min-height: 82px;
    margin: 20px 0;
    padding: 13px;
    border: 1px solid #dfe5d9;
    border-radius: 12px;
    background: #f3f6ee;
}

.instruction-card.error {
    border-color: #efd3cc;
    background: #fff3f0;
}

.instruction-card.success {
    border-color: #cfe5b2;
    background: #f1f9e5;
}

.instruction-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--forest);
    color: white;
    font-size: 17px;
}

.instruction-card.error .instruction-icon {
    background: var(--danger);
}

.instruction-card.success .instruction-icon {
    background: #638b3d;
}

.instruction-card small {
    color: #7d867e;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.instruction-card p {
    margin: 3px 0 0;
    color: #344039;
    font-size: 11px;
    line-height: 1.45;
}

.line-progress {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.line-progress-header {
    margin-bottom: 8px;
    color: #707870;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.line-progress-header strong {
    color: var(--ink);
}

.progress-track {
    height: 5px;
    overflow: hidden;
    border-radius: 5px;
    background: #e3e5df;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--forest-2);
    transition: width .25s ease;
}

.moves-panel {
    min-height: 102px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.moves-heading {
    color: #707870;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.moves-heading .mistakes {
    color: #a0a59f;
    font-size: 8px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.empty-moves {
    margin: 18px 0 0;
    color: #a0a59f;
    font-size: 10px;
}

.move-grid {
    max-height: 102px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 24px 1fr 1fr;
    gap: 4px 12px;
    margin-top: 11px;
    color: #374139;
    font-size: 10px;
}

.move-number {
    color: #9ca29d;
}

.variant-note {
    margin: 12px 0 0;
    padding: 9px;
    border-radius: 7px;
    background: #f7f1fa;
    color: #725f7c;
    font-size: 8px;
    line-height: 1.5;
}

.lesson-actions {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 9px;
    margin-top: 18px;
}

.secondary-button,
.primary-button {
    min-height: 40px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

.secondary-button {
    border: 1px solid #dcddd6;
    background: white;
}

.secondary-button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.primary-button {
    border: 1px solid var(--forest);
    background: var(--forest);
    color: white;
}

.primary-button:hover {
    background: #24543e;
}

.progress-overview {
    max-width: 1080px;
    display: grid;
    grid-template-columns: 1fr 1.45fr;
    gap: 32px;
    align-items: center;
    margin: 26px auto 0;
    padding: 22px 24px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #f1efe8;
}

.progress-copy h2 {
    margin: 5px 0;
    font-family: "Manrope", sans-serif;
    font-size: 17px;
}

.progress-copy p {
    max-width: 440px;
    margin: 0;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.progress-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 9px;
}

.progress-cards article {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 11px;
    border: 1px solid #e1dfd6;
    border-radius: 10px;
    background: var(--paper);
}

.progress-icon {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #e4ecd5;
    color: #405934;
}

.progress-icon.defense {
    background: #d9e5e0;
    color: #31594a;
}

.progress-icon.variant {
    background: #e7dcef;
    color: #654676;
}

.progress-cards small,
.progress-cards strong {
    display: block;
}

.progress-cards small {
    color: #858d86;
    font-size: 8px;
}

.progress-cards strong {
    margin-top: 2px;
    font-size: 13px;
}

.quiz-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 16%, rgba(199, 243, 107, .1), transparent 26rem),
        var(--surface);
}

.quiz-topbar {
    grid-template-columns: 1fr auto 1fr;
}

.quiz-header-score {
    justify-self: end;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.quiz-header-score small {
    color: #829087;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.quiz-header-score strong {
    color: var(--lime);
    font-family: "Manrope", sans-serif;
    font-size: 19px;
}

.quiz-header-score strong span {
    color: #9ca89f;
    font-family: "DM Sans", sans-serif;
    font-size: 10px;
    font-weight: 600;
}

.quiz-content {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 38px 0 50px;
}

.quiz-intro {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 25px;
}

.quiz-intro h1 {
    margin: 5px 0 5px;
    font-family: "Manrope", sans-serif;
    font-size: clamp(27px, 3.2vw, 42px);
    letter-spacing: -.045em;
}

.quiz-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.quiz-session-stats {
    display: flex;
    gap: 32px;
}

.quiz-session-stats div {
    min-width: 76px;
}

.quiz-session-stats small,
.quiz-session-stats strong {
    display: block;
}

.quiz-session-stats small {
    margin-bottom: 2px;
    color: #808a82;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.quiz-session-stats strong {
    color: var(--forest);
    font-family: "Manrope", sans-serif;
    font-size: 23px;
}

.quiz-session-stats strong span {
    color: #9fa79f;
    font-size: 11px;
}

.quiz-stage {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) minmax(340px, .9fr);
    gap: clamp(30px, 5vw, 70px);
    align-items: center;
    padding: clamp(22px, 3.5vw, 42px);
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--paper);
    box-shadow: 0 18px 55px rgba(35, 46, 39, .08);
}

.quiz-board-panel {
    width: min(100%, 540px);
}

.quiz-board-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #778078;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.position-status {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.last-move-label,
.side-to-move {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border: 1px solid #dfe2da;
    border-radius: 6px;
    background: #f7f7f2;
    color: #788078;
    white-space: nowrap;
}

.last-move-label strong {
    color: var(--forest);
    font-size: 10px;
}

.side-to-move {
    color: #4e5c53;
}

.side-dot {
    width: 9px;
    height: 9px;
    display: inline-block;
    border: 1px solid #26372e;
    border-radius: 50%;
}

.side-dot.white {
    background: #fffdf3;
}

.side-dot.black {
    background: #1a2a22;
}

.level-pill {
    padding: 5px 8px;
    border-radius: 20px;
}

.level-pill.beginner {
    background: #e3efcc;
    color: #48652f;
}

.level-pill.intermediate {
    background: #fae7b5;
    color: #795b15;
}

.level-pill.advanced {
    background: #f5d2c9;
    color: #8b4034;
}

.level-pill.expert {
    background: #2d3832;
    color: white;
}

.quiz-position-board {
    border-width: 6px;
}

.quiz-position-board .square {
    cursor: default;
}

.quiz-position-board .square:hover::after {
    display: none;
}

.position-clue {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
    color: #7a837b;
}

.position-clue span {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: #e8eee3;
    color: var(--forest);
}

.position-clue p {
    margin: 0;
    font-size: 9px;
}

.quiz-answer-panel {
    min-width: 0;
}

.question-number {
    color: #7c877e;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.quiz-answer-panel h2 {
    margin: 8px 0 20px;
    font-family: "Manrope", sans-serif;
    font-size: clamp(22px, 2.4vw, 31px);
    letter-spacing: -.035em;
}

.answer-list {
    display: grid;
    gap: 9px;
}

.answer-option {
    width: 100%;
    min-height: 52px;
    display: grid;
    grid-template-columns: 34px 1fr 24px;
    align-items: center;
    gap: 11px;
    padding: 8px 12px;
    border: 1px solid #dfdfd7;
    border-radius: 11px;
    background: white;
    color: #334039;
    text-align: left;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.answer-option:not(:disabled):hover {
    transform: translateX(3px);
    border-color: #8ba08d;
    background: #f7faf4;
}

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

.answer-letter {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: #eeeee8;
    color: #6d766e;
    font-size: 10px;
    font-weight: 800;
}

.answer-state {
    justify-self: end;
    font-size: 18px;
    font-weight: 800;
}

.answer-option.correct {
    border-color: #9ec777;
    background: #f0f8e6;
    color: #375525;
}

.answer-option.correct .answer-letter {
    background: #6d9a43;
    color: white;
}

.answer-option.wrong {
    border-color: #d99a8e;
    background: #fff1ee;
    color: #824237;
}

.answer-option.wrong .answer-letter {
    background: #b75c4b;
    color: white;
}

.answer-option.muted {
    opacity: .48;
}

.answer-help {
    margin: 15px 0 0;
    color: #969e97;
    font-size: 9px;
    text-align: center;
}

.answer-explanation {
    margin-top: 15px;
    padding: 13px;
    border-radius: 11px;
    background: #f2f7eb;
}

.answer-explanation.wrong {
    background: #fff3f0;
}

.explanation-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #44612f;
    font-size: 10px;
}

.answer-explanation.wrong .explanation-title {
    color: #8c493d;
}

.answer-explanation code {
    display: block;
    margin: 9px 0 6px;
    color: #29362e;
    font-size: 10px;
}

.answer-explanation p {
    margin: 0;
    color: #68736b;
    font-size: 9px;
    line-height: 1.5;
}

.next-question-button {
    width: 100%;
    min-height: 43px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 11px;
    border: 1px solid var(--forest);
    border-radius: 9px;
    background: var(--forest);
    color: white;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
}

.next-question-button:hover {
    background: var(--forest-2);
}

.quiz-source {
    margin-top: 16px;
    color: #8a928b;
    font-size: 9px;
    text-align: center;
}

.quiz-source a {
    color: #506e5c;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.quiz-finished {
    min-height: 540px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--paper);
    text-align: center;
    box-shadow: 0 18px 55px rgba(35, 46, 39, .08);
}

.result-knight {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    margin-bottom: 20px;
    border-radius: 18px;
    background: var(--lime);
    color: var(--forest);
    font-size: 42px;
}

.quiz-finished h2 {
    margin: 8px 0 4px;
    font-family: "Manrope", sans-serif;
    font-size: 50px;
    letter-spacing: -.05em;
}

.quiz-finished p {
    max-width: 470px;
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 12px;
}

.quiz-finished .primary-button {
    min-width: 190px;
    padding: 0 20px;
}

.quiz-back-link {
    margin-top: 14px;
    color: #6e786f;
    font-size: 10px;
    text-decoration: underline;
}

#blazor-error-ui {
    position: fixed;
    z-index: 1000;
    right: 18px;
    bottom: 18px;
    display: none;
    padding: 12px 16px;
    border-radius: 9px;
    background: #8d382e;
    color: white;
    font-size: 12px;
}

#blazor-error-ui .dismiss {
    margin-left: 10px;
    cursor: pointer;
}

@media (max-width: 1050px) {
    :root {
        --sidebar-width: 260px;
    }

    .topbar {
        grid-template-columns: var(--sidebar-width) 1fr auto;
        padding: 0 18px;
    }

    .trainer-shell {
        grid-template-columns: minmax(350px, 1.2fr) minmax(250px, .8fr);
        gap: 24px;
        padding: 20px;
    }

    .content {
        padding-inline: 24px;
    }

    .piece {
        font-size: clamp(29px, 5.2vw, 48px);
    }
}

@media (max-width: 820px) {
    .topbar {
        position: relative;
        grid-template-columns: 1fr auto;
    }

    .main-nav {
        display: none;
    }

    .workspace {
        display: block;
    }

    .sidebar {
        position: relative;
        top: 0;
        width: 100%;
        height: auto;
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar-heading,
    .source-link {
        display: none;
    }

    .filter-tabs {
        max-width: 360px;
        margin: 0 auto 12px;
    }

    .trap-list {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 6px;
    }

    .trap-item {
        flex: 0 0 170px;
        margin: 0;
    }

    .trap-chevron {
        display: none;
    }

    .random-button {
        display: none;
    }

    .content {
        padding: 25px 18px 48px;
    }

    .trainer-shell {
        grid-template-columns: 1fr;
        max-width: 650px;
    }

    .lesson-panel {
        padding: 4px 4px 0;
    }

    .piece {
        font-size: clamp(34px, 10vw, 68px);
    }

    .progress-overview {
        grid-template-columns: 1fr;
    }

    .quiz-topbar {
        position: sticky;
        grid-template-columns: 1fr auto;
    }

    .quiz-topbar .main-nav {
        display: flex;
        grid-column: 1 / -1;
        grid-row: 2;
        padding-bottom: 8px;
    }

    .quiz-topbar {
        height: auto;
        min-height: 70px;
        padding-top: 10px;
    }

    .quiz-content {
        width: min(100% - 28px, 650px);
        padding-top: 24px;
    }

    .quiz-stage {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 18px;
    }

    .quiz-board-panel {
        width: 100%;
        margin: 0 auto;
    }

    .quiz-intro p {
        max-width: 420px;
    }
}

@media (max-width: 540px) {
    .topbar {
        height: 64px;
        padding: 0 13px;
    }

    .brand {
        font-size: 15px;
    }

    .brand-mark {
        width: 33px;
        height: 33px;
    }

    .header-stats div:first-child,
    .header-progress {
        display: none;
    }

    .hero-strip {
        align-items: start;
    }

    .hero-strip p,
    .hero-metric {
        display: none;
    }

    .hero-strip h2 {
        font-size: 23px;
    }

    .trainer-shell {
        padding: 12px;
        border-radius: 14px;
    }

    .chessboard {
        border-width: 4px;
    }

    .piece {
        font-size: clamp(30px, 10.8vw, 53px);
    }

    .progress-cards {
        grid-template-columns: 1fr;
    }

    .quiz-topbar {
        padding-inline: 13px;
    }

    .quiz-topbar .main-nav {
        justify-content: start;
        overflow-x: auto;
    }

    .quiz-header-score small {
        display: none;
    }

    .quiz-intro {
        display: block;
    }

    .quiz-intro p {
        font-size: 10px;
    }

    .quiz-session-stats {
        margin-top: 16px;
        gap: 18px;
    }

    .quiz-stage {
        padding: 12px;
        border-radius: 15px;
    }

    .quiz-board-topline {
        align-items: flex-start;
    }

    .position-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .quiz-answer-panel {
        padding: 2px 3px 5px;
    }

    .quiz-position-board .piece {
        font-size: clamp(30px, 10.8vw, 53px);
    }
}

/* ==========================================================================
   Coordonnées Training Styles
   ========================================================================== */

.coordinates-content {
    max-width: 1140px;
    margin: 0 auto;
    padding: 32px clamp(16px, 3vw, 48px) 64px;
}

.coordinates-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
}

.coordinates-intro h1 {
    margin: 6px 0;
    font-family: "Manrope", sans-serif;
    font-size: clamp(24px, 2.5vw, 32px);
    letter-spacing: -.03em;
}

.coordinates-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.coordinates-settings-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-label {
    font-size: 11px;
    font-weight: 700;
    color: #6a746c;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.toggle-group {
    display: inline-flex;
    background: #e6e3da;
    border: 1px solid #d9d5cb;
    border-radius: 9px;
    padding: 3px;
    gap: 3px;
}

.toggle-group button {
    border: none;
    background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #555f57;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.toggle-group button.active {
    background: var(--paper);
    color: var(--forest);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
}

/* Section de sélection des difficultés */
.difficulty-selection {
    margin-bottom: 24px;
}

.difficulty-title {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6a746c;
    margin-bottom: 10px;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.25fr 1fr 1fr;
    gap: 10px;
}

.diff-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding: 12px 12px;
    background: var(--paper);
    border: 2px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s ease;
    min-width: 0;
}

.diff-card:hover {
    border-color: #a8b8aa;
    transform: translateY(-1px);
}

.diff-card.selected {
    border-color: var(--forest);
    background: #fbfbf8;
    box-shadow: 0 6px 18px rgba(32, 45, 37, .08);
}

.diff-card-header {
    margin-bottom: 8px;
}

.diff-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.diff-badge.very-easy {
    background: #d4edda;
    color: #155724;
}

.diff-badge.easy {
    background: #e2f0d9;
    color: #2b6623;
}

.diff-badge.intermediate {
    background: #e0f2fe;
    color: #0369a1;
}

.diff-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.diff-badge.hard {
    background: #f8d7da;
    color: #721c24;
}

.diff-card strong {
    font-size: 12px;
    color: var(--forest);
    margin-bottom: 4px;
    white-space: nowrap;
}

.diff-card small {
    font-size: 10px;
    color: var(--muted);
    line-height: 1.3;
}

/* Zone de travail Coordinates */
.coordinates-workspace {
    display: grid;
    grid-template-columns: minmax(360px, 560px) minmax(280px, 1fr);
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
    padding: clamp(20px, 3vw, 36px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--paper);
    box-shadow: 0 18px 50px rgba(35, 46, 39, .08);
}

.coordinates-board-column {
    width: 100%;
}

.coordinates-board-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 32px;
    margin-bottom: 12px;
}

.side-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #555f57;
}

.timer-badge {
    padding: 4px 10px;
    border-radius: 12px;
    background: #e2ece5;
    color: var(--forest);
    font-size: 12px;
    font-weight: 800;
}

.timer-badge.urgent {
    background: #fce8e6;
    color: #c53929;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .8; transform: scale(1.05); }
}

/* Échiquier spécifique aux coordonnées */
.coordinates-board {
    position: relative;
    user-select: none;
}

.coordinates-board .square {
    transition: background-color .15s ease;
}

.square-full-coord {
    font-family: "Manrope", sans-serif;
    font-size: clamp(11px, 1.4vw, 16px);
    font-weight: 800;
    letter-spacing: .02em;
    color: rgba(35, 56, 46, .82);
    pointer-events: none;
}

.square.dark .square-full-coord {
    color: rgba(255, 255, 255, .88);
}

.square-full-coord.target-highlight {
    color: #1b4b32 !important;
    background: rgba(208, 235, 83, .85);
    padding: 3px 8px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    animation: targetPulse 1.2s infinite alternate;
}

@keyframes targetPulse {
    from { transform: scale(0.95); }
    to { transform: scale(1.1); }
}

.target-surround-ring {
    position: absolute;
    inset: 6%;
    border: 4px solid #ff0033;
    border-radius: 50%;
    pointer-events: none;
    z-index: 6;
    box-shadow: 0 0 12px rgba(255, 0, 51, 0.85), inset 0 0 8px rgba(255, 0, 51, 0.4);
    animation: surroundPulse 1s ease-in-out infinite alternate;
}

@keyframes surroundPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.85;
        border-color: #ff1744;
        box-shadow: 0 0 8px rgba(255, 23, 68, 0.7);
    }
    100% {
        transform: scale(1.04);
        opacity: 1;
        border-color: #ff0000;
        box-shadow: 0 0 18px rgba(255, 0, 0, 0.95), inset 0 0 10px rgba(255, 0, 0, 0.45);
    }
}

/* Coordonnées sur bord droit et bas */
.border-letter-bottom {
    right: 4px;
    bottom: 2px;
    font-size: clamp(8px, .9vw, 11px);
    font-weight: 800;
}

.border-number-right {
    top: 2px;
    right: 4px;
    font-size: clamp(8px, .9vw, 11px);
    font-weight: 800;
}

/* Animation des lignes guidées (Mode Intermédiaire) */
.guided-crosshair-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

/* Ligne verticale qui monte vers le haut depuis le bas et s'arrête */
.guided-v-line {
    position: absolute;
    bottom: 0;
    width: 4px;
    background: #ff0033;
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.9);
    transform-origin: bottom center;
    transform: translateX(-50%) scaleY(0);
    opacity: 0;
    animation: lineGrowUp 1s cubic-bezier(0.22, 1, 0.36, 1) 2.2s forwards;
}

@keyframes lineGrowUp {
    0% {
        transform: translateX(-50%) scaleY(0);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scaleY(1);
        opacity: 1;
    }
}

/* Ligne horizontale qui part de la gauche vers la droite et s'arrête */
.guided-h-line {
    position: absolute;
    left: 0;
    height: 4px;
    background: #ff0033;
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.9);
    transform-origin: left center;
    transform: translateY(-50%) scaleX(0);
    opacity: 0;
    animation: lineGrowRight 1s cubic-bezier(0.22, 1, 0.36, 1) 2.2s forwards;
}

@keyframes lineGrowRight {
    0% {
        transform: translateY(-50%) scaleX(0);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scaleX(1);
        opacity: 1;
    }
}

/* Point au croisement des deux lignes */
.guided-cross-point {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ff0033;
    border: 2px solid #ffffff;
    box-shadow: 0 0 12px rgba(255, 0, 51, 1);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    animation: crosshairPointAppear 0.35s ease-out 3.2s forwards, crosshairPointPulse 1s ease-in-out 3.55s infinite alternate;
}

@keyframes crosshairPointAppear {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes crosshairPointPulse {
    from {
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 0 0 10px rgba(255, 0, 51, 0.9);
    }
    to {
        transform: translate(-50%, -50%) scale(1.35);
        box-shadow: 0 0 18px rgba(255, 0, 0, 1);
    }
}

/* Flash retour de clic */
.coord-success-flash {
    background: #7ec765 !important;
    transition: background-color .1s ease;
}

.coord-error-flash {
    background: #e66a55 !important;
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Panneau d'action & cible */
.coordinates-action-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.target-card {
    padding: 24px 20px;
    background: #f7f6f0;
    border: 1px solid var(--line);
    border-radius: 16px;
    text-align: center;
}

.target-display {
    margin: 12px 0 16px;
}

.target-square-label {
    display: inline-block;
    padding: 10px 28px;
    background: var(--forest);
    color: #f7f9f3;
    font-family: "Manrope", sans-serif;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: .05em;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(27, 43, 34, .25);
}

.feedback-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.feedback-badge.neutral {
    background: #e9ece7;
    color: #536056;
}

.feedback-badge.success {
    background: #dff0d8;
    color: #2b6623;
}

.feedback-badge.error {
    background: #f8d7da;
    color: #721c24;
}

/* Grille de stats */
.stats-card {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    background: #f7f6f0;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--paper);
    border-radius: 8px;
    border: 1px solid #e5e2d8;
}

.stat-value {
    font-family: "Manrope", sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: var(--forest);
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    margin-top: 2px;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons button {
    flex: 1;
    min-height: 40px;
}

/* Cartes Chrono 30s */
.action-card {
    padding: 28px 24px;
    background: #f7f6f0;
    border: 1px solid var(--line);
    border-radius: 16px;
    text-align: center;
}

.card-icon {
    font-size: 36px;
    display: block;
    margin-bottom: 8px;
}

.action-card h2 {
    font-family: "Manrope", sans-serif;
    font-size: 20px;
    margin: 4px 0 8px;
    color: var(--forest);
}

.action-card p {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.cta-button {
    width: 100%;
    min-height: 44px;
    font-size: 13px;
}

.summary-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 16px 0;
}

.summary-score strong {
    font-family: "Manrope", sans-serif;
    font-size: 48px;
    font-weight: 900;
    color: var(--forest);
    line-height: 1;
}

.summary-score span {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-top: 4px;
}

.summary-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.back-to-free-button {
    width: 100%;
    margin-top: 10px;
}

/* Responsiveness Coordonnées */
@media (max-width: 900px) {
    .coordinates-workspace {
        grid-template-columns: 1fr;
    }

    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .difficulty-grid {
        grid-template-columns: 1fr;
    }

    .coordinates-settings-bar {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
}

