:root{
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --border: #eaecf0;
  --blue: #2563eb;
  --blue-hover:#1d4ed8;
  --radius: 16px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  cursor: url("assets/cursor-vocabulapp.png") 2 2, auto;
}

button,
.theme-item,
.card-item,
.theme-delete,
#tutorialBubbleNext,
.themed-image-btn,
#btnChangeLanguage,
#btnResumeGame,
#btnDeleteSave,
#btnAddTheme,
#btnExitGame,
.btn-back-floating,
.lang-btn,
.audio-toggle,
.phase-content button,
#themeList .theme-item{
  cursor: url("assets/cursor-vocabulapp-hover.png") 2 2, auto !important;
}

.screen-temas {
  --bg: #f5f7fa;
}

.screen-juego {
  --bg: url('biblioteca.jpg');
  background-size: cover;
  background-position: center;
}

.header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.top-bar{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin: 20px 0 30px;
}

.logo-area{
  flex: 0 0 auto;
}

.controls-area{
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.brand{
  margin: 0 auto;
  max-width: 960px;
  font-size: 28px;
  letter-spacing: .2px;
}

.container{
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
}

.row{
  display:flex;
  align-items:center;
}

.row-between{
  justify-content: space-between;
  gap: 12px;
}

.row-end{
  justify-content: flex-end;
}

.gap{
  gap: 10px;
}

.title{
  margin: 0;
  font-size: 20px;
}

.muted{
  color: var(--muted);
}

.small{
  font-size: 13px;
}

.btn{
  border: 1px solid var(--border);
  background: white;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary{
  border-color: transparent;
  background: var(--blue);
  color: white;
}

.btn-primary:hover{
  background: var(--blue-hover);
}

.list{
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

.theme-item{
  background: white;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  transition: transform .15s, box-shadow .15s;
  cursor: pointer;
}

.theme-item:hover{
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.theme-name{
  font-weight: 700;
}

.theme-meta{
  color: var(--muted);
  font-size: 13px;
}

/* Dialog */
.dialog::backdrop{
  background: rgba(16,24,40,.35);
}

.dialog{
  border: none;
  padding: 0;
  border-radius: 18px;
  width: min(720px, calc(100% - 24px));
}

.dialog-inner{
  padding: 18px;
}

.dialog-title{
  margin: 0 0 14px;
  font-size: 18px;
}

.field{
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

input,
textarea{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
}

textarea{
  resize: vertical;
}

.divider{
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 16px;
  background: white;
}

.game-board{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.game-board > div:first-child{
  padding-right: 16px;
  border-right: 1px solid var(--border);
}

.board-title{
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--muted);
}

.board{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

/* --- Flip cards --- */
.card-item{
  height: 120px;
  border-radius: 14px;
  perspective: 900px;
  cursor: pointer;
}

.card-inner{
  width: 100%;
  height: 100%;
  position: relative;
  border-radius: 14px;
  transform-style: preserve-3d;
  transition: transform 220ms ease;
}

.card-item.is-flipped .card-inner{
  transform: rotateY(180deg);
}

.card-face{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: visible;
  font-weight: 800;
}

/* Cara trasera */
.card-back{
  padding: 0;
  background: transparent;
  border: none;
}

.card-back-img{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

/* Cara frontal */
.card-front{
  transform: rotateY(180deg);
  background: linear-gradient(to bottom, #f4e7d3 0%, #ead7b8 100%);
  border: 2px solid #1f3a5f;
  padding: 10px;
  box-sizing: border-box;
}

.card-item[data-matched="true"]{
  transform: translateY(0px);
  box-shadow:
    0 6px 14px rgba(0,0,0,.25),
    0 0 6px rgba(240,207,107,.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

}

.score-board{
  display: flex;
  gap: 16px;
  margin: 8px 0 12px;
  font-weight: 700;
}

.score{
  padding: 6px 12px;
  border-radius: 10px;
  background: linear-gradient(
    to bottom,
    #2c4f7a 0%,
    #1f3a5f 60%,
    #162c45 100%
  );
   /* borde dorado */
  border: 4px solid #d4a63a;

/* texto */
  color: #d4a63a;

  font-weight: 700;

  /* efecto relieve */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.2),
    inset 0 -1px 0 rgba(0,0,0,.3),
    0 1px 3px rgba(0,0,0,.2);
}

.score.active{
  border-color: var(--blue);
  color: var(--blue);

}/* ===== Overlay fase ===== */
.phase-overlay{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 9999;
}

.phase-content{
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

.phase-content::before{
  content: none !important;
}

.phase-content img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  background: #000;
  display: block;
}

.phase-content button{
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 34px;
  padding: 0;
  background: transparent;
  background-image: url("assets/btn-cont-screen.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  overflow: hidden;
}

.phase-content button,
.phase-content button:hover,
.phase-content button:focus,
.phase-content button:active{
  background-color: transparent !important;
  background-image: url("assets/btn-cont-screen.png") !important;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  outline: none;
  box-shadow: none;
}

.phase-content button:hover{
  transform: translateX(-50%) translateY(-1px);
  filter: brightness(1.05);
}

 .phase-content button{
  -webkit-tap-highlight-color: transparent;
}

}/* ===== Color traducción FR ===== */
#boardFR .card-front{
  color:#d00000;
  font-weight:800;
}

#boardES .card-front{
  color:#222;
}

/* =====================================================
   BARRA DE PROGRESO - VERSIÓN FINAL DECORADA
   ===================================================== */

#screenGame #progressWrap{
  position: relative !important;
  display: block !important;
  width: calc(100% - 120px) !important;
  max-width: 980px !important;
  margin: 110px auto 14px auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  z-index: 1 !important;
}

#screenGame #progressLabels{
  position: relative !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 0 8px 0 !important;
  padding: 0 4px !important;
  font-family: 'Cinzel', serif !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #7a5a24 !important;
  line-height: 1 !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
}

#screenGame #progressLabels .progress-label{
  opacity: .8;
}

#screenGame #progressLabels .progress-label.active{
  color: #1f3a5f !important;
  opacity: 1;
}

#screenGame #progressLabels .progress-label.done{
  color: #a57a2a !important;
  opacity: 1;
}

#screenGame #progressBar{
  position: relative !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 18px !important; /* espacio para los terminales */
  box-sizing: border-box !important;
}

#screenGame #progressTrack{
  position: relative !important;
  display: block !important;
  width: 100% !important;
  height: 14px !important;
  margin: 0 !important;
  border: 2px solid #a47a2a !important;
  border-radius: 3px !important;
  background: linear-gradient(to bottom, #2c4f7a 0%, #1f3a5f 50%, #162c45 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.25),
    inset 0 -1px 0 rgba(0,0,0,.30),
    0 1px 3px rgba(0,0,0,.2) !important;
  overflow: visible !important;
}

#screenGame #progressFill{
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  width: 0%;
  background: linear-gradient(to bottom, #f0cf6b 0%, #d7a73d 50%, #a8741e 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.35),
    inset 0 -1px 0 rgba(0,0,0,.18) !important;
  transition: width .35s ease !important;
  z-index: 2 !important;
  border-radius: 1px !important;
}

/* 3 bolitas doradas centradas en las divisiones */
#screenGame #progressTrack::after{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background-image:
    radial-gradient(circle, #f0cf6b 0 3px, transparent 4px),
    radial-gradient(circle, #f0cf6b 0 3px, transparent 4px),
    radial-gradient(circle, #f0cf6b 0 3px, transparent 4px);
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position:
    25% 50%,
    50% 50%,
    75% 50%;
  background-size:
    8px 8px,
    8px 8px,
    8px 8px;
}

/* =========================================
   TERMINALES TIPO FLECHA (ESTILO METAL)
   ========================================= */

/* flecha izquierda */
#screenGame #progressTrack::before{
  content: "";
  position: absolute;
  top: 50%;
  left: -18px;
  transform: translateY(-50%);

  width: 0;
  height: 0;

  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 14px solid #a47a2a;
  
  filter: drop-shadow(0 0 2px rgba(0,0,0,.4));
  z-index: 5;
}

/* flecha derecha */
#screenGame #progressBar::after{
  content: "";
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);

  width: 0;
  height: 0;

  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 14px solid #a47a2a;

  filter: drop-shadow(0 0 2px rgba(0,0,0,.4));
  z-index: 5;
}

/* ===== Pantalla inicial ===== */
.start-fullscreen{
  position: fixed;
  inset: 0;
  z-index: 50;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.start-screen{
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background-image: url("assets/fondo-inicio.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.start-title{
  font-size: 52px;
  color: white;
  text-shadow: 0 4px 12px rgba(0,0,0,.45);
  margin-bottom: 8px;
}

.start-school{
  color: white;
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 3px 10px rgba(0,0,0,.45);
  margin-bottom: 22px;
}

.start-subtitle{
  color: white;
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 3px 10px rgba(0,0,0,.45);
  margin-bottom: 22px;
}

.start-language-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(180px, 240px));
  justify-content:center;
  gap: 18px;
}

.lang-card{
  border: 1px solid var(--border);
  background:rgba(255,255,255,0.95);
  backdrop-filter:blur(2px);
  border-radius: 18px;
  padding: 22px 18px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.lang-card:hover{
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(16,24,40,.08);
}

.lang-flag{
  font-size: 42px;
  margin-bottom: 10px;
}

.lang-name{
  font-size: 18px;
  font-weight: 800;
}

.screen-transition{
  opacity:0;
  transform:translateY(12px);
  transition:opacity .35s ease, transform .35s ease;
}

.screen-visible{
  opacity:1;
  transform:translateY(0);
}

/* ===== Botón global de audio ===== */
.audio-toggle{
  position: fixed;
  right: 24px;
  bottom: 24px;
  top: auto;
  left: auto;

  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;

  z-index: 9999;
}

.audio-toggle img{
  width: 56px;
  height: 56px;
  display: block;
  image-rendering: pixelated;
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,0.45));
}

.audio-toggle.is-muted img{
  opacity: 0.7;
}

/* ===== Pantalla de temas ===== */
#screenThemes.card{
  background: linear-gradient(180deg, #f5f7fb, #e9eef6);
  border: none;
  box-shadow: none;
  padding: 20px;
}

.themes-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 20px;
  padding: 8px 0;
}

.themes-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.themes-list{
  background: transparent;
}

.empty-state{
  text-align: center;
  margin-top: 80px;
  opacity: 0.9;
}

.empty-icon{
  font-size: 48px;
  margin-bottom: 12px;
}

#btnAddTheme{
  background-image: url("assets/btn-anadir.png") !important;
  width: 250px;
}

#btnAddTheme:hover{
  background: #4338ca;
}

#screenThemes{
  position: relative;
  max-height: 100vh;
  padding: 0;
  border: none;
  box-shadow: none;
  background:
    radial-gradient(circle at top left, rgba(79,70,229,.10), transparent 28%),
    radial-gradient(circle at top right, rgba(37,99,235,.08), transparent 24%),
    linear-gradient(180deg, #f7f9fc, #eef3f8);
}

.themes-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0px;
  margin-bottom: 32px;
}

.themes-logo img{
  width: 500px;
  max-width: 100%;
  height: auto;
  display: block;
}

.themes-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.container{
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 24px 0px;
}

#screenThemes{
  min-height: 100vh;
  background: linear-gradient(180deg, #f5f7fb, #e9eef6);
  border: none;
  box-shadow: none;
  padding: 0;
}

.themes-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 40px;
}

.themes-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.empty-state{
  max-width: 520px;
  margin: 90px auto 0;
  text-align: center;
  padding: 36px 24px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(16,24,40,.08);
  backdrop-filter: blur(6px);
  opacity: 1;
}

.empty-state h2{
  margin: 8px 0 10px;
  font-size: 34px;
}

.empty-state p{
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.empty-icon{
  font-size: 54px;
  margin-bottom: 12px;
}

.themes-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}

.themes-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

#btnChangeLanguage,
#btnAddTheme,
#btnResumeGame,
#btnDeleteSave{
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
}

/* ===== PANTALLA TEMAS: CABECERA MÁS PRO ===== */

.themes-header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
  padding: 8px 0 0;
}

.themes-logo{
  display: flex;
  align-items: center;
}

.themes-logo img{
  width: 500px;
  max-width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 18px rgba(16,24,40,.10));
}

.themes-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* Unificar estilo de botones de la cabecera */
#btnChangeLanguage,
#btnResumeGame,
#btnDeleteSave,
#btnAddTheme{
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(16,24,40,.06);
}

/* Botón secundario */
#btnChangeLanguage,
#btnResumeGame,
#btnDeleteSave{
  background: none;
  border: 1px solid rgba(255,255,255,.95);
  color: #1f2937;
  backdrop-filter: none;
}

/* Botón principal */
#btnAddTheme{
  background: linear-gradient(135deg, #315efb, #254eda);
  color: white;
  border: none;
}

#btnAddTheme:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(37,78,218,.22);
}

#btnChangeLanguage:hover,
#btnResumeGame:hover,
#btnDeleteSave:hover{
  transform: translateY(-1px);
}

.top-actions{
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

/* ===== TARJETA CENTRAL MÁS CUIDADA ===== */

.empty-state{
  max-width: 560px;
  margin: 90px auto 0;
  text-align: center;
  padding: 40px 28px;
  background: rgba(255,255,255,0.76);
  border: 1px solid rgba(255,255,255,0.92);
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(16,24,40,.08);
  backdrop-filter: blur(10px);
  opacity: 1;
}

.empty-icon{
  font-size: 56px;
  margin-bottom: 14px;
}

.empty-state h2{
  margin: 8px 0 10px;
  font-size: 30px;
  line-height: 1.1;
}

.empty-state p{
  margin: 0;
  font-size: 17px;
  color: var(--muted);
}

.add-topic-btn{
  align-self: flex-start;
}

/* ===== TARJETAS DE TEMAS ===== */

.list{
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 16px;
}

.theme-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;

  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(255,255,255,0.95);
  border-radius: 22px;
  padding: 18px 20px;
  box-shadow: 0 12px 28px rgba(16,24,40,.07);
  backdrop-filter: blur(8px);

  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  cursor: pointer;
}

.theme-item:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(16,24,40,.10);
  border-color: rgba(49,94,251,.22);
}

.theme-item > div:first-child{
  min-width: 0;
}

.theme-name{
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 6px;
  color: #111827;
}

.theme-meta{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.theme-item > .theme-meta{
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(49,94,251,.08);
  color: #315efb;
  font-weight: 700;
  font-size: 13px;
}

.bg-biblioteca {
  background-image: url('biblioteca.jpg');
  background-color: var(--bg);
}

/* ===== VOCABULAPP THEMES FINAL OVERRIDES ===== */
body{
  overflow-x: hidden;
}

.bg-biblioteca{
  background-image: url("assets/biblioteca.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: var(--bg);
}

#screenThemes,
.bg-biblioteca #screenThemes{
  min-height: 100vh;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent !important;
  overflow: hidden;
}

.themes-layout{
  display: grid;
  grid-template-columns: minmax(780px, 1000px) 240px;
  gap: 24px;
  align-items: start;

  position: relative;
  top: 35px;
}

.themes-left{
  min-width: 0;
}

/*Para espacio entre logo y botones-> GAP*/
.themes-header{
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 4px !important;
  margin-bottom: 16px !important;
  padding: 0 !important;
  background: transparent !important;
}

.themes-logo img{
  width: 800px !important;
  max-width: 100%;
  height: auto;
  display: block;
  filter: none !important;
}

.themes-actions{
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 8px !important;
  margin-top: 0 !important;
}

.themed-image-btn,
#btnChangeLanguage,
#btnResumeGame,
#btnDeleteSave,
#btnAddTheme{
  min-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;
  box-shadow: none !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  cursor: pointer !important;
  transition: transform .15s ease, filter .15s ease !important;
}

.themed-image-btn{ height: 64px !important; }

#btnChangeLanguage{ width: 175px !important; background-image:url("assets/btn-idioma.png") !important;   transform: translateY(1px); /* baja solo este botón */
}
#btnResumeGame{ width: 175px !important; background-image:url("assets/btn-continuar.png") !important; }
#btnDeleteSave{ width: 175px !important; background-image:url("assets/btn-borrar.png") !important; }
#btnAddTheme{ width: 175px !important; background-image:url("assets/btn-anadir.png") !important; }

.themed-image-btn:hover,
#btnChangeLanguage:hover,
#btnResumeGame:hover,
#btnDeleteSave:hover,
#btnAddTheme:hover{
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.themed-image-btn span{
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.themes-panel-image{
  position: relative;
  width: 100%;
  max-width: 930px;
}

.themes-panel-image > img{
  width: 100%;
  display: block;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.themes-content{
  position: absolute;
  top: 122px;
  left: 52px;
  right: 52px;
  bottom: 42px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#themeList,
.themes-content .list{
  list-style: none !important;
  margin: 0 !important;
  padding: 0 6px 0 0 !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  display: block !important;
  background: transparent !important;
}

#themeList::-webkit-scrollbar{
  width: 10px;
}
#themeList::-webkit-scrollbar-track{
  background: rgba(10,20,60,.25);
  border-radius: 999px;
}
#themeList::-webkit-scrollbar-thumb{
  background: rgba(240,205,95,.72);
  border-radius: 999px;
  border: 2px solid rgba(10,20,60,.18);
}

.theme-item,
#themeList .theme-item{
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 16px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 14px 8px 12px !important;
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid rgba(239,220,152,.18) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  cursor: url("assets/cursor-vocabulapp.png") 2 2, auto;
  transform: none !important;
}

.theme-item:hover,
#themeList .theme-item:hover{
  background: rgba(255,255,255,.05) !important;
  box-shadow: none !important;
  border-color: transparent !important;
}

.theme-item:last-child{ border-bottom: none !important; }

.theme-item > div:first-child{ min-width: 0; }

.theme-name{
  margin: 0 0 3px 0 !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  color: #f4e5ab !important;
  text-shadow: 0 2px 2px rgba(0,0,0,.35);
}

.theme-meta{
  color: #dcc98d !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
  background: transparent !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
}

.theme-status{
  flex-shrink: 0 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  color: #f5d774 !important;
  margin-left: 12px !important;
}

.empty-state{
  display: none;
  max-width: 360px;
  margin: auto;
  text-align: center;
  padding: 18px 16px;
  background: rgba(8,23,72,.28) !important;
  border: 1px dashed rgba(234,202,100,.28) !important;
  border-radius: 16px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  opacity: 1 !important;
}

.empty-state h2{
  margin: 6px 0 8px;
  font-size: 24px;
  line-height: 1.1;
  color: #f7e7b0;
}

.empty-state p{
  margin: 0;
  color: #dcc98d;
  font-size: 14px;
}

.empty-icon{
  font-size: 36px;
  margin-bottom: 8px;
}

.themes-character-slot{
  min-height: 620px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

@media (max-width: 980px){
  .themes-layout{ grid-template-columns: 1fr; }
  .themes-character-slot{ display: none; }
}

@media (max-width: 900px){
  .themes-actions{ flex-wrap: wrap !important; }
  .themes-logo img{ width: 800px !important; }
  .themes-content{
    top: 108px;
    left: 38px;
    right: 38px;
    bottom: 34px;
  }
}

/* ===== Parche mínimo: borrar tema con X junto a "Nuevo" ===== */

/* ===== X de borrado más integrada con la estética fantasy ===== */

.theme-actions-right{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.theme-status{
  color: #f5d774;
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

.theme-delete{
  appearance: none;
  border: 1px solid rgba(222, 180, 76, 0.55);
  background: linear-gradient(180deg, rgba(35,69,127,.95), rgba(23,49,91,.95));
  color: #f3d36d;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.08),
    inset 0 -2px 3px rgba(0,0,0,.28),
    0 1px 3px rgba(0,0,0,.22);
  text-shadow: 0 1px 1px rgba(0,0,0,.45);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease, color .12s ease;
}

.theme-delete:hover{
  color: #ffd7d7;
  background: linear-gradient(180deg, rgba(145,42,42,.96), rgba(110,28,28,.96));
  border-color: rgba(255, 170, 170, 0.7);
  transform: scale(1.08);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.06),
    inset 0 -2px 3px rgba(0,0,0,.35),
    0 2px 5px rgba(0,0,0,.28);
}

.theme-delete:focus-visible{
  outline: 2px solid rgba(255, 228, 138, 0.95);
  outline-offset: 2px;
}

.theme-share{
  appearance: none;
  border: 1px solid rgba(222, 180, 76, 0.55);
  background: linear-gradient(180deg, rgba(35,69,127,.95), rgba(23,49,91,.95));
  color: #f3d36d;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.08),
    inset 0 -2px 3px rgba(0,0,0,.28),
    0 1px 3px rgba(0,0,0,.22);
  text-shadow: 0 1px 1px rgba(0,0,0,.45);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease, color .12s ease;
}

.theme-share:hover{
  color: #fff4c2;
  background: linear-gradient(180deg, rgba(58,96,165,.96), rgba(28,58,106,.96));
  border-color: rgba(255, 220, 140, 0.7);
  transform: scale(1.08);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.06),
    inset 0 -2px 3px rgba(0,0,0,.35),
    0 2px 5px rgba(0,0,0,.28);
}

.theme-share:focus-visible{
  outline: 2px solid rgba(255, 228, 138, 0.95);
  outline-offset: 2px;
}

/* ===== Monsieur Bête ===== */

.themes-layout{
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.themes-character-slot{
  min-height: 620px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
  position: relative;
  padding-top: 20px;
}

#monsieurBete{
  display: block;
  width: auto;
  max-width: 430px;   /* un poco más grande */
  max-height: none;
  height: auto;

  transform: translate(-45px, -20px); /* mover a la izquierda y arriba */

  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
  z-index: 2;
}

/* =========================
   PANTALLA INICIO VOCABULAPP
========================= */

.start-screen,
.pantalla-inicio {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* CONTENEDOR */
.welcome-panel {
  width: min(92vw, 720px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* LOGO */
.app-logo {
  width: min(85vw, 520px); /* más grande */
  margin-bottom: 10px;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.35));
}

/* COLEGIO */
.school-name {
  margin-bottom: 10px;
  font-size: 2rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* TEXTO */
.language-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 24px;
  text-shadow:
    0 0 6px rgba(255,255,255,0.2),
    0 2px 8px rgba(0,0,0,0.4);
}

/* BOTONES */
.language-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.lang-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lang-btn img {
  width: min(36vw, 240px);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.3));
}

/* HOVER */
.lang-btn:hover {
  transform: translateY(-4px) scale(1.05);
  filter: brightness(1.05);
}

/* CLICK */
.lang-btn:active {
 transform: scale(0.96);
  filter: brightness(0.95);
}

/* ===== ANIMACIÓN ENTRADA PANTALLA INICIO ===== */

.start-screen{
  animation: fadeInScreen 0.6s ease-out;
}

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

/* LOGO */
.app-logo{
  opacity: 0;
  transform: scale(0.85);
  animation: logoIn 0.6s ease-out forwards;
  animation-delay: 0.2s;
}

@keyframes logoIn{
  to{
    opacity: 1;
    transform: scale(1);
  }
}

/* TEXTO */
.school-name,
.language-title{
  opacity: 0;
  transform: translateY(10px);
  animation: textIn 0.5s ease-out forwards;
}

.school-name{
  animation-delay: 1.5s;
}

.language-title{
  animation-delay: 2s;
}

@keyframes textIn{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* BOTONES */
.language-buttons{
  opacity: 0;
  transform: translateY(30px);
  animation: buttonsIn 0.6s ease-out forwards;
  animation-delay: 2.5s;
}

@keyframes buttonsIn{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* HOVER (sensación de juego) */
.lang-btn img{
  transition: transform 0.2s ease, filter 0.2s ease;
}

.lang-btn:hover img{
  transform: scale(1.08);
  filter: brightness(1.1);
}

.lang-btn:active img{
  transform: scale(0.95);
}

/* ===== CONFIGURACIÓN LAYOUT ===== */

.config-layout{
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

/* Fondo panel */
.config-panel-bg{
  width: 100%;
  display: block;
}

/* Contenido encima */
.config-content{
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);

  width: 85%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Filas */
.config-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Labels */
.config-row label{
  color: #ffe48a;
  font-weight: bold;
  font-size: 14px;
}

/* Inputs y selects */
.config-row input,
.config-row select{
  padding: 6px;
  border-radius: 6px;
  border: 2px solid #c9a441;
  background: rgba(0,0,0,0.4);
  color: white;
}

/* Fases */
.phase-options{
  display: flex;
  gap: 10px;
}

/* Botones */
.config-btn{
  margin-top: 10px;
  padding: 8px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* Botón volver */
.back-btn{
  align-self: flex-start;
  background: #444;
  color: white;
}

/* Botón empezar */
.start-btn{
  background: gold;
  color: black;
}

/* ===== CONFIGURACIÓN ===== */

#screenConfig{
  min-height: 100vh;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

.config-layout{
  position: relative;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  top: 0px;
}

.config-panel-bg{
  width: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}

.config-content{
  position: absolute;
  top: 115px;            /* antes lo tienes demasiado abajo */
  left: 50%;
  transform: translateX(-50%);
  width: 72%;
  height: calc(100% - 155px);   /* para que quepa dentro */
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;      /* scroll dentro del panel */
  padding-right: 8px;
}

.config-content::-webkit-scrollbar{
  width: 10px;
}

.config-content::-webkit-scrollbar-track{
  background: rgba(10,20,60,.25);
  border-radius: 999px;
}

.config-content::-webkit-scrollbar-thumb{
  background: rgba(240,205,95,.72);
  border-radius: 999px;
  border: 2px solid rgba(10,20,60,.18);
}

.back-btn{
  align-self: flex-start;
  margin-bottom: 2px;    /* para que quede cerca de la línea */
}

.config-head{
  margin-bottom: 4px;
}

#configThemeTitle{
  margin: 0;
  color: #f5d774;
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 2px rgba(0,0,0,.35);
}

#configThemeMeta{
  margin: 4px 0 0;
  color: #dcc98d;
  font-size: 14px;
}

.config-row{
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-player-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.config-row input,
.config-row select{
  min-height: 42px;
  padding: 8px 12px;
}

.phase-options{
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.config-note{
  margin: 6px 0 0;
  color: #dcc98d;
  font-size: 13px;
}

.config-actions{
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ===== Ajuste de contraste en pantalla de Configuración ===== */

#screenConfig,
#screenConfig .config-content,
#screenConfig .config-row,
#screenConfig .config-head{
  color: #f5d774;
}

#screenConfig #configThemeTitle{
  color: #f5d774;
}

#screenConfig #configThemeMeta{
  color: #dcc98d;
}

#screenConfig .config-row label,
#screenConfig .config-label{
  color: #f5d774;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

#screenConfig input,
#screenConfig select,
#screenConfig textarea{
  color: #fff4c2;
  background: rgba(18, 39, 92, 0.55);
  border: 2px solid rgba(222, 180, 76, 0.85);
}

#screenConfig input::placeholder,
#screenConfig textarea::placeholder{
  color: rgba(255,244,194,0.72);
}

#screenConfig .phase-options,
#screenConfig .phase-options label{
  color: #f5d774;
}

#screenConfig .config-note{
  color: #dcc98d;
}

/* ===== Botón Volver flotante ===== */

#screenConfig{
  position: relative;
}

.btn-back-floating{
  position: absolute;
  top: 28px;      /* ajusta fino */
  left: 40px;     /* ajusta fino */

  background: none;
  border: none;

  color: #f5d774;
  font-size: 18px;
  font-weight: bold;
  font-family: inherit;

  cursor: pointer;

  text-shadow:
    0 2px 4px rgba(0,0,0,0.6),
    0 0 6px rgba(255,215,120,0.3);

  transition: all 0.2s ease;
}

.btn-back-floating:hover{
  transform: translateX(-3px);
  color: #fff4c2;
}

.btn-back-floating:active{
  transform: translateX(-1px);
}

#screenConfig{
  position: relative;
}

#screenConfig select option{
  color: #111827;
  background: #f6e7b8;
}

.btn-back-floating{
  position: absolute;
  top: 95px;
  left: 80px;
  z-index: 10;

  appearance: none;
  background: none !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.btn-back-floating img{
  display: block;
  width: 100px;
  height: auto;
}

.btn-back-floating:hover{
  transform: translateX(-2px);
  filter: brightness(1.06);
}

/* =========================
   GAMEPLAY LIMPIO Y AJUSTABLE
========================= */

#screenGame{
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100vw;
  height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  background: url("assets/gameplay-screen.png") center center / cover no-repeat !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  --ui-left: 255px;
  --ui-top: 30px;
  --ui-width: calc(75% - 180px);
  --ui-height: calc(100% - 120px);

  --title-size: 24px;
  --meta-size: 12px;
  --phase-size: 12px;
  --score-size: 13px;
  --board-title-size: 16px;
  --card-font-size: 14px;

  --exit-width: 160px;
  --exit-height: 62px;

  --cards-top: 170px;
  --board-gap: 60px;
  --cards-gap: 10px;
}

#screenGame.card{
  background: url("assets/gameplay-screen.png") center center / cover no-repeat !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#screenGame > *{
  position: relative;
  z-index: 1;
}

#screenGame .row.row-between:first-child,
#gameMeta,
#scoreBoard,
#screenGame .game-board{
  position: absolute;
  left: var(--ui-left);
  width: var(--ui-width);
  margin: 0;
  z-index: 2;
}

/* cabecera */
#screenGame .row.row-between:first-child{
  top: var(--ui-top);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#gameTitle{
  font-family: 'Cinzel', serif;
  font-weight: 600;

  font-size: 25px; /* ajusta si quieres */
  letter-spacing: 0px;

  color: #1f3a5f; /* azul marino elegante */

  text-shadow:
    0 1px 0 rgba(0,0,0,0.4),
    0 2px 4px rgba(0,0,0,0.3);
}

#btnExitGame{
  width: var(--exit-width);
  height: var(--exit-height);
  min-width: 0;
  padding: 0;
  border: none;
  background-color: transparent !important;
  background-image: url("assets/btn-salir.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: none !important;
  color: transparent;
  font-size: 0;
  cursor: pointer;
  overflow: hidden;
}

/* meta */
#gameMeta{
 font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 25px;
  font-weight: 600;

  color: #1f3a5f; /* azul marino */


}


/* score */
#scoreBoard{
  position: absolute !important;
  top: 150px !important;
  right: 600px !important;   /* ajusta fino si hace falta */
  left: auto !important;

  width: 320px !important;   /* espacio para 2 marcadores */
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 12px !important;

  margin: 0 !important;
  z-index: 5 !important;
}

#scoreBoard .score{
  width: auto !important;
  min-width: 110px !important;
  white-space: nowrap !important;
  text-align: center !important;
  flex: 0 0 auto !important;
}

/* tableros */
#screenGame .game-board{
  top: var(--cards-top);
  height: calc(var(--ui-height) - var(--cards-top));
  display: grid;
  grid-template-columns: 120px, 120px;
  gap: var(--board-gap);
  align-items: start;
}

#screenGame .game-board > div{
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: 100%;
}

#screenGame .game-board > div:first-child{
  border-right: none !important;
}

#screenGame .board-title{
  margin: 0 0 4px;
  font-size: var(--board-title-size);
  font-weight: 800;
  color: #6c4d24;
}

/* cartas */
#screenGame .board{
  height: 320px !important;   /* ajusta luego si quieres */
  
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-rows: 100px !important;   /* altura fija de carta */
  
  gap: var(--cards-gap) !important;

  align-content: start !important;

  overflow-y: auto !important;
  overflow-x: hidden !important;

  padding-right: 6px;
  box-sizing: border-box;
}

#screenGame .card-item{
  width: 100%;
  height: 100px !important;
  aspect-ratio: auto;
  border-radius: 16px;
}

#screenGame .card-inner{
  width: 100%;
  height: 100% !important;
  border-radius: 16px;
}

#screenGame .card-face{
  border-radius: 16px;

  /* Fondo tipo papel */
  background: linear-gradient(
    to bottom,
    #f4e7d3 0%,
    #ead7b8 100%
  );

  /* Ribete azul marino fino */
  border: 2px solid #1f3a5f;

  /* Sombra suave */
  box-shadow: 
    0 2px 6px rgba(0,0,0,.12),
    inset 0 0 10px rgba(0,0,0,.05);

  padding: 6px;
  font-size: var(--card-font-size);
}

@media (max-width: 980px){
  #screenGame .game-board{
    grid-template-columns: 1fr;
    height: auto;
  }

  #screenGame .game-board > div{
    height: auto;
  }

  #screenGame .board{
    height: 300px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 100px;
    gap: var(--cards-gap);
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    box-sizing: border-box;
  }

/* ===== Scroll personalizado del tablero ===== */

#screenGame .board::-webkit-scrollbar{
  width: 8px;
}

#screenGame .board::-webkit-scrollbar-track{
  background: rgba(60,40,20,0.10);
  border-radius: 10px;
}

#screenGame .board::-webkit-scrollbar-thumb{
  background: linear-gradient(to bottom, #d4a63a, #8a6423);
  border-radius: 10px;
}

#screenGame .board{
  scrollbar-width: thin;
  scrollbar-color: #a47a2a rgba(60,40,20,0.10);
}

#screenGame .board::before,
#screenGame .board::after{
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
  z-index: 3;
}

#screenGame .board::before{
  top: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.25), transparent);
}

#screenGame .board::after{
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,.25), transparent);
}

#screenGame .board::-webkit-scrollbar{
  width: 6px;
}

#screenGame .board::-webkit-scrollbar-thumb{
  background: linear-gradient(to bottom, #d4a63a, #8a6423);
  border-radius: 10px;
}

#screenGame .board::-webkit-scrollbar-track{
  background: rgba(0,0,0,0.08);
}

}

/* ===== AJUSTE FINO CABECERA GAMEPLAY ===== */

/* 1) La fila superior deja de repartir título y botón */
#screenGame .row.row-between:first-child{
  position: absolute !important;
  top: 66px !important;
  left: 255px !important;
  width: 620px !important;
  display: block !important;
  margin: 0 !important;
}

/* 2) Título: se queda en la "hoja izquierda" */
#gameTitle{
  margin: 0 !important;
  max-width: 620px !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
}

/* 3) Contador: se pone a la derecha, a la misma altura visual */
#gameMeta{
  position: absolute !important;
  top: 66px !important;
  right: 280px !important;
  left: auto !important;
  width: auto !important;
  max-width: 420px !important;
  margin: 0 !important;
  text-align: right !important;
  font-size: 14px !important;
 
  white-space: nowrap !important;
  z-index: 5 !important;
}

/* 4) Botón Salir: fuera del contenedor, arriba a la derecha */
#btnExitGame{
  position: fixed !important;
  top: 18px !important;
  right: 22px !important;
  width: 136px !important;
  height: 53px !important;
  z-index: 9999 !important;

  min-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background-color: transparent !important;
  background-image: url("assets/btn-salir.png") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: contain !important;

  color: transparent !important;
  font-size: 0 !important;
  overflow: hidden !important;
  cursor: pointer !important;
}


#scoreBoard{
  position: absolute !important;
  top: 145px !important;

  right: 270px !important;   /* ajusta fino aquí */
  left: auto !important;     /* MUY importante */
  width: auto !important;    /* MUY importante */

  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;

  margin: 0 !important;
  z-index: 5 !important;
}

#scoreBoard .score{
  display: inline-block;
  padding: 5px 10px;
  font-size: var(--score-size);
  font-weight: 800;

  min-width: 92px !important;
  width: auto !important;
  white-space: nowrap !important;
  text-align: center !important;
  flex: 0 0 auto !important;
}


/* =========================================
   AJUSTE FINAL DE POSICIÓN Y ANCHO DE BARRA
   ========================================= */

#screenGame #progressWrap{
  position: relative !important;
  display: block !important;

  /* más estrecha para que entre dentro del libro */
  width: calc(100% - 500px) !important;
  max-width: 1280px !important;

  /* centrada y MÁS ABAJO */
  margin: 100px auto 16px auto !important;

  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;

  z-index: 1 !important;
}

#screenGame #progressLabels{
  margin: 0 0 8px 0 !important;
  padding: 0 6px !important;
}

#screenGame #progressBar{
  margin: 0 !important;
}

/* por si algún contenedor superior la está empujando */
#screenGame .game-top,
#screenGame .game-header,
#screenGame .game-info{
  overflow: visible;
}

@keyframes pulseGold {
  0% { transform: translateY(-50%) scale(1); }
  50% { transform: translateY(-50%) scale(1.15); }
  100% { transform: translateY(-50%) scale(1); }
}

.progress-pulse::before,
.progress-pulse::after{
  animation: pulseGold 0.5s ease;
}

@keyframes glowComplete {
  0% { box-shadow: 0 0 0 rgba(255,215,100,0); }
  50% { box-shadow: 0 0 14px rgba(255,215,100,.8); }
  100% { box-shadow: 0 0 0 rgba(255,215,100,0); }
}

.progress-complete{
  animation: glowComplete 0.8s ease;
}

  #screenGame .board::-webkit-scrollbar{
    width: 6px;
  }

  #screenGame .board::-webkit-scrollbar-track{
    background: rgba(0,0,0,0.08);
    border-radius: 10px;
  }

  #screenGame .board::-webkit-scrollbar-thumb{
    background: linear-gradient(to bottom, #d4a63a, #8a6423);
    border-radius: 10px;
  }

  #screenGame .board{
    scrollbar-width: thin;
    scrollbar-color: #a47a2a rgba(60,40,20,0.10);
 
    scroll-behavior: smooth;
  }
@keyframes matchGlow {
  0% {
    box-shadow: 0 0 0 rgba(240,207,107,0);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 0 18px rgba(240,207,107,.9),
      0 0 6px rgba(240,207,107,.7) inset;
    transform: scale(1.04);
  }
  100% {
    box-shadow: 0 0 0 rgba(240,207,107,0);
    transform: scale(1);
  }
}

.card-item.matching .card-face{
  animation: matchGlow 0.35s ease;
}

.card-item{
  transform-style: preserve-3d;
}

/* =========================================
   SISTEMA DE MODALES VOCABULAPP
   ========================================= */

.dialog::backdrop{
  background: rgba(10, 18, 38, 0.62);
  backdrop-filter: blur(2px);
}

.app-dialog{
  width: min(680px, calc(100% - 32px)) !important;
  border: 3px solid #c9972f !important;
  border-radius: 22px !important;
  padding: 0 !important;
  background:
    linear-gradient(180deg, rgba(39,73,128,.98), rgba(21,43,79,.98)) !important;
  box-shadow:
    0 18px 40px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -1px 0 rgba(0,0,0,.18) !important;
  color: #f5e7ba !important;
  overflow: hidden;
}

.app-dialog-inner{
  padding: 22px 24px 20px !important;
}

.app-dialog-title{
  margin: 0 0 12px !important;
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  color: #f0cf6b;
  text-shadow: 0 2px 4px rgba(0,0,0,.35);
}

.app-dialog-text{
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
  color: #f8f0d2;
}

.app-dialog-actions{
  margin-top: 20px;
}

.app-btn-primary,
.app-btn-secondary{
  min-width: 132px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 14px !important;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, box-shadow .14s ease;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  box-sizing: border-box;
}
.app-btn-primary{
  border: 2px solid #d4a63a !important;
  color: #f8f3df !important;
  background: linear-gradient(180deg, #315efb, #1f3a5f) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.18),
    inset 0 -1px 0 rgba(0,0,0,.28),
    0 4px 10px rgba(0,0,0,.18);
}

.app-btn-secondary{
  border: 2px solid rgba(212,166,58,.75) !important;
  color: #f0cf6b !important;
  background: rgba(17,31,58,.72) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    inset 0 -1px 0 rgba(0,0,0,.24);
}

.app-btn-primary:hover,
.app-btn-secondary:hover{
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.app-btn-primary:active,
.app-btn-secondary:active{
  transform: translateY(0);
}

/* Versión estética para los dialogs ya existentes */
#themeDialog.dialog,
#bonusDialog.dialog,
#writeDialog.dialog{
  width: min(760px, calc(100% - 32px)) !important;
  border: 3px solid #c9972f !important;
  border-radius: 22px !important;
  padding: 0 !important;
  background:
    linear-gradient(180deg, rgba(39,73,128,.98), rgba(21,43,79,.98)) !important;
  box-shadow:
    0 18px 40px rgba(0,0,0,.35),
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -1px 0 rgba(0,0,0,.18) !important;
  color: #f5e7ba !important;
}

#themeDialog .dialog-inner,
#bonusDialog .dialog-inner,
#writeDialog .dialog-inner{
  padding: 22px 24px 20px !important;
}

#themeDialog .dialog-title,
#bonusDialog .dialog-title,
#writeDialog .dialog-title{
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 700;
  color: #f0cf6b;
  margin: 0 0 12px !important;
  text-shadow: 0 2px 4px rgba(0,0,0,.35);
}

#themeDialog .muted,
#bonusDialog .muted,
#writeDialog .muted,
#writeFeedback{
  color: #f8f0d2 !important;
}

#themeDialog .small,
#bonusDialog .small,
#writeDialog .small{
  color: #dcc98d !important;
}

#themeDialog input,
#themeDialog textarea,
#writeDialog input{
  background: rgba(247,235,201,.98) !important;
  color: #1b2333 !important;
  border: 2px solid #c9972f !important;
  border-radius: 14px !important;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}

#themeDialog input::placeholder,
#themeDialog textarea::placeholder,
#writeDialog input::placeholder{
  color: rgba(27,35,51,.55) !important;
}

#themeDialog .btn,
#bonusDialog .btn,
#writeDialog .btn{
  min-width: 132px;
  min-height: 46px;
  border-radius: 14px !important;
  font-weight: 800;
}

#themeDialog .btn-primary,
#bonusDialog .btn-primary,
#writeDialog .btn-primary{
  border: 2px solid #d4a63a !important;
  color: #f8f3df !important;
  background: linear-gradient(180deg, #315efb, #1f3a5f) !important;
}

#themeDialog .btn:not(.btn-primary),
#bonusDialog .btn:not(.btn-primary),
#writeDialog .btn:not(.btn-primary){
  border: 2px solid rgba(212,166,58,.75) !important;
  color: #f0cf6b !important;
  background: rgba(17,31,58,.72) !important;
}

/* ===== BOTÓN JUGAR (start-btn) ESTILO VOCABULAPP ===== */

.start-btn{
  border-radius: 14px;
  padding: 12px 20px;
  font-weight: 800;

  /* dorado con volumen */
  background: linear-gradient(
    180deg,
    #f7e7a1 0%,
    #e6c76b 35%,
    #d4a94f 55%,
    #b9872e 100%
  ) !important;

  border: 2px solid #8a6425 !important;

  /* efecto relieve */
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.6),
    inset 0 -3px 6px rgba(0,0,0,0.25),
    0 4px 10px rgba(0,0,0,0.25);

  /* texto azul */
  color: #1e3a8a !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);

  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}

/* hover */
.start-btn:hover{
  transform: translateY(-1px);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.7),
    inset 0 -3px 6px rgba(0,0,0,0.3),
    0 6px 14px rgba(0,0,0,0.3);
}

/* click */
.start-btn:active{
  transform: translateY(1px);
  box-shadow:
    inset 0 3px 6px rgba(0,0,0,0.35),
    0 2px 6px rgba(0,0,0,0.2);
}

/* =========================================================
   AJUSTES TABLET / iPAD
   Añadir al FINAL del CSS
   ========================================================= */

@media screen and (min-width: 768px) and (max-width: 1180px) {

  /* -------------------------
     REGLAS GENERALES TABLET
     ------------------------- */
  html,
  body{
    height: 100%;
    overflow-x: hidden;
  }

  body{
    -webkit-text-size-adjust: 100%;
  }

  .container{
    max-width: 100%;
    padding-left: 18px;
    padding-right: 18px;
  }

  /* =========================
     1) PANTALLA TEMAS
     Problema: pequeño aire abajo y scroll leve
     ========================= */

  .bg-biblioteca #screenThemes,
  #screenThemes{
    min-height: 100vh !important;
    height: auto !important;
    overflow: visible !important;
  }

  .themes-layout{
    grid-template-columns: minmax(0, 1fr) 250px !important;
    gap: 12px !important;
    align-items: start !important;
  }

  .themes-header{
    margin-bottom: 10px !important;
  }

  .themes-logo img{
    width: 620px !important;
    max-width: 100% !important;
  }

  .themes-actions{
    gap: 6px !important;
  }

  .themed-image-btn,
  #btnChangeLanguage,
  #btnResumeGame,
  #btnDeleteSave,
  #btnAddTheme{
    height: 52px !important;
  }

  #btnChangeLanguage,
  #btnResumeGame,
  #btnDeleteSave,
  #btnAddTheme{
    width: 148px !important;
  }

  .themes-panel-image{
    max-width: 100% !important;
  }

  .themes-content{
    top: 112px !important;
    left: 42px !important;
    right: 42px !important;
    bottom: 26px !important; /* antes dejaba demasiado aire abajo */
  }

  #themeList,
  .themes-content .list{
    padding-right: 10px !important;
    scrollbar-gutter: stable;
  }

  .themes-character-slot{
    min-height: 520px !important;
    padding-top: 8px !important;
  }

  #monsieurBete{
    max-width: 280px !important;
  }

  /* =========================
     2) PANTALLA CONFIGURACIÓN
     Problema: scrollbar interna poco visible
     ========================= */

  #screenConfig{
    min-height: 100vh !important;
    overflow: hidden !important;
  }

  .config-layout{
    max-width: 860px !important;
  }

  .config-content{
    top: 108px !important;
    width: 74% !important;
    height: calc(100% - 150px) !important;
    padding-right: 14px !important;
    padding-bottom: 12px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  /* En iPad la barra suele ser flotante, pero así gana presencia */
  .config-content::-webkit-scrollbar{
    width: 16px !important;
  }

  .config-content::-webkit-scrollbar-track{
    background: rgba(10,20,60,.34) !important;
    border-radius: 999px !important;
    border: 2px solid rgba(240,205,95,.20) !important;
  }

  .config-content::-webkit-scrollbar-thumb{
    background: linear-gradient(to bottom, #f0cf6b, #c8952f) !important;
    border-radius: 999px !important;
    border: 3px solid rgba(10,20,60,.22) !important;
  }

  .config-row label,
  #screenConfig .config-row label{
    font-size: 15px !important;
  }

  .config-row input,
  .config-row select{
    min-height: 46px !important;
    font-size: 16px !important;
  }

  .phase-options{
    gap: 14px 16px !important;
  }

  .btn-back-floating{
    top: 42px !important;
    left: 92px !important;
  }

  .btn-back-floating img{
    width: 92px !important;
  }

  .config-actions{
    padding-bottom: 4px !important;
  }

  .start-btn{
    min-width: 120px !important;
    min-height: 48px !important;
    font-size: 16px !important;
  }

  /* =========================
     3) PANTALLA DE FASE
     Problema: botón continuar apenas visible
     ========================= */

  .phase-content button{
    bottom: 28px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-width: 170px !important;
    min-height: 54px !important;
    padding: 12px 28px !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    border-radius: 14px !important;
    z-index: 20 !important;
    box-shadow: 0 6px 18px rgba(0,0,0,.35) !important;
  }

  .phase-content button:hover{
    transform: translateX(-50%) scale(1.03) !important;
  }

  /* =========================
     4) GAMEPLAY TABLET
     Problema principal: todo queda demasiado alto
     ========================= */

  #screenGame{
    --ui-left: 170px !important;
    --ui-top: 74px !important;
    --ui-width: calc(100% - 340px) !important;
    --ui-height: calc(100% - 130px) !important;

    --title-size: 22px !important;
    --meta-size: 13px !important;
    --phase-size: 13px !important;
    --score-size: 13px !important;
    --board-title-size: 17px !important;
    --card-font-size: 13px !important;

    --cards-top: 212px !important;   /* baja el bloque de cartas */
    --board-gap: 44px !important;
    --cards-gap: 10px !important;

    background-position: center center !important;
    background-size: cover !important;
  }

  /* título del tema */
  #screenGame .row.row-between:first-child{
    top: 88px !important;
    left: 178px !important;
    width: 470px !important;
  }

  #gameTitle{
    font-size: 20px !important;
    line-height: 1.05 !important;
    max-width: 470px !important;
  }

  /* meta de fase / parejas / aciertos */
  #gameMeta{
    top: 90px !important;
    right: 174px !important;
    font-size: 13px !important;
    max-width: 330px !important;
  }

  /* barra progreso: más abajo y un poco más ancha */
  #screenGame #progressWrap{
    width: calc(100% - 350px) !important;
    max-width: none !important;
    margin: 122px auto 16px auto !important;
  }

  #screenGame #progressLabels{
    font-size: 14px !important;
    margin-bottom: 7px !important;
  }

  #screenGame #progressTrack{
    height: 12px !important;
  }

  /* puntos */
  #scoreBoard{
    top: 168px !important;
    right: 168px !important;
    gap: 8px !important;
  }

  #scoreBoard .score{
    min-width: 88px !important;
    font-size: 12px !important;
    padding: 5px 9px !important;
  }

  /* idiomas + tableros */
  #screenGame .game-board{
    top: 218px !important;
    left: 178px !important;
    width: calc(100% - 356px) !important;
    height: auto !important;
    gap: 38px !important;
    grid-template-columns: 1fr 1fr !important;
    align-items: start !important;
  }

  #screenGame .board-title{
    margin-bottom: 8px !important;
    font-size: 15px !important;
  }

  #screenGame .board{
    height: 255px !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 84px !important;
    gap: 9px !important;
    padding-right: 8px !important;
  }

  #screenGame .card-item{
    height: 84px !important;
  }

  #screenGame .card-inner{
    height: 84px !important;
  }

  #screenGame .card-face{
    font-size: 12px !important;
    padding: 6px !important;
  }

  /* botón salir */
  #btnExitGame{
    top: 14px !important;
    right: 14px !important;
    width: 112px !important;
    height: 46px !important;
  }

  /* scroll del tablero algo más visible */
  #screenGame .board::-webkit-scrollbar{
    width: 10px !important;
  }

  #screenGame .board::-webkit-scrollbar-track{
    background: rgba(0,0,0,0.12) !important;
    border-radius: 10px !important;
  }

  #screenGame .board::-webkit-scrollbar-thumb{
    background: linear-gradient(to bottom, #d4a63a, #8a6423) !important;
    border-radius: 10px !important;
    border: 2px solid rgba(0,0,0,0.10) !important;
  }

  #screenGame .board{
    scrollbar-width: auto !important;
  }
}

/* =========================================================
   EXTRA: iPad/tablet algo más pequeña
   ========================================================= */
@media screen and (min-width: 768px) and (max-width: 920px) {

  .themes-layout{
    grid-template-columns: 1fr 210px !important;
  }

  .themes-logo img{
    width: 560px !important;
  }

  #monsieurBete{
    max-width: 230px !important;
  }

  #screenGame{
    --ui-left: 145px !important;
    --ui-width: calc(100% - 290px) !important;
    --cards-top: 205px !important;
  }

  #screenGame .row.row-between:first-child{
    left: 150px !important;
    width: 420px !important;
  }

  #gameMeta{
    right: 150px !important;
  }

  #scoreBoard{
    right: 145px !important;
  }

  #screenGame .game-board{
    left: 150px !important;
    width: calc(100% - 300px) !important;
    gap: 28px !important;
  }

  #screenGame #progressWrap{
    width: calc(100% - 300px) !important;
  }
}

/* =================================
   AJUSTE TEMAS iPAD
   ================================= */

@media screen and (max-width: 1180px){

  .themes-layout{
    grid-template-columns: 780px 300px !important;
    justify-content: center;
    gap: 18px !important;
  }

  .themes-panel-image{
    max-width: 780px !important;
  }

  .themes-character-slot{
    min-height: 620px !important;
    align-items: flex-end !important;
  }

  #monsieurBete{
    max-width: 360px !important;
  }

}

/* =========================================
   GAMEPLAY iPAD / TABLET - AJUSTE FINO REAL
   Pegar AL FINAL del CSS
   ========================================= */

@media screen and (min-width: 768px) and (max-width: 1180px) {

  /* Base general del gameplay */
  #screenGame{
    --ui-left: 220px !important;
    --ui-width: calc(100% - 440px) !important;
    --ui-height: calc(100% - 120px) !important;

    --cards-top: 214px !important;
    --board-gap: 44px !important;
    --cards-gap: 10px !important;

    --board-title-size: 15px !important;
    --card-font-size: 12px !important;
    --score-size: 12px !important;
  }

  /* =========================
     1) TÍTULO DEL TEMA
     ========================= */
  #screenGame .row.row-between:first-child{
    position: absolute !important;
    top: 148px !important;
    left: 220px !important;
    width: 360px !important;
    display: block !important;
    margin: 0 !important;
  }

  #gameTitle{
    margin: 0 !important;
    max-width: 360px !important;
    font-size: 21px !important;
    line-height: 1.05 !important;
  }

  /* =========================
     2) META SUPERIOR DERECHA
     ========================= */
  #gameMeta{
    position: absolute !important;
    top: 150px !important;
    right: 205px !important;
    left: auto !important;
    width: auto !important;
    max-width: 340px !important;
    margin: 0 !important;
    text-align: right !important;
    white-space: nowrap !important;
    font-size: 13px !important;
    z-index: 5 !important;
  }

  /* =========================
     3) BARRA DE PROGRESO
     ========================= */
  #screenGame #progressWrap{
    position: relative !important;
    display: block !important;
    width: calc(100% - 440px) !important;
    max-width: none !important;
    margin: 182px auto 14px auto !important;
    z-index: 2 !important;
  }

  #screenGame #progressLabels{
    font-size: 13px !important;
    margin: 0 0 6px 0 !important;
    padding: 0 6px !important;
  }

  #screenGame #progressTrack{
    height: 12px !important;
  }

  #screenGame #progressBar{
    padding: 0 16px !important;
  }

  /* =========================
     4) PUNTOS
     ========================= */
  #scoreBoard{
    position: absolute !important;
    top: 224px !important;
    right: 202px !important;
    left: auto !important;
    width: auto !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    z-index: 5 !important;
  }

  #scoreBoard .score{
    min-width: 94px !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  /* =========================
     5) TABLEROS
     ========================= */
  #screenGame .game-board{
    position: absolute !important;
    top: 254px !important;
    left: 220px !important;
    width: calc(100% - 440px) !important;
    height: auto !important;

    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 34px !important;
    align-items: start !important;
    margin: 0 !important;
    z-index: 3 !important;
  }

  #screenGame .game-board > div{
    height: auto !important;
    min-height: 0 !important;
  }

  /* títulos idioma */
  #screenGame .board-title{
    margin: 0 0 10px 0 !important;
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  /* rejilla de cartas */
  #screenGame .board{
    height: 260px !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 86px !important;
    gap: 9px !important;
    align-content: start !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;

    padding-right: 8px !important;
    box-sizing: border-box !important;
    scrollbar-width: auto !important;
  }

  #screenGame .card-item{
    width: 100% !important;
    height: 86px !important;
  }

  #screenGame .card-inner{
    height: 86px !important;
  }

  #screenGame .card-face{
    padding: 6px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
  }

  /* Scroll visible del tablero */
  #screenGame .board::-webkit-scrollbar{
    width: 10px !important;
  }

  #screenGame .board::-webkit-scrollbar-track{
    background: rgba(0,0,0,0.10) !important;
    border-radius: 10px !important;
  }

  #screenGame .board::-webkit-scrollbar-thumb{
    background: linear-gradient(to bottom, #d4a63a, #8a6423) !important;
    border-radius: 10px !important;
    border: 2px solid rgba(0,0,0,0.08) !important;
  }

  /* =========================
     6) BOTÓN SALIR
     ========================= */
  #btnExitGame{
    top: 18px !important;
    right: 18px !important;
    width: 120px !important;
    height: 48px !important;
  }
}

/* =========================================
   GAMEPLAY iPAD algo más estrecho
   ========================================= */
@media screen and (min-width: 768px) and (max-width: 920px) {

  #screenGame{
    --ui-left: 190px !important;
    --ui-width: calc(100% - 380px) !important;
  }

  #screenGame .row.row-between:first-child{
    left: 190px !important;
    width: 320px !important;
  }

  #gameTitle{
    max-width: 320px !important;
  }

  #gameMeta{
    right: 178px !important;
  }

  #screenGame #progressWrap{
    width: calc(100% - 380px) !important;
  }

  #scoreBoard{
    right: 176px !important;
  }

  #screenGame .game-board{
    left: 190px !important;
    width: calc(100% - 380px) !important;
    gap: 26px !important;
  }
}

@media screen and (min-width: 768px) and (max-width: 1180px) {

  #screenGame{
    --ui-left: 220px !important;
    --ui-width: calc(100% - 440px) !important;
    --ui-height: calc(100dvh - 120px) !important;

    --hud-top: 108px !important;
    --progress-top: 142px !important;
    --boards-top: 214px !important;
  }

  #screenGame .row.row-between:first-child{
    top: var(--hud-top) !important;
  }

  #gameMeta{
    top: calc(var(--hud-top) + 2px) !important;
  }

  #screenGame #progressWrap{
    margin: var(--progress-top) auto 14px auto !important;
  }

  #screenGame .game-board{
    top: var(--boards-top) !important;
  }

  #scoreBoard{
    top: calc(var(--boards-top) - 30px) !important;
  }
}


/* =========================================
   GAMEPLAY iPAD HORIZONTAL - BLOQUE ÚNICO
   ========================================= */
@media screen and (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {

  #screenGame{
    --ui-left: 220px !important;
    --ui-width: calc(100% - 440px) !important;
    --ui-height: calc(100% - 120px) !important;

    --hud-top: 148px !important;
    --progress-top: 182px !important;
    --boards-top: 254px !important;

    --board-gap: 34px !important;
    --cards-gap: 9px !important;
    --board-title-size: 15px !important;
    --card-font-size: 12px !important;
    --score-size: 12px !important;
  }

  #screenGame .row.row-between:first-child{
    position: absolute !important;
    top: var(--hud-top) !important;
    left: 220px !important;
    width: 360px !important;
    display: block !important;
    margin: 0 !important;
  }

  #gameTitle{
    margin: 0 !important;
    max-width: 360px !important;
    font-size: 21px !important;
    line-height: 1.05 !important;
  }

  #gameMeta{
    position: absolute !important;
    top: calc(var(--hud-top) + 2px) !important;
    right: 205px !important;
    left: auto !important;
    width: auto !important;
    max-width: 340px !important;
    margin: 0 !important;
    text-align: right !important;
    white-space: nowrap !important;
    font-size: 13px !important;
    z-index: 5 !important;
  }

  #screenGame #progressWrap{
    position: relative !important;
    display: block !important;
    width: calc(100% - 440px) !important;
    max-width: none !important;
    margin: var(--progress-top) auto 14px auto !important;
    z-index: 2 !important;
  }

  #screenGame #progressLabels{
    font-size: 13px !important;
    margin: 0 0 6px 0 !important;
    padding: 0 6px !important;
  }

  #screenGame #progressTrack{
    height: 12px !important;
  }

  #screenGame #progressBar{
    padding: 0 16px !important;
  }

  #scoreBoard{
    position: absolute !important;
    top: calc(var(--boards-top) - 30px) !important;
    right: 202px !important;
    left: auto !important;
    width: auto !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 0 !important;
    z-index: 5 !important;
  }

  #scoreBoard .score{
    min-width: 94px !important;
    width: auto !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  #screenGame .game-board{
    position: absolute !important;
    top: var(--boards-top) !important;
    left: 220px !important;
    width: calc(100% - 440px) !important;
    height: auto !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 34px !important;
    align-items: start !important;
    margin: 0 !important;
    z-index: 3 !important;
  }

  #screenGame .game-board > div{
    height: auto !important;
    min-height: 0 !important;
  }

  #screenGame .board-title{
    margin: 0 0 10px 0 !important;
    font-size: 15px !important;
    line-height: 1.1 !important;
  }

  #screenGame .board{
    height: 260px !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    grid-auto-rows: 86px !important;
    gap: 9px !important;
    align-content: start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 8px !important;
    box-sizing: border-box !important;
  }

  #screenGame .card-item{
    width: 100% !important;
    height: 86px !important;
  }

  #screenGame .card-inner{
    height: 86px !important;
  }

  #screenGame .card-face{
    padding: 6px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
  }

  #btnExitGame{
    top: 18px !important;
    right: 18px !important;
    width: 120px !important;
    height: 48px !important;
  }
}


/* =========================================
   GAMEPLAY NUEVO SISTEMA
   Fondo + libro separado
   ========================================= */

#screenGame{
  position: fixed;
  inset: 0;
  z-index: 40;
  width: 100vw;
  height: 100vh;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  background: url("assets/gameplay-screen.png") center center / cover no-repeat !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* Libro independiente */
.gameplay-book{
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(94vw, 1320px);
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

/* Todo el HUD va por encima del libro */
#screenGame > *:not(.gameplay-book){
  position: relative;
  z-index: 2;
}

/* =========================================
   GAMEPLAY PC - referencia inicial
   ========================================= */

#screenGame{
  --book-ui-left: 250px;
  --book-ui-width: calc(100% - 500px);

  --hud-top: 72px;
  --progress-top: 112px;
  --score-top: 160px;
  --boards-top: 198px;
}

/* título */
#screenGame .row.row-between:first-child{
  position: absolute !important;
  top: var(--hud-top) !important;
  left: var(--book-ui-left) !important;
  width: 430px !important;
  display: block !important;
  margin: 0 !important;
}

#gameTitle{
  margin: 0 !important;
  max-width: 430px !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
}

/* meta derecha */
#gameMeta{
  position: absolute !important;
  top: calc(var(--hud-top) + 2px) !important;
  right: 250px !important;
  left: auto !important;
  width: auto !important;
  max-width: 360px !important;
  margin: 0 !important;
  text-align: right !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  z-index: 5 !important;
}

/* barra */
#screenGame #progressWrap{
  position: relative !important;
  display: block !important;
  width: var(--book-ui-width) !important;
  max-width: none !important;
  margin: var(--progress-top) auto 14px auto !important;
  z-index: 2 !important;
}

#screenGame #progressLabels{
  font-size: 14px !important;
  margin: 0 0 6px 0 !important;
  padding: 0 6px !important;
}

#screenGame #progressTrack{
  height: 12px !important;
}

#screenGame #progressBar{
  padding: 0 16px !important;
}

/* puntos */
#scoreBoard{
  position: absolute !important;
  top: var(--score-top) !important;
  right: 246px !important;
  left: auto !important;
  width: auto !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  z-index: 5 !important;
}

#scoreBoard .score{
  min-width: 94px !important;
  width: auto !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  text-align: center !important;
}

/* tableros */
#screenGame .game-board{
  position: absolute !important;
  top: var(--boards-top) !important;
  left: var(--book-ui-left) !important;
  width: var(--book-ui-width) !important;
  height: auto !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 34px !important;
  align-items: start !important;
  margin: 0 !important;
  z-index: 3 !important;
}

#screenGame .game-board > div{
  height: auto !important;
  min-height: 0 !important;
}

#screenGame .board-title{
  margin: 0 0 10px 0 !important;
  font-size: 15px !important;
  line-height: 1.1 !important;
}

#screenGame .board{
  height: 305px !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-rows: 86px !important;
  gap: 9px !important;
  align-content: start !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 8px !important;
  box-sizing: border-box !important;
}

#screenGame .card-item{
  width: 100% !important;
  height: 86px !important;
}

#screenGame .card-inner{
  height: 86px !important;
}

#screenGame .card-face{
  padding: 6px !important;
  font-size: 12px !important;
  border-radius: 14px !important;
}

/* botón salir */
#btnExitGame{
  position: fixed !important;
  top: 18px !important;
  right: 18px !important;
  width: 120px !important;
  height: 48px !important;
  z-index: 9999 !important;
}

/* =========================================
   iPAD / TABLET horizontal
   ========================================= */

@media screen and (min-width: 768px) and (max-width: 1180px) and (orientation: landscape){

  .gameplay-book{
    width: min(96vw, 1240px) !important;
  }

  #screenGame{
    --book-ui-left: 220px;
    --book-ui-width: calc(100% - 440px);

    --hud-top: 148px;
    --progress-top: 182px;
    --score-top: 224px;
    --boards-top: 254px;
  }

  #screenGame .row.row-between:first-child{
    left: 220px !important;
    width: 360px !important;
  }

  #gameTitle{
    max-width: 360px !important;
    font-size: 21px !important;
  }

  #gameMeta{
    right: 205px !important;
    max-width: 340px !important;
    font-size: 13px !important;
  }

  #screenGame #progressWrap{
    width: calc(100% - 440px) !important;
  }

  #scoreBoard{
    right: 202px !important;
  }

  #screenGame .game-board{
    left: 220px !important;
    width: calc(100% - 440px) !important;
  }
}

/* =========================================
   FIX REAL tras añadir gameplay-book
   ========================================= */

/* 1) El libro queda detrás */
.gameplay-book{
  position: absolute !important;
  left: 50% !important;
  bottom: -55px !important;
  transform: translateX(-50%) !important;
  width: min(94vw, 1320px) !important;
  height: auto !important;
  z-index: 1 !important;
  pointer-events: none !important;
  user-select: none !important;
}

/* 2) Ya NO dependemos de :first-child */
#screenGame > .row.row-between{
  position: absolute !important;
  top: var(--hud-top, 88px) !important;
  left: var(--book-ui-left, 230px) !important;
  width: 430px !important;
  display: block !important;
  margin: 0 !important;
  z-index: 5 !important;
}

/* 3) Título visible */
#screenGame > .row.row-between #gameTitle{
  margin: 0 !important;
  max-width: 430px !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
  z-index: 6 !important;
}

/* 4) Meta visible */
#gameMeta{
  position: absolute !important;
  top: calc(var(--hud-top, 88px) + 2px) !important;
  right: 250px !important;
  left: auto !important;
  width: auto !important;
  max-width: 360px !important;
  margin: 0 !important;
  text-align: right !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  z-index: 6 !important;
}

/* 5) Barra forzada por encima y con posición clara */
#screenGame #progressWrap{
  position: absolute !important;
  top: var(--progress-top, 128px) !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  width: var(--book-ui-width, calc(100% - 500px)) !important;
  max-width: none !important;
  margin: 0 !important;
  z-index: 6 !important;
}

/* 6) Puntos y tableros por encima */
#scoreBoard{
  z-index: 7 !important;
}

#screenGame .game-board{
  z-index: 8 !important;
}


/* =========================================
   AJUSTE FINO GAMEPLAY PC
   ========================================= */

#screenGame{
  --book-ui-left: 228px !important;
  --book-ui-width: calc(100% - 450px) !important;

  --hud-top: 72px !important;
  --progress-top: 112px !important;
  --score-top: 160px !important;
  --boards-top: 198px !important;
}

#screenGame > .row.row-between{
  width: 480px !important;
}

#screenGame > .row.row-between #gameTitle{
  max-width: 480px !important;
}

#gameMeta{
  right: 235px !important;
  max-width: 420px !important;
}

#screenGame #progressWrap{
  width: var(--book-ui-width, calc(100% - 430px)) !important;
}

#scoreBoard{
  right: 230px !important;
}

#screenGame .game-board{
  left: var(--book-ui-left, 235px) !important;
  width: var(--book-ui-width, calc(100% - 430px)) !important;
  gap: 50px !important;
}

#screenGame .board{
  height: 305px !important;
}

.tutorial-bubble {
  position: absolute;
  top: 165px;
  right: 300px;
  width: 440px;
  height: 293px;
  background-image: url("assets/speech-bubble.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  z-index: 30;
  pointer-events: none;
  filter: drop-shadow(-6px 6px 6px rgba(0,0,0,0.25));
}

.tutorial-bubble.is-visible {
  animation: bubbleAppear 0.35s ease-out;
}

@keyframes bubbleAppear {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.tutorial-bubble__text {
  position: absolute;
  top: 64px;
  left: 55px;
  right: 78px;
  bottom: 78px;

  display: flex;
  align-items: center;
  justify-content: center;

  text-align: center;

  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
  color: #1F3A6D;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);

  white-space: pre-line;
}

.tutorial-bubble__arrow {
  position: absolute;
  right: 218px;
  bottom: 22px;

  font-size: 42px;
  color: #D9A21B;

  animation: bubbleArrowBlink 1.1s infinite ease-in-out;
  pointer-events: auto;
  cursor: pointer;
}

@keyframes bubbleArrowBlink{
  0%{
    opacity:0.4;
    transform:translateX(0);
  }
  50%{
    opacity:1;
    transform:translateX(5px);
  }
  100%{
    opacity:0.4;
    transform:translateX(0);
  }
}




/* =========================================================
   GAMEPLAY CLEAN REPLACEMENT
   Libro + HUD en un mismo sistema
   ========================================================= */

#screenGame.gameplay-clean{
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: url("assets/gameplay-screen.png") center center / cover no-repeat !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#screenGame.gameplay-clean > *{
  position: relative;
  z-index: auto;
}

#screenGame.gameplay-clean .gameplay-stage{
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;

  width: min(94vw, 1320px) !important;
  height: auto !important;
}

#screenGame.gameplay-clean .gameplay-book{
  position: relative !important;
  display: block !important;

  width: 100% !important;
  height: auto !important;

  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  inset: auto !important;
  transform: none !important;

  z-index: 1 !important;
  pointer-events: none !important;
  user-select: none !important;
}

#screenGame.gameplay-clean .gameplay-hud{
  position: absolute !important;
  left: 50% !important;
  top: 18% !important;
  transform: translateX(-50%) !important;

  width: 65% !important;
  z-index: 3 !important;
}

/* CABECERA */
#screenGame.gameplay-clean .gameplay-header{
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 20px !important;
  width: 100% !important;
  margin: 0 !important;
}

#screenGame.gameplay-clean .gameplay-header-main{
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

#screenGame.gameplay-clean .row,
#screenGame.gameplay-clean .row-between,
#screenGame.gameplay-clean .row-end{
  justify-content: initial;
}

#screenGame.gameplay-clean .gameplay-header .row.row-between,
#screenGame.gameplay-clean > .row.row-between,
#screenGame.gameplay-clean .gameplay-hud > .row.row-between{
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  margin: 0 !important;
  display: block !important;
}

#screenGame.gameplay-clean #gameTitle{
  margin: 0 0 4px 0 !important;
  max-width: 520px !important;
  font-family: 'Cinzel', serif !important;
  font-size: 22px !important;
  line-height: 1.05 !important;
  color: #1f3a5f !important;
  text-shadow:
    0 1px 0 rgba(0,0,0,0.4),
    0 2px 4px rgba(0,0,0,0.3) !important;
}

#screenGame.gameplay-clean #gameMeta{
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: 520px !important;
  margin: 0 !important;
  font-family: 'Cinzel', serif !important;
  font-size: 14px !important;
  color: #1f3a5f !important;
  text-align: left !important;
  white-space: nowrap !important;
}


/* BARRA */
#screenGame.gameplay-clean #progressWrap{
  position: static !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  z-index: auto !important;
}

#screenGame.gameplay-clean #progressLabels{
  position: relative !important;
  width: 100% !important;
  margin: 0 0 8px 0 !important;
  padding: 0 6px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  font-family: 'Cinzel', serif !important;
  font-size: 15px !important;
  line-height: 1 !important;
  color: #7a5a24 !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
}

#screenGame.gameplay-clean #progressBar{
  position: relative !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 16px !important;
  box-sizing: border-box !important;
}

#screenGame.gameplay-clean #progressTrack{
  position: relative !important;
  width: 100% !important;
  height: 12px !important;
  margin: 0 !important;
}

#screenGame.gameplay-clean #progressFill{
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

/* SCORE */
#screenGame.gameplay-clean #scoreBoard{
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  margin: 0 0 0 auto !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  z-index: auto !important;
}

#screenGame.gameplay-clean #scoreBoard .score{
  min-width: 94px !important;
  width: auto !important;
  padding: 5px 10px !important;
  font-size: 12px !important;
  white-space: nowrap !important;
  text-align: center !important;
  flex: 0 0 auto !important;
}

/* TABLEROS */
#screenGame.gameplay-clean .game-board{
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 34px !important;
  align-items: start !important;
  z-index: auto !important;
}

#screenGame.gameplay-clean .game-board-col,
#screenGame.gameplay-clean .game-board > div{
  min-width: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

#screenGame.gameplay-clean .game-board > div:first-child{
  border-right: none !important;
}

#screenGame.gameplay-clean .board-title{
  margin: 0 0 10px 0 !important;
  font-size: 15px !important;
  line-height: 1.1 !important;
  color: #6c4d24 !important;
}

#screenGame.gameplay-clean .board{
  height: 300px !important;
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-rows: 86px !important;
  gap: 9px !important;
  align-content: start !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 8px !important;
  box-sizing: border-box !important;
}

#screenGame.gameplay-clean .card-item{
  width: 100% !important;
  height: 86px !important;
}

#screenGame.gameplay-clean .card-inner{
  height: 86px !important;
}

#screenGame.gameplay-clean .card-face{
  padding: 6px !important;
  font-size: 12px !important;
  border-radius: 14px !important;
}

/* AJUSTE TABLET */
@media screen and (min-width: 768px) and (max-width: 1180px){
  #screenGame.gameplay-clean .gameplay-hud{
    top: 148px !important;
    width: min(62vw, 720px) !important;
    gap: 12px !important;
  }

  #screenGame.gameplay-clean #gameTitle{
    max-width: 360px !important;
    font-size: 21px !important;
  }

  #screenGame.gameplay-clean #gameMeta{
    max-width: 340px !important;
    font-size: 13px !important;
  }

  #screenGame.gameplay-clean .game-board{
    gap: 26px !important;
  }

  #screenGame.gameplay-clean .board{
    height: 260px !important;
    grid-auto-rows: 84px !important;
  }

  #screenGame.gameplay-clean .card-item,
  #screenGame.gameplay-clean .card-inner{
    height: 84px !important;
  }

  #screenGame.gameplay-clean .card-face{
    font-size: 12px !important;
  }

  #screenGame.gameplay-clean #btnExitGame{
    width: 112px !important;
    height: 46px !important;
  }
}


/* =========================
   AJUSTE FINO GAMEPLAY
========================= */

#screenGame.gameplay-clean .gameplay-hud{
  top: 12.5% !important;
  width: 72% !important;
}

#screenGame.gameplay-clean .gameplay-hud > .row.row-between #gameTitle{
  max-width: 520px !important;
  font-size: 22px !important;
}

#screenGame.gameplay-clean .gameplay-hud > #gameMeta{
  max-width: 420px !important;
  margin: -2px 0 0 auto !important;
  text-align: right !important;
}

#screenGame.gameplay-clean .gameplay-hud > #scoreBoard{
  margin: 6px 0 6px auto !important;
}

#screenGame.gameplay-clean .gameplay-hud > .game-board{
  gap: 54px !important;
}

#btnExitGame{
  position: fixed !important;
  top: 18px !important;
  right: 118px !important;
  width: 120px !important;
  height: 48px !important;
  z-index: 9999 !important;
}

@media screen and (min-width: 768px) and (max-width: 1180px){
  #screenGame.gameplay-clean .gameplay-hud{
    top: 13.5% !important;
    width: 74% !important;
  }

  #screenGame.gameplay-clean .gameplay-hud > .game-board{
    gap: 44px !important;
  }

  #btnExitGame{
    top: 14px !important;
    right: 14px !important;
    width: 112px !important;
    height: 46px !important;
  }
}

//*BOTON SALIR A LA DERECHA*//
#screenGame #btnExitGame{
  position: fixed !important;
  top: 18px !important;
  right: 18px !important;
  left: auto !important;

  width: 120px !important;
  height: 48px !important;

  z-index: 9999 !important;
}


/* ===== FORZAR BOTÓN SALIR ARRIBA DERECHA ===== */

#screenGame > #btnExitGame{
  position: fixed !important;
  inset: 18px 18px auto auto !important;

  left: auto !important;
  right: 18px !important;
  top: 18px !important;
  bottom: auto !important;

  margin: 0 !important;
  transform: none !important;
  float: none !important;

  width: 120px !important;
  height: 48px !important;

  z-index: 99999 !important;
}

@media screen and (max-width: 1180px){
  #screenGame.gameplay-clean .gameplay-hud{
    top: 10% !important;
  }

  #screenGame.gameplay-clean .game-board .board{
    height: 280px !important;
  }
}

@media screen and (max-width: 1180px){
  #screenConfig #btnBack{
    top: 82px !important;
    left: 170px !important;
  }
}

/* =========================================
   iPAD HORIZONTAL - TEMAS como en PC
   Pegar AL FINAL del CSS
   ========================================= */
@media screen and (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {

  .themes-layout{
    grid-template-columns: minmax(0, 1fr) 250px !important;
    gap: 12px !important;
  }

  .themes-left{
    max-width: 860px !important;
  }

  .themes-logo img{
    width: 800px !important;
    max-width: 100% !important;
  }

  .themes-actions{
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }

  #btnChangeLanguage,
  #btnResumeGame,
  #btnDeleteSave,
  #btnAddTheme{
    width: 194px !important;
    height: 65px !important;
  }

  .themes-panel-image{
    max-width: 800px !important;
  }

  .themes-content{
    top: 118px !important;
    left: 46px !important;
    right: 46px !important;
    bottom: 32px !important;
  }

  .themes-character-slot{
    min-height: 460px !important;
    padding-top: 4px !important;
    align-items: flex-end !important;
  }

  #monsieurBete{
    max-width: 460px !important;
    transform: translate(-45px, -5px) !important;
  }

  .tutorial-bubble{
    top: 165px !important;
    right: 210px !important;
    width: 440px !important;
    height: 293px !important;
  }

  .tutorial-bubble__text{
    top: 64px !important;
    left: 55px !important;
    right: 78px !important;
    bottom: 78px !important;
    font-size: 24px !important;
    line-height: 1.2 !important;
  }


/* =========================================
   iPAD / SAFARI - subir botón Continuar
   Pantallas Fase / Victory / Final
   ========================================= */
@media screen and (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) {
  .phase-content button,
  #btnContinuePhase{
    bottom: 86px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-width: 170px !important;
    min-height: 54px !important;
    z-index: 30 !important;
  }

  .phase-content button:hover,
  #btnContinuePhase:hover{
    transform: translateX(-50%) scale(1.03) !important;
  }
}
  .tutorial-bubble__arrow{
    right: 218px !important;
    bottom: 22px !important;
    font-size: 42px !important;
  }
}

/* =========================================
   iPAD / SAFARI - quitar selección azul en cartas
   ========================================= */
#screenGame .card-item,
#screenGame .card-inner,
#screenGame .card-face{
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  outline: none !important;
}

#screenGame .card-item:focus,
#screenGame .card-item:active,
#screenGame .card-inner:focus,
#screenGame .card-inner:active,
#screenGame .card-face:focus,
#screenGame .card-face:active{
  outline: none !important;
  box-shadow: none !important;
}

#screenGame .board{
  -webkit-tap-highlight-color: transparent !important;
}





/* =========================================
   iPAD - bajar panel de configuración
   ========================================= */
@media screen and (min-width: 768px) and (max-width: 1366px) and (orientation: landscape){
  .config-layout{
    margin-top: 48px !important;
  }
}




/* =========================================================
   TEMAS - SEPARACIÓN EXACTA PC vs iPad TÁCTIL
   Basado en los valores exactos ya usados por el usuario.
   No toca gameplay.
   ========================================================= */

/* -------- ESCRITORIO / PORTÁTIL --------
   Valores exactos de PC:
   - banderola 800px
   - botones 175x64
   - panel 930px
   - contenido 122 / 52 / 52 / 42
   - Monsieur Bête 430px + translate(-45px,-20px)
   - bocadillo top 165, right 235, 440x293
*/
@media screen and (min-width: 981px) and (hover: hover) and (pointer: fine) {

  .themes-layout{
    grid-template-columns: minmax(720px, 1fr) 320px !important;
    gap: 16px !important;
    align-items: start !important;
  }

  .themes-left{
    min-width: 0 !important;
    max-width: none !important;
  }

  .themes-logo img{
    width: 800px !important;
    max-width: 100% !important;
    height: auto !important;
    filter: none !important;
  }

  .themes-actions{
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 0 !important;
  }

  #btnChangeLanguage,
  #btnResumeGame,
  #btnDeleteSave,
  #btnAddTheme{
    width: 175px !important;
    height: 64px !important;
  }

  .themes-panel-image{
    max-width: 930px !important;
  }

  .themes-content{
    top: 122px !important;
    left: 52px !important;
    right: 52px !important;
    bottom: 42px !important;
  }

  .themes-character-slot{
    min-height: 620px !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    overflow: visible !important;
    position: relative !important;
    padding-top: 20px !important;
  }

  #monsieurBete{
    display: block !important;
    width: auto !important;
    max-width: 430px !important;
    height: auto !important;
    max-height: none !important;
    transform: translate(-45px, -20px) !important;
    pointer-events: none !important;
    user-select: none !important;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45)) !important;
    z-index: 2 !important;
  }

  .tutorial-bubble{
    top: 165px !important;
    right: 235px !important;
    width: 440px !important;
    height: 293px !important;
  }

  .tutorial-bubble__text{
    top: 64px !important;
    left: 55px !important;
    right: 78px !important;
    bottom: 78px !important;
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  .tutorial-bubble__arrow{
    right: 218px !important;
    bottom: 22px !important;
    font-size: 42px !important;
  }
}

/* -------- iPAD TÁCTIL HORIZONTAL --------
   Valores exactos que el usuario dejó bien en iPad:
   - banderola 800px
   - botones 194x65
   - panel 800px
   - contenido 118 / 46 / 46 / 32
   - Monsieur Bête 460px + translate(-45px,-5px)
   - bocadillo top 165, right 210, 440x293
*/
@media screen and (min-width: 768px) and (max-width: 1366px) and (orientation: landscape) and (hover: none) and (pointer: coarse) {

  .themes-layout{
    grid-template-columns: minmax(0, 1fr) 250px !important;
    gap: 12px !important;
    align-items: start !important;
  }

  .themes-left{
    max-width: 860px !important;
    min-width: 0 !important;
  }

  .themes-logo img{
    width: 800px !important;
    max-width: 100% !important;
    height: auto !important;
    filter: none !important;
  }

  .themes-actions{
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    margin-top: 0 !important;
  }

  #btnChangeLanguage,
  #btnResumeGame,
  #btnDeleteSave,
  #btnAddTheme{
    width: 194px !important;
    height: 65px !important;
  }

  .themes-panel-image{
    max-width: 800px !important;
  }

  .themes-content{
    top: 118px !important;
    left: 46px !important;
    right: 46px !important;
    bottom: 32px !important;
  }

  .themes-character-slot{
    min-height: 460px !important;
    padding-top: 4px !important;
    align-items: flex-end !important;
  }

  #monsieurBete{
    max-width: 460px !important;
    transform: translate(-45px, -5px) !important;
  }

  .tutorial-bubble{
    top: 165px !important;
    right: 210px !important;
    width: 440px !important;
    height: 293px !important;
  }

  .tutorial-bubble__text{
    top: 64px !important;
    left: 55px !important;
    right: 78px !important;
    bottom: 78px !important;
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  .tutorial-bubble__arrow{
    right: 218px !important;
    bottom: 22px !important;
    font-size: 42px !important;
  }
}

button,
a,
.card-item,
.theme-item,
.theme-delete,
.lang-btn,
.audio-toggle,
.themed-image-btn,
#btnExitGame,
#btnChangeLanguage,
#btnResumeGame,
#btnDeleteSave,
#btnAddTheme{
  cursor: url("assets/cursor-vocabulapp.png") 2 2, pointer !important;
}

