/* ============================================================
   layout.css — estructura de la app (cabecera, barra lateral, vista)
   ============================================================ */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------- Cabecera ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { font-family: var(--font-serif); font-size: 19px; letter-spacing: .3px; }
.brand-text b { color: var(--accent); font-weight: 700; }

/* Mini teclado del logo */
.brand-mark {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: end;
  gap: 2px;
  padding: 6px 7px;
  height: 34px;
  background: linear-gradient(#0e0b09, #1c1712);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
.brand-mark .k { width: 5px; border-radius: 0 0 2px 2px; }
.brand-mark .k.w { height: 20px; background: var(--key-white); }
.brand-mark .k.b { height: 13px; background: var(--accent); }

.header-spacer { flex: 1; }
.header-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.field { display: inline-flex; align-items: center; gap: 8px; }
.field.compact .field-label { font-size: 12px; color: var(--ink-mute); }
.field.vol { width: 118px; }

/* ---------- Cuerpo ---------- */
.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: 244px 1fr;
  gap: 0;
  width: 100%;
}

/* ---------- Barra lateral ---------- */
.sidebar {
  position: sticky;
  top: 57px;
  align-self: start;
  height: calc(100dvh - 57px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 40%, transparent);
}

.nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  background: transparent;
  text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s;
}
.nav-item:hover { background: var(--panel-2); color: var(--ink); }
.nav-item.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent) 8%, transparent));
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--ink);
}
.nav-item .nav-ico {
  display: grid; place-items: center;
  width: 30px; height: 30px; flex: none;
  font-size: 17px;
  border-radius: 8px;
  background: var(--panel-2);
}
.nav-item.active .nav-ico { background: color-mix(in srgb, var(--accent) 30%, var(--panel-2)); }
.nav-item .nav-txt { display: flex; flex-direction: column; line-height: 1.15; }
.nav-item .nav-txt small { font-size: 11px; color: var(--ink-mute); }
.nav-item.active .nav-txt small { color: color-mix(in srgb, var(--accent) 70%, var(--ink-mute)); }

.sidebar-foot { margin-top: auto; }
.xp-box { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.xp-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.xp-label { font-size: 12px; color: var(--ink-mute); }
.xp-value { font-weight: 700; color: var(--accent); font-size: 13px; }
.xp-bar { height: 8px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.xp-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brass), var(--brass-strong)); transition: width .5s var(--ease); }
.xp-streak { margin-top: 8px; font-size: 12px; color: var(--ink-soft); }

/* ---------- Vista principal ---------- */
.view {
  min-width: 0;
  padding: 28px clamp(16px, 4vw, 44px) 64px;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
}
.view:focus { outline: none; }

/* ---------- Scrim para menú móvil ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
}

.nav-toggle { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .app-body { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; z-index: 35;
    height: 100dvh; width: 270px;
    transform: translateX(-102%);
    transition: transform .28s var(--ease);
    background: var(--bg);
    background-image: var(--bg-grad);
  }
  .app.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); }
  .brand-text { display: none; }
}

@media (max-width: 620px) {
  .field.compact .field-label { display: none; }
  .field.vol { width: 84px; }
  .midi-btn .midi-label { display: none; }
  .view { padding: 20px 16px 56px; }
}
