/* ═══ HOW TO PLAY — chooser, Visual Guide, playable lessons ═══
   Everything here is prefixed ht- so it can't collide with the game's own
   styles. It uses the game's colour variables, so the Light Theme works too. */

.ht-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 10, 15, 0.92);
}

.ht-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 960px;
    height: min(660px, calc(100vh - 32px));
    background: var(--bg-medium);
    border: 2px solid var(--accent-gold);
    border-radius: 12px;
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.2);
    overflow: hidden;
}
.ht-modal.ht-narrow { max-width: 640px; height: auto; max-height: calc(100vh - 32px); }

.ht-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}
.ht-head-text { flex: 1 1 auto; min-width: 0; }
.ht-kicker {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-gold);
}
.ht-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--text-primary);
    line-height: 1.15;
}
.ht-icon-btn {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.ht-icon-btn:hover { color: var(--accent-gold); border-color: var(--accent-gold); }

.ht-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px;
}

.ht-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}
.ht-foot .btn { padding: 10px 20px; font-size: 0.9rem; }
.ht-dots {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.ht-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--accent-gold);
    background: transparent;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.ht-dot.on { background: var(--accent-gold); transform: scale(1.25); }
.ht-count {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    min-width: 54px;
    text-align: center;
}

/* ── Chooser ── */
.ht-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ht-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 20px;
    text-align: left;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.ht-choice:hover:not(:disabled) {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.15);
}
.ht-choice:disabled { opacity: 0.55; cursor: default; }
.ht-choice-icon { font-size: 2rem; line-height: 1; }
.ht-choice-name { font-size: 1.15rem; font-weight: 800; color: var(--accent-gold); }
.ht-choice-desc { font-size: 0.88rem; line-height: 1.5; color: var(--text-secondary); }
.ht-choice-tag {
    margin-top: auto;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

/* ── Shared slide pieces ── */
.ht-slide { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.ht-lead { font-size: 1.02rem; line-height: 1.55; color: var(--text-primary); max-width: 62ch; }
.ht-note { font-size: 0.82rem; line-height: 1.5; color: var(--text-secondary); }
.ht-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: center; }
.ht-cols.ht-top { align-items: start; }
.ht-panel {
    padding: 14px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ht-panel h4 {
    margin-bottom: 4px;
    font-size: 0.95rem;
    color: var(--accent-gold);
}
.ht-panel p { font-size: 0.84rem; line-height: 1.5; color: var(--text-secondary); }
.ht-gold { color: var(--accent-gold); }

.ht-enter { animation: ht-rise 0.5s ease both; animation-delay: calc(var(--d, 0) * 90ms); }
@keyframes ht-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes ht-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }

/* Dice */
.ht-die {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    background: var(--bg-light);
    border: 2px solid var(--accent-gold);
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
}
.ht-die.ht-roll { animation: ht-tumble 1.6s ease-in-out infinite; }
@keyframes ht-tumble {
    0%   { transform: rotate(0) scale(1); }
    18%  { transform: rotate(180deg) translateY(-8px) scale(1.1); }
    36%  { transform: rotate(360deg) scale(1); }
    100% { transform: rotate(360deg) scale(1); }
}
.ht-plus { color: var(--text-secondary); font-weight: 700; }

/* Mini board */
.ht-board {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    width: 100%;
    max-width: 330px;
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.ht-sq { background: var(--square-light); animation: ht-pop 0.45s ease both; animation-delay: calc(var(--d, 0) * 28ms); }
.ht-sq.d { background: var(--square-dark); }
.ht-sq.back { background: rgba(201, 168, 76, 0.28); }
.ht-sq.pawn { background: rgba(212, 203, 184, 0.14); }
.ht-sq.center { background: #8f2f2b; box-shadow: inset 0 0 0 2px #e0645a; }
.ht-sq.center.pulse { animation: ht-pop 0.45s ease both, ht-glow 1.8s ease-in-out 0.6s infinite; }
@keyframes ht-glow {
    0%, 100% { box-shadow: inset 0 0 0 2px #e0645a, 0 0 0 rgba(224, 100, 90, 0); }
    50% { box-shadow: inset 0 0 0 2px #ff8a7e, 0 0 14px rgba(224, 100, 90, 0.9); }
}
.ht-sq.goal { box-shadow: inset 0 0 0 2px var(--accent-gold); }
.ht-sq.goal.filled { background: var(--accent-gold); animation: ht-pop 0.4s ease both; }
.ht-sq.me { background: var(--accent-gold); }
.ht-sq.foe { background: var(--black-piece); }

/* Pillars (slide 1) */
.ht-pillars { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.ht-pillar { padding-top: 10px; border-top: 1px solid var(--border-color); }
.ht-pillar b { display: block; font-size: 1.05rem; color: var(--accent-gold); }
.ht-pillar span { font-size: 0.84rem; color: var(--text-secondary); line-height: 1.4; }

/* Steps (slide 2) */
.ht-steps { display: flex; flex-direction: column; gap: 10px; }
.ht-step { display: flex; gap: 12px; align-items: flex-start; }
.ht-step-num {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-darkest);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ht-step b { color: var(--text-primary); }
.ht-step p { font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); }

.ht-majors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ht-major {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 6px;
    text-align: center;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ht-major img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    object-fit: cover;
    background: var(--bg-light);
}
.ht-major .nm { font-weight: 800; font-size: 0.9rem; }
.ht-major .rl { font-size: 0.72rem; font-weight: 700; color: var(--accent-gold); }
.ht-major .ab { font-size: 0.72rem; color: var(--text-secondary); line-height: 1.35; }
.ht-major .bo { font-size: 0.68rem; color: var(--accent-orange); line-height: 1.3; }

/* Turn beats (slide 3) */
.ht-beats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ht-beat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    animation: ht-beat 8.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * 2.2s);
}
@keyframes ht-beat {
    0%, 28%, 100% { border-color: var(--border-color); box-shadow: none; transform: none; }
    3%, 24% { border-color: var(--accent-gold); box-shadow: 0 0 18px rgba(201, 168, 76, 0.3); transform: translateY(-3px); }
}
.ht-beat-num { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.14em; color: var(--accent-gold); }
.ht-beat b { font-size: 1rem; }
.ht-beat p { font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); }
.ht-beat-art { height: 58px; display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
.ht-slot {
    width: 40px;
    height: 40px;
    border: 2px dashed var(--text-dim);
    border-radius: 8px;
    font-size: 0.62rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ht-art-bank .ht-die.mv { animation: ht-bank 8.8s ease-in-out infinite; animation-delay: 2.2s; }
@keyframes ht-bank {
    0%, 8%, 100% { transform: none; }
    18%, 90% { transform: translateX(48px); }
}
.ht-art-spend .ht-die { animation: ht-spend 8.8s ease-in-out infinite; animation-delay: 4.4s; }
@keyframes ht-spend {
    0%, 4%, 30%, 100% { transform: none; box-shadow: none; }
    14%, 22% { transform: scale(1.18); box-shadow: 0 0 16px rgba(201, 168, 76, 0.8); }
}
.ht-tag-ability {
    padding: 6px 10px;
    border: 1px solid var(--accent-gold);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-gold);
}
.ht-art-move .ht-mini {
    display: grid;
    grid-template-columns: repeat(4, 14px);
    grid-template-rows: repeat(3, 14px);
    border: 1px solid var(--border-color);
}
.ht-art-move .ht-mini i { background: var(--square-light); }
.ht-art-move .ht-mini i:nth-child(odd) { background: var(--square-dark); }
.ht-art-move .ht-piece {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-gold);
    animation: ht-slide 8.8s ease-in-out infinite;
    animation-delay: 6.6s;
}
@keyframes ht-slide {
    0%, 6%, 100% { transform: translate(-22px, 10px); }
    16%, 90% { transform: translate(22px, -10px); }
}
.ht-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Ability ladder + cards (slide 4) */
.ht-ladder { display: flex; flex-direction: column; gap: 14px; }
.ht-rung {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    animation: ht-rung 7s ease-in-out infinite;
}
.ht-rung.second { animation-delay: 3.5s; }
@keyframes ht-rung {
    0%, 46%, 100% { border-color: var(--border-color); }
    4%, 40% { border-color: var(--accent-gold); box-shadow: 0 0 16px rgba(201, 168, 76, 0.25); }
}
.ht-rung .ht-die { animation: ht-jig 7s ease-in-out infinite; }
.ht-rung.second .ht-die { animation-delay: 3.5s; }
@keyframes ht-jig {
    0%, 12%, 100% { transform: none; }
    3% { transform: rotate(-14deg) scale(1.1); }
    6% { transform: rotate(10deg) scale(1.1); }
    9% { transform: rotate(-4deg); }
}
.ht-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ht-acard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ht-acard-top { display: flex; align-items: center; gap: 8px; }
.ht-acard img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent-gold); }
.ht-acard-name { flex: 1 1 auto; font-weight: 800; font-size: 0.9rem; line-height: 1.1; }
.ht-acard-name small { display: block; font-weight: 600; font-size: 0.7rem; color: var(--text-secondary); }
.ht-cost {
    flex: 0 0 auto;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    border-radius: 13px;
    background: var(--accent-gold);
    color: var(--bg-darkest);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ht-acard p { font-size: 0.76rem; line-height: 1.4; color: var(--text-secondary); }

/* AI cards (slide 5) */
.ht-trig { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.ht-combo {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    animation: ht-combo 6s ease-in-out infinite;
    animation-delay: calc(var(--i) * 2s);
}
@keyframes ht-combo {
    0%, 33%, 100% { border-color: transparent; background: transparent; }
    3%, 30% { border-color: var(--accent-gold); background: rgba(201, 168, 76, 0.12); }
}
.ht-deck {
    position: relative;
    flex: 0 0 auto;
    width: 56px;
    height: 76px;
    margin-left: auto;
}
.ht-deck i {
    position: absolute;
    inset: 0;
    border-radius: 7px;
    background: var(--bg-light);
    border: 2px solid var(--accent-gold);
}
.ht-deck i:nth-child(1) { transform: translate(-6px, 6px); opacity: 0.5; }
.ht-deck i:nth-child(2) { transform: translate(-3px, 3px); opacity: 0.75; }
.ht-deck i:nth-child(3) {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--accent-gold);
    animation: ht-draw 3s ease-in-out infinite;
}
@keyframes ht-draw {
    0%, 55%, 100% { transform: none; }
    75% { transform: translateY(-10px) rotate(-6deg); }
}
.ht-groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ht-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ht-group h4 { font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }
.ht-group.boon h4 { color: #6fcf6f; }
.ht-group.curse h4 { color: var(--accent-red); }
.ht-group.wild h4 { color: #7aa2e3; }
.ht-group.summon h4 { color: var(--accent-orange); }
.ht-group div { font-size: 0.76rem; line-height: 1.35; color: var(--text-secondary); }
.ht-group div b { display: block; color: var(--text-primary); font-size: 0.82rem; }

/* Bosses (slide 6) */
.ht-flow { display: flex; flex-direction: column; gap: 8px; }
.ht-flow-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 12px;
    background: var(--bg-dark);
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 6px 6px 0;
}
.ht-flow-step b { display: block; font-size: 0.92rem; }
.ht-flow-step span { font-size: 0.8rem; line-height: 1.4; color: var(--text-secondary); }
.ht-bosses { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ht-boss {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.ht-boss b { color: var(--accent-red); font-size: 0.92rem; }
/* A boss with art (Game.BOSS_ART): the art beside the card's text */
.ht-boss.has-art { flex-direction: row; align-items: center; gap: 10px; }
.ht-boss.has-art .ht-boss-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ht-boss-art {
    flex: 0 0 auto;
    width: 52px;
    height: 68px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 50, 20, 0.7));
}
.ht-boss .hp { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.ht-boss .tx { font-size: 0.74rem; line-height: 1.35; color: var(--text-secondary); }
.ht-hp { display: flex; gap: 3px; }
.ht-hp i {
    flex: 1 1 0;
    height: 10px;
    border-radius: 2px;
    background: var(--accent-red);
    transition: background 0.25s, transform 0.25s;
}
.ht-hp i.gone { background: var(--bg-light); transform: scaleY(0.6); }
.ht-hp.hit { animation: ht-shake 0.3s linear; }
@keyframes ht-shake {
    0%, 100% { transform: none; }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
.ht-compass {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.ht-compass .arrow { font-size: 1.4rem; color: var(--accent-orange); min-width: 1.4em; text-align: center; transition: transform 0.4s; }

/* Ending (slide 7) */
.ht-ends { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ht-end {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    padding: 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.ht-end h4 { font-size: 1.05rem; color: var(--accent-gold); }
.ht-end p { font-size: 0.84rem; line-height: 1.5; color: var(--text-secondary); }
.ht-carl { position: relative; width: 74px; height: 74px; }
.ht-carl img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-gold);
    animation: ht-check 3.6s ease-in-out infinite;
}
@keyframes ht-check {
    0%, 30% { border-color: var(--accent-gold); box-shadow: none; }
    45%, 100% { border-color: var(--accent-red); box-shadow: 0 0 20px rgba(192, 64, 64, 0.8); }
}
.ht-stamp {
    position: absolute;
    left: 50%;
    top: 50%;
    padding: 2px 6px;
    border: 2px solid var(--accent-red);
    border-radius: 4px;
    background: rgba(10, 10, 15, 0.85);
    color: var(--accent-red);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    white-space: nowrap;
    transform: translate(-50%, -50%) rotate(-12deg);
    animation: ht-stamp 3.6s ease-in infinite;
}
@keyframes ht-stamp {
    0%, 55% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(2.2); }
    65%, 100% { opacity: 1; transform: translate(-50%, -50%) rotate(-12deg) scale(1); }
}
.ht-glyph { font-size: 2.6rem; line-height: 74px; height: 74px; }

/* ── Mobile ── */
@media (max-width: 760px) {
    .ht-overlay { padding: 0; }
    .ht-modal, .ht-modal.ht-narrow {
        max-width: none;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        border-width: 0;
    }
    .ht-body { padding: 14px 16px; }
    .ht-head { padding: 10px 14px; }
    .ht-title { font-size: 1.15rem; }
    .ht-foot { padding: 10px 14px; gap: 8px; }
    .ht-foot .btn { padding: 10px 14px; }
    .ht-choices, .ht-cols, .ht-strip, .ht-ends { grid-template-columns: 1fr; }
    .ht-groups, .ht-beats { grid-template-columns: 1fr 1fr; }
    .ht-majors { grid-template-columns: repeat(3, 1fr); }
    .ht-bosses, .ht-cards { grid-template-columns: 1fr; }
    .ht-board { max-width: 260px; margin: 0 auto; }
    .ht-count { display: none; }
    .ht-dot { width: 8px; height: 8px; }
}
@media (max-width: 420px) {
    .ht-groups, .ht-beats, .ht-pillars { grid-template-columns: 1fr; }
    .ht-majors { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .ht-overlay *, .ht-overlay *::before, .ht-overlay *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}

body.ht-open .rotate-hint { display: none !important; }

/* ═══ PLAY THE TUTORIAL (static/howto-lessons.js) ═══ */

.tl-note { font-size: 0.74rem; font-style: italic; color: var(--text-secondary); line-height: 1.35; }
.tl-note-top { margin-bottom: 12px; text-align: center; }

/* Lesson menu */
.tl-menu { display: flex; flex-direction: column; gap: 8px; }
.tl-menu-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    text-align: left;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
}
.tl-menu-row:hover { border-color: var(--accent-gold); transform: translateX(3px); }
.tl-menu-num {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tl-menu-row.done .tl-menu-num { background: var(--accent-gold); color: var(--bg-darkest); }
.tl-menu-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.tl-menu-text small { color: var(--text-secondary); font-size: 0.8rem; }
.tl-menu-go { flex: 0 0 auto; font-size: 0.8rem; font-weight: 700; color: var(--accent-gold); }
.tl-menu-progress { font-size: 0.8rem; color: var(--text-secondary); font-weight: 700; }

/* Lesson layout */
.tl-modal { max-width: 1000px; height: min(720px, calc(100vh - 32px)); }
.tl-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}
.tl-stage { min-width: 0; display: flex; justify-content: center; }
.tl-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; position: sticky; top: 0; }
.tl-stepno { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-gold); }
.tl-instr { font-size: 0.95rem; line-height: 1.55; color: var(--text-primary); }
.tl-instr.tl-flash { animation: ht-rise 0.35s ease both; }
.tl-fb { font-size: 0.86rem; line-height: 1.45; color: var(--text-secondary); min-height: 0; }
.tl-fb:empty { display: none; }
.tl-fb.good { color: #7fd17f; }
.tl-fb.bad { color: #e8806e; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tl-actions:empty { display: none; }
.tl-actions .btn { padding: 10px 16px; font-size: 0.9rem; }
.tl-hint-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tl-hint-btn {
    background: none;
    border: none;
    padding: 2px 0;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-gold);
    cursor: pointer;
}
.tl-hint {
    font-size: 0.84rem;
    line-height: 1.5;
    color: var(--text-primary);
    padding: 10px 12px;
    background: rgba(201, 168, 76, 0.1);
    border-left: 3px solid var(--accent-gold);
    border-radius: 0 6px 6px 0;
    animation: ht-rise 0.25s ease both;
}
.tl-done-banner {
    display: block;
    width: fit-content;
    margin-bottom: 8px;
    padding: 4px 12px;
    border-radius: 14px;
    background: var(--success);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    animation: ht-pop 0.4s ease both;
}
.tl-foot { flex-wrap: wrap; }
.tl-foot .tl-note { flex: 1 1 200px; text-align: center; }
.tl-pulse { animation: tl-pulse 1.4s ease-in-out infinite; }
@keyframes tl-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.6); }
    50% { box-shadow: 0 0 0 8px rgba(201, 168, 76, 0); }
}
.tl-counter { font-size: 0.9rem; color: var(--text-secondary); }
.tl-counter b { color: var(--accent-gold); font-size: 1.1rem; }

/* Dice tray */
.tl-tray { display: flex; gap: 18px; align-items: flex-end; }
.tl-tray small { display: block; margin-bottom: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.tl-dice { display: flex; gap: 8px; min-height: 40px; }
.tl-die { font: inherit; font-size: 1.2rem; font-weight: 800; cursor: pointer; transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s; }
.tl-die.rolling { animation: ht-tumble 0.45s linear infinite; }
.tl-die.glow { box-shadow: 0 0 14px rgba(201, 168, 76, 0.85); animation: tl-pulse 1.4s ease-in-out infinite; }
.tl-die.used { opacity: 0.3; text-decoration: line-through; cursor: default; box-shadow: none; animation: none; }
.tl-die.banked { border-style: dashed; cursor: default; }

/* Ability cards */
.tl-cards { display: flex; flex-direction: column; gap: 8px; }
.tl-acard {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: default;
}
.tl-acard img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 1px solid var(--accent-gold); }
.tl-acard-txt { flex: 1 1 auto; display: flex; flex-direction: column; }
.tl-acard-txt small { font-size: 0.72rem; color: var(--text-secondary); }
.tl-acard.on { cursor: pointer; border-color: var(--accent-gold); animation: tl-pulse 1.4s ease-in-out infinite; }
.tl-acard.used { opacity: 0.45; }

/* Boss HP */
.tl-hpbox {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(143, 47, 43, 0.18);
    border: 1px solid rgba(224, 100, 90, 0.5);
    border-radius: 8px;
}
.tl-hp-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tl-hp-top b { color: #e0645a; }
.tl-hp-top span { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.tl-hp i { height: 12px; }
.tl-dmg {
    position: absolute;
    right: 14px;
    top: -4px;
    font-weight: 900;
    color: #ff6b5a;
    pointer-events: none;
    animation: tl-dmg 0.9s ease-out forwards;
}
@keyframes tl-dmg { from { opacity: 1; transform: translateY(0) scale(1.3); } to { opacity: 0; transform: translateY(-26px) scale(1); } }

/* Placement queue */
.tl-queue { display: flex; flex-wrap: wrap; gap: 4px; }
.tl-qpc img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); opacity: 0.6; display: block; }
.tl-qpc.now img { width: 34px; height: 34px; border: 2px solid var(--accent-gold); opacity: 1; animation: tl-pulse 1.4s ease-in-out infinite; }

/* Board */
.tl-board-wrap { position: relative; width: 100%; max-width: 560px; }
.tl-board {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    grid-template-rows: repeat(11, minmax(0, 1fr));
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    user-select: none;
}
.tl-sq { position: relative; min-width: 0; min-height: 0; background: var(--square-light); display: flex; align-items: center; justify-content: center; }
.tl-sq.d { background: var(--square-dark); }
.tl-sq.center { box-shadow: inset 0 0 0 2px rgba(201, 168, 76, 0.3); }
.tl-sq.click { cursor: pointer; }
.tl-sq.sel { background: var(--highlight-selected); }
.tl-sq.mv::after {
    content: '';
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: rgba(100, 200, 100, 0.75);
    animation: ht-pop 0.2s ease both;
}
.tl-sq.cap { box-shadow: inset 0 0 0 3px rgba(224, 100, 90, 0.9); }
.tl-sq.tgt { box-shadow: inset 0 0 0 2px var(--accent-gold); animation: tl-tgt 1.1s ease-in-out infinite; }
@keyframes tl-tgt { 0%, 100% { background-color: rgba(201, 168, 76, 0.12); } 50% { background-color: rgba(201, 168, 76, 0.38); } }
.tl-sq.can .tl-pc { animation: tl-can 1.4s ease-in-out infinite; }
@keyframes tl-can { 0%, 100% { box-shadow: 0 0 0 0 rgba(201, 168, 76, 0.7); } 50% { box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.35); } }
.tl-sq.lava {
    background: linear-gradient(135deg, #ff9a2e, #d4380d, #ff6a00, #b02a07);
    background-size: 300% 300%;
    animation: tl-lava 2.4s ease-in-out infinite;
}
@keyframes tl-lava { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.tl-sq.boss { background: #5e1d1a; box-shadow: inset 0 0 0 2px #e0645a; }

/* Pieces */
.tl-pc {
    position: relative;
    width: 84%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--white-piece);
    background: var(--bg-light);
    pointer-events: none;
}
.tl-pc.b { border-color: var(--black-piece); }
.tl-pc img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.tl-glyph {
    position: absolute;
    right: -14%;
    bottom: -14%;
    width: 46%;
    height: 46%;
    border-radius: 50%;
    font-size: clamp(7px, 1.3vw, 12px);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white-piece);
    color: #1a1a2e;
}
.tl-pc.b .tl-glyph { background: var(--black-piece); color: #fff; }
.tl-pc.frozen::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: rgba(120, 200, 255, 0.45);
    box-shadow: 0 0 10px rgba(140, 210, 255, 0.9), inset 0 0 8px #fff;
    z-index: 1;
}
.tl-ice, .tl-warn {
    position: absolute;
    left: -12%;
    top: -14%;
    z-index: 2;
    font-size: clamp(9px, 1.5vw, 14px);
    line-height: 1;
}
.tl-pc.warn { outline: 2px dashed #ff5a3c; outline-offset: 1px; }
.tl-pc.check { box-shadow: 0 0 0 3px #e0645a, 0 0 16px rgba(224, 100, 90, 0.9); animation: tl-check 1s ease-in-out infinite; }
@keyframes tl-check { 50% { box-shadow: 0 0 0 3px #ff8a7e, 0 0 26px rgba(255, 120, 100, 1); } }
.tl-pc.arrive { animation: ht-pop 0.3s ease both; }
.tl-pc.drop { animation: tl-drop 0.4s cubic-bezier(0.3, 1.4, 0.6, 1) both; }
@keyframes tl-drop { from { opacity: 0; transform: translateY(-120%) scale(1.3); } to { opacity: 1; transform: none; } }
.tl-pc.freeze { animation: tl-freeze 0.6s ease both; }
@keyframes tl-freeze { 0% { transform: scale(1); } 30% { transform: scale(1.2) rotate(-6deg); } 60% { transform: scale(0.95) rotate(4deg); } 100% { transform: none; } }
.tl-pc.caught { animation: ht-shake 0.3s linear 3; }

.tl-boss-tok {
    position: absolute;
    inset: -10%;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(18px, 3.4vw, 34px);
    filter: drop-shadow(0 0 8px rgba(255, 90, 40, 0.9));
    animation: tl-boss-idle 1.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes tl-boss-idle { 50% { transform: scale(1.12); } }
/* Boss art (Game.BOSS_ART): head token on the practice board over a red glow */
.tl-boss-tok.has-art { inset: -16%; filter: drop-shadow(0 0 8px rgba(255, 60, 20, 0.95)); }
.tl-boss-tok.has-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tl-sq.boss { background: radial-gradient(circle, #b8321f 0%, #5e1d1a 70%); }
.tl-hp-art {
    width: 26px;
    height: 26px;
    margin: -4px 4px -4px 0;
    vertical-align: middle;
    border-radius: 50%;
    object-fit: cover;
    background: radial-gradient(circle, #7a1a12, #1a0505);
    border: 1px solid #e0645a;
}
.tl-boss-intro {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 18px rgba(255, 40, 20, 0.7));
    animation: ht-rise 0.5s ease both;
}
.tl-boss-tok.slam { animation: tl-slam 0.45s cubic-bezier(0.5, 0, 1, 0.6) both, tl-boss-idle 1.6s ease-in-out 0.45s infinite; }
@keyframes tl-slam { from { opacity: 0; transform: translateY(-260%) scale(3); } to { opacity: 1; transform: none; } }
.tl-boss-tok.stomp { animation: tl-stomp 0.35s ease-in both, tl-boss-idle 1.6s ease-in-out 0.35s infinite; }
@keyframes tl-stomp { from { transform: translateY(-100%) scale(1.4); } to { transform: none; } }
.tl-boss-tok.die { animation: tl-bossdie 0.7s ease-in forwards; }
@keyframes tl-bossdie { to { opacity: 0; transform: scale(2.4) rotate(40deg); filter: drop-shadow(0 0 20px #fff); } }

/* Effects layer */
.tl-fx { position: absolute; inset: 0; pointer-events: none; }
.tl-fx-el { position: absolute; transform: translate(-50%, -50%); z-index: 5; }
.tl-burst { width: var(--s); height: var(--s); border-radius: 50%; animation: tl-burst 0.7s ease-out forwards; }
@keyframes tl-burst { from { opacity: 1; transform: translate(-50%, -50%) scale(0.3); } to { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
.tl-burst.fire { background: radial-gradient(circle, #fff6b0 0%, #ffb02e 35%, #e0401a 65%, transparent 72%); }
.tl-burst.ice { background: radial-gradient(circle, #ffffff 0%, #a8e6ff 40%, #4fb3ff 65%, transparent 72%); }
.tl-burst.lava { background: radial-gradient(circle, #ffd27a 0%, #ff7a1a 45%, #c0300a 68%, transparent 72%); }
.tl-burst.hit { background: radial-gradient(circle, #fff 0%, rgba(255, 255, 255, 0.4) 45%, transparent 70%); }
.tl-burst.arcane { background: radial-gradient(circle, #fff 0%, #d7a8ff 35%, #8a3cff 62%, transparent 72%); }
.tl-burst.gore { background: radial-gradient(circle, #ff8a8a 0%, #c01818 50%, transparent 72%); }
.tl-burst.fizz { background: radial-gradient(circle, rgba(200, 200, 210, 0.8) 0%, transparent 65%); }
.tl-burst.shock { background: none; border: 4px solid rgba(255, 120, 80, 0.9); animation-duration: 0.8s; }
.tl-fireball {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #fff6b0, #ffb02e 40%, #e0401a 75%);
    box-shadow: 0 0 18px 6px rgba(255, 120, 30, 0.85), -10px -16px 22px rgba(255, 160, 40, 0.5);
}
.tl-missile {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff, #c084ff 50%, #7a2cff);
    box-shadow: 0 0 14px 5px rgba(170, 100, 255, 0.85);
}
.tl-icebolt {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff, #8fdcff 55%, #3aa0ff);
    box-shadow: 0 0 12px 4px rgba(120, 200, 255, 0.85);
}
.tl-blob {
    display: block;
    width: 18px;
    height: 14px;
    border-radius: 50% 50% 45% 55%;
    background: radial-gradient(circle, #ffd27a, #ff6a00 60%, #b02a07);
    box-shadow: 0 0 12px 4px rgba(255, 110, 20, 0.8);
}
.tl-bomb, .tl-claw { display: block; font-size: 22px; line-height: 1; }
.tl-shake { animation: tl-shake 0.4s linear; }
@keyframes tl-shake {
    0%, 100% { transform: none; }
    20% { transform: translate(-5px, 2px); }
    40% { transform: translate(5px, -3px); }
    60% { transform: translate(-4px, -2px); }
    80% { transform: translate(3px, 3px); }
}
.tl-stamp, .tl-victory {
    padding: 4px 10px;
    border: 3px solid #e0645a;
    border-radius: 6px;
    background: rgba(10, 10, 15, 0.9);
    color: #e0645a;
    font-weight: 900;
    letter-spacing: 0.1em;
    white-space: nowrap;
    font-size: clamp(0.8rem, 2vw, 1.1rem);
    animation: tl-stampin 0.5s ease-in both;
}
.tl-stamp { transform: translate(-50%, 40%) rotate(-10deg); }
@keyframes tl-stampin { from { opacity: 0; scale: 2.4; } to { opacity: 1; scale: 1; } }
.tl-victory { border-color: var(--accent-gold); color: var(--accent-gold); font-size: clamp(0.9rem, 2.4vw, 1.4rem); }

/* AI card */
.tl-aicard {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 6;
    width: min(62%, 260px);
    aspect-ratio: 5 / 7;
    transform: translate(-50%, -50%);
    perspective: 900px;
    animation: tl-cardin 0.5s ease both;
    transition: opacity 0.35s, transform 0.35s;
}
.tl-aicard.gone { opacity: 0; transform: translate(-50%, -60%) scale(0.8); }
@keyframes tl-cardin { from { opacity: 0; transform: translate(-50%, 20%) rotate(-8deg); } to { opacity: 1; transform: translate(-50%, -50%); } }
.tl-aicard-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.8s ease; }
.tl-aicard.flip .tl-aicard-in { transform: rotateY(180deg); }
.tl-aicard-back, .tl-aicard-front {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    border: 3px solid var(--accent-gold);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7);
}
.tl-aicard-back {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 900;
    color: var(--accent-gold);
    background: repeating-linear-gradient(45deg, #1a1a2e 0 10px, #252540 10px 20px);
}
.tl-aicard-front {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: linear-gradient(160deg, #252540, #12121a);
}
.tl-aicard-front small { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: #7aa2e3; font-weight: 800; }
.tl-aicard-front b { font-size: 1.25rem; color: var(--accent-gold); }
.tl-aicard-front span { font-size: 0.78rem; line-height: 1.5; color: var(--text-primary); }
.tl-aicard-die { margin-top: auto; display: flex; justify-content: center; }
.tl-aicard-die .rolling { animation: ht-tumble 0.45s linear infinite; }
.tl-aicard-die .glow { box-shadow: 0 0 16px rgba(255, 120, 30, 0.9); }

/* Draft cards */
.tl-draft {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-height: 100%;
    align-content: start;
}
.tl-pcard {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 10px;
    font: inherit;
    text-align: left;
    color: var(--text-primary);
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.tl-pcard:hover { border-color: var(--text-secondary); }
.tl-pcard img { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; border: 1px solid var(--border-color); }
.tl-pcard-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-pcard-txt b { font-size: 0.88rem; }
.tl-pcard-ab { font-size: 0.74rem; font-weight: 700; color: var(--accent-gold); }
.tl-pcard-ab em { margin-left: 6px; padding: 0 6px; border-radius: 8px; font-style: normal; background: var(--accent-gold); color: var(--bg-darkest); }
.tl-pcard-txt small { font-size: 0.72rem; line-height: 1.35; color: var(--text-secondary); }
.tl-pcard-check {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-gold);
    color: var(--bg-darkest);
    font-size: 0.75rem;
    font-weight: 900;
    display: none;
    align-items: center;
    justify-content: center;
}
.tl-pcard.on { border-color: var(--accent-gold); background: rgba(201, 168, 76, 0.1); }
.tl-pcard.on img { border-color: var(--accent-gold); }
.tl-pcard.on .tl-pcard-check { display: flex; animation: ht-pop 0.25s ease both; }
.tl-pcard.tl-picked { animation: tl-picked 0.3s ease; }
@keyframes tl-picked { 50% { transform: scale(1.04); } }
.tl-draft.locked .tl-pcard:not(.on) { opacity: 0.35; }
.tl-draft.locked { pointer-events: none; }

@media (max-width: 760px) {
    .tl-modal { height: 100vh; height: 100dvh; }
    .tl-body { display: flex; flex-direction: column; gap: 10px; }
    .tl-side { display: contents; }
    .tl-stepno { order: 1; }
    .tl-instr { order: 2; font-size: 0.9rem; }
    .tl-fb { order: 3; }
    .tl-actions { order: 4; }
    .tl-stage { order: 5; width: 100%; }
    #tl-extra { order: 6; display: flex; flex-direction: column; gap: 10px; }
    .tl-hint-wrap { order: 7; }
    .tl-draft { grid-template-columns: 1fr; }
    .tl-foot .tl-note { order: -1; flex-basis: 100%; }
    .tl-foot .btn { flex: 1 1 auto; padding: 10px 8px; font-size: 0.82rem; }
}
