:root{
  --line:#5b4636;      /* trazo del lápiz */
  --new:#fb8c00;       /* parte nueva resaltada */
  --bg1:#fff3c4; --bg2:#ffd6e0;
  --ink:#4a3b2f;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%;margin:0}
body{
  font-family:'Comic Sans MS','Baloo 2',system-ui,sans-serif;
  background:linear-gradient(160deg,var(--bg1),var(--bg2));
  background-attachment:fixed;
  color:var(--ink);min-height:100dvh;
}
button{font-family:inherit}
.hidden{display:none !important}

/* ---------- MENÚ ---------- */
#menu{max-width:760px;margin:0 auto;padding:18px 14px 40px}
.brand{text-align:center;margin:6px 0 4px}
.brand h1{font-size:clamp(26px,7vw,40px);margin:0;color:#3a2d22;text-shadow:0 2px 0 #ffffff80}
.brand p{margin:4px 0 0;color:#6b5a4a;font-size:15px}

.create-btn{
  display:flex;align-items:center;justify-content:center;gap:10px;
  width:100%;margin:16px 0 20px;border:none;cursor:pointer;
  background:linear-gradient(90deg,#8e54e9,#ff5d73);color:#fff;
  font-size:clamp(17px,4.5vw,22px);font-weight:800;
  padding:16px;border-radius:20px;box-shadow:0 5px 0 #00000022;
}
.create-btn:active{transform:translateY(3px);box-shadow:0 2px 0 #00000022}

.cat-head{display:flex;align-items:center;gap:8px;font-size:clamp(19px,5vw,24px);
  color:#3a2d22;margin:22px 4px 10px;text-shadow:0 2px 0 #ffffff80}
.cat-head small{font-size:13px;font-weight:700;color:#fff;background:#ffb04d;
  border-radius:999px;padding:2px 9px;margin-left:2px}
.cat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(130px,1fr));gap:14px}
.grid{display:block}
.card{
  background:#fff;border:none;border-radius:22px;cursor:pointer;padding:8px 8px 10px;
  box-shadow:0 6px 16px #00000018;display:flex;flex-direction:column;align-items:center;gap:4px;
  transition:transform .12s;
}
.card:active{transform:scale(.96)}
.card svg{width:100%;height:96px}
.card .label{font-size:15px;font-weight:700;color:#4a3b2f}
.card .label .emoji{margin-right:4px}

/* ---------- VISTA PREVIA ---------- */
#preview{display:flex;flex-direction:column;align-items:center;min-height:100dvh;padding:8px 12px 18px;gap:10px}

/* ---------- REPRODUCTOR ---------- */
#player{
  display:flex;flex-direction:column;align-items:center;
  min-height:100dvh;padding:8px 12px 18px;gap:8px;
}
.topbar{width:100%;max-width:520px;display:flex;justify-content:space-between;align-items:center;gap:8px}
.mini{
  border:none;background:#ffffffcc;border-radius:999px;
  width:48px;height:48px;font-size:22px;cursor:pointer;flex:0 0 auto;
  box-shadow:0 3px 0 #00000018;display:grid;place-items:center;
}
.mini:active{transform:translateY(2px);box-shadow:0 1px 0 #00000018}
.dots{display:flex;gap:6px;flex-wrap:wrap;justify-content:center;flex:1 1 auto}
.dot{width:13px;height:13px;border-radius:50%;background:#ffffff99;transition:.25s}
.dot.done{background:var(--new)}
.dot.current{background:var(--new);transform:scale(1.5);box-shadow:0 0 0 4px #fb8c0033}

.title{font-size:clamp(22px,6vw,34px);font-weight:800;margin:2px 0 0;text-align:center;
  min-height:1.2em;color:#3a2d22;text-shadow:0 2px 0 #ffffff80}

.canvas{position:relative;width:100%;max-width:430px;flex:1 1 auto;
  background:#fff;border-radius:28px;box-shadow:0 10px 30px #00000022, inset 0 0 0 6px #ffffff;
  display:grid;place-items:center;padding:8px;overflow:hidden;min-height:0}
.canvas svg{width:100%;height:100%;max-height:58vh}

.stroke{fill:none;stroke:var(--line);stroke-width:5.5;stroke-linecap:round;stroke-linejoin:round;
  visibility:hidden;transition:fill .5s ease,stroke .3s ease}
.stroke.show{visibility:visible}
.stroke.coloronly{stroke:none}
.stroke.draw{stroke-dasharray:100;animation:draw .85s ease forwards}
.stroke.current{stroke:var(--new);stroke-width:6.5}
@keyframes draw{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}

.timewrap{width:100%;max-width:430px;height:12px;background:#ffffff77;border-radius:999px;overflow:hidden}
.timebar{height:100%;width:100%;background:linear-gradient(90deg,#06d6a0,#ffd166);border-radius:999px;transition:width .1s linear}

.controls{display:flex;align-items:center;gap:16px;justify-content:center}
.big{border:none;border-radius:50%;width:78px;height:78px;font-size:34px;cursor:pointer;
  background:#fff;color:#3a2d22;box-shadow:0 5px 0 #00000022;display:grid;place-items:center}
.big:active{transform:translateY(3px);box-shadow:0 2px 0 #00000022}
.big:disabled{opacity:.35;box-shadow:none;transform:none}
.play{width:92px;height:92px;font-size:42px;background:var(--new);color:#fff;box-shadow:0 5px 0 #c25e00}
.play:active{box-shadow:0 2px 0 #c25e00}
.hint{font-size:14px;color:#6b5a4a;text-align:center;opacity:.85;min-height:1.2em}

/* fiesta final */
.party{position:absolute;inset:0;display:none;place-items:center;pointer-events:none}
.party.show{display:grid}
.party b{font-size:clamp(30px,9vw,54px);background:#ffffffd0;padding:10px 22px;border-radius:20px;animation:pop .5s ease}
@keyframes pop{from{transform:scale(.3);opacity:0}to{transform:scale(1);opacity:1}}
.confetti{position:absolute;font-size:26px;animation:fall 2.4s linear infinite}
@keyframes fall{0%{transform:translateY(-40px) rotate(0)}100%{transform:translateY(70vh) rotate(360deg)}}

/* ---------- MODAL DIBUJO A MEDIDA ---------- */
.modal{position:fixed;inset:0;background:#00000055;display:none;place-items:center;padding:18px;z-index:10}
.modal.show{display:grid}
.sheet{background:#fff;border-radius:26px;max-width:440px;width:100%;padding:22px;
  box-shadow:0 20px 50px #00000040;text-align:center}
.sheet h2{margin:0 0 6px;font-size:24px;color:#3a2d22}
.sheet p{margin:0 0 16px;color:#6b5a4a;font-size:15px}
.micbtn{border:none;cursor:pointer;width:120px;height:120px;border-radius:50%;font-size:54px;
  background:linear-gradient(135deg,#8e54e9,#ff5d73);color:#fff;box-shadow:0 6px 0 #00000022;margin:6px auto}
.micbtn:active{transform:translateY(3px);box-shadow:0 3px 0 #00000022}
.micbtn.rec{animation:pulse 1s infinite}
@keyframes pulse{0%,100%{box-shadow:0 6px 0 #00000022,0 0 0 0 #ff5d7355}50%{box-shadow:0 6px 0 #00000022,0 0 0 18px #ff5d7300}}
.heard{font-size:18px;font-weight:700;color:#3a2d22;margin:14px 0 6px;min-height:1.3em}
.row{display:flex;gap:8px;margin-top:10px}
.row input{flex:1;border:2px solid #e6dccb;border-radius:14px;padding:12px;font-size:16px;font-family:inherit}
.row input:focus{outline:none;border-color:#8e54e9}
.btn{border:none;cursor:pointer;border-radius:14px;padding:12px 18px;font-size:16px;font-weight:800;
  background:#06d6a0;color:#fff;box-shadow:0 4px 0 #00000022}
.btn:active{transform:translateY(2px);box-shadow:0 2px 0 #00000022}
.btn.ghost{background:#eee;color:#555;box-shadow:0 4px 0 #00000012}
.status{margin-top:14px;color:#6b5a4a;font-size:15px;min-height:1.2em}
.spinner{width:42px;height:42px;border:5px solid #eee;border-top-color:#8e54e9;border-radius:50%;
  margin:10px auto;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
