/* ==================== RESET & BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #fff;
  overflow-x: hidden;
}

/* ==================== SCREENS ==================== */
.screen {
  display: none;
  position: relative;
  min-height: 100vh;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==================== OVERLAYS ==================== */
.screen-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); z-index: 1; }
.dark-overlay { background: rgba(0,0,0,0.6); }
.light-overlay { background: rgba(0,0,0,0.25); }
.sepia-overlay { background: rgba(30,20,10,0.4); }

/* ==================== SCREEN CONTENT ==================== */
.screen-content {
  position: relative; z-index: 2; width: 100%; min-height: 100vh;
  display: flex; flex-direction: column; padding: 20px;
  max-width: 1000px; margin: 0 auto;
}

/* ==================== BUTTONS ==================== */
.btn-close {
  position: absolute; top: 16px; left: 16px;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; width: 40px; height: 40px; border-radius: 8px;
  font-size: 1.2rem; cursor: pointer; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.btn-close:hover { background: rgba(0,0,0,0.8); }

.nav-arrows {
  display: flex; justify-content: space-between;
  padding: 16px 0; margin-top: auto;
}

.btn-arrow {
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.2);
  color: #fff; padding: 10px 24px; border-radius: 8px;
  font-size: 0.95rem; cursor: pointer; transition: background 0.2s;
}
.btn-arrow:hover { background: rgba(0,0,0,0.8); }

.screen-title {
  text-align: center; font-size: 1.8rem; font-weight: 700;
  margin: 16px 0 20px; text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
}

.content-scroll { flex: 1; overflow-y: auto; padding-bottom: 10px; }

/* ==================== INICIO ==================== */
.inicio-content {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; gap: 8px;
}
.title-otomi {
  font-size: 4.5rem; font-weight: 800;
  text-shadow: 3px 3px 15px rgba(0,0,0,0.8); letter-spacing: 2px;
}
.version { font-size: 0.9rem; opacity: 0.7; }
.author {
  font-size: 1.2rem; font-weight: 300; margin-bottom: 30px;
  text-shadow: 1px 1px 6px rgba(0,0,0,0.8);
}
.inicio-buttons { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.btn-inicio {
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 14px 48px; font-size: 1.1rem; font-weight: 600;
  border-radius: 6px; cursor: pointer; min-width: 220px;
  transition: background 0.2s, transform 0.2s;
}
.btn-inicio:hover { background: rgba(0,0,0,0.75); transform: scale(1.03); }
.btn-colab { font-size: 0.95rem; padding: 10px 36px; }

/* ==================== INSTRUCCIONES ==================== */
.instrucciones-box {
  background: rgba(255,255,255,0.92); color: #333; border-radius: 10px;
  padding: 28px; max-width: 700px; margin: 0 auto; line-height: 1.7;
  font-size: 0.95rem; flex: 1;
}
.instrucciones-box p { margin-bottom: 12px; }
.instrucciones-box ol { padding-left: 20px; }
.instrucciones-box li { margin-bottom: 8px; }

/* ==================== MENU GRID ==================== */
.menu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; padding: 10px 0; flex: 1; align-content: center;
}
.menu-card {
  background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 14px; padding: 28px 14px; text-align: center;
  cursor: pointer; color: #fff; font-size: 1rem; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  backdrop-filter: blur(4px); transition: transform 0.2s, background 0.2s;
}
.menu-card:hover { transform: translateY(-4px); background: rgba(0,0,0,0.65); }
.menu-icon { font-size: 2.4rem; }

/* ==================== WORD GRID ==================== */
.section-label {
  font-size: 1rem; margin: 18px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  text-shadow: 1px 1px 4px rgba(0,0,0,0.5);
}
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.word-card {
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 12px; display: flex; align-items: center; gap: 10px;
  backdrop-filter: blur(3px); transition: border-color 0.2s;
}
.word-card:hover { border-color: rgba(255,255,255,0.35); }

.play-btn {
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; width: 38px; height: 38px; min-width: 38px; border-radius: 50%;
  cursor: pointer; font-size: 0.85rem; display: flex; align-items: center;
  justify-content: center; transition: background 0.2s, transform 0.1s;
}
.play-btn:hover { background: rgba(255,255,255,0.35); }
.play-btn:active { transform: scale(0.9); }
.play-btn.playing {
  background: rgba(245,166,35,0.6); border-color: #f5a623;
  animation: pulse 0.6s infinite alternate;
}

@keyframes pulse {
  from { box-shadow: 0 0 0 0 rgba(245,166,35,0.5); }
  to { box-shadow: 0 0 0 10px rgba(245,166,35,0); }
}

.word-info { flex: 1; min-width: 0; }
.word-otomi { font-weight: 700; font-size: 1rem; }
.word-spanish { font-size: 0.78rem; opacity: 0.65; margin-top: 1px; }

/* ==================== COLORES GRID ==================== */
.colores-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  flex: 1; align-content: center; max-width: 600px; margin: 0 auto; width: 100%;
}
.color-card {
  padding: 14px 20px; border-radius: 8px; text-align: center;
  font-weight: 700; font-size: 0.95rem; cursor: pointer;
  border: 2px solid rgba(0,0,0,0.15); text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.color-card:hover { transform: scale(1.05); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.color-card:active { transform: scale(0.97); }
.color-card.playing-color { animation: colorPulse 0.5s infinite alternate; }
@keyframes colorPulse { to { box-shadow: 0 0 20px rgba(255,255,255,0.5); } }

/* ==================== COLORES EXERCISE (visual) ==================== */
.colores-exercise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.color-exercise-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.15);
  transition: transform 0.15s;
}
.color-exercise-card:hover { transform: scale(1.02); }

.color-exercise-card .ce-play {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(0,0,0,0.2);
  color: #fff; width: 34px; height: 34px; min-width: 34px;
  border-radius: 50%; cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.color-exercise-card .ce-play:hover { background: rgba(0,0,0,0.5); }
.color-exercise-card .ce-play.playing { background: rgba(0,0,0,0.6); animation: pulse 0.6s infinite alternate; }

.color-exercise-card input {
  flex: 1; background: rgba(255,255,255,0.85); border: 2px solid rgba(0,0,0,0.15);
  border-radius: 6px; padding: 8px 10px; color: #333; font-size: 0.85rem;
  outline: none; transition: border-color 0.3s;
}
.color-exercise-card input:focus { border-color: #333; }
.color-exercise-card input.correct { border-color: #2ecc71; background: rgba(46,204,113,0.25); }
.color-exercise-card input.incorrect { border-color: #e74c3c; background: rgba(231,76,60,0.2); }

.color-exercise-card .ce-mark { font-size: 1.1rem; min-width: 20px; }

.color-exercise-card .ce-check {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(0,0,0,0.2);
  color: #fff; padding: 8px 12px; border-radius: 6px;
  cursor: pointer; font-size: 0.8rem; white-space: nowrap;
  transition: background 0.2s;
}
.color-exercise-card .ce-check:hover { background: rgba(0,0,0,0.5); }

/* ==================== DIAGRAM SCREENS (María, etc.) ==================== */
.screen-diagram {
  background: #1a1a2e;
  align-items: center;
  justify-content: center;
}

.diagram-frame {
  position: relative;
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 1772 / 1180;
  margin: 0 auto;
  overflow: hidden;
}

.diagram-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.diagram-frame .btn-close { z-index: 10; }

.diagram-title {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 8px rgba(0,0,0,0.8);
  white-space: nowrap;
  color: #fff;
}

/* Tags positioned on the image */
.dtag, .dtag-ex {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Learn mode label (clickable audio button) */
.dtag-label {
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.dtag-label:hover { background: rgba(0,0,0,0.8); border-color: rgba(255,255,255,0.6); transform: scale(1.05); }
.dtag-label:active { transform: scale(0.95); }
.dtag-label.playing { border-color: #f5a623; background: rgba(245,166,35,0.35); animation: pulse 0.6s infinite alternate; }

/* Legacy .dtag-btn - keeping for compatibility */
.dtag-btn {
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  backdrop-filter: blur(4px);
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}
.dtag-btn:hover { background: rgba(0,0,0,0.8); border-color: rgba(255,255,255,0.6); transform: scale(1.05); }
.dtag-btn:active { transform: scale(0.95); }
.dtag-btn.playing { border-color: #f5a623; background: rgba(245,166,35,0.35); animation: pulse 0.6s infinite alternate; }

.dtag-otomi { font-weight: 700; font-size: 0.9rem; }
.dtag-es { font-size: 0.65rem; opacity: 0.65; }

/* Practice input (in learn mode) */
.dtag-input {
  width: 85px;
  background: rgba(255,255,255,0.88);
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 5px;
  padding: 5px 7px;
  color: #333;
  font-size: 0.78rem;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
}
.dtag-input:focus { border-color: #8B008B; background: #fff; }
.dtag-input.match { border-color: #2ecc71; background: rgba(46,204,113,0.2); }
.dtag-input.no-match { border-color: #e74c3c; background: rgba(231,76,60,0.15); }

/* Exam mode: play button + input + check mark */
.dtag-play {
  background: rgba(0,0,0,0.6);
  border: 2px solid rgba(255,255,255,0.3);
  color: #fff;
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.1s;
}
.dtag-play:hover { background: rgba(0,0,0,0.8); }
.dtag-play:active { transform: scale(0.9); }
.dtag-play.playing { border-color: #f5a623; background: rgba(245,166,35,0.4); animation: pulse 0.6s infinite alternate; }

.dtag-exam-input {
  width: 90px;
  background: rgba(255,255,255,0.92);
  border: 2px solid rgba(0,0,0,0.15);
  border-radius: 5px;
  padding: 6px 8px;
  color: #333;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
}
.dtag-exam-input:focus { border-color: #8B008B; }
.dtag-exam-input.correct { border-color: #2ecc71; background: rgba(46,204,113,0.2); }
.dtag-exam-input.incorrect { border-color: #e74c3c; background: rgba(231,76,60,0.15); }

.dtag-mark { font-size: 1.1rem; min-width: 18px; text-align: center; }

/* Nav inside diagram */
.diagram-nav {
  position: absolute;
  bottom: 2%; left: 2%; right: 2%;
  display: flex; justify-content: space-between; z-index: 5;
}

.btn-check-write,
.btn-revisar-diag {
  background: rgba(139,0,139,0.6) !important;
  border-color: rgba(255,255,255,0.4) !important;
  font-weight: 600;
}
.btn-check-write:hover,
.btn-revisar-diag:hover {
  background: rgba(139,0,139,0.85) !important;
}

/* Green inputs for Leo exercise (matches green tags in image) */
.dtag-green {
  background: rgba(200,230,150,0.9) !important;
  border-color: rgba(80,120,40,0.4) !important;
  color: #2a3a10 !important;
}
.dtag-green:focus { border-color: #4a7a20 !important; }
.dtag-green.correct { background: rgba(46,204,113,0.4) !important; border-color: #2ecc71 !important; }
.dtag-green.incorrect { background: rgba(231,76,60,0.3) !important; border-color: #e74c3c !important; }

/* ==================== REGLAS ==================== */
.rule-card {
  background: rgba(255,255,255,0.9); color: #333; border-radius: 10px;
  padding: 20px; margin-bottom: 14px;
}
.rule-card h3 { color: #1a1a2e; margin-bottom: 8px; font-size: 1.05rem; }
.rule-card p { line-height: 1.6; font-size: 0.92rem; }

/* ==================== EXERCISES ==================== */
.exercise-instruction {
  text-align: center; opacity: 0.8; margin-bottom: 14px;
  font-size: 0.9rem; text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}
.exercise-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.exercise-item {
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 14px; display: flex; flex-direction: column;
  gap: 8px; backdrop-filter: blur(3px);
}
.exercise-label { font-size: 0.9rem; opacity: 0.8; }
.exercise-row { display: flex; gap: 8px; align-items: center; }
.exercise-item input {
  flex: 1; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px; padding: 10px 12px; color: #fff; font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
.exercise-item input:focus { border-color: rgba(255,255,255,0.6); }
.exercise-item input.correct { border-color: #2ecc71; background: rgba(46,204,113,0.15); }
.exercise-item input.incorrect { border-color: #e74c3c; background: rgba(231,76,60,0.15); }
.check-btn {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; transition: background 0.2s; white-space: nowrap;
}
.check-btn:hover { background: rgba(255,255,255,0.25); }
.exercise-feedback { font-size: 0.8rem; min-height: 18px; }
.exercise-feedback.correct { color: #2ecc71; }
.exercise-feedback.incorrect { color: #ff7675; }
.score-bar {
  background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px; padding: 14px; text-align: center;
  font-size: 1.1rem; font-weight: 600; margin-top: 10px;
}

/* ==================== COLABORADORES ==================== */
.colab-main {
  background: rgba(255,255,255,0.92); color: #333; border-radius: 12px;
  padding: 24px; margin-bottom: 20px; display: flex; gap: 20px; align-items: flex-start;
}
.colab-photo-main { width: 130px; height: 160px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.colab-main p { line-height: 1.6; font-size: 0.88rem; }
.colab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.colab-person {
  background: rgba(255,255,255,0.9); color: #333; border-radius: 12px;
  padding: 20px; text-align: center;
}
.colab-photo { width: 100px; height: 120px; border-radius: 10px; object-fit: cover; margin-bottom: 10px; }
.colab-person h4 { margin-bottom: 8px; color: #1a1a2e; }
.colab-person p { font-size: 0.85rem; line-height: 1.5; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .diagram-title { font-size: 1.1rem; }
  .dtag-btn { padding: 3px 7px; }
  .dtag-otomi { font-size: 0.75rem; }
  .dtag-es { font-size: 0.55rem; }
  .dtag-input, .dtag-exam-input { width: 65px; padding: 4px 5px; font-size: 0.7rem; }
  .dtag-play { width: 26px; height: 26px; min-width: 26px; font-size: 0.6rem; }
}

@media (max-width: 600px) {
  .title-otomi { font-size: 2.8rem; }
  .author { font-size: 1rem; }
  .screen-title { font-size: 1.4rem; }
  .menu-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .menu-card { padding: 20px 10px; }
  .menu-icon { font-size: 1.8rem; }
  .word-grid { grid-template-columns: 1fr; }
  .exercise-grid { grid-template-columns: 1fr; }
  .colab-main { flex-direction: column; align-items: center; text-align: center; }
  .colab-photo-main { width: 100px; height: 120px; }
  .instrucciones-box { padding: 18px; font-size: 0.88rem; }
  .screen-content { padding: 14px; }
  .btn-arrow { padding: 8px 16px; font-size: 0.85rem; }
}

@media (max-width: 550px) {
  .diagram-frame { aspect-ratio: auto; height: 100vh; max-width: 100%; }
  .diagram-bg { object-position: center; }
  .diagram-title { font-size: 0.9rem; }
  .dtag-btn { padding: 2px 5px; }
  .dtag-otomi { font-size: 0.65rem; }
  .dtag-input, .dtag-exam-input { width: 50px; padding: 3px 4px; font-size: 0.62rem; }
  .dtag-mark { font-size: 0.85rem; min-width: 14px; }
  .dtag-play { width: 22px; height: 22px; min-width: 22px; font-size: 0.5rem; }
  .colores-grid { gap: 6px; }
  .color-card { padding: 8px 10px; font-size: 0.78rem; }
}
