:root {
  --bg: #f4f8f5; 
  --surface: #ffffff;
  --ink: #1c2321;
  --accent-blue: #4a8e94;
  --accent-green: #59a89c;
  --accent-amber: #e5b15d;
  --accent-pink: #d96c75;
  --shadow: 6px 6px 0px 0px var(--ink);
  --wobble: 255px 15px 225px 15px/15px 225px 15px 255px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  padding: 2rem;
  background-image: radial-gradient(var(--ink) 0.5px, transparent 0.5px);
  background-size: 20px 20px;
}

.container { max-width: 850px; margin: 0 auto; position: relative; }

.toolbar {
  position: absolute;
  top: 2rem;
  right: 0rem;
  display: flex;
  gap: 1rem;
  z-index: 10;
}
.tool-btn {
  background: var(--surface);
  border: 3px solid var(--ink);
  padding: 0.6rem 1.2rem;
  border-radius: 12px;
  font-family: 'Lexend', sans-serif;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 4px 4px 0px var(--ink);
  transition: 0.1s;
  font-size: 0.85rem;
}
.tool-btn:active { box-shadow: 0px 0px 0px var(--ink); transform: translate(4px, 4px); }

header {
  background: #fff;
  border: 3px solid var(--ink);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 12px 12px 0px var(--ink);
  margin-bottom: 2rem;
  text-align: center;
  position: relative;
}

.sumie-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 0.5rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

header h1 { font-family: 'Lexend', sans-serif; font-size: 1.8rem; line-height: 1.2; text-transform: uppercase; }
header p { font-weight: 500; opacity: 0.8; margin-top: 0.8rem; font-size: 0.9rem; line-height: 1.5; }

.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  background: var(--accent-amber);
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-weight: 800;
}

.step-card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 24px;
  padding: 1.5rem;
  box-shadow: 15px 15px 0px var(--ink);
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

h2 { font-family: 'Lexend', sans-serif; font-size: 1.5rem; border-bottom: 2px dashed #ddd; padding-bottom: 0.8rem; }
.card-sub { font-size: 0.95rem; font-style: italic; opacity: 0.8; border-left: 4px solid var(--accent-blue); padding-left: 1rem; line-height: 1.5; }

.options { display: flex; flex-direction: column; gap: 1.2rem; margin-top: 1rem; }
.opt {
  background: var(--surface);
  border: 3px solid var(--ink);
  padding: 1.2rem 1.5rem;
  border-radius: 15px;
  cursor: pointer;
  font-family: 'Lexend', sans-serif;
  font-weight: 600;
  font-size: 1rem; text-align: left; transition: 0.1s; display: flex; align-items: center; gap: 1.2rem; box-shadow: 4px 4px 0px var(--ink);
}
.opt:hover { background: #faf9f5; transform: translate(-2px, -2px); box-shadow: 6px 6px 0px var(--ink); }
.opt:active { box-shadow: 0px 0px 0px var(--ink); transform: translate(4px, 4px); }
.opt span:first-child { font-size: 1.4rem; }

.result-banner {
  padding: 0.8rem 1.5rem;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.8rem;
  display: inline-block;
  align-self: flex-start;
}
.danger { background: var(--accent-pink); color: #fff; border-color: rgba(255,255,255,0.4); }
.warning { background: var(--accent-amber); color: var(--ink); border-color: var(--ink); }
.ok { background: var(--accent-green); color: #fff; border-color: rgba(255,255,255,0.4); }
.info { background: var(--accent-blue); color: #fff; border-color: rgba(255,255,255,0.4); }

.actions { 
  margin-top: auto; 
  display: flex; 
  gap: 1rem; 
  padding-top: 2rem;
  border-top: 3px dashed var(--ink);
}
.btn {
  background: var(--surface);
  border: 3px solid var(--ink);
  padding: 0.8rem 1.5rem;
  font-family: 'Lexend', sans-serif;
  font-weight: 800;
  cursor: pointer;
  border-radius: 12px;
  box-shadow: 4px 4px 0px var(--ink);
  transition: 0.1s;
  font-size: 0.85rem;
  text-transform: uppercase;
}
.btn:active { box-shadow: 0px 0px 0px var(--ink); transform: translate(4px, 4px); }

footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.85rem;
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
}

.footer-email {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  opacity: 0.8;
  transition: 0.2s;
  border-bottom: 2px solid transparent;
}
.footer-email:hover {
  opacity: 1;
  border-bottom-color: var(--accent-green);
}

/* Modal para informe */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal-content {
  background: var(--surface);
  border: 3px solid var(--ink);
  border-radius: 25px;
  max-width: 600px;
  width: 90%;
  max-height: 80%;
  overflow: auto;
  padding: 2rem;
  box-shadow: 8px 8px 0 var(--ink);
  font-family: 'Inter', monospace;
}
.modal-content h3 { margin-bottom: 1rem; }
.modal-content pre {
  background: #f0f0f0;
  padding: 1rem;
  white-space: pre-wrap;
  font-size: 0.8rem;
}
.close-modal {
  margin-top: 1rem;
  background: var(--ink);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  body { padding: 0.75rem; overflow-x: hidden; }
  .container { width: 100%; }
  header { width: 100%; padding: 1.5rem 1rem; border-radius: 20px; margin-bottom: 2rem; }
  header h1 { font-size: 1.4rem; }

  .toolbar { position: static; display: flex; margin-bottom: 1.5rem; justify-content: center; gap: 0.8rem; }
  .tool-btn { flex: 1; text-align: center; padding: 0.8rem 0.5rem; font-size: 0.75rem; box-shadow: 2px 2px 0px var(--ink) !important; }

  .step-card { padding: 1.5rem 1rem; min-height: auto; border-radius: 20px; box-shadow: 4px 4px 0px var(--ink); }
  h2 { font-size: 1.25rem; }

  .opt { padding: 1rem; font-size: 0.9rem; gap: 0.8rem; border-radius: 12px; box-shadow: 2px 2px 0px var(--ink) !important; }
  .opt:hover { box-shadow: 3px 3px 0px var(--ink) !important; }
  .opt span:first-child { font-size: 1.2rem; }

  .actions { flex-direction: column; gap: 0.8rem; padding-top: 1.5rem; }
  .btn { width: 100%; text-align: center; padding: 1rem; box-shadow: 2px 2px 0px var(--ink) !important; }

  footer { padding: 2rem 1rem; margin-top: 2rem; }
}

@media print {
  body { background: #fff !important; }
  .toolbar, .actions, footer { display: none !important; }
  .step-card, header { box-shadow: none !important; border: 1px solid #000; min-height: auto; width:100%; }
  .result-banner { border: 2px solid #000; background: #eee !important; color:#000; }
  .step-card::after {
    content: "Dictamen generado para expediente clínico/investigación. Firma del Responsable: ______________________";
    display: block;
    margin-top: 4rem;
    font-size: 0.9rem;
    border-top: 1px dashed #000;
    padding-top: 1rem;
  }
}

/* ----- BUY ME A COFFEE ----- */
.bmc-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #FFDD00;
  color: #000;
  border: 2px solid var(--ink);
  border-radius: 30px;
  padding: 0.35rem 0.85rem;
  font-family: 'Lexend', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  text-decoration: none;
  box-shadow: 2px 2px 0px var(--ink);
  transition: 0.2s;
  white-space: nowrap;
  margin-top: 1rem;
}

.bmc-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0px var(--ink);
}

.bmc-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
