/* Paint Online 2.0 — un solo CSS, sin frameworks */
:root {
  --teal: #56a8af;
  --teal-dark: #3b8a91;
  --orange: #f4511e;
  --orange-dark: #c93c10;
  --ink: #1b1b1b;
  --paper: #fffdf8;
  --bg: #f1f6f6;
  --muted: #6b7a7b;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(27, 27, 27, .10);
  --font-display: 'Luckiest Guy', 'Arial Black', Impact, sans-serif;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.45; }
img { max-width: 100%; height: auto; }
a { color: var(--teal-dark); }
button { font: inherit; cursor: pointer; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; background: #fff; padding: 8px; z-index: 99; }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: .5px; line-height: 1.05; text-transform: lowercase; margin: 0 0 .4em; }
.center { text-align: center; }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: .4em; border: 0; border-radius: 999px; padding: .55em 1.1em; font-weight: 700; text-decoration: none; color: var(--ink); background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.08); transition: transform .08s, box-shadow .08s, background .15s; white-space: nowrap; }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-primary { background: var(--orange); color: #fff; box-shadow: 0 4px 0 var(--orange-dark); }
.btn-primary:hover { background: #ff6333; }
.btn-ghost { background: #fff; color: var(--teal-dark); border: 2px solid rgba(86,168,175,.35); }
.btn-ghost:hover { border-color: var(--teal); }
.btn-lg { font-size: 1.15rem; padding: .7em 1.4em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Barra superior */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 20; }
.brand img { display: block; height: 48px; width: auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.langs a { font-size: .8rem; font-weight: 700; text-decoration: none; padding: 4px 6px; border-radius: 6px; color: var(--muted); }
.langs a.on { background: var(--bg); color: var(--ink); }

/* Hero */
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, var(--teal) 0%, #7cc7cd 60%, #ffd27a 140%); color: #fff; padding: clamp(48px, 10vw, 110px) 16px; text-align: center; }
.hero-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; }
.hero .display { font-size: clamp(2.2rem, 6.5vw, 4.4rem); text-shadow: 0 4px 0 rgba(0,0,0,.15); }
.hero .slogan { font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.9rem); margin: 0 0 .2em; color: #fff3ee; text-shadow: 0 2px 0 rgba(0,0,0,.12); }
.hero .lead { font-size: clamp(1.05rem, 2.5vw, 1.35rem); margin: 0 0 1.4em; opacity: .95; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0; }
.hero-blobs span { position: absolute; border-radius: 50%; opacity: .35; filter: blur(2px); animation: flotar 9s ease-in-out infinite; }
.hero-blobs span:nth-child(1) { width: 220px; height: 220px; background: var(--orange); left: -60px; top: -40px; }
.hero-blobs span:nth-child(2) { width: 160px; height: 160px; background: #ffeb3b; right: 8%; top: 10%; animation-delay: -3s; }
.hero-blobs span:nth-child(3) { width: 260px; height: 260px; background: #8e24aa; right: -80px; bottom: -120px; animation-delay: -6s; }
.hero-blobs span:nth-child(4) { width: 120px; height: 120px; background: #43a047; left: 12%; bottom: -30px; animation-delay: -1.5s; }
@keyframes flotar { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-18px) } }
@media (prefers-reduced-motion: reduce) { .hero-blobs span { animation: none; } }

/* Pasos */
.pasos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 980px; margin: -34px auto 0; padding: 0 16px; position: relative; z-index: 3; }
.paso { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 14px; text-align: center; }
.paso img { width: 72px; height: 72px; }
.paso h3 { font-family: var(--font-display); font-weight: 400; color: var(--orange); margin: .5em 0 .1em; font-size: 1.5rem; }
.paso p { margin: 0; color: var(--muted); }
@media (max-width: 640px) { .pasos { grid-template-columns: 1fr; margin-top: 16px; } .paso { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 14px; } .paso img { width: 56px; height: 56px; } }

/* Galería */
.section { padding: 48px 16px; max-width: 1200px; margin: 0 auto; }
.galeria h2 { text-align: center; color: var(--teal-dark); font-size: clamp(1.8rem, 4vw, 2.6rem); }
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid transparent; background: #fff; border-radius: 999px; padding: .4em 1em; font-weight: 700; color: var(--teal-dark); }
.chip.on { background: var(--teal); color: #fff; }
.buscar { flex: 1 1 220px; max-width: 320px; border: 2px solid #d9e6e7; border-radius: 999px; padding: .55em 1em; font-size: 1rem; background: #fff; }
.buscar:focus { outline: none; border-color: var(--teal); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.card { position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: var(--ink); box-shadow: var(--shadow); text-decoration: none; color: #fff; transition: transform .15s; aspect-ratio: 1; }
.card:hover { transform: translateY(-4px) rotate(-.5deg); }
.card img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-title { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; background: linear-gradient(transparent, rgba(0,0,0,.65)); font-family: var(--font-display); font-size: 1.2rem; letter-spacing: .5px; }
.card .badge { position: absolute; top: 8px; left: 8px; background: var(--orange); color: #fff; font-size: .7rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.card[hidden] { display: none; }
.vacio { text-align: center; color: var(--muted); padding: 24px; }

/* Categorías, texto, FAQ, info del dibujo */
.cats-section h2, .texto h2, .faq h2, .dib-info h2 { color: var(--teal-dark); font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.cat-card { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; text-decoration: none; color: var(--ink); transition: transform .15s; }
.cat-card:hover { transform: translateY(-3px); }
.cat-card img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; background: var(--ink); }
.cat-name { font-family: var(--font-display); font-size: 1.2rem; color: var(--orange); }
.cat-n { font-size: .8rem; color: var(--muted); }
.texto { max-width: 820px; }
.texto p, .dib-desc, .lead-cat { font-size: 1.05rem; line-height: 1.6; }
.qa { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 4px 18px; margin-bottom: 10px; }
.qa summary { cursor: pointer; list-style: none; padding: 10px 0; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary h3 { display: inline; font-size: 1.05rem; margin: 0; color: var(--teal-dark); }
.qa summary::before { content: '▸'; display: inline-block; margin-right: 8px; color: var(--orange); transition: transform .15s; }
.qa[open] summary::before { transform: rotate(90deg); }
.qa p { margin: 0 0 14px; color: #333; }
.faq, .dib-info { max-width: 900px; }
.migas ol { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 4px; font-size: .85rem; color: var(--muted); }
.migas li + li::before { content: '›'; margin: 0 6px; }
.migas a { text-decoration: none; }
.dib-meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: .95rem; }
.pasos-lista { padding-left: 1.2em; line-height: 1.6; }
.pasos-lista li { margin-bottom: 6px; }
.grid-rel { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.editor-title small { font-size: .55em; color: var(--muted); font-family: var(--font); font-weight: 400; text-transform: none; }
.footer-cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-bottom: 12px; }
.footer-cats a { text-decoration: none; font-weight: 700; }
.licencia { max-width: 760px; margin: 0 auto 12px; font-size: .8rem; }
.lead-cat { max-width: 820px; margin: 0 0 20px; }
.categoria h1.display { color: var(--teal-dark); font-size: clamp(1.8rem, 4vw, 2.6rem); }

.ad { text-align: center; margin: 24px auto; max-width: 1200px; padding: 0 16px; }
.footer { text-align: center; color: var(--muted); padding: 30px 16px; font-size: .9rem; }

/* Editor */
.editor { max-width: 1240px; margin: 0 auto; padding: 12px 16px 32px; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.editor-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.4rem, 3vw, 2.2rem); margin: 0; color: var(--teal-dark); text-transform: lowercase; }
.editor-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.lienzo-wrap { min-width: 0; }
.lienzo { position: relative; width: 100%; max-width: 820px; margin: 0 auto; background: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.lienzo canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lienzo canvas:first-child { position: relative; }
.lienzo.balde { cursor: crosshair; }
.lienzo.pincel, .lienzo.goma { cursor: cell; }
.atajos { text-align: center; color: var(--muted); font-size: .8rem; margin: 10px 0 0; }

.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; position: sticky; top: 80px; }
.herramientas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid #e4eeee; background: #fff; border-radius: 10px; padding: 8px 4px; font-size: .78rem; font-weight: 700; color: var(--ink); }
.tool .ic { font-size: 1.3rem; line-height: 1; }
.tool.on { border-color: var(--orange); background: #fff3ee; }
.tool[disabled] { opacity: .4; cursor: not-allowed; }
.tamano { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: .85rem; font-weight: 700; color: var(--muted); }
.tamano input { flex: 1; accent-color: var(--orange); }
.color-actual { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.swatch-big { width: 54px; height: 54px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #d9e6e7; flex: none; }
.custom { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.custom input { width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }
.paleta { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); padding: 0; transition: transform .1s; }
.sw:hover { transform: scale(1.15); }
.sw.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--orange); }
.recientes-wrap { margin-top: 10px; }
.lbl { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.acciones .btn { flex: 1 1 auto; justify-content: center; }
.ad-panel { margin: 14px 0 0; padding: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; font-weight: 700; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .editor-body { grid-template-columns: 1fr; }
  .panel { position: static; }
  .herramientas { grid-template-columns: repeat(7, 1fr); }
  .tool { font-size: .7rem; }
  .atajos { display: none; }
}
@media (max-width: 480px) {
  .topbar .btn { display: none; }
  .brand img { height: 40px; }
  .editor { padding: 8px 8px 24px; }
  .editor-nav .btn { padding: .45em .8em; font-size: .85rem; }
  .herramientas { grid-template-columns: repeat(4, 1fr); }
  .paleta { grid-template-columns: repeat(8, 1fr); }
}
@media print {
  .topbar, .panel, .editor-top, .atajos, .footer, .ad, .toast { display: none !important; }
  .lienzo { box-shadow: none; max-width: 100%; }
}

/* Cookies y legales */
.cookies { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 560px; margin: 0 auto; background: #fff; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 14px 16px; z-index: 60; font-size: .9rem; }
.cookies p { margin: 0 0 10px; }
.cookies-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.legal h2 { font-size: 1.15rem; color: var(--teal-dark); margin: 1.4em 0 .4em; }
.legal .muted { color: var(--muted); font-size: .9rem; }
.suscribir { max-width: 720px; text-align: center; }
.suscribir h2 { color: var(--teal-dark); font-size: clamp(1.4rem, 3.5vw, 2rem); }
.sus-form { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.sus-form input[type=email] { flex: 1 1 240px; max-width: 340px; border: 2px solid #d9e6e7; border-radius: 999px; padding: .6em 1em; font-size: 1rem; }
.sus-form .hp { position: absolute; left: -9999px; }
.sus-msg { min-height: 1.4em; font-weight: 700; }
.sus-msg.ok { color: var(--teal-dark); } .sus-msg.err { color: #c62828; }

/* Progreso, magia, publicar, confeti, modal */
.progreso { display: flex; align-items: center; gap: 10px; max-width: 820px; margin: 10px auto 0; }
.progreso-barra { flex: 1; height: 10px; background: #dfe9ea; border-radius: 999px; overflow: hidden; }
.progreso-barra span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--orange)); border-radius: 999px; transition: width .25s; }
.progreso-txt { font-size: .8rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tool.magia { border-color: #ffe08a; background: #fff9e6; }
.btn-publicar { background: var(--teal); color: #fff; box-shadow: 0 4px 0 var(--teal-dark); }
.btn-publicar:hover { background: #63b7be; }
.confeti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 55; display: none; }
.confeti.on { display: block; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 70; padding: 16px; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.3); text-align: center; }
.modal-box h2 { font-family: var(--font-display); font-weight: 400; color: var(--teal-dark); margin: 0 0 8px; }
.modal-box img { width: 160px; height: 160px; border-radius: 10px; background: var(--ink); margin: 6px auto; display: block; }
.modal-box label { display: block; text-align: left; font-size: .85rem; font-weight: 700; color: var(--muted); margin: 8px 0; }
.modal-box input[type=text] { display: block; width: 100%; margin-top: 4px; border: 2px solid #d9e6e7; border-radius: 10px; padding: .5em .8em; font: inherit; }
.modal-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#pubLink { word-break: break-all; font-weight: 700; }
.obra-fig { margin: 0 auto 16px; max-width: 640px; }
.obra-fig img { display: block; width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--ink); }
.obra-fig figcaption { font-size: .9rem; color: var(--muted); margin-top: 8px; text-align: center; }
.obra-acciones { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0 0 24px; }
.obra h1.display, .obra h2.display { color: var(--teal-dark); text-align: center; }
.obra .muted { text-align: center; color: var(--muted); }
.paginas { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; font-weight: 700; }
.vermas { text-align: center; margin-top: 20px; }
