/* GameLab — grid 3 columnas: categorías | visor | métodos (sin clases layout-col-* de demo.css) */

#gl-main-layout {
  display: grid !important;
  grid-template-columns: 280px minmax(0, 1fr) 300px !important;
  grid-template-areas: "left center right" !important;
  gap: 1rem !important;
  align-items: start !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#gl-main-layout > .gl-col-left {
  grid-area: left !important;
  grid-column: 1 !important;
  min-width: 0 !important;
  max-width: 280px !important;
  width: 100% !important;
}

#gl-main-layout > .gl-col-center {
  grid-area: center !important;
  grid-column: 2 !important;
  min-width: 0 !important;
  width: 100% !important;
}

#gl-main-layout > #gl-panel-methods {
  grid-area: right !important;
  grid-column: 3 !important;
  min-width: 0 !important;
  max-width: 300px !important;
  width: 100% !important;
  position: sticky;
  top: calc(var(--header-offset, 80px) + 12px);
  align-self: start;
  z-index: 2;
}

.gl-app-series .gl-col-left {
  position: sticky;
  top: calc(var(--header-offset, 80px) + 12px);
  align-self: start;
}

.gl-app-series .gl-col-left .panel,
.gl-app-series #gl-panel-methods {
  max-width: 100%;
  box-sizing: border-box;
}

.gl-app-series #gl-panel-methods .methods-panel {
  max-height: calc(100vh - var(--header-offset, 80px) - 200px);
  overflow-y: auto;
}

.gl-cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.gl-cat-list.is-collapsed .gl-cat-btn:not(.active) {
  display: none;
}

.gl-cat-list.is-collapsed .gl-cat-btn.active {
  cursor: default;
}

.gl-cat-panel-head {
  margin-bottom: 8px;
}

.gl-cat-panel-head .panel-title {
  margin-bottom: 0;
}

.gl-cat-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid hsl(var(--border) / 0.35);
  padding-top: 12px;
}

.gl-cat-detail-section {
  min-width: 0;
}

.gl-cat-detail-label {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 6px;
}

.gl-cat-apps {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.65;
}

.gl-cat-method-hint {
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

.lab-mode-plus {
  border-color: hsl(var(--primary) / 0.35);
}

.lab-mode-pro {
  border-color: hsl(45 90% 55% / 0.35);
  background: hsl(45 90% 55% / 0.06);
}

.gl-export-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid hsl(var(--border) / 0.35);
}

.gl-export-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 8px;
}

.gl-export-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.gl-export-row .gl-export-btn {
  flex: 1 1 auto;
  min-width: 52px;
  padding: 6px 8px;
  font-size: 12px;
}

.gl-export-pro {
  margin-bottom: 0;
}

.plan-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.plan-compare-col h4 {
  font-family: var(--font-display);
  margin: 0 0 10px;
  font-size: 1rem;
}

.plan-compare-col ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.7;
  color: hsl(var(--muted-foreground));
}

.plan-compare-col li.plan-compare-no {
  color: hsl(var(--destructive, 0 70% 50%) / 0.85);
  list-style: none;
  margin-left: -18px;
}

.plan-compare-pro {
  border-left: 1px solid hsl(var(--border) / 0.4);
  padding-left: 1.5rem;
}

@media (max-width: 720px) {
  .plan-compare-grid {
    grid-template-columns: 1fr;
  }
  .plan-compare-pro {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid hsl(var(--border) / 0.4);
    padding-top: 1.25rem;
  }
}

.gl-term-metrics {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gl-term-metrics li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid hsl(var(--border) / 0.25);
  font-size: 12px;
}

.gl-term-name {
  color: hsl(var(--muted-foreground));
  flex: 1;
}

.gl-term-val {
  font-weight: 600;
  font-family: var(--font-display);
  text-align: right;
}

.gl-tech-terms {
  grid-column: span 2;
}

.gl-term-metrics-compact li {
  border-bottom: none;
  padding: 2px 0;
}

@media (max-width: 960px) {
  .gl-tech-terms {
    grid-column: span 1;
  }
}

.gl-cat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid hsl(var(--border) / 0.45);
  border-radius: var(--radius-lg);
  background: hsl(var(--background) / 0.35);
  color: hsl(var(--muted-foreground));
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s;
}

.gl-cat-btn:hover,
.gl-cat-btn.active {
  background: hsl(var(--primary) / 0.12);
  border-color: hsl(var(--primary) / 0.4);
  color: hsl(var(--foreground));
}

.gl-cat-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.gl-cat-name {
  font-weight: 600;
  font-family: var(--font-display);
}

.gl-cat-brief {
  font-size: 12px;
  line-height: 1.55;
}

.gl-cat-project-name label {
  display: block;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-bottom: 4px;
}

.gl-cat-project-name .gl-input {
  font-size: 12px;
}

.gl-panel-setup label {
  display: block;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin-bottom: 4px;
}

.gl-input, .gl-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid hsl(var(--border) / 0.55);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: hsl(var(--background) / 0.5);
  color: hsl(var(--foreground));
  font-size: 13px;
  font-family: var(--font-body);
}

.gl-textarea {
  resize: vertical;
  min-height: 72px;
}

.gl-header-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.gl-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.gl-metrics .metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  padding: 0.65rem 0.5rem;
  overflow: hidden;
}

.gl-metrics .metric-title {
  font-size: clamp(7px, 1.6vw, 9px);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.gl-metrics .metric-value {
  font-size: clamp(0.7rem, 2vw, 1.05rem);
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.gl-method-config-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid hsl(var(--border) / 0.35);
}

.gl-method-config-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.gl-config-label {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: hsl(var(--muted-foreground));
  margin-bottom: 8px;
}

.gl-method-config-section label {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  color: hsl(var(--muted-foreground));
}

.gl-config-btn {
  width: 100%;
  margin-top: 6px;
}

.gl-config-viz-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 8px;
  background: hsl(var(--primary) / 0.08);
  border: 1px solid hsl(var(--primary) / 0.2);
  color: var(--brand-blue);
}

.gl-config-viz-sub {
  margin: 6px 0 0;
  font-size: 11px;
}

.gl-scenario-checks,
.gl-check-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.gl-check-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.gl-range {
  width: 100%;
  margin: 6px 0 4px;
}

.gl-range-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-blue);
}

.gl-metric-cat {
  font-size: 14px !important;
}

.gl-chart-main {
  height: 480px;
  min-height: 480px;
}

.gl-chart-secondary {
  height: 220px;
  min-height: 220px;
  margin-top: 12px;
}

.gl-hidden {
  display: none !important;
}

.gl-panel-technical {
  margin-top: 0;
}

.gl-tech-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 13px;
}

.gl-tech-grid h4 {
  font-family: var(--font-display);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 8px;
}

.gl-tech-narrative {
  grid-column: span 2;
}

.gl-tech-table {
  grid-column: span 2;
}

.gl-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.75;
}

.gl-muted {
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.gl-math {
  padding: 10px;
  border-radius: var(--radius-md);
  background: hsl(var(--background) / 0.5);
  overflow-x: auto;
  font-size: 13px;
}

.gl-method-info-btn {
  float: right;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  line-height: 1;
}

.gl-method-info-btn:hover {
  color: var(--brand-blue);
}

.gl-lib-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gl-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gl-modal.is-open {
  display: flex;
}

.gl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.gl-modal-dialog {
  position: relative;
  z-index: 1;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card));
  box-shadow: var(--panel-shadow);
}

.gl-modal-dialog.gl-modal-lg {
  max-width: 640px;
}

.gl-modal-dialog h3 {
  font-family: var(--font-display);
  margin: 0 0 12px;
}

.gl-modal-dialog h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 16px 0 8px;
}

.gl-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.gl-ai-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.gl-modal-dialog label {
  display: block;
  font-size: 11px;
  color: hsl(var(--muted-foreground));
  margin: 10px 0 4px;
}

@media (max-width: 1280px) {
  #gl-main-layout {
    grid-template-columns: 250px minmax(0, 1fr) 270px !important;
  }

  #gl-main-layout > .gl-col-left {
    max-width: 250px !important;
  }

  #gl-main-layout > #gl-panel-methods {
    max-width: 270px !important;
  }
}

@media (max-width: 960px) {
  #gl-main-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-areas: unset !important;
  }

  #gl-main-layout > .gl-col-left,
  #gl-main-layout > .gl-col-center,
  #gl-main-layout > #gl-panel-methods {
    grid-area: unset !important;
    grid-column: unset !important;
    max-width: 100% !important;
    position: static !important;
  }

  #gl-main-layout > .gl-col-center {
    order: 1;
  }

  #gl-main-layout > .gl-col-left {
    order: 2;
  }

  #gl-main-layout > #gl-panel-methods {
    order: 3;
  }

  .gl-tech-grid {
    grid-template-columns: 1fr;
  }

  .gl-tech-narrative,
  .gl-tech-table {
    grid-column: span 1;
  }

  .gl-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gl-ai-grid {
    grid-template-columns: 1fr;
  }
}
