/* Leafonado: start page and game table. Uses the shop's colour tokens from style.css. */
:root {
  --lf-atk: #b8573f; --lf-atk-bg: #f6e1d9;
  --lf-def: #3f6a8a; --lf-def-bg: #dfe9f1;
  --lf-sp: #b8860b; --lf-sp-bg: #fbefc6;
  --lf-char: #3f6147; --lf-char-bg: #dce5c9;
  --lf-back: #2f4a36;
  --lf-card-w: 84px;
  --lf-card-sm: 54px;
}
:root[data-theme="dark"] {
  --lf-atk: #f0a08a; --lf-atk-bg: #45251d;
  --lf-def: #9fc3e0; --lf-def-bg: #1f3040;
  --lf-sp: #f2cf6b; --lf-sp-bg: #43361a;
  --lf-char: #a6d5a1; --lf-char-bg: #2a3524;
  --lf-back: #17231b;
}
.notice-error { background: var(--error-bg); color: var(--danger); }

/* ---------- start page ---------- */
.lf-hero { background: var(--beige-2); padding: 40px 0 48px; }
.lf-hero-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: center; }
.lf-hero h1 { margin-bottom: .2em; }
.lf-lead { font-size: 1.1rem; max-width: 52ch; color: var(--ink-soft); }
.lf-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.lf-start-card { display: flex; flex-direction: column; gap: 10px; }
.lf-start-card .h3 { margin: 0; }
.lf-start-card .btn { margin-top: auto; }
.lf-code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 700; font-size: 1.2rem; }
.lf-rules { padding-top: 40px; padding-bottom: 56px; }
.lf-rules h2 { margin-top: 1.2em; }
.lf-chars { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.lf-char { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px; }
.lf-char img { width: 110px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 10px; }
.lf-char-badge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 1.8rem; background: var(--lf-char-bg); color: var(--lf-char); }
.lf-rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.lf-rule-grid ol, .lf-rule-grid ul { padding-left: 1.2em; margin: 0; }
.lf-rule-grid li { margin-bottom: 6px; }

/* Promo card linking to the physical deck */
.lf-promo { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-decoration: none; color: var(--ink); border-color: var(--wood); }
.lf-promo:hover { border-color: var(--forest); }
.lf-promo strong { font-family: var(--serif); font-size: 1.15rem; color: var(--heading); }
.lf-promo .btn { margin-top: 4px; }
.lf-promo-img { width: 72px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 8px; box-shadow: var(--shadow); }
.lf-promo-deck { position: relative; width: 70px; height: 84px; }
.lf-promo-deck i { position: absolute; width: 52px; height: 72px; border-radius: 8px; background: var(--lf-back); border: 3px solid var(--paper); box-shadow: var(--shadow); }
.lf-promo-deck i:nth-child(1) { left: 0; top: 8px; transform: rotate(-10deg); }
.lf-promo-deck i:nth-child(2) { left: 8px; top: 4px; background: var(--lf-atk); }
.lf-promo-deck i:nth-child(3) { left: 16px; top: 0; transform: rotate(9deg); background: var(--lf-sp); }
.lf-promo-big { flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; margin: 16px 0; }
.lf-promo-big strong { flex: 1 1 60%; }
.lf-promo-big .muted { flex: 1 1 100%; }

/* ---------- table ---------- */
.lf-loading { padding: 60px 16px; text-align: center; }
.lf-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; padding-bottom: 10px; }
.lf-bar-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.lf-logo { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--heading); text-decoration: none; }
.lf-room { color: var(--muted); }
.lf-room strong { letter-spacing: .15em; color: var(--heading); }
.lf-bar-info { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lf-btn-chip { border: 0; cursor: pointer; font: inherit; font-size: .8rem; font-weight: 700; }
.lf-chip-warn { background: var(--st-amber-bg); color: var(--st-amber); }
.lf-chip-turn { background: var(--forest); color: var(--on-accent); }
.lf-chip-out { background: var(--st-red-bg); color: var(--danger); }

.lf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; padding-bottom: 40px; }
.lf-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lf-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 90px; }
.lf-log { padding: 16px 18px; }
.lf-log .h3 { margin: 0 0 8px; font-size: 1rem; }
.lf-log ol { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow: auto; font-size: .85rem; }
.lf-log li { padding: 5px 0; border-bottom: 1px solid var(--line); }
.lf-log li:first-child { font-weight: 700; }

/* Lobby */
.lf-lobby h1 { font-size: 1.6rem; }
.lf-code { letter-spacing: .2em; font-size: 1.1em; }
.lf-invite { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.lf-invite input { flex: 1 1 220px; min-width: 0; }
.lf-seats { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.lf-seat-slot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field-bg); flex-wrap: wrap; }
.lf-seat-slot.lf-empty { border-style: dashed; background: transparent; }
.lf-name-form { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 14px; flex-wrap: wrap; }
.lf-name-form .field { flex: 1 1 200px; margin: 0; }
.lf-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; display: inline-block; }
.lf-dot.on { background: var(--leaf); }

/* Seats */
.lf-opponents { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.lf-seat { padding: 14px; transition: border-color .15s, box-shadow .15s; }
.lf-seat header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.lf-seat header strong { font-size: 1rem; }
.lf-hand-count { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; position: relative; }
.lf-hand-count .lf-card { --lf-card-sm: 26px; }
.lf-seat-body { display: flex; gap: 12px; align-items: flex-start; }
.lf-seat-char { display: flex; flex-direction: column; gap: 4px; width: 92px; flex: none; }
.lf-seat-char .small { font-size: .7rem; line-height: 1.25; }
.lf-board { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; align-items: flex-start; }
.lf-no-def { font-size: .8rem; color: var(--danger); font-weight: 700; }
.lf-turn { border-color: var(--forest); box-shadow: 0 0 0 2px var(--forest), var(--shadow); }
.lf-out { opacity: .55; }
.lf-targetable { cursor: pointer; border-style: dashed; border-color: var(--lf-atk); }
.lf-targeted { box-shadow: 0 0 0 3px var(--lf-atk), var(--shadow); }
.lf-me { border-color: var(--wood); }

/* Center */
.lf-center { display: flex; align-items: center; gap: 20px; padding: 14px 18px; flex-wrap: wrap; }
.lf-piles { display: flex; gap: 18px; }
.lf-pile { display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.lf-status { flex: 1; min-width: 200px; }
.lf-status p { margin: 0; }
.lf-timer { font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px !important; }
.lf-timer.lf-hurry { color: var(--danger); }
.lf-count { position: absolute; top: -6px; right: -8px; background: var(--forest); color: var(--on-accent); font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; }
.lf-hand-count .lf-count { position: static; background: var(--beige-2); color: var(--heading); }
.lf-empty-pile { border: 2px dashed var(--line); background: transparent; }

/* Hand + actions */
.lf-hand-wrap { padding: 14px; }
.lf-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; min-height: 38px; }
.lf-help { margin: 0; flex: 1 1 100%; font-size: .9rem; }
.lf-btn-special { background: var(--lf-sp); border-color: var(--lf-sp); color: #1d1606; }
.lf-hand { display: flex; flex-wrap: wrap; gap: 8px; }
.lf-hand-card, .lf-board-card { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 10px; position: relative; transition: transform .12s; font: inherit; color: inherit; }
.lf-hand-card:disabled, .lf-board-card:disabled, .lf-hand-card[aria-disabled="true"] { cursor: default; }
.lf-hand-card:not([aria-disabled="true"]):hover { transform: translateY(-4px); }
.lf-hand-card.lf-picked { transform: translateY(-10px); }
.lf-picked .lf-card { box-shadow: 0 0 0 3px var(--forest), 0 6px 16px rgba(0, 0, 0, .2); }
.lf-board-card.lf-picked .lf-card { box-shadow: 0 0 0 3px var(--lf-atk); }
.lf-board-card:not(:disabled) .lf-card { outline: 2px dashed var(--lf-atk); outline-offset: 2px; }
.lf-x2 { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); background: var(--lf-sp); color: #1d1606; font-size: .65rem; font-weight: 800; border-radius: 999px; padding: 1px 6px; white-space: nowrap; }

/* Cards */
.lf-card { width: var(--lf-card-w); aspect-ratio: 5 / 7; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
  border: 2px solid currentColor; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); overflow: hidden; user-select: none; flex: none; }
.lf-card.lf-sm { width: var(--lf-card-sm); border-radius: 7px; border-width: 1.5px; }
.lf-card.lf-has-img { border: 0; background: var(--beige-2); }
.lf-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lf-card-big { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1; }
.lf-sm .lf-card-big { font-size: 1.3rem; }
.lf-card-label { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; text-align: center; padding: 0 3px; margin-top: 4px; line-height: 1.1; }
.lf-sm .lf-card-label { font-size: .48rem; }
.lf-card-corner { position: absolute; top: 4px; left: 6px; font-size: .7rem; font-weight: 800; }
.lf-sm .lf-card-corner { display: none; }
.lf-k-atk { color: var(--lf-atk); background: var(--lf-atk-bg); }
.lf-k-def { color: var(--lf-def); background: var(--lf-def-bg); }
.lf-k-dbl, .lf-k-dturn, .lf-k-elh { color: var(--lf-sp); background: var(--lf-sp-bg); }
.lf-k-char { color: var(--lf-char); background: var(--lf-char-bg); }
.lf-k-back { color: var(--lf-back); background: var(--lf-back); }
.lf-k-back .lf-card-big { font-size: 1rem; }
.lf-seat-char .lf-card { --lf-card-sm: 64px; }

/* Game over */
.lf-overlay { position: fixed; inset: 0; background: rgba(20, 16, 10, .55); display: grid; place-items: center; z-index: 60; padding: 16px; overflow: auto; }
.lf-over { max-width: 460px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; }
.lf-over h2 { margin: 12px 0 4px; }
.lf-over .btn-row { justify-content: center; }

/* Toasts */
.lf-toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; width: min(92vw, 420px); }
.lf-toast { background: var(--forest-deep, #22362a); color: #f6eedf; padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: .9rem; animation: lf-in .2s ease-out; }
.lf-toast a { color: #f2cf6b; font-weight: 700; }
.lf-toast-error { background: var(--danger); color: #fff; }
.lf-toast-promo { background: var(--lf-sp-bg); color: var(--ink); border: 1px solid var(--lf-sp); }
.lf-toast-promo a { color: var(--forest); }
@keyframes lf-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 900px) {
  .lf-hero-inner, .lf-layout { grid-template-columns: 1fr; }
  .lf-side { position: static; }
}
@media (max-width: 560px) {
  :root { --lf-card-w: 62px; --lf-card-sm: 44px; }
  .lf-seat-char { width: 70px; }
  .lf-seat-char .lf-card { --lf-card-sm: 50px; }
  .lf-seat-char .small { display: none; }
  .lf-card-big { font-size: 1.5rem; }
}

.lf-rules-pdf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.lf-side .lf-rules-pdf { margin: 0; }

/* Admin: card image slots */
.lf-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.lf-slot { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--field-bg); }
.lf-slot-preview { aspect-ratio: 5 / 7; width: 90px; border-radius: 8px; background: var(--beige-2); display: grid; place-items: center; overflow: hidden; }
.lf-slot-preview img { width: 100%; height: 100%; object-fit: cover; }
.lf-slot input[type=file] { font-size: .8rem; max-width: 100%; }

.lf-kick { margin-left: 4px; font-size: .78rem; }
.lf-hand-count + .lf-kick { margin-left: 0; }
.lf-warn { display: inline-block; margin-top: 6px; color: var(--danger); font-weight: 700; font-size: .9rem; }
.lf-toast-alert { background: var(--st-amber-bg); color: var(--st-amber); border: 1px solid var(--warn); }
.lf-removed { z-index: 90; }

/* ---------- gentle animations (skipped with reduced motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .lf-deal { animation: lf-deal .35s ease-out backwards; }
  .lf-pop { animation: lf-pop .3s ease-out; }
  .lf-fx-hit { animation: lf-shake .45s ease-in-out; box-shadow: 0 0 0 3px var(--lf-atk), var(--shadow); }
  .lf-fx-dodge { animation: lf-sway .5s ease-in-out; }
  .lf-fx-glow { animation: lf-glow 1s ease-out; }
  .lf-fx-out { animation: lf-fade .6s ease-out; }
  .lf-fx-storm .lf-hand-wrap, .lf-fx-storm .lf-hand-count { animation: lf-shake .5s ease-in-out; }
  .lf-chip-turn { animation: lf-breathe 2.4s ease-in-out infinite; }
  .lf-overlay .lf-over { animation: lf-pop .35s ease-out; }
}
@keyframes lf-drop { from { opacity: 0; transform: translateY(-10px); } }
@keyframes lf-deal { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes lf-pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes lf-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes lf-sway { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-1.2deg); } 70% { transform: rotate(1.2deg); } }
@keyframes lf-glow { from { box-shadow: 0 0 0 6px var(--lf-sp), var(--shadow); } }
@keyframes lf-fade { from { opacity: 1; filter: none; } to { opacity: .55; } }
@keyframes lf-breathe { 50% { opacity: .75; } }

/* ---------- action scenes ----------
   Timings scale with --t (1 normally, 0.6 when several scenes are waiting). */
.lf-stage { --sc: 104px; --t: 1; position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 16, 10, .62); cursor: pointer; animation: lf-fade-in calc(.2s * var(--t)) ease-out; }
.lf-stage.lf-leave { opacity: 0; transition: opacity .2s; }
.lf-scene { width: min(100%, 620px); display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.lf-sc-row { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: calc(var(--sc) * 1.4); position: relative; max-width: 100%; }
.lf-sc-card { position: relative; flex: none; }
.lf-sc-card .lf-card { --lf-card-w: var(--sc); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.lf-sc-char .lf-card { --lf-card-w: calc(var(--sc) * .9); }
.lf-sc-x2 { font-size: .8rem; bottom: -10px; }
.lf-sc-fan { display: flex; }
.lf-sc-fan .lf-sc-card + .lf-sc-card { margin-left: calc(var(--sc) * -.45); }
.lf-sc-fan .lf-sc-card:nth-child(2) { transform: rotate(8deg) translateY(4px); }
.lf-sc-fan .lf-sc-card:nth-child(1):not(:only-child) { transform: rotate(-6deg); }
.lf-sc-arrow { font-size: 2rem; color: #f6eedf; }
.lf-sc-value { width: 58px; height: 58px; border-radius: 50%; background: var(--lf-atk); color: #fff; display: grid; place-items: center; flex: none;
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600; box-shadow: 0 0 0 4px rgba(255, 255, 255, .85), 0 8px 20px rgba(0, 0, 0, .3); }
.lf-sc-banner { font-family: var(--serif); font-size: clamp(2.4rem, 9vw, 3.6rem); font-weight: 600; color: #fffaf0; text-shadow: 0 4px 24px rgba(0, 0, 0, .45); line-height: 1.1; }
.lf-cap { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  padding: 14px 22px; display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.lf-cap strong { font-family: var(--serif); font-size: 1.35rem; color: var(--heading); font-weight: 600; line-height: 1.25; }
.lf-cap span { color: var(--ink-soft); font-size: .98rem; }
.lf-cap strong:only-child { font-size: 1.15rem; }
.lf-sc-turn .lf-cap, .lf-sc-round .lf-cap { padding: 10px 18px; }
.lf-skip { margin: 0; color: rgba(255, 250, 240, .7); font-size: .75rem; }
.lf-sc-alert .lf-cap { border: 2px solid var(--warn); }
.lf-sc-alert .lf-cap strong { font-size: 1.5rem; }

/* Coin */
.lf-coin { width: calc(var(--sc) * .95); height: calc(var(--sc) * .95); position: relative; transform-style: preserve-3d; flex: none; }
.lf-coin span { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 2.4rem; font-weight: 600;
  backface-visibility: hidden; background: radial-gradient(circle at 35% 30%, #ffe68a, #d9a514 70%); color: #3b2a02; border: 5px solid #8a6508; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.lf-coin .lf-coin-t { transform: rotateY(180deg); }
.lf-coin.lf-heads { --lf-end: 1800deg; }
.lf-coin.lf-tails { --lf-end: 1980deg; }
.lf-sc-coin .lf-coin { animation: lf-spin 1.6s cubic-bezier(.2, .6, .3, 1) forwards, lf-coin-land .4s ease-out 1.6s; }
.lf-reveal { display: inline-block; opacity: 0; animation: lf-reveal .35s ease-out 1.6s forwards; }
.lf-reveal b { color: var(--heading); font-size: 1.1em; }
@keyframes lf-spin { from { transform: rotateY(0) translateY(0); } 50% { transform: rotateY(calc(var(--lf-end) / 2)) translateY(-40px); } to { transform: rotateY(var(--lf-end)) translateY(0); } }
@keyframes lf-coin-land { 50% { scale: 1.12; } }
@keyframes lf-reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .lf-scene { animation: lf-scene-in calc(.3s * var(--t)) ease-out; }
  .lf-sc-turn .lf-sc-banner, .lf-sc-round .lf-sc-banner { animation: lf-pop calc(.45s * var(--t)) ease-out; }
  .lf-flip-in { animation: lf-flip-in calc(.55s * var(--t)) ease-out backwards; }
  .lf-flip-in .lf-card { animation: lf-shield calc(1s * var(--t)) ease-out calc(.5s * var(--t)); }
  .lf-sc-x2 { animation: lf-pop calc(.35s * var(--t)) ease-out calc(.5s * var(--t)) backwards; }
  .lf-late-pop { animation-delay: calc(.85s * var(--t)); }
  .lf-rise-in { animation: lf-rise calc(.5s * var(--t)) ease-out calc(.55s * var(--t)) backwards; }
  .lf-drop-out { animation: lf-drop-out calc(.6s * var(--t)) ease-in calc(.35s * var(--t)) forwards; }
  .lf-swoop { position: absolute; left: 50%; top: 0; animation: lf-swoop calc(.9s * var(--t)) ease-in-out forwards; }
  .lf-spin-in { animation: lf-spin-in calc(.8s * var(--t)) ease-out, lf-shield calc(1s * var(--t)) ease-out calc(.6s * var(--t)); }
  .lf-wobble { animation: lf-wobble calc(1.2s * var(--t)) ease-in-out; }
  .lf-burst i { position: absolute; left: 50%; top: 50%; width: 30px; height: 42px; margin: -21px 0 0 -15px; border-radius: 6px; background: var(--lf-back);
    border: 2px solid #f6eedf; opacity: 0; animation: lf-burst calc(1.3s * var(--t)) ease-out calc(.35s * var(--t)) forwards; }
  /* Attack: cards slide in, lunge at the target at ~0.9s; the target cracks, sways or holds. */
  .lf-sc-versus .lf-sc-fan:first-child { animation: lf-from-left calc(.4s * var(--t)) ease-out backwards; }
  .lf-sc-versus .lf-sc-value { animation: lf-pop calc(.35s * var(--t)) ease-out calc(.35s * var(--t)) backwards; }
  .lf-lunge { animation: lf-from-left calc(.4s * var(--t)) ease-out backwards, lf-lunge calc(.45s * var(--t)) ease-in calc(.85s * var(--t)); }
  .lf-lunge.lf-bounce { animation: lf-from-left calc(.4s * var(--t)) ease-out backwards, lf-bounce calc(.6s * var(--t)) ease-in-out calc(.85s * var(--t)); }
  .lf-lunge.lf-fall { animation: lf-from-left calc(.4s * var(--t)) ease-out backwards, lf-bounce-fall calc(1s * var(--t)) ease-in calc(.85s * var(--t)) forwards; }
  .lf-crack .lf-card { animation: lf-crack calc(.9s * var(--t)) ease-in calc(1.05s * var(--t)) forwards; }
  .lf-ko .lf-card { animation: lf-shake calc(.45s * var(--t)) ease-in-out calc(1.05s * var(--t)); }
  .lf-ko::after, .lf-stamp::after { content: 'OUT'; position: absolute; inset: 32% -6%; display: grid; place-items: center; transform: rotate(-14deg);
    border: 4px solid var(--danger); color: var(--danger); background: rgba(255, 250, 240, .9); border-radius: 8px; font-weight: 900; letter-spacing: .12em;
    font-size: calc(var(--sc) * .2); animation: lf-stamp calc(.35s * var(--t)) ease-out calc(1.15s * var(--t)) backwards; }
  .lf-stamp::after { content: 'REMOVED'; font-size: calc(var(--sc) * .15); animation-delay: calc(.3s * var(--t)); }
  .lf-stamp .lf-card { filter: grayscale(.7); }
  .lf-sway { animation: lf-sway calc(.7s * var(--t)) ease-in-out calc(.9s * var(--t)); }
  .lf-hold { animation: lf-shake calc(.4s * var(--t)) ease-in-out calc(1s * var(--t)); }
}
@media (prefers-reduced-motion: reduce) {
  .lf-sc-coin .lf-coin { animation: none; transform: rotateY(var(--lf-end)); }
  .lf-reveal { animation: none; opacity: 1; }
  .lf-ko::after, .lf-stamp::after { content: 'OUT'; position: absolute; inset: 30% -12%; display: grid; place-items: center; border: 4px solid var(--danger); color: var(--danger); background: #fffaf0; font-weight: 900; }
}
@keyframes lf-fade-in { from { opacity: 0; } }
@keyframes lf-scene-in { from { opacity: 0; transform: scale(.94); } }
@keyframes lf-flip-in { from { transform: perspective(600px) rotateY(90deg) translateY(30px); opacity: 0; } }
@keyframes lf-shield { 0% { box-shadow: 0 0 0 0 rgba(159, 195, 224, .9), 0 10px 30px rgba(0, 0, 0, .35); } 100% { box-shadow: 0 0 0 26px rgba(159, 195, 224, 0), 0 10px 30px rgba(0, 0, 0, .35); } }
@keyframes lf-rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes lf-drop-out { to { transform: translateY(50px) rotate(12deg); opacity: 0; } }
@keyframes lf-swoop { from { transform: translate(140%, -60%) rotate(25deg); opacity: 0; } 60% { opacity: 1; } to { transform: translate(-20%, 10%) rotate(0) scale(.6); opacity: 0; } }
@keyframes lf-spin-in { from { transform: rotate(-200deg) scale(.4); opacity: 0; } }
@keyframes lf-wobble { 0%, 100% { transform: rotate(0) scale(1); } 20% { transform: rotate(-10deg) scale(1.08); } 40% { transform: rotate(9deg) scale(1.1); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }
@keyframes lf-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) rotate(0); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(var(--sc) * -1.7)) rotate(160deg); } }
@keyframes lf-from-left { from { transform: translateX(-60px); opacity: 0; } }
@keyframes lf-lunge { 50% { transform: translateX(calc(var(--sc) * .9)) scale(1.05); } }
@keyframes lf-bounce { 35% { transform: translateX(calc(var(--sc) * .8)); } 60% { transform: translateX(-12px); } }
@keyframes lf-bounce-fall { 30% { transform: translateX(calc(var(--sc) * .8)); } 55% { transform: translateX(-10px) rotate(-8deg); opacity: 1; } 100% { transform: translate(-30px, 140px) rotate(-40deg); opacity: 0; } }
@keyframes lf-crack { 0% { filter: none; } 15% { transform: translateX(-6px) rotate(-3deg); filter: brightness(1.4) saturate(1.5); box-shadow: 0 0 0 6px var(--lf-atk); }
  35% { transform: translateX(6px) rotate(3deg); } 100% { transform: translateY(60px) rotate(20deg) scale(.8); opacity: 0; } }
@keyframes lf-stamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } }

@media (max-width: 560px) {
  .lf-stage { --sc: 72px; padding: 12px; }
  .lf-sc-row { gap: 10px; }
  .lf-sc-value { width: 46px; height: 46px; font-size: 1.3rem; }
  .lf-cap { padding: 12px 16px; }
  .lf-cap strong { font-size: 1.12rem; }
  .lf-cap span { font-size: .9rem; }
  .lf-coin span { font-size: 1.8rem; }
}
/* Long special-card names ("Catastrophe", "Double Turn") scale with the card so they fit on one line. */
.lf-card { container-type: inline-size; }
.lf-k-elh .lf-card-label, .lf-k-dturn .lf-card-label, .lf-k-dbl .lf-card-label { letter-spacing: 0; white-space: nowrap; font-size: min(.62rem, 10.5cqw); }

/* Give up */
.lf-forfeit { display: flex; justify-content: flex-end; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.lf-forfeit .link-btn { color: var(--muted); }
.lf-forfeit .link-btn:hover { color: var(--danger); }
@media (prefers-reduced-motion: no-preference) { .lf-stamp-flag::after { content: 'GAVE UP'; } }
@media (prefers-reduced-motion: reduce) { .lf-stamp-flag::after { content: 'GAVE UP'; } }

/* In-game confirmation window */
.lf-ask { z-index: 92; }
.lf-ask-box { max-width: 400px; width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lf-ask-box .h3 { margin: 6px 0 2px; }
.lf-ask-box p { margin: 0 0 14px; color: var(--ink-soft); }
.lf-ask-card { margin-bottom: 6px; }
.lf-ask-card .lf-card { --lf-card-w: 88px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.lf-ask-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; width: 100%; }
.lf-ask-btns .btn { flex: 1 1 140px; }
.lf-btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
@media (prefers-reduced-motion: no-preference) { .lf-ask-box { animation: lf-pop .25s ease-out; } }

/* Hover tip for special cards (desktop) */
.lf-tip { position: fixed; z-index: 96; max-width: 260px; background: var(--paper); color: var(--ink); border: 1px solid var(--lf-sp); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2); padding: 10px 12px; font-size: .84rem; line-height: 1.4; pointer-events: none; }
.lf-tip strong { display: block; color: var(--lf-sp); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.lf-tip::after { content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: var(--paper);
  border-right: 1px solid var(--lf-sp); border-bottom: 1px solid var(--lf-sp); transform: rotate(45deg); }
.lf-tip-below::after { bottom: auto; top: -6px; transform: rotate(225deg); }
@media (prefers-reduced-motion: no-preference) { .lf-tip { animation: lf-fade-in .12s ease-out; } }
