/* KiraraBot Batalla v2 */
@font-face { font-family: 'Quicksand'; font-weight: 700; src: url('assets/fonts/quicksand-bold.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Space Mono'; font-weight: 400; src: url('assets/fonts/spacemono.woff2') format('woff2'); font-display: swap; }
:root {
  --bg: #0b0710; --paper: rgba(20, 13, 32, 0.92); --paper-border: rgba(255, 215, 120, 0.22);
  --gold: #ffd76a; --gold-2: #eecf85; --cyan: #7fd0f0; --lila: #c9b3ef; --text: #f4eefb; --muted: #a897c4;
  --hp: #58d67a; --hp-low: #ff5a5a; --enemy: #ff6b6b; --shield: #ffc9de;
  --font: 'Quicksand', 'Segoe UI', system-ui, sans-serif; --mono: 'Space Mono', ui-monospace, monospace;
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
button { font-family: var(--font); cursor: pointer; }

/* pantallas */
.screen { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
.screen.active { display: flex; }
#screen-battle.active { display: block; padding: 0; pointer-events: none; }
#screen-battle.active > * { pointer-events: auto; }
#screen-loading, #screen-pause, #screen-result, #screen-perk, #screen-shop { background: rgba(6, 3, 12, 0.72); backdrop-filter: blur(3px); z-index: 20; }
#screen-menu { z-index: 10; background: linear-gradient(180deg, rgba(6, 3, 12, 0.35), rgba(6, 3, 12, 0.7) 85%); }

.logo { font-size: clamp(30px, 6vw, 56px); letter-spacing: 0.08em; margin: 0 0 6px; line-height: 1; text-align: center; color: var(--text); text-shadow: 0 2px 0 #2a1c45, 0 0 24px rgba(201, 179, 239, 0.35); }
.logo span { display: block; font-size: 0.62em; letter-spacing: 0.32em; color: var(--gold); text-shadow: 0 2px 0 #4a3520, 0 0 20px rgba(255, 215, 106, 0.4); }
.panel-title { font-size: clamp(18px, 3.4vw, 26px); letter-spacing: 0.16em; margin: 0 0 10px; color: var(--gold); text-align: center; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 8px; text-align: center; }
.tip { color: var(--lila); font-size: 13px; margin-top: 12px; min-height: 18px; text-align: center; }

.loading-box { width: min(420px, 90vw); text-align: center; }
.loading-bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--paper-border); overflow: hidden; margin: 18px 0 8px; }
#loading-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-2), var(--gold)); transition: width 0.2s; }
#loading-text { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0; }

.menu-panel { display: none; flex-direction: column; align-items: center; width: 100%; max-height: 100%; }
.menu-panel.active { display: flex; }
.menu-buttons { display: flex; flex-direction: column; gap: 8px; width: min(300px, 80vw); margin-top: 10px; }
.menu-hero-label { color: var(--lila); font-size: 14px; margin: 0; letter-spacing: 0.06em; }
.menu-best { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.menu-credits { font-family: var(--mono); font-size: 10px; color: rgba(168, 151, 196, 0.6); margin: 8px 0 0; }
.btn-big { padding: 12px 18px; border-radius: 12px; border: 2px solid var(--gold); background: linear-gradient(180deg, #4a3520, #2a1c12); color: var(--gold); font-size: 16px; letter-spacing: 0.14em; font-weight: 700; box-shadow: 0 4px 0 #1a1008, 0 8px 20px rgba(0, 0, 0, 0.4); transition: transform 0.08s, box-shadow 0.08s; }
.btn-big:active { transform: translateY(3px); box-shadow: 0 1px 0 #1a1008; }
.btn-big.alt { border-color: rgba(201, 179, 239, 0.6); background: linear-gradient(180deg, #2a1c45, #17102a); color: var(--lila); box-shadow: 0 4px 0 #0b0710, 0 8px 20px rgba(0, 0, 0, 0.4); }
.btn-big.alt:active { box-shadow: 0 1px 0 #0b0710; }
.btn-big:disabled { opacity: 0.45; cursor: default; }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }

.paper { background: var(--paper); border: 1px solid var(--paper-border); border-radius: 16px; padding: 18px 20px; width: min(380px, 92vw); max-height: calc(100% - 10px); overflow: auto; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.paper.wide { width: min(720px, 94vw); }
.cfg-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); font-size: 14px; }
.cfg-row input[type=text], .cfg-row select { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--paper-border); color: var(--text); border-radius: 8px; padding: 6px 10px; font-family: var(--font); font-size: 14px; max-width: 160px; }
.cfg-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
.cfg-hint { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 6px 0; }

/* seleccion de heroe */
#panel-select { gap: 8px; }
.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; width: min(720px, 94vw); max-height: 34vh; overflow: auto; padding: 4px; }
.char-card { background: rgba(20, 13, 32, 0.85); border: 2px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 8px 4px; color: var(--text); font-size: 11px; letter-spacing: 0.04em; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color 0.12s, transform 0.12s; }
.char-card .dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 12px currentColor; }
.char-card.selected { border-color: var(--gold); transform: translateY(-2px); }
.char-card.locked { opacity: 0.5; }
.select-info { width: min(520px, 94vw); background: var(--paper); border: 1px solid var(--paper-border); border-radius: 14px; padding: 10px 14px; text-align: center; }
.char-name { color: var(--gold); font-size: 18px; letter-spacing: 0.12em; }
.char-desc { color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.char-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--lila); }
.char-stats .stat b { display: block; color: var(--text); font-size: 13px; font-family: var(--font); }
.stat-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 3px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; background: var(--cyan); }
.char-special { margin-top: 8px; font-size: 12px; color: var(--text); }
.char-special b { color: var(--cyan); }

/* HUD */
.hud-top { position: absolute; left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r)); top: calc(8px + var(--safe-t)); display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.hp-block { width: min(280px, 42vw); }
.hp-name { font-size: 12px; letter-spacing: 0.14em; color: var(--gold); text-shadow: 0 1px 2px #000; }
.hp-bar { position: relative; height: 16px; border-radius: 8px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.18); overflow: hidden; }
.hp-fill { height: 100%; width: 100%; background: linear-gradient(180deg, #7dffa0, var(--hp)); transition: width 0.12s; }
.hp-fill.low { background: linear-gradient(180deg, #ff8a8a, var(--hp-low)); }
.hp-fill.enemy { background: linear-gradient(180deg, #ff9a9a, var(--enemy)); }
.hp-shield { position: absolute; left: 0; top: 0; height: 100%; width: 0; background: rgba(255, 201, 222, 0.55); }
.hp-text { position: absolute; inset: 0; text-align: center; font-family: var(--mono); font-size: 10px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px #000; }
.perk-row { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }
.perk-row span { width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 215, 106, 0.18); border: 1px solid var(--gold); font-size: 10px; display: flex; align-items: center; justify-content: center; color: var(--gold); }
.round-box { margin: 0 auto; text-align: center; background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 12px; padding: 4px 14px; min-width: 110px; }
#round-label { font-size: 15px; letter-spacing: 0.18em; color: var(--gold); }
.enemies-left { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.score-block { text-align: right; font-family: var(--mono); font-size: 12px; margin-right: 44px; }
.gold-line { display: flex; align-items: center; gap: 6px; justify-content: flex-end; color: var(--gold); font-weight: 700; font-size: 15px; }
.gold-line.center { justify-content: center; }
.gold-coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, var(--gold) 45%, #a9781c); display: inline-block; box-shadow: 0 0 6px rgba(255, 215, 106, 0.6); }
.score-line { color: var(--lila); }
.combo-line { color: var(--cyan); font-weight: 700; min-height: 14px; }
.pause-btn { position: absolute; right: 0; top: 0; width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.45); display: flex; gap: 5px; align-items: center; justify-content: center; }
.pause-btn span { width: 4px; height: 16px; background: var(--text); border-radius: 2px; display: block; }
.boss-bar { position: absolute; left: 50%; transform: translateX(-50%); top: calc(64px + var(--safe-t)); width: min(460px, 70vw); display: none; text-align: center; }
.boss-bar.on { display: block; }
.boss-name { font-size: 12px; letter-spacing: 0.24em; color: var(--enemy); text-shadow: 0 1px 2px #000; }
.hp-bar.boss { height: 12px; }
.announce { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: clamp(28px, 7vw, 64px); letter-spacing: 0.2em; color: var(--gold); text-shadow: 0 3px 0 #3a2810, 0 0 30px rgba(255, 215, 106, 0.5); opacity: 0; transform: scale(0.8); pointer-events: none; }
.announce.show { animation: announce 1.6s ease-out forwards; }
.announce.small { top: 24%; font-size: clamp(16px, 3vw, 24px); color: var(--cyan); text-shadow: 0 2px 0 #10303a; }
.announce.small.show { animation: announce 1.2s ease-out forwards; }
@keyframes announce { 0% { opacity: 0; transform: scale(0.7); } 15% { opacity: 1; transform: scale(1.05); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) translateY(-10px); } }
.keys-hint { position: absolute; bottom: calc(8px + var(--safe-b)); left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 11px; color: rgba(168, 151, 196, 0.7); }
.touch .keys-hint { display: none; }

/* controles tactiles */
#touch-controls { display: none; position: absolute; inset: 0; }
.touch #touch-controls { display: block; }
#joystick-zone { position: absolute; left: 0; bottom: 0; width: 46%; height: 62%; }
#joystick-base { position: absolute; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.06); display: none; left: 25%; top: 62%; }
#joystick-base.on { display: block; }
#joystick-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 215, 106, 0.55); border: 2px solid var(--gold); }
#action-buttons { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); width: 210px; height: 190px; }
.act-btn { position: absolute; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(20, 13, 32, 0.7); color: var(--text); font-size: 11px; letter-spacing: 0.06em; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.act-btn.down { background: rgba(255, 215, 106, 0.5); border-color: var(--gold); }
.act-btn.big { width: 74px; height: 74px; font-size: 12px; }
.act-btn[data-action=light] { right: 0; bottom: 0; border-color: var(--gold); }
.act-btn[data-action=heavy] { right: 84px; bottom: 26px; border-color: #ff9a5a; }
.act-btn[data-action=special] { right: 20px; bottom: 90px; border-color: var(--cyan); }
.act-btn[data-action=dodge] { right: 148px; bottom: 100px; }
.act-btn[data-action=block] { right: 96px; bottom: 120px; }
.act-btn.special .cd-ring { position: absolute; inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); transform: rotate(-90deg); pointer-events: none; }
.act-btn.special .cd-ring circle { fill: none; stroke: var(--cyan); stroke-width: 3; stroke-dasharray: 113; stroke-dashoffset: 0; transition: stroke-dashoffset 0.1s linear; }
.act-btn.special.cooling { color: var(--muted); }
.act-btn.special.ready { box-shadow: 0 0 16px rgba(127, 208, 240, 0.7); }

/* numeros de danio y barras */
.dmg { position: absolute; font-family: var(--mono); font-weight: 700; font-size: 15px; color: #fff4d0; text-shadow: 0 1px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8); transform: translate(-50%, -50%); will-change: transform, opacity; }
.dmg.crit { color: var(--gold); font-size: 20px; }
.dmg.hero { color: #ff7a7a; }
.dmg.heal { color: #7dffa0; }
.dmg.poison { color: #8ff0a4; font-size: 12px; }
.dmg.magic { color: #d8b8ff; }
.dmg.miss, .dmg.block { color: var(--cyan); font-size: 11px; letter-spacing: 0.1em; }
.dmg.on { animation: dmgpop 0.85s ease-out forwards; }
@keyframes dmgpop { 0% { opacity: 0; margin-top: 0; scale: 0.6; } 12% { opacity: 1; scale: 1.15; } 30% { scale: 1; } 100% { opacity: 0; margin-top: -44px; } }
.ebar { position: absolute; width: 44px; height: 5px; margin-left: -22px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(0, 0, 0, 0.7); border-radius: 3px; overflow: hidden; }
.ebar i { display: block; height: 100%; background: var(--enemy); }
.ebar.ally i { background: var(--hp); }
.ebar.elite { width: 56px; margin-left: -28px; border-color: var(--gold); }
.ebar .lbl { position: absolute; left: 0; right: 0; top: -13px; text-align: center; font-family: var(--mono); font-size: 9px; color: var(--gold); white-space: nowrap; text-shadow: 0 1px 2px #000; }

/* reliquias y tienda */
.perk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.perk-card { background: linear-gradient(180deg, #2a1c45, #17102a); border: 2px solid rgba(201, 179, 239, 0.5); border-radius: 14px; padding: 14px 10px; color: var(--text); text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; transition: transform 0.1s, border-color 0.1s; }
.perk-card:hover, .perk-card:active { border-color: var(--gold); transform: translateY(-3px); }
.perk-card .icon { width: 44px; height: 44px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff3b0, var(--gold) 40%, #7a561c); display: flex; align-items: center; justify-content: center; font-size: 20px; color: #2a1c12; box-shadow: 0 0 18px rgba(255, 215, 106, 0.5); }
.perk-card b { color: var(--gold); letter-spacing: 0.08em; font-size: 13px; }
.perk-card span { font-size: 12px; color: var(--muted); }
.shop-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.shop-item { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--paper-border); border-radius: 12px; padding: 10px; color: var(--text); text-align: left; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.shop-item b { font-size: 13px; color: var(--text); }
.shop-item .price { color: var(--gold); font-family: var(--mono); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.shop-item .desc { color: var(--muted); }
.shop-item:disabled { opacity: 0.45; }
.shop-item.maxed { border-color: rgba(127, 208, 240, 0.5); }

/* resultado y marcador */
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.result-stats b { color: var(--text); font-family: var(--font); font-size: 18px; display: block; }
.tabs { display: flex; gap: 6px; justify-content: center; }
.tab { padding: 6px 14px; border-radius: 10px; border: 1px solid var(--paper-border); background: transparent; color: var(--muted); font-size: 13px; }
.tab.active { background: rgba(255, 215, 106, 0.15); color: var(--gold); border-color: var(--gold); }
.leader-list { max-height: 50vh; overflow: auto; font-family: var(--mono); font-size: 12px; }
.leader-row { display: grid; grid-template-columns: 30px 1fr 70px 50px 70px; gap: 6px; padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); align-items: center; }
.leader-row.me { background: rgba(255, 215, 106, 0.1); }
.leader-row .n { color: var(--gold); }
.leader-row .name { font-family: var(--font); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leader-row .hero { color: var(--muted); font-size: 10px; }
.leader-row .score { text-align: right; color: var(--cyan); }
.leader-row.head { color: var(--muted); font-size: 10px; letter-spacing: 0.1em; }

#rotate-overlay { position: absolute; inset: 0; background: var(--bg); display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 50; color: var(--lila); font-size: 16px; }
.touch.portrait.in-battle #rotate-overlay { display: flex; }
.rotate-icon { width: 46px; height: 80px; border: 3px solid var(--gold); border-radius: 10px; margin-bottom: 14px; animation: rot 1.6s ease-in-out infinite; }
@keyframes rot { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.35s; z-index: 40; }
#fade.on { opacity: 1; }
#toast { position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--paper); border: 1px solid var(--paper-border); border-radius: 10px; padding: 8px 14px; font-size: 13px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 60; }
#toast.on { opacity: 1; }

@media (max-height: 460px) {
  .logo { font-size: 26px; }
  .menu-buttons { gap: 5px; }
  .btn-big { padding: 8px 14px; font-size: 13px; }
  .char-grid { max-height: 30vh; }
  .paper { padding: 12px 14px; }
  .perk-card .icon { width: 34px; height: 34px; font-size: 16px; }
}
@media (max-width: 520px) {
  .hp-block { width: 40vw; }
  .score-block { font-size: 11px; margin-right: 40px; }
  .round-box { min-width: 80px; padding: 3px 8px; }
  #round-label { font-size: 12px; }
  .perk-cards { grid-template-columns: 1fr; }
}

/* en horizontal el heroe se ve a la izquierda y los paneles van a la derecha */
@media (min-aspect-ratio: 5/4) {
  #screen-menu { justify-content: flex-end; }
  .menu-panel { width: 60%; }
  .char-grid, .select-info { width: 100%; }
  .paper.wide { width: min(640px, 100%); }
}

#mooncat-splash {
  position: fixed; inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2px, 1.2vh, 10px);
  background:
    radial-gradient(1px 1px at 22px 34px, rgba(255,255,255,0.55), transparent 1.5px),
    radial-gradient(1px 1px at 130px 90px, rgba(203,178,240,0.5), transparent 1.5px),
    radial-gradient(1.5px 1.5px at 200px 150px, rgba(255,255,255,0.4), transparent 2px),
    radial-gradient(1px 1px at 68px 160px, rgba(203,178,240,0.4), transparent 1.5px),
    radial-gradient(1px 1px at 170px 40px, rgba(255,255,255,0.35), transparent 1.5px),
    radial-gradient(ellipse at 50% 38%, #120a24 0%, #050512 78%);
  background-size: 260px 210px, 260px 210px, 260px 210px, 260px 210px, 260px 210px, 100% 100%;
  overflow: hidden;
  cursor: pointer;
}
#mooncat-splash.out {
  opacity: 0;
  transition: opacity 0.7s ease;
  pointer-events: none;
}

.mc-shooting {
  position: absolute;
  top: 18%; left: 0;
  width: 110px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #e9defc);
  transform: translateX(110vw) rotate(-14deg);
  opacity: 0;
  animation: mcShoot 0.9s 0.45s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes mcShoot {
  0%   { transform: translateX(110vw) translateY(-4vh) rotate(-14deg); opacity: 0; }
  15%  { opacity: 0.9; }
  100% { transform: translateX(-30vw) translateY(28vh) rotate(-14deg); opacity: 0; }
}

#mc-logo {
  width: clamp(180px, 38vh, 280px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(139, 111, 192, 0.4)) drop-shadow(0 0 50px rgba(88, 52, 150, 0.32));
}

/* 1. Luna y disco entran con rebote */
.mc-moon {
  transform-box: view-box;
  transform-origin: center;
  opacity: 0;
  animation: mcEnter 1.1s 0.15s cubic-bezier(0.34, 1.35, 0.45, 1) forwards;
}
@keyframes mcEnter {
  from { opacity: 0; transform: scale(0.5) rotate(-70deg); }
  to   { opacity: 1; transform: none; }
}

/* 2. El gato se dibuja solo */
.mc-cat {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: mcDraw 1.6s 1.2s cubic-bezier(0.45, 0.05, 0.35, 1) forwards;
}
@keyframes mcDraw { to { stroke-dashoffset: 0; } }

/* 3. Detalles de la cara */
.mc-earline { opacity: 0; animation: mcFade 0.4s 2.75s ease forwards; }
.mc-eye     { opacity: 0; animation: mcFade 0.4s 2.85s ease forwards; }
.mc-whiskers{ opacity: 0; animation: mcFadeW 0.35s 3.0s ease forwards; }
@keyframes mcFade  { to { opacity: 1; } }
@keyframes mcFadeW { to { opacity: 0.7; } }

/* 4. La cola se dibuja */
.mc-tail {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: mcDraw 1s 2.5s cubic-bezier(0.3, 0.8, 0.4, 1) forwards;
}

/* 5. Estrella */
.mc-spark {
  transform-box: view-box;
  opacity: 0;
  animation: mcFade 0.5s 3.4s cubic-bezier(0.34, 1.6, 0.5, 1) forwards,
             mcTwinkle 2.4s 4.0s ease-in-out infinite;
}
.mc-spark2 {
  opacity: 0;
  animation: mcFadeW 0.5s 3.6s ease forwards,
             mcTwinkle 3.1s 4.2s ease-in-out infinite;
}
@keyframes mcTwinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.mc-text { text-align: center; }
.mc-crafted {
  display: block;
  font-family: 'Space Mono', 'Courier New', monospace;
  font-size: clamp(0.68rem, 2vh, 0.9rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: #b9a7d9;
  opacity: 0;
  animation: mcFadeUp 0.7s 3.3s ease forwards;
}
@keyframes mcFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 0.85; transform: none; }
}
.mc-name {
  display: block;
  font-family: 'Quicksand', 'Segoe UI', sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 9.5vh, 3.9rem);
  line-height: 1.15;
  filter: drop-shadow(0 0 14px rgba(168, 121, 240, 0.35));
}
.mc-name i {
  font-style: normal;
  display: inline-block;
  background: linear-gradient(180deg, #f7f2ff, #c3aae8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(16px);
  animation: mcLetter 0.45s cubic-bezier(0.2, 1, 0.35, 1) forwards;
}
.mc-name i:nth-child(1) { animation-delay: 3.45s; }
.mc-name i:nth-child(2) { animation-delay: 3.53s; }
.mc-name i:nth-child(3) { animation-delay: 3.61s; }
.mc-name i:nth-child(4) { animation-delay: 3.69s; }
.mc-name i:nth-child(5) { animation-delay: 3.77s; }
.mc-name i:nth-child(6) { animation-delay: 3.85s; }
.mc-name i:nth-child(7) { animation-delay: 3.93s; }
@keyframes mcLetter {
  to { opacity: 1; transform: none; }
}
