/* ============================================================================
   Studio Play · sistema de diseño alineado con Studio Mind (familia Smartmind)
   Crema #F5F1EA · verde #00804C · negro #090C02 · bordes #B8D5C3 · Inter
   ========================================================================== */

:root {
  --cream:    #F5F1EA;
  --sidebar:  #FAF8F4;
  --surface:  #ffffff;
  --ink:      #090C02;
  --green:    #00804C;
  --green-600:#006d40;
  --green-700:#005a35;
  --green-50: #eef6f1;
  --green-100:#d4ebe0;
  --orange:   #FF9505;
  --orange-50:#fff8eb;
  --red:      #983628;
  --red-50:   #faf1f0;

  /* opacidades de negro (como en Studio Mind) */
  --t-80: rgba(9,12,2,.80);
  --t-60: rgba(9,12,2,.58);
  --t-45: rgba(9,12,2,.45);
  --t-30: rgba(9,12,2,.30);
  --line: rgba(184,213,195,.5);
  --line-strong: rgba(184,213,195,.75);

  /* el logo conserva el triángulo play; en el chrome usamos verde */
  --logo-1: #d63b27; --logo-2: #f0913f;

  /* alias de compatibilidad para el player rico (adventure.css), en verde Smartmind */
  --grad: var(--green);
  --muted: var(--t-60);
  --text: var(--ink);
  --paper: #efe9dd;
  --play-1: var(--green);
  --play-2: var(--green-600);

  --r:    14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(9,12,2,.05), 0 1px 3px rgba(9,12,2,.04);
  --shadow: 0 6px 18px -8px rgba(9,12,2,.18), 0 2px 6px rgba(9,12,2,.05);
  --shadow-lg: 0 24px 60px -20px rgba(9,12,2,.35);
  --ease: cubic-bezier(.16,1,.3,1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3 { font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }
.mono { font-variant-numeric: tabular-nums; }

@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--green);
  display: grid; place-items: center; flex: none; }
.logo .mark svg { width: 52%; height: 52%; display: block; }
.logo .mark svg polygon { fill: #fff; }
.logo .word { font-weight: 700; font-size: 16px; letter-spacing: -.02em; color: var(--ink); }
.logo .word span { color: var(--green); }
.logo .word b { font-weight: 700; }

/* ---------------------------------------------------------------- Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer;
  font-weight: 600; font-size: 14.5px; transition: background .18s, box-shadow .2s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--green-600); }
.btn-ghost { background: var(--surface); color: var(--t-80); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.btn-dark { background: var(--ink); color: var(--cream); }
.btn-dark:hover { background: #1a1e10; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }

/* ---------------------------------------------------------------- Formularios */
.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-size: 13.5px; font-weight: 500; color: var(--t-80); margin-bottom: 6px; }
.input, textarea.input { width: 100%; height: 44px; padding: 0 13px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 92px; padding: 10px 13px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-100); }

/* ---------------------------------------------------------------- Vistas */
.view { display: none; }
.view.active { display: block; }

/* ---------- LOGIN (centrado, estilo Studio Mind) ---------- */
#view-login.active { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-card { width: 100%; max-width: 380px; animation: fade-up .6s var(--ease) both; }
.login-card .head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; margin-bottom: 26px; }
.login-card .mark-lg { width: 52px; height: 52px; border-radius: 16px; background: var(--green); display: grid; place-items: center; }
.login-card .mark-lg svg { width: 52%; height: 52%; }
.login-card .mark-lg svg polygon { fill: #fff; }
.login-card h1 { font-size: 24px; }
.login-card h1 span { color: var(--green); }
.login-card .sub { font-size: 14px; color: var(--t-60); }
.login-card form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 24px; box-shadow: var(--shadow-sm); }
.login-card form .btn-primary { width: 100%; margin-top: 8px; }
.login-card .foot { margin-top: 14px; font-size: 12px; color: var(--t-45); }
.login-card code { background: rgba(9,12,2,.05); border-radius: 4px; padding: 1px 5px; font-size: 12px; }

/* ---------- SHELL con SIDEBAR (estilo Studio Mind) ---------- */
.shell { display: flex; min-height: 100dvh; }
.sidebar { width: 240px; flex: none; background: var(--sidebar); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; height: 64px; padding: 0 20px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--t-30); padding: 12px 12px 4px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--t-60); cursor: pointer; transition: background .18s, color .18s; border: 0; background: none; width: 100%; text-align: left; }
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { background: var(--green-50); color: var(--green-700); }
.nav-link.active { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar .foot { border-top: 1px solid var(--line); padding: 12px; }
.sidebar .who { display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.who .name { font-size: 13.5px; font-weight: 600; min-width: 0; }
.who .name small { display: block; color: var(--t-45); font-weight: 400; font-size: 11.5px; }

.main { flex: 1; min-width: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: clamp(22px, 4vw, 40px) clamp(16px, 4vw, 36px) 80px; }
#view-host { animation: fade-up .35s var(--ease) both; }

.view-head { margin-bottom: 24px; }
.view-head .eyebrow { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--green); margin-bottom: 6px; }
.view-head h1 { font-size: clamp(25px, 4vw, 31px); }
.view-head p { color: var(--t-60); margin-top: 7px; max-width: 66ch; }

/* tiles de estadística (overview) */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); margin-bottom: 32px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.stat .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--green-50); color: var(--green); display: grid; place-items: center; margin-bottom: 12px; }
.stat .ic svg { width: 18px; height: 18px; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--t-60); margin-top: 1px; }

/* "próximamente" (motor de creación por construir) */
.soon { border: 1px dashed var(--line-strong); border-radius: var(--r-xl); padding: 44px 28px; text-align: center; background: rgba(255,255,255,.55); }
.soon .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--green-50); color: var(--green); display: grid; place-items: center; margin: 0 auto 16px; }
.soon .ic svg { width: 28px; height: 28px; }
.soon h3 { font-size: 21px; margin-bottom: 8px; }
.soon p { color: var(--t-60); max-width: 52ch; margin: 0 auto; }
.soon .steps { text-align: left; max-width: 460px; margin: 18px auto 0; color: var(--t-60); font-size: 13.5px; padding-left: 18px; }
.soon .steps li { margin: 4px 0; }
.soon .pill { display: inline-block; margin-top: 16px; font-size: 12px; font-weight: 600; color: #9a5a00; background: var(--orange-50); padding: 5px 13px; border-radius: 999px; }

/* formulario de "Crear aventura" */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow-sm); }
.rows { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.row-node { display: grid; grid-template-columns: 1fr 160px 38px; gap: 10px; align-items: center; }
.row-node select { height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); padding: 0 10px; background: var(--surface); }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; color: var(--t-60); font-size: 18px; line-height: 1; }
.icon-btn:hover { background: var(--red-50); color: var(--red); border-color: var(--red); }

.section { margin-top: 34px; animation: fade-up .5s var(--ease) both; }
.section > h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--t-45); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.section > h2 .count { font-variant-numeric: tabular-nums; background: var(--green-50); color: var(--green-700);
  border-radius: 999px; padding: 1px 8px; font-size: 11px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm); transition: transform .16s var(--ease), box-shadow .2s, border-color .2s; }
.card.interactive { cursor: pointer; }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--green-100); }
.card h3 { font-size: 16.5px; margin-bottom: 6px; }
.card .desc { color: var(--t-60); font-size: 13.5px; min-height: 38px; }
.card .foot { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px; background: var(--green-50); color: var(--green-700); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; }
.badge.green { background: var(--green-50); color: var(--green-700); }
.badge.amber { background: var(--orange-50); color: #9a5a00; }
.badge.ink { background: rgba(9,12,2,.06); color: var(--t-80); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.empty { border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 26px; text-align: center;
  color: var(--t-60); background: rgba(255,255,255,.5); }

.meter { height: 9px; border-radius: 999px; background: rgba(9,12,2,.08); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .5s var(--ease); }

/* pantalla de resultados (scorecard) — verde Smartmind */
.complete { text-align: center; padding: 36px 20px; }
.complete .seal { width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; margin: 0 auto 16px; box-shadow: var(--shadow); }
.complete h2 { font-size: 26px; margin-bottom: 6px; }
.complete p { color: var(--t-60); }
.verdict { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.complete .dims { text-align: left; margin: 18px auto 0; display: flex; flex-direction: column; gap: 13px; max-width: 460px; }
.dim-h { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; margin-bottom: 6px; }
.dim-h .mono { font-size: 12px; color: var(--t-45); }
.dim.fail .meter > i { background: var(--red); }
.dim.pending { opacity: .5; }
.motivos { text-align: left; max-width: 460px; margin: 16px auto 0; color: var(--t-60); font-size: 13px; padding-left: 18px; }
.motivos li { margin: 2px 0; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--cream); padding: 11px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--red); color: #fff; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .sidebar.open { transform: none; }
  .main { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; transition: none !important; } }
