:root {
  --bg-page: #f2f5f7;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-tinted: #eaf1f3;
  --text-main: #192c35;
  --text-muted: #536c77;
  --text-faint: #78909c;
  --primary: #126353;
  --primary-hover: #0c4d40;
  --primary-light: #e4f4f0;
  --primary-border: #9ec9bf;
  --secondary: #264350;
  --secondary-hover: #192d37;
  --accent: #d97706;
  --accent-light: #fef3c7;
  --border-subtle: #d3dfe3;
  --border-strong: #9fb6bf;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 6px rgba(18, 36, 43, 0.05);
  --shadow-md: 0 6px 18px rgba(18, 36, 43, 0.08);
  --shadow-lg: 0 16px 36px rgba(18, 36, 43, 0.16);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Page Header */
.page-header {
  background: linear-gradient(180deg, #ffffff 0%, #f4f7f8 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 44px 24px 36px;
}

.header-container {
  max-width: 1140px;
  margin: 0 auto;
}

.nav-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.back-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-border);
  transition: all 0.15s ease;
}

.back-link:hover {
  background: #d3ece6;
  color: var(--primary-hover);
}

.badge-edition {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  background: #e2ebef;
  padding: 4px 10px;
  border-radius: 99px;
}

.page-header h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.15;
  color: var(--text-main);
  letter-spacing: -0.03em;
  font-weight: 800;
  margin-bottom: 16px;
}

.header-subtitle {
  max-width: 820px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.header-subtitle strong {
  color: var(--text-main);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Button Base */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(18, 99, 83, 0.2);
}

.button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
}

.button.secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.button.secondary:hover {
  background: var(--bg-tinted);
  border-color: var(--text-main);
}

.button.outline {
  background: transparent;
  color: var(--secondary);
  border-color: var(--border-strong);
}

.button.outline:hover {
  background: rgba(38, 67, 80, 0.05);
}

/* Page Content */
.page-content {
  flex: 1;
  max-width: 1140px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px;
}

/* Instructions Section */
.instructions-section {
  margin-bottom: 40px;
}

.instruction-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}

.instruction-box h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.step-card {
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  position: relative;
}

.step-num {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--border-strong);
}

.step-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
  padding-right: 28px;
}

.step-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.note-box {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.5;
}

/* Catalog Section */
.catalog-section {
  margin-bottom: 48px;
}

.catalog-header {
  margin-bottom: 24px;
}

.catalog-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.catalog-hint {
  font-size: 15px;
  color: var(--primary);
  font-weight: 600;
}

/* Practices Grid */
.practices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* Practice Card */
.practice-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
}

.practice-card:hover,
.practice-card:focus-visible {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(18, 99, 83, 0.12);
  outline: none;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-id {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  background: var(--secondary);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: -0.02em;
}

.card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-level {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 99px;
  background: #e5edf1;
  color: var(--secondary);
}

.tag-level.tag-b-sico {
  background: #e2f4ed;
  color: #0f6249;
}

.tag-level.tag-intermedio {
  background: #e0f2fe;
  color: #0369a1;
}

.tag-level.tag-avanzado {
  background: #fef3c7;
  color: #92400e;
}

.tag-level.tag-recreativo,
.tag-level.tag-integrador {
  background: #f3e8ff;
  color: #6b21a8;
}

.tag-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 8px;
}

.card-goal {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 14px;
}

.card-mission-preview {
  background: #f5f9f8;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #1e3d36;
  margin-bottom: 18px;
  flex: 1;
}

.card-mission-preview strong {
  color: var(--primary);
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.btn-card-details {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-card-details:hover {
  background: var(--primary);
  color: #ffffff;
}

.card-direct-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-direct-sim,
.btn-direct-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-direct-sim:hover {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
}

.btn-direct-dl:hover {
  background: var(--bg-tinted);
  color: var(--text-main);
  border-color: var(--border-strong);
}

/* Modal Dialog */
.practice-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: 94vw;
  max-width: 880px;
  max-height: 90vh;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  outline: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.practice-modal:not([open]) {
  display: none;
}

.practice-modal::backdrop {
  background: rgba(18, 36, 43, 0.72);
  backdrop-filter: blur(5px);
}

.modal-dialog-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 90vh;
  overflow: hidden;
}

/* Modal Header */
.modal-header {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: #fbfdfd;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.modal-badge-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  background: var(--secondary);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.modal-badge-level {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 2px 8px;
  border-radius: 4px;
}

.modal-badge-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.modal-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: #e2ebef;
  color: var(--text-main);
}

/* Modal Quick Bar */
.modal-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 28px;
  background: #f2f7f8;
  border-bottom: 1px solid var(--border-subtle);
}

/* Modal Body */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-description {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Mission Callout */
.mission-callout {
  background: linear-gradient(135deg, #e7f5f1 0%, #edf9f5 100%);
  border: 1px solid var(--primary-border);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: 0 4px 14px rgba(18, 99, 83, 0.08);
}

.callout-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.callout-icon {
  font-size: 22px;
}

.callout-head h3 {
  font-size: 18px;
  font-weight: 800;
  color: #0c4d40;
}

.callout-text {
  font-size: 15px;
  line-height: 1.65;
  color: #173830;
  font-weight: 500;
}

.concepts-text {
  background: #f7fafb;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
}

/* Lists */
.checklist-bullet,
.numbered-requirements,
.steps-list,
.checks-list,
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 20px;
}

.checklist-bullet li,
.numbered-requirements li,
.steps-list li,
.checks-list li,
.questions-list li {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-main);
}

.numbered-requirements li {
  padding-left: 6px;
}

.numbered-requirements li::marker {
  font-weight: 800;
  color: var(--primary);
}

.checks-list {
  list-style: none;
  padding-left: 0;
}

.checks-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f7fafb;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.check-box {
  color: var(--primary);
  font-weight: 700;
  font-size: 15px;
}

/* Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.signals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.signals-table th {
  background: #eef4f6;
  color: var(--secondary);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-strong);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.signals-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  color: var(--text-main);
}

.signals-table tr:last-child td {
  border-bottom: none;
}

.signals-table tr:nth-child(even) td {
  background: #fafcfd;
}

.signals-table code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  background: #e8f0f3;
  padding: 2px 6px;
  border-radius: 4px;
  color: #193844;
}

.signal-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
}

.signal-tag.input {
  background: #e0f2fe;
  color: #0369a1;
}

.signal-tag.output {
  background: #fef3c7;
  color: #92400e;
}

/* Modal Footer */
.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-subtle);
  background: #fbfdfd;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Page Footer */
.page-footer {
  background: #192d37;
  color: #b0c4ce;
  padding: 32px 24px;
  margin-top: auto;
  font-size: 13px;
  line-height: 1.6;
}

.footer-container {
  max-width: 1140px;
  margin: 0 auto;
}

.footer-sub {
  color: #7995a2;
  font-size: 12px;
  margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .page-header {
    padding: 28px 18px 24px;
  }
  .page-content {
    padding: 24px 18px;
  }
  .practices-grid {
    grid-template-columns: 1fr;
  }
  .modal-header,
  .modal-quick-bar,
  .modal-body,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }
  .modal-title {
    font-size: 19px;
  }
  .modal-quick-bar {
    flex-direction: column;
  }
}
