/* Estudio Manga Anime — tema azul (estilo Explorador de Páramos) */
:root {
  --ms-primary: #2563eb;
  --ms-primary-dark: #1d4ed8;
  --ms-accent: #38bdf8;
  --ms-accent-2: #60a5fa;
  --ms-bg: #eff6ff;
  --ms-card: rgba(255, 255, 255, 0.92);
  --ms-text: #12213f;
  --ms-muted: #51638c;
  --ms-border: rgba(37, 99, 235, 0.2);
  --ms-shadow: 0 22px 60px rgba(29, 78, 216, 0.16);
  --ms-sidebar: linear-gradient(180deg, #0f2f77 0%, #1d4ed8 55%, #2563eb 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--ms-text);
  background:
    radial-gradient(circle at 8% 12%, rgba(56, 189, 248, 0.28), transparent 32%),
    radial-gradient(circle at 92% 8%, rgba(96, 165, 250, 0.25), transparent 30%),
    radial-gradient(circle at 70% 88%, rgba(147, 197, 253, 0.22), transparent 28%),
    linear-gradient(155deg, #f0f9ff 0%, #dbeafe 45%, #bfdbfe 100%);
}

button, input, select { font: inherit; }

.ms-sparkles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle, rgba(37, 99, 235, 0.1) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.45;
}

.ms-hub .ms-shell,
.ms-hub .ms-topbar,
.ms-hub .ms-footer { position: relative; z-index: 1; }

.ms-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: min(1200px, calc(100% - 32px));
  margin: 20px auto 0;
  padding: 14px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--ms-card);
  box-shadow: var(--ms-shadow);
  backdrop-filter: blur(12px);
}

.ms-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}

.ms-brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--ms-sidebar);
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 8px 20px rgba(29, 78, 216, 0.35);
}

.ms-brand strong { display: block; font-size: 1.05rem; }
.ms-brand small { color: var(--ms-muted); font-size: 0.82rem; display: block; }
.ms-brand .ms-build-badge { margin-top: 6px; }

.ms-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.ms-hero {
  padding: 32px;
  margin-bottom: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--ms-card);
  box-shadow: var(--ms-shadow);
}

.ms-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ms-primary-dark);
  background: rgba(191, 219, 254, 0.45);
}

.ms-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.ms-lead { margin: 0; color: var(--ms-muted); max-width: 62ch; line-height: 1.55; }

.ms-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.ms-app-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border-radius: 22px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--ms-border);
  background: var(--ms-card);
  box-shadow: 0 12px 32px rgba(29, 78, 216, 0.1);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.ms-app-card:hover {
  transform: translateY(-4px);
  border-color: var(--ms-primary);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.22);
}

.ms-app-card-featured {
  grid-column: 1 / -1;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(219,234,254,0.98) 100%);
}

.ms-app-card-featured h2 { flex: 1 1 200px; }
.ms-app-card-featured p { flex: 2 1 280px; margin: 0; }

.ms-app-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 1.25rem;
  color: #fff;
}

.ms-tone-violet { background: linear-gradient(135deg, #1d4ed8, #60a5fa); }
.ms-tone-pink { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.ms-tone-indigo { background: linear-gradient(135deg, #1e40af, #6366f1); }
.ms-tone-sky { background: linear-gradient(135deg, #0369a1, #7dd3fc); }
.ms-tone-amber { background: linear-gradient(135deg, #2563eb, #93c5fd); }

.ms-app-card h2 { margin: 0; font-size: 1.2rem; font-weight: 700; }
.ms-app-card p { margin: 0; color: var(--ms-muted); font-size: 0.92rem; line-height: 1.45; }

.ms-app-cta {
  margin-top: auto;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ms-primary);
}

.ms-ideas-panel {
  padding: 24px 28px;
  border-radius: 22px;
  border: 1px solid var(--ms-border);
  background: rgba(255, 255, 255, 0.75);
}

.ms-ideas-panel h2 {
  margin: 0 0 18px;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ms-ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.ms-ideas-grid h3 { margin: 0 0 10px; font-size: 1rem; color: var(--ms-primary-dark); }
.ms-ideas-grid ul { margin: 0; padding-left: 1.2rem; color: var(--ms-muted); line-height: 1.6; }

.ms-footer {
  text-align: center;
  padding: 0 16px 28px;
  color: var(--ms-muted);
  font-size: 0.85rem;
}

/* Botones */
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.ms-btn:active { transform: scale(0.98); }

.ms-btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 100%);
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.35);
}

.ms-btn-primary:hover { box-shadow: 0 8px 22px rgba(29, 78, 216, 0.45); }

.ms-btn-ghost {
  color: var(--ms-primary-dark);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid var(--ms-border);
}

.ms-btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }

.ms-btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #f87171, #dc2626);
}

/* Layout taller / herramientas */
body.ms-workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  background: linear-gradient(160deg, #dbeafe 0%, #bfdbfe 48%, #93c5fd 100%) !important;
}

.ms-build-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e3a8a;
  background: rgba(191, 219, 254, 0.95);
  border: 1px solid rgba(37, 99, 235, 0.35);
  white-space: nowrap;
}

.ms-work-top .ms-build-badge { margin-left: 8px; }

.ms-work-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ms-border);
  background: var(--ms-card);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.ms-work-title { margin: 0; font-size: 1rem; font-weight: 700; }
.ms-work-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.ms-work-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
  min-height: 420px;
}

.ms-panel {
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid var(--ms-border);
  background: rgba(255, 255, 255, 0.88);
}

.ms-panel h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ms-muted);
}

.ms-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.ms-tool-btn {
  padding: 10px 6px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: #eff6ff;
  color: var(--ms-text);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ms-tool-btn i { font-size: 1rem; }
.ms-tool-btn.active {
  border-color: var(--ms-primary);
  background: rgba(37, 99, 235, 0.12);
  color: var(--ms-primary-dark);
}

.ms-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.ms-swatch {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.ms-swatch.active { border-color: var(--ms-primary); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ms-primary); }

.ms-field { margin-bottom: 12px; }
.ms-field label { display: block; font-size: 0.8rem; color: var(--ms-muted); margin-bottom: 4px; }
.ms-field input[type="range"] { width: 100%; }

.ms-layer-list { display: flex; flex-direction: column; gap: 6px; }
.ms-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #eff6ff;
  cursor: pointer;
  font-size: 0.85rem;
}

.ms-layer-row.active { background: rgba(37, 99, 235, 0.15); font-weight: 600; }

.ms-canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  flex: 1;
  min-height: 360px;
  touch-action: none;
  cursor: crosshair;
  background:
    linear-gradient(45deg, #dbeafe 25%, transparent 25%),
    linear-gradient(-45deg, #dbeafe 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dbeafe 75%),
    linear-gradient(-45deg, transparent 75%, #dbeafe 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #bfdbfe;
}

.ms-canvas-stack {
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 800 / 1000;
  max-height: calc(100vh - 140px);
  box-shadow: 0 16px 48px rgba(18, 33, 63, 0.2);
  border-radius: 4px;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
  pointer-events: auto;
}

.ms-canvas-stack canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}

#drawCanvas { z-index: 1; }
#guideCanvas { z-index: 2; }

/* Cartillas */
.ms-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 20px;
}

.ms-cartilla-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--ms-border);
  background: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: left;
  padding: 0;
}

.ms-cartilla-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.2);
}

.ms-cartilla-thumb {
  aspect-ratio: 4/3;
  background: #f0f9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.ms-cartilla-thumb img,
.ms-cartilla-thumb svg { max-width: 100%; max-height: 100%; }

.ms-cartilla-body { padding: 12px 14px; }
.ms-cartilla-body strong { display: block; font-size: 0.95rem; }
.ms-cartilla-body span { font-size: 0.8rem; color: var(--ms-muted); }

/* Viñetas */
.ms-vigneta-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ms-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--ms-border);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.ms-chip.active {
  background: var(--ms-primary);
  color: #fff;
  border-color: var(--ms-primary);
}

/* Cuadernillo */
.ms-page-list { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.ms-page-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--ms-card);
  border: 1px solid var(--ms-border);
}

.ms-page-thumb-wrap {
  width: 56px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ms-border);
  background: #eff6ff;
}

.ms-page-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }

.ms-hint {
  font-size: 0.82rem;
  color: var(--ms-muted);
  line-height: 1.45;
  margin: 0;
}

.ms-hint a { color: var(--ms-primary); font-weight: 600; }

.ms-tone-panel {
  display: none;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--ms-border);
}

.ms-tone-mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.ms-tone-thumb {
  padding: 4px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: #fff;
  cursor: pointer;
}

.ms-tone-thumb.active { border-color: var(--ms-primary); }

.ms-tone-thumb img { width: 100%; display: block; border-radius: 6px; }

.ms-tone-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.ms-tone-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 16px;
  border: 2px solid var(--ms-border);
  background: var(--ms-card);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.ms-tone-card:hover,
.ms-tone-card.active {
  border-color: var(--ms-primary);
  transform: translateY(-2px);
}

.ms-tone-card img {
  width: 100%;
  max-width: 120px;
  border-radius: 10px;
  border: 1px solid var(--ms-border);
}

.ms-tone-card strong { font-size: 0.9rem; text-align: center; }

.ms-bubble-types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.ms-topbar .ms-btn + .ms-btn { margin-left: 0; }

.ms-page-item strong { font-size: 0.95rem; }

.ms-content-pad { padding: 20px; max-width: 900px; }

@media (max-width: 900px) {
  .ms-work-layout { grid-template-columns: 1fr; }
  .ms-panel { max-height: 220px; border-right: none; border-bottom: 1px solid var(--ms-border); }
  .ms-app-card-featured { flex-direction: column; align-items: flex-start; }
}
