/* ===========================================================================
   learn-chess-styles.css — Learn Chess (cinematic guided opening lesson)
   =========================================================================== */

.lc-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    font-family: var(--font-body, 'Inter', sans-serif);
    background:
        radial-gradient(1200px 800px at 70% -10%, rgba(91, 155, 213, 0.14) 0%, transparent 58%),
        radial-gradient(900px 700px at 12% 112%, rgba(150, 110, 230, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #05060d 0%, #04050a 60%, #020308 100%);
    overflow-x: hidden;
}

/* ambient layers */
.lc-stars {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}
.lc-fx {
    position: fixed; inset: 0;
    width: 100%; height: 100%;
    z-index: 40;
    pointer-events: none;
}

.lc-home {
    position: fixed; top: calc(14px + env(safe-area-inset-top)); left: calc(14px + env(safe-area-inset-left));
    z-index: 60;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(10, 12, 18, 0.6);
    color: var(--text-secondary);
    font-size: 1.1rem; text-decoration: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.15s ease;
}
.lc-home:hover { border-color: var(--accent); color: var(--accent-light); }

/* ===== account gate ===== */
.lc-gate {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.lc-gate-card {
    max-width: 460px;
    text-align: center;
    background: linear-gradient(165deg, rgba(91, 155, 213, 0.07), rgba(255, 255, 255, 0.012));
    border: 1px solid var(--border-hover);
    border-radius: 22px;
    padding: 44px 38px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5), 0 0 70px rgba(91, 155, 213, 0.1);
    animation: lcRise 0.6s var(--ease-smooth, cubic-bezier(0.22,1,0.36,1)) both;
}
.lc-gate-glyph {
    font-size: 3rem;
    line-height: 1;
    color: #c9a6ff;
    text-shadow: 0 0 26px rgba(201, 166, 255, 0.55);
    margin-bottom: 14px;
}
.lc-gate-card h1 {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 14px;
    background: linear-gradient(115deg, #eef3fb 20%, #b9d4f0 55%, #c9a6ff 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.lc-gate-lead { font-size: 0.92rem; line-height: 1.7; color: var(--text-muted); margin: 0 0 14px; }
.lc-gate-free { font-size: 0.84rem; color: var(--text-secondary); margin: 0 0 22px; }
.lc-gate-btn {
    background: linear-gradient(120deg, var(--accent), #7e6bd0);
    border: none;
    border-radius: 999px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.94rem;
    font-weight: 600;
    padding: 13px 34px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 8px 28px rgba(91, 110, 200, 0.3);
}
.lc-gate-btn:hover { filter: brightness(1.12); transform: translateY(-2px); }
.lc-gate-sub { margin-top: 16px; font-size: 0.76rem; color: var(--text-faint); }

/* ===== lesson stage ===== */
.lc-stage {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: calc(18px + env(safe-area-inset-top)) calc(22px + env(safe-area-inset-right)) calc(26px + env(safe-area-inset-bottom)) calc(22px + env(safe-area-inset-left));
}
.lc-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto 6px;
    padding: 0 50px;
}
.lc-chapter-label {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}
.lc-progress { flex: 1; display: flex; gap: 5px; align-items: center; }
.lc-pdot {
    height: 4px;
    flex: 1;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    position: relative;
}
.lc-pdot span {
    position: absolute; inset: 0 100% 0 0;
    background: linear-gradient(90deg, var(--accent), #c9a6ff);
    border-radius: 999px;
    transition: right 0.5s var(--ease-smooth, ease);
}
.lc-pdot.done span { right: 0; }
.lc-pdot.active span { right: 0; box-shadow: 0 0 10px rgba(126, 184, 232, 0.6); }

.lc-scene {
    flex: 1;
    display: grid;
    grid-template-columns: min(58vh, 540px) 1fr;
    gap: 40px;
    align-items: center;
    justify-content: center;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
}

/* board with depth */
.lc-board-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    perspective: 1500px;
    perspective-origin: 50% 30%;
}
.lc-board-plinth {
    position: absolute;
    left: 50%; bottom: -6%;
    width: 86%; height: 26%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(126, 184, 232, 0.28) 0%, transparent 70%);
    filter: blur(14px);
    z-index: 1;
    animation: lcGlow 5s ease-in-out infinite;
}
@keyframes lcGlow { 0%,100% { opacity: 0.5; } 50% { opacity: 0.85; } }

.lc-board {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    transform: rotateX(12deg);
    transform-style: preserve-3d;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 0 60px rgba(91, 155, 213, 0.1);
    transition: opacity 0.35s ease, transform 0.45s var(--ease-smooth, ease);
}
.lc-board.dissolving { opacity: 0; transform: rotateX(12deg) scale(0.95); }

.lc-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lc-cell.light { background: var(--sq-light, #e8edf4); }
.lc-cell.dark { background: var(--sq-dark, #6f86a6); }

.lc-pc {
    width: 86%; height: 86%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.45));
    transition: opacity 0.25s ease;
    pointer-events: none;
    position: relative;
    z-index: 3;
}
.lc-pc.captured { animation: lcCapture 0.45s var(--ease-smooth, ease) forwards; }
@keyframes lcCapture {
    to { opacity: 0; transform: scale(1.4) rotate(12deg); filter: blur(3px) drop-shadow(0 0 18px rgba(244,114,140,0.7)); }
}

/* square accents */
.lc-cell::after {
    content: '';
    position: absolute; inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.lc-cell.zone::after { opacity: 1; box-shadow: inset 0 0 0 2px rgba(126, 231, 255, 0.4), inset 0 0 24px rgba(126, 231, 255, 0.22); }
.lc-cell.hl::after { opacity: 1; box-shadow: inset 0 0 0 3px rgba(255, 210, 138, 0.7); }
.lc-cell.from-glow::after { opacity: 1; box-shadow: inset 0 0 0 3px rgba(126, 184, 232, 0.55); }
.lc-cell.to-glow::after { opacity: 1; box-shadow: inset 0 0 0 3px rgba(110, 231, 183, 0.85), inset 0 0 26px rgba(110, 231, 183, 0.4); }
.lc-cell.pick::after { opacity: 1; box-shadow: inset 0 0 0 3px rgba(201, 166, 255, 0.85); }
.lc-cell.target { cursor: pointer; }
.lc-cell.target::before {
    content: '';
    position: absolute;
    width: 30%; height: 30%;
    border-radius: 50%;
    background: rgba(201, 166, 255, 0.6);
    box-shadow: 0 0 14px rgba(201, 166, 255, 0.6);
    animation: lcPulse 1.3s ease-in-out infinite;
    z-index: 4;
}
@keyframes lcPulse { 0%,100% { transform: scale(0.8); opacity: 0.55; } 50% { transform: scale(1.15); opacity: 1; } }
.lc-board.interactive .lc-cell.target,
.lc-board.interactive .lc-cell.pickable { cursor: pointer; }
.lc-board.shake { animation: lcShake 0.4s ease; }
@keyframes lcShake { 0%,100%{transform:rotateX(12deg) translateX(0)} 25%{transform:rotateX(12deg) translateX(-7px)} 75%{transform:rotateX(12deg) translateX(7px)} }

/* the flying piece (screen-space, lifts off the board) */
.lc-fly {
    position: fixed;
    z-index: 45;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    will-change: transform, left, top;
}

/* panel */
.lc-panel {
    max-width: 420px;
    animation: lcRise 0.5s var(--ease-smooth, ease) both;
}
.lc-step-kicker {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 10px;
    min-height: 14px;
}
.lc-step-title {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 1.7rem;
    font-weight: 600;
    margin: 0 0 14px;
    line-height: 1.15;
    color: var(--text);
}
.lc-step-text {
    font-family: 'Cormorant Garamond', var(--font-body), serif;
    font-size: 1.18rem;
    line-height: 1.6;
    color: rgba(225, 232, 244, 0.86);
    margin: 0 0 20px;
    min-height: 80px;
}
.lc-step-text b { color: #fff; font-weight: 500; }
.lc-hint {
    font-size: 0.86rem;
    line-height: 1.5;
    color: #ffd28a;
    background: rgba(255, 210, 138, 0.07);
    border: 1px solid rgba(255, 210, 138, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 18px;
    animation: lcRise 0.3s ease both;
}

.lc-controls { display: flex; align-items: center; gap: 10px; }
.lc-ctl {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    min-width: 50px;
    height: 50px;
    padding: 0 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lc-ctl:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-light); transform: translateY(-1px); }
.lc-ctl:disabled { opacity: 0.35; cursor: default; }
.lc-next {
    flex: 1;
    font-size: 0.95rem;
    background: linear-gradient(120deg, var(--accent), #7e6bd0);
    border: none;
    color: #fff;
}
.lc-next:hover:not(:disabled) { filter: brightness(1.12); }
.lc-next.waiting { background: var(--surface); border: 1px dashed var(--border-hover); color: var(--text-faint); }

/* chapter sweep */
.lc-chapter-intro {
    position: fixed; inset: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(5,7,14,0.55) 0%, rgba(3,4,9,0.8) 100%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
.lc-chapter-intro.show { animation: lcChapter 2.1s ease both; }
@keyframes lcChapter {
    0% { opacity: 0; }
    18% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}
.lc-chapter-intro-inner { text-align: center; transform: translateY(10px); }
.lc-chapter-intro.show .lc-chapter-intro-inner { animation: lcRise 0.9s var(--ease-smooth, ease) both; }
.lc-chapter-no {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--accent-light);
    margin-bottom: 12px;
}
.lc-chapter-name {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    background: linear-gradient(115deg, #eef3fb 20%, #9fd0f5 55%, #c9a6ff 95%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* finale */
.lc-finale {
    position: fixed; inset: 0;
    z-index: 58;
    display: flex; align-items: center; justify-content: center;
    padding: 28px;
    background: radial-gradient(circle at center, rgba(8,10,18,0.85), rgba(3,4,9,0.95));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: lcChapterFade 0.6s ease both;
}
@keyframes lcChapterFade { from { opacity: 0; } to { opacity: 1; } }
.lc-finale-inner {
    text-align: center;
    max-width: 480px;
    animation: lcRise 0.7s var(--ease-smooth, ease) both;
}
.lc-finale-glyph { font-size: 3.4rem; color: #ffd28a; text-shadow: 0 0 30px rgba(255, 210, 138, 0.5); }
.lc-finale-inner h2 {
    font-family: var(--font-brand, 'Space Grotesk', sans-serif);
    font-size: 1.9rem; font-weight: 600; margin: 12px 0;
}
.lc-finale-inner p { color: var(--text-muted); line-height: 1.65; margin: 0 0 26px; font-size: 0.95rem; }
.lc-finale-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.lc-finale-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-body); font-size: 0.86rem; font-weight: 600;
    padding: 12px 22px;
    cursor: pointer; text-decoration: none;
    transition: all 0.15s ease;
}
.lc-finale-btn:hover { border-color: var(--accent); color: var(--accent-light); transform: translateY(-2px); }
.lc-finale-btn.primary { background: linear-gradient(120deg, var(--accent), #7e6bd0); border: none; color: #fff; }

@keyframes lcRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ===== responsive ===== */
@media (max-width: 880px) {
    .lc-bar { padding: 0 46px; }
    .lc-scene {
        grid-template-columns: 1fr;
        gap: 18px;
        align-content: start;
        padding-top: 6px;
    }
    .lc-board-stage { width: min(82vw, 60vh); margin: 0 auto; }
    .lc-panel { max-width: 100%; text-align: center; }
    .lc-step-text { min-height: 0; font-size: 1.1rem; }
    .lc-controls { justify-content: center; }
    .lc-step-title { font-size: 1.45rem; }
}
@media (max-width: 480px) {
    .lc-stage { padding: calc(14px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(14px + env(safe-area-inset-left)); }
    .lc-bar { padding: 0 44px; gap: 10px; }
    .lc-chapter-label { font-size: 0.62rem; letter-spacing: 0.16em; }
    .lc-board-stage { width: min(90vw, 70vh); }
    .lc-step-text { font-size: 1.05rem; }
    .lc-ctl { height: 46px; min-width: 46px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lc-board-plinth, .lc-cell.target::before { animation: none; }
    .lc-chapter-intro.show { animation-duration: 1.2s; }
}

/* reachable-square markers (movement teaching) */
.lc-cell.reach::before {
    content: '';
    position: absolute;
    width: 32%; height: 32%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126, 231, 255, 0.85) 0%, rgba(126, 231, 255, 0.25) 70%, transparent 72%);
    box-shadow: 0 0 12px rgba(126, 231, 255, 0.5);
    animation: lcReach 1.8s ease-in-out infinite;
    z-index: 2;
}
/* a reachable square that holds an enemy piece = a capture: ring it instead */
.lc-cell.reach:has(.lc-pc)::before {
    width: 84%; height: 84%;
    background: none;
    border: 3px solid rgba(244, 114, 140, 0.8);
    box-shadow: inset 0 0 16px rgba(244, 114, 140, 0.4);
    border-radius: 10px;
    animation: lcReachCap 1.8s ease-in-out infinite;
}
@keyframes lcReach { 0%,100% { opacity: 0.55; transform: scale(0.85); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes lcReachCap { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
