/* =========================================
   1. CONFIGURACIÓN GLOBAL
   ========================================= */
:root {
  --gap-base: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; /* Evita efecto gris al tocar (Apple) */
}

/* Prevención de selección de texto (botones y textos) */
button,
h1, h2, h3,
h1 span,
.name-slot,
.name-slot h3,
.name-reading,
.name-kanji,
.word-display,
.mnemo-active {
  user-select: none;
  -webkit-user-select: none;
}

html {
  height: 100vh;
  height: -webkit-fill-available; /* iOS antiguo */
  height: 100dvh; /* Estándar moderno */
  overflow: hidden;
}

body {
  width: 100%;
  height: 100vh;
  height: -webkit-fill-available; /* iOS antiguo */
  height: 100dvh; /* Estándar moderno */
  overflow: hidden;
  margin: 0;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  
  /* 2. Contenedor relativo para centrar #root desde el centro */
  position: relative;
  
  /* 3. Estética y comportamiento */
  touch-action: manipulation;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: #1e3a8a;
  /* Opcional por bloque → fondo_web (portada) → fondo-bloques */
  background-image: var(--app-fondo-bloque-activo, var(--app-fondo-web, var(--app-fondo-bloques, none)));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overscroll-behavior-y: contain;
  position: fixed;
  box-sizing: border-box;
}

@media (orientation: landscape) {
  body {
    justify-content: flex-start;
    padding-top: env(safe-area-inset-top, 5px);
    padding-bottom: env(safe-area-inset-bottom, 5px);
  }
}

#root {
  height: 100vh;
  height: -webkit-fill-available; /* iOS antiguo */
  height: 100dvh; /* Dynamic Viewport: se encoge solo si sale el teclado */
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  align-items: center;
  touch-action: pan-y; /* Android: permite scroll vertical, evita gestos laterales accidentales */
  width: 100%;
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

/* =========================================
   2. CONTENEDOR PRINCIPAL
   ========================================= */
/* Panel principal transparente en index; barra de bloques: .app-block-bar-wrap + .bottom-menu */
/* Zona principal: sin barra de desplazamiento; el contenido se reparte y la imagen cede espacio */
/* Texto del estudio legible sobre el degradado del body (panel sin fondo blanco) */
/* Nombre de bloque (ej. ブロック 00-09): más visible sobre el fondo */
.app-main-panel #app > p.app-block-label,
.app-main-panel #app > p:first-of-type {
  color: #FFD700 !important;
  opacity: 1 !important;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
}
.app-main-panel #app > p.app-block-label {
  margin-bottom: 6px;
  margin-top: 0;
  font-size: 0.9rem;
}
.app-main-panel #app h2 {
  color: #FFD700 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 10px rgba(0,0,0,0.4);
}
.app-main-panel .name-slot h3 {
  color: #FFD700 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
}
.app-main-panel .name-slot-jp .name-reading {
  color: #FFD700 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
}
.app-main-panel .name-slot-jp .name-kanji {
  color: #FFD700 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
}
.app-main-panel .responsive-image {
  border-color: rgba(255, 255, 255, 0.35) !important;
}

#app {
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  height: 0;
  min-height: 0;
  margin: 0 auto !important;
  background: transparent !important;
  padding: 8px 8px 2px !important;
  border-radius: 0;
  box-shadow: none !important;
  position: relative;
  z-index: 1;
  text-align: center;
  flex: 1 1 0%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: clamp(6px, 1.2vh, 10px);
  overflow: hidden;
  overflow-x: hidden;
  overflow-y: hidden;
}

#app > p:first-of-type {
  flex-shrink: 0;
  margin: 0 0 4px !important;
  line-height: 1.2;
  font-size: clamp(0.72rem, 2.8vw, 0.88rem) !important;
}

#app h2 {
  flex: 0 0 auto;
  flex-shrink: 0;
  font-size: clamp(1.45rem, 8.5vw, 2.55rem);
  margin: 0;
  color: #FFD700;
  font-weight: 700;
  line-height: 1.05;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 10px rgba(0,0,0,0.4);
}

/* Número → hueco → imagen completa → hueco → nombre. Nunca se enciman. */
#app .content-area {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  gap: clamp(6px, 1.2vh, 10px);
}

#app .controls {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-top: 0;
}

#app .controls .row {
  gap: 8px;
}

/* Botones del estudio (4): imagen / nombre / atrás / adelante — cristal ahumado (paridad App-Ko) */
#app .controls button {
  background: rgba(15, 23, 42, 0.42);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  padding: 6px 11px;
  font-size: clamp(0.76rem, 3.2vw, 0.9rem);
  line-height: 1.2;
  border-radius: 12px;
  min-height: 0;
}

#app .controls button:active:not(:disabled) {
  background: rgba(15, 23, 42, 0.55);
}

#app .controls button:disabled {
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.82);
  border-color: rgba(255, 255, 255, 0.28);
  opacity: 0.88;
  cursor: not-allowed;
}

/* =========================================
   5. SLOT DE IMAGEN
   ========================================= */
.image-slot {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  max-height: min(36dvh, 48vmin, 260px);
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  overflow: hidden;
}

#app img,
.responsive-image {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  flex-shrink: 1;
  image-rendering: auto; /* Nítida en Retina / Super AMOLED */
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.image-slot.hidden img {
  visibility: hidden;
  opacity: 0;
}

/* =========================================
   6. NOMBRE Y CONTROLES
   ========================================= */
.name-slot {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 28vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.name-slot h3 {
  font-size: 3.4rem;
  color: #FFD700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  margin: 0;
}

.name-slot.hidden h3 {
  visibility: hidden;
}

/* JP: lectura (ひらがな / カタカナ) arriba, kanji abajo; kanji vacío conserva altura */
.name-slot-jp {
  flex-direction: column;
  gap: clamp(2px, 0.8vw, 8px);
  min-height: 0;
  max-height: 28vh;
  align-items: center;
  justify-content: center;
}

.name-slot-jp .name-reading {
  font-size: clamp(1.9rem, 6.8vw, 2.6rem);
  color: #FFD700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  margin: 0;
  font-weight: 500;
  line-height: 1.4;
  min-height: 1.35em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "MS PGothic", sans-serif;
}

.name-slot-jp .name-kanji {
  font-size: clamp(2.6rem, 9vw, 3.4rem);
  color: #FFD700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.4);
  margin: 0;
  font-weight: 700;
  line-height: 1.3;
  min-height: 1.45em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "MS PGothic", sans-serif;
}

.name-slot.hidden .name-reading,
.name-slot.hidden .name-kanji {
  visibility: hidden;
}

.controls {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1.2vh, 8px);
}

.row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

button {
  flex: 1;
  padding: 12px 15px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #4169E1;
  color: white;
  cursor: pointer; /* Surface Pen, trackpad: indica elemento interactivo */
  transition: all 0.2s ease;
  touch-action: manipulation; /* Elimina delay 300ms en iOS/Android antiguos */
}

button:active {
  transform: translateY(1px);
}

/* =========================================
   7. RESPONSIVE - TABLETS Y PANTALLAS GRANDES (iPad y Tablets Android)
   ========================================= */
@media (min-width: 768px) and (max-width: 1024px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 18px 14px 4px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.7rem, 7vw, 3rem);
    margin: 0 0 10px;
  }
  h1 {
    font-size: 2.2rem;
    margin: 10px 0 12px 0;
  }
  h1 span {
    font-size: 1.3rem;
    margin-top: 6px;
  }
  .name-slot {
    margin: 12px 0;
  }
  .name-slot h3 {
    font-size: 3.6rem;
  }
  .controls {
    margin-top: 10px;
    gap: 12px;
  }
  button {
    padding: 14px 18px;
    font-size: 1.1rem;
  }
  .bottom-menu {
    padding: 14px;
    width: 95%;
    max-width: 95%;
  }
  .bottom-menu button {
    height: 48px;
    font-size: 0.6875rem;
  }
  .bottom-menu .buttons {
    gap: 6px;
  }
  #area-retos {
    min-height: 36px;
    margin: 2px 0 1px;
  }
}

/* iPad Pro, Tablets grandes y pantallas muy grandes */
@media (min-width: 1024px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 20px 16px 4px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.85rem, 6vw, 3.4rem);
    margin: 0 0 10px;
  }
  h1 {
    font-size: 2.4rem;
    margin: 12px 0 15px 0;
  }
  h1 span {
    font-size: 1.4rem;
    margin-top: 8px;
  }
  .name-slot {
    margin: 15px 0;
  }
  .name-slot h3 {
    font-size: 4rem;
  }
  .controls {
    margin-top: 12px;
    gap: 14px;
  }
  button {
    padding: 16px 20px;
    font-size: 1.2rem;
  }
  .bottom-menu {
    padding: 16px;
    width: 95%;
    max-width: 95%;
  }
  .bottom-menu button {
    height: 52px;
    font-size: 0.75rem;
  }
  .bottom-menu .buttons {
    gap: 7px;
  }
  #area-retos {
    min-height: 36px;
    margin: 2px 0 1px;
  }
}

/* =========================================
   8. RESPONSIVE - MÓVILES GRANDES
   ========================================= */
@media (max-width: 600px) and (min-width: 376px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 12px 8px 2px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.48rem, 8.5vw, 2.15rem);
    margin: 0 0 6px;
  }
  h1 {
    font-size: 1.5rem;
    margin: 8px 0 10px 0;
  }
  h1 span {
    font-size: 1rem;
    margin-top: 6px;
  }
  .name-slot {
    margin: 8px 0;
  }
  .name-slot h3 {
    font-size: 2.8rem;
  }
  .controls {
    margin-top: 6px;
    gap: 8px;
  }
  .bottom-menu {
    padding: 9px;
  }
  .bottom-menu button {
    height: 38px;
    font-size: 0.5625rem;
  }
  #area-retos {
    min-height: 36px;
    margin: 2px 0 1px;
  }
}

/* =========================================
   9. RESPONSIVE - MÓVILES MEDIANOS (iPhone estándar)
   ========================================= */
@media (max-width: 414px) and (min-width: 376px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 10px 6px 2px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.4rem, 8vw, 2rem);
    margin: 0 0 6px;
  }
  h1 {
    font-size: 1.4rem;
    margin: 6px 0 8px 0;
  }
  .name-slot {
    margin: 6px 0;
  }
  .name-slot h3 {
    font-size: 2.6rem;
  }
  .controls {
    margin-top: 5px;
    gap: 8px;
  }
  button {
    padding: 9px 10px;
    font-size: 0.85rem;
  }
}

/* =========================================
   10. RESPONSIVE - MÓVILES PEQUEÑOS (iPhone SE, etc.)
   ========================================= */
@media (max-width: 375px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 8px 6px 2px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.28rem, 8vw, 1.72rem);
    margin: 0 0 5px;
  }
  h1 {
    font-size: 1.2rem;
    margin: 5px 0 6px 0;
  }
  h1 span {
    font-size: 0.9rem;
    margin-top: 4px;
  }
  .name-slot {
    min-height: 0;
    margin: 0;
  }
  .name-slot h3 {
    font-size: 2.4rem;
  }
  .controls {
    gap: 6px;
    margin-top: 0;
  }
  .row {
    gap: 6px;
  }
  button {
    padding: 8px 8px;
    font-size: 0.8rem;
  }
  .bottom-menu {
    padding: 8px;
    width: calc(100% - 16px);
  }
  .bottom-menu button {
    height: 36px;
    font-size: 0.5rem;
  }
  .bottom-menu .buttons {
    gap: 3px;
  }
  #area-retos {
    min-height: 36px;
    margin: 2px 0 1px;
  }
}

/* =========================================
   11. RESPONSIVE - PANTALLAS MUY PEQUEÑAS
   ========================================= */
@media (max-width: 320px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 6px 4px 2px !important;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
    min-height: auto;
  }
  #app h2 {
    font-size: clamp(1.12rem, 7vw, 1.55rem);
    margin: 0 0 4px;
  }
  h1 {
    font-size: 1.1rem;
    margin: 4px 0 5px 0;
  }
  h1 span {
    font-size: 0.85rem;
  }
  .name-slot {
    margin: 0;
  }
  .name-slot h3 {
    font-size: 2.2rem;
  }
  .controls {
    margin-top: 0;
    gap: 5px;
  }
  button {
    padding: 7px;
    font-size: 0.75rem;
  }
  .bottom-menu button {
    height: 32px;
    font-size: 0.4375rem;
  }
  .bottom-menu .buttons {
    gap: 2px;
  }
  #area-retos {
    min-height: 34px;
    margin: 2px 0 1px;
  }
}

/* =========================================
   12. ORIENTACIÓN HORIZONTAL (LANDSCAPE)
   ========================================= */
@media (orientation: landscape) and (max-height: 600px) {
  body {
    overflow-x: hidden;
    overflow-y: hidden;
  }
  
  #root {
    padding: 5px env(safe-area-inset-right, 10px) 5px env(safe-area-inset-left, 10px);
    justify-content: flex-start;
    min-height: auto;
    overflow: hidden;
  }
  
  h1 {
    font-size: 1.2rem;
    margin: 3px 0 5px 0;
  }
  
  h1 span {
    font-size: 0.9rem;
    margin-top: 2px;
  }
  
  .app-main-panel {
    max-width: 400px !important;
    margin: 3px auto !important;
  }
  .app-block-bar-wrap {
    max-width: 400px !important;
    margin: 3px auto !important;
  }
  #app {
    padding: 8px 6px 2px !important;
    margin: 0 auto !important;
  }
  
  #app h2 {
    font-size: 1.42rem;
    margin: 0 0 4px;
  }
  
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px) !important;
    min-height: auto !important;
  }
  
  .name-slot {
    margin: 4px 0;
    min-height: 0;
    max-height: 28vh;
  }
  
  .name-slot h3 {
    font-size: 2.2rem;
  }
  
  .controls {
    margin-top: 3px;
    gap: 5px;
  }
  
  button {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  #app .controls button {
    padding: 5px 8px;
    font-size: 0.68rem;
  }
  
  #area-retos {
    min-height: 34px;
    margin: 2px 0 1px;
  }
  
  .bottom-menu {
    padding: 6px;
    margin: 2px auto;
  }
  
  .bottom-menu button {
    height: 32px;
    font-size: 0.4375rem;
  }
  
  .bottom-menu .buttons {
    gap: 3px;
  }
}

/* Landscape para tablets/iPad */
@media (orientation: landscape) and (min-width: 768px) and (max-height: 600px) {
  .app-main-panel,
  .app-block-bar-wrap {
    width: 95% !important;
    max-width: 95% !important;
  }
  #app {
    padding: 14px 12px 4px !important;
  }
  
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px) !important;
    min-height: auto !important;
  }
  
  #app h2 {
    font-size: 2.5rem;
    margin: 0 0 8px;
  }
  
  h1 {
    font-size: 1.8rem;
    margin: 6px 0 10px 0;
  }
  
  h1 span {
    font-size: 1.1rem;
  }
  
  .name-slot {
    margin: 8px 0;
  }
  
  .name-slot h3 {
    font-size: 3.4rem;
  }
  
  .controls {
    margin-top: 8px;
    gap: 10px;
  }
  
  button {
    padding: 12px 14px;
    font-size: 1rem;
  }
  
  .bottom-menu {
    padding: 12px;
    max-width: 500px;
  }
  
  .bottom-menu button {
    height: 42px;
    font-size: 0.625rem;
  }
  
  .bottom-menu .buttons {
    gap: 5px;
  }
  
  #area-retos {
    min-height: 36px;
    margin: 2px 0 1px;
  }
}

/* =========================================
   13. ESPACIO DE RETOS (RESERVADO)
   ========================================= */
#area-retos {
  width: 100%;
  height: 36px;
  min-height: 36px;
  max-height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2px auto 1px;
  padding: 0;
  overflow: visible;
  background: transparent;
  flex: 0 0 auto;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
  box-sizing: border-box;
}
/* El placeholder es invisible pero mantiene el espacio del área de retos */
.btn-reto-placeholder {
  width: 90%;
  height: 36px;
  min-height: 36px;
  display: block;         /* Mantiene el espacio */
  border-radius: 8px;
  border: none;
  visibility: hidden;     /* Invisible pero mantiene el espacio */
  opacity: 0;             /* Invisible pero mantiene el espacio */
  background: transparent;
  pointer-events: none;   /* No interfiere con clics */
}

/* El botón activo */
.btn-reto-active {
  width: 90%;            /* Mismo ancho que el bloque de números de abajo */
  max-width: 420px;      /* Mismo max-width que .bottom-menu */
  height: 34px;
  min-height: 34px;
  max-height: 36px;
  background: #4169E1;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  animation: pulse-blue 2s infinite; /* El brillo que mencionamos */
  /* Centrar el texto siempre */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto;        /* Centrado horizontal */
  box-sizing: border-box;
}

/* Animación de brillo para que resalte en tus videos de TikTok */
@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(65, 105, 225, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(65, 105, 225, 0); }
  100% { box-shadow: 0 0 0 0 rgba(65, 105, 225, 0); }
}

/* Estilos para resaltado mnemotécnico */
.mnemo-active { 
    color: #00FF00 !important; 
    font-weight: bold; 
    text-shadow: 0 0 5px #00FF00;
}

.word-display { 
    font-size: 2.5rem; 
    letter-spacing: 2px; 
}

/* Sensor: Pantalla corta (iPhone SE 2/3, Huawei antiguos, alto < 670px) */
@media (max-height: 670px) {
  h1,
  .app-main-panel > h1 { display: none !important; }
  h1 span,
  .app-main-panel > h1 span { display: none !important; }
  .image-slot { min-height: 0 !important; max-height: min(36dvh, 48vmin, 260px) !important; flex-shrink: 1 !important; }
  .name-slot,
  .name-slot-jp { max-height: 16vh; flex-shrink: 0; }
  .btn-reto-active { height: 32px !important; margin-top: 0 !important; }
  #area-retos { height: 34px !important; min-height: 34px !important; max-height: 36px !important; margin: 2px 0 1px !important; }
}

/* Evitar flash blanco en modo oscuro (Android/Google Play) */
@media (prefers-color-scheme: dark) {
  /* Ajustes mínimos: el fondo ya usa gradiente; theme-color en HTML evita destello */
}

/* =========================================
   SURFACE / TABLET PC - Proporción 3:2 y teclado físico
   ========================================= */
@media (min-width: 768px) and (orientation: landscape) {
  .app-main-panel,
  .app-block-bar-wrap,
  .card-container {
    max-width: 600px;
    margin: 0 auto;
  }
  .image-slot {
    max-height: min(36dvh, 48vmin, 260px);
  }
}

/* Elimina "sticky hover" en pantallas táctiles (Surface, tabletas) */
@media (hover: hover) {
  button:hover {
    filter: brightness(1.1);
  }
}
@media (hover: none) {
  button:hover:not(#cerrar-tabla):not(#fermer-tabla) {
    background: inherit;
  }
  #cerrar-tabla:hover,
  #fermer-tabla:hover {
    background: #FF3B30 !important;
    color: #FFFFFF !important;
  }
}