  :root{
    --bg:#fffaf6;
    --card:#ffffff;
    --muted:#6b7280;
    --accent-pink: #f6b3f0;
    --accent-purple: #c48be3;
    --accent-sky: #9bd3ff;
    --accent-yellow:#ffd166;
    --green:#4ade80;
    --orange:#f59e0b;
    --red:#fb6b6b;
    --white-flag:#e9eef9;
    --pastel-green: #46a049;
    --pastel-green-hover: #04AA6D;
    --pastel-red: #da190b;
    --pastel-red-hover: #f44336;
    --pastel-gray: #e7e7e7;
    --pastel-gray-hover: #d0d0d0;
    --pastel-orange: #ff9800;
    --pastel-orange-hover: #ffb74d;
    --radius:14px;
    --shadow: 0 12px 32px rgba(10,20,40,0.06);
  }
  /* Page layout */
  *{box-sizing:border-box;font-family:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial;}
  body{margin:0;background:linear-gradient(135deg,var(--bg),#f0fbff);color:#05204a;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:0;}
  .app{width:90vw;height:90vh;max-width:90vw;max-height:90vh;background:linear-gradient(180deg,rgba(255,255,255,0.98),rgba(255,255,255,0.96));border-radius:16px;padding:18px;box-shadow:var(--shadow);position:relative;border:1px solid rgba(10,20,40,0.04);overflow:auto;}

  header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:8px;position:relative;}
  h1{margin:0;font-size:28px;font-weight:800;color:#072040;font-family:"Fredoka One", Inter, system-ui;display:flex;align-items:center;gap:12px;}
  h1 img{width:36px;height:36px;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,0.1);}
  p.lead{margin:6px 0 12px 0;color:var(--muted);font-size:13px;}

  /* Top-right diet toggle container */
  .topright { position:absolute; right:18px; top:18px; display:flex; gap:12px; align-items:center; }
  .topright stripe-buy-button { display:inline-block; }
  .donate-wrapper { display:inline-flex; align-items:center; }

  /* Diet dropdown */
  .diet-dropdown {
    position: relative;
    background: linear-gradient(90deg, #fff, #fbfbff);
    border-radius: 12px;
    border: 1px solid rgba(10, 20, 40, 0.04);
    min-width: 140px;
  }
  
  .dropdown-selected {
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    color: #05204a;
    transition: all 0.2s ease;
  }
  
  .dropdown-selected:hover {
    background: rgba(10, 20, 40, 0.02);
  }
  
  .dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s ease;
  }
  
  .diet-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
  }
  
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid rgba(10, 20, 40, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(10, 20, 40, 0.12);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    margin-top: 4px;
  }
  
  .diet-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    transition: all 0.15s ease;
    border-radius: 8px;
    margin: 4px;
  }
  
  .dropdown-item:hover {
    background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple));
    color: #04122a;
    transform: translateX(2px);
  }
  
  .dropdown-item.active {
    background: linear-gradient(90deg, var(--accent-pink), var(--accent-purple));
    color: #04122a;
    font-weight: 800;
  }  /* layout grid */
  .main-grid{display:grid;grid-template-columns:1fr 640px;gap:18px;grid-template-areas:"left right" "tasks tasks";}
  .left-column{grid-area:left;}
  .right-column{grid-area:right;}
  .tasks-section{grid-area:tasks;}
  .card{background:var(--card);padding:14px;border-radius:12px;border:1px solid rgba(10,20,40,0.03);}

  /* Users and controls column */
  .controls-row{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px;}
  .left-controls { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }

  /* Buttons: match your attached style */
  .pill-btn {
    --w:220px; height:52px; display:inline-flex;align-items:center;justify-content:center;gap:10px;
    border-radius:999px;padding:0 20px;border:none;cursor:pointer;font-weight:800;font-size:16px;color:white;
    box-shadow: 0 10px 22px rgba(12,20,40,0.06); transition:transform .12s ease, filter .12s ease;
    text-transform:uppercase; letter-spacing:1px;
    font-family: "Fredoka One", Inter, sans-serif;
  }
  .pill-btn:active{transform:translateY(2px) scale(.995);}
  .pill-btn.small { height:38px; font-size:13px; padding:0 12px; border-radius:999px; font-weight:700; text-transform:none; font-family:Inter; }

  /* QUIT style (left) - pastel pink with small white square icon on the right */
  .pill-quit{
    background:linear-gradient(90deg,var(--accent-pink), #ffd6f8); color:#3b1b46;
  }
  .pill-quit .sym { width:18px; height:18px; border-radius:3px; background:white; box-shadow:0 2px 6px rgba(0,0,0,0.06); display:inline-block; }
  /* RESUME style (right) - purple */
  .pill-resume{
    background:linear-gradient(90deg,var(--accent-purple), #c1a0f7); color:#fff;
  }
  .pill-resume .sym { width:0;height:0;border-left:8px solid white;border-top:6px solid transparent;border-bottom:6px solid transparent; display:inline-block; transform:translateX(2px); }

  /* OFFTOPIC style - orange gradient with pause lines */
  .pill-offtopic{
    background: var(--pastel-orange); 
    color: white;
    transition: all 0.3s ease;
  }
  .pill-offtopic:hover:not(:disabled) {
    background: var(--pastel-orange-hover);
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.4);
    transform: translateY(-2px);
  }
  .pill-offtopic:disabled {
    background: #ccc;
    color: #888;
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
  }
  .pill-offtopic .sym { 
    width:16px; height:16px; display:inline-flex; align-items:center; justify-content:center; gap:2px;
  }
  .pill-offtopic .sym::before,
  .pill-offtopic .sym::after {
    content: '';
    width: 3px;
    height: 12px;
    background: white;
    border-radius: 1px;
  }

  /* STOP OFFTOPIC style - green gradient */
  .pill-stop-offtopic{
    background: var(--pastel-green); 
    color: white;
    transition: all 0.3s ease;
  }
  .pill-stop-offtopic:hover:not(:disabled) {
    background: var(--pastel-green-hover);
    box-shadow: 0 8px 20px rgba(4, 170, 109, 0.4);
    transform: translateY(-2px);
  }
  .pill-stop-offtopic .sym { 
    width:16px; height:16px; display:inline-flex; align-items:center; justify-content:center;
  }
  .pill-stop-offtopic .sym::before {
    content: '';
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 2px;
  }
  .pill-stop-offtopic:disabled { opacity:0.5; cursor:not-allowed; box-shadow: none; transform: none; }
  
  /* Iconos SVG integrados para botón offtopic */
  #offtopicBtnIcon {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
  }
  
  /* Other action buttons */
  .btn-fun { 
    background: var(--pastel-green); 
    color: white; 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:800; 
    cursor:pointer;
    border: none;
    transition: all 0.3s ease;
  }
  .btn-fun:hover {
    background: var(--pastel-green-hover);
    box-shadow: 0 8px 20px rgba(4, 170, 109, 0.4);
    transform: translateY(-2px);
  }
  
  .btn-ghost { 
    background:transparent; 
    border:1px solid rgba(10,20,40,0.06); 
    color:var(--muted); 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:700; 
    cursor:pointer;
    transition: all 0.3s ease;
  }
  .btn-ghost:hover {
    background: rgba(10,20,40,0.05);
    box-shadow: 0 4px 12px rgba(10,20,40,0.15);
    transform: translateY(-1px);
  }
  
  .btn-shuffle { 
    background: var(--pastel-gray); 
    color: #333; 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:800; 
    cursor:pointer;
    border: none;
    transition: all 0.3s ease;
  }
  .btn-shuffle:hover {
    background: var(--pastel-gray-hover);
    box-shadow: 0 8px 20px rgba(231, 231, 231, 0.6);
    transform: translateY(-2px);
  }
  
  .btn-danger { 
    background: var(--pastel-red); 
    color: white; 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:800; 
    cursor:pointer;
    border: none;
    transition: all 0.3s ease;
  }
  .btn-danger:hover {
    background: var(--pastel-red-hover);
    box-shadow: 0 8px 20px rgba(244, 67, 54, 0.4);
    transform: translateY(-2px);
  }
  
  /* Play/Pause button dynamic colors */
  .btn-play { 
    background: var(--pastel-green); 
    color: white; 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:700; 
    cursor:pointer;
    border: none;
    transition: all 0.3s ease;
  }
  .btn-play:hover {
    background: var(--pastel-green-hover);
    box-shadow: 0 8px 20px rgba(4, 170, 109, 0.4);
    transform: translateY(-2px);
  }
  
  .btn-pause { 
    background: var(--pastel-red); 
    color: white; 
    padding:8px 12px; 
    border-radius:10px; 
    font-weight:700; 
    cursor:pointer;
    border: none;
    transition: all 0.3s ease;
  }
  .btn-pause:hover {
    background: var(--pastel-red-hover);
    box-shadow: 0 8px 20px rgba(244, 67, 54, 0.4);
    transform: translateY(-2px);
  }

  /* Icon-only large Play/Pause (for playPauseBtn2) */
  #playPauseBtn2 {
    width: 52px;
    height: 52px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
  }
  #playPauseBtn2 svg { width: 22px; height: 22px; fill: currentColor; display:block; }

  /* Match prev/next 2 to the same square size */
  #prevBtn2, #nextBtn2 {
    width: 52px;
    height: 52px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
  }
  #prevBtn2 svg, #nextBtn2 svg { width: 22px; height: 22px; display:block; }

  /* Form inputs */
  input[type="text"], input[type="number"], textarea { width:100%; padding:10px 12px; border-radius:10px; border:1px solid rgba(10,20,40,0.06); font-size:14px; }
  textarea { min-height:90px; resize:vertical; }

  /* Users list */
  .users-list { display:flex;flex-direction:column; gap:10px; margin-top:12px; max-height:420px; overflow:auto; padding-right:4px; }
  .user-row { display:flex; align-items:center; gap:10px; padding:10px; border-radius:10px; background:linear-gradient(180deg,#fff,#fbfdff); border:1px solid rgba(10,20,40,0.03); cursor:move; transition:all 0.2s ease; }
  .user-row.selected { outline:3px solid rgba(179,137,237,0.18); box-shadow:0 12px 30px rgba(128,90,170,0.06); }
  .user-row:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(10,20,40,0.08); }
  .user-row[draggable="true"] { cursor:grab; }
  .user-row[draggable="true"]:active { cursor:grabbing; }
  .user-row.drag-over { border:2px dashed var(--accent-purple); background:rgba(196,139,227,0.1); }
  .user-row.dragging { opacity:0.5; transform:rotate(5deg); }
  .flag { width:36px; text-align:center; font-size:18px; }
  .user-meta { flex:1; min-width:0; }
  .user-name { font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .user-sub { color:var(--muted); font-size:13px; margin-top:4px; }

  .user-actions { display:flex; gap:8px; align-items:center; }

  /* Collapsible Users panel */
  .users-panel { border:1px solid rgba(10,20,40,0.12) !important; padding:12px; border-radius:12px; }
  .users-panel-header { display:flex; justify-content:space-between; align-items:center; cursor:pointer; }
  .users-panel-header .chevron { font-size:12px; transition: transform .2s ease; }
  .users-panel.collapsed .users-panel-header .chevron { transform: rotate(-90deg); }
  .users-panel-content { overflow:hidden; transition:max-height .25s ease, opacity .2s ease; }
  .users-panel.collapsed .users-panel-content { max-height:0; opacity:0; margin-top:0 !important; }
  /* Right column: timers, image, summary */
  .timer-display { font-size:32px; font-weight:900; color:#05204a; }
  .image-box { 
    width:100%; 
    max-width:540px; 
    display:flex; 
    align-items:center; 
    justify-content:center; 
    overflow:hidden; 
  }
  .image-box img { 
    width:100%; 
    height:auto; 
    object-fit:contain; 
    background:transparent; 
  }

  /* Flags stats badges (top-right) */
  .stats { display:flex; gap:8px; align-items:center; }
  .badge { display:inline-flex; gap:8px; align-items:center; padding:6px 12px; border-radius:999px; font-weight:800; font-size:13px; color:white; }
  .badge.white { background:var(--white-flag); color:#042040; border:1px solid rgba(10,20,40,0.04); }  .badge.green { background:var(--green); }
  .badge.orange { background:var(--orange); }
  .badge.red { background:var(--red); }
  /* Tasks table styling */
  .tasks-table { width:100%; border-collapse:collapse; margin-top:8px; font-size:13px; }
  .tasks-table th { background:linear-gradient(180deg,#f8f9fa,#e9ecef); padding:8px; text-align:left; font-weight:700; border:1px solid rgba(10,20,40,0.06); }
  .tasks-table td { padding:6px 8px; border:1px solid rgba(10,20,40,0.06); vertical-align:top; }
  .tasks-table tbody tr:nth-child(even) { background:rgba(0,0,0,0.01); }
  .state-group { margin-bottom:16px; }
  .state-header { font-weight:700; color:#072040; margin-bottom:4px; padding:4px 0; border-bottom:2px solid rgba(10,20,40,0.06); }
  /* Responsive */
  @media(max-width:1400px){ .main-grid{grid-template-columns:1fr 1fr;grid-template-areas:"left right" "tasks tasks";} }
  @media(max-width:1100px){ .main-grid{grid-template-columns:1fr;grid-template-areas:"left" "right" "tasks";} .panel.vertical{grid-template-columns:1fr 1fr;} }
  
  /* Mobile responsive fixes */
  @media(max-width:768px){
    .app { width:100vw; height:100vh; max-width:100vw; max-height:100vh; padding:12px; }
    
    /* Header mobile fixes */
    header { flex-direction:column; gap:12px; position:relative; }
    .topright { position:static; margin-top:8px; justify-content:flex-start; flex-wrap:wrap; }
    h1 { font-size:24px; }
    h1 img { width:30px; height:30px; }
    
    /* Offtopic buttons same width */
    .pill-btn.pill-offtopic, .pill-btn.pill-stop-offtopic { 
      min-width:200px; 
      flex:1; 
      max-width:250px; 
    }
    
    /* Controls responsive */
    .controls-row { flex-direction:column; align-items:stretch; gap:8px; }
    .left-controls { justify-content:center; }
    
    /* Stats badges responsive */
    .stats { flex-wrap:wrap; gap:6px; }
    .badge { font-size:11px; padding:4px 8px; }
    
    /* Diet dropdown responsive */
    .diet-dropdown { min-width:120px; }
    
    /* Footer responsive */
    .app-footer { gap:12px; flex-wrap:wrap; }
    .footer-btn { font-size:11px; padding:5px 8px; }
  }
  
  @media(max-width:480px){
    .app { width:100vw; height:100vh; max-width:100vw; max-height:100vh; padding:8px; }
    body { padding:0; }
    
    /* Header extra small screens */
    h1 { font-size:20px; gap:8px; }
    h1 img { width:24px; height:24px; }
    
    /* Offtopic buttons stack on very small screens */
    .left-controls { flex-direction:column; }
    .pill-btn.pill-offtopic, .pill-btn.pill-stop-offtopic { 
      min-width:100%; 
      max-width:100%; 
    }
    
    /* Stats compact */
    .stats { gap:4px; }
    .badge { font-size:10px; padding:3px 6px; }
  }

  /* Modal styles */
  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
  }
  
  .modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 80vw;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(10, 20, 40, 0.04);
  }
  
  .ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 13px;
  }
  
  .ranking-table th {
    background: linear-gradient(180deg, #f8f9fa, #e9ecef);
    padding: 12px 8px;
    text-align: left;
    font-weight: 700;
    border: 1px solid rgba(10, 20, 40, 0.06);
  }
  
  .ranking-table td {
    padding: 10px 8px;
    border: 1px solid rgba(10, 20, 40, 0.06);
    vertical-align: middle;
  }
  
  .ranking-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.01);
  }
  
  .ranking-table .rank-medal {
    font-size: 18px;
    text-align: center;
  }

  /* Cookie and Privacy Consent Styles */
  .consent-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
  }

  /* Intro Modal Styles */
  .intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25000;
  }

  /* Message Modal (alerts replacement) */
  .message-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.75);
    display: flex; align-items: center; justify-content: center;
    z-index: 26000;
  }
  .message-modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: min(520px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(10, 20, 40, 0.06);
    text-align: left;
  }
  .message-modal h3 {
    margin: 0 0 12px 0;
    font-family: "Fredoka One", Inter, system-ui;
    color: #072040;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .message-body {
    color: #374151;
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 16px;
    max-height: 40vh;
    overflow: auto;
  }
  .message-actions { display:flex; justify-content:flex-end; }
  
  .intro-modal {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 90vw;
    height: 90vh;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(10, 20, 40, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
  }
  
  .intro-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(90vh - 200px);
  }
  
  .intro-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  }
  
  .intro-start-btn {
    background: linear-gradient(90deg, var(--pastel-green), var(--pastel-green-hover));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 16px 40px;
    font-size: 18px;
    font-weight: 800;
    font-family: "Fredoka One", Inter, system-ui;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(70, 160, 73, 0.3);
  }
  
  .intro-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(70, 160, 73, 0.4);
    background: linear-gradient(90deg, var(--pastel-green-hover), var(--pastel-green));
  }
  
  .intro-start-btn:active {
    transform: translateY(-1px);
  }

    .tour-start-btn {
      background: linear-gradient(90deg, var(--pastel-gray), var(--pastel-gray-hover));
      color: #333;
      border: none;
      border-radius: 50px;
      padding: 16px 40px;
      font-size: 18px;
      font-weight: 800;
      font-family: "Fredoka One", Inter, system-ui;
      text-transform: uppercase;
      letter-spacing: 1px;
      cursor: pointer;
      transition: all 0.3s ease;
      box-shadow: 0 8px 25px rgba(120, 120, 120, 0.2);
    }
  
    .tour-start-btn:hover {
      transform: translateY(-3px);
      box-shadow: 0 12px 35px rgba(120, 120, 120, 0.3);
      background: linear-gradient(90deg, var(--pastel-gray-hover), var(--pastel-gray));
    }
  
    .tour-start-btn:active {
      transform: translateY(-1px);
    }
  
  .consent-modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    margin: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(10, 20, 40, 0.04);
    text-align: center;
  }
  
  .consent-modal h3 {
    margin: 0 0 16px 0;
    font-family: "Fredoka One", Inter, system-ui;
    color: #072040;
    font-size: 20px;
  }
  
  .consent-modal p {
    margin: 0 0 20px 0;
    color: #374151;
    line-height: 1.6;
    font-size: 14px;
  }

  /* Tour modal layout: ocupar 80% de la pantalla y evitar reflow entre imágenes */
  .consent-modal.tour-modal {
    width: 60vw;
    aspect-ratio: 1 / 1;   /* mantener 1:1 */
    height: auto;          /* calculada por aspect-ratio */
    max-width: 60vw;
    max-height: 90vh;      /* no exceder alto de la pantalla */
    display: flex;
    flex-direction: column;
  }
  /* Responsive: en pantallas pequeñas, dar más ancho relativo */
  @media(max-width: 900px){
    .consent-modal.tour-modal { width: 90vw; max-width: 90vw; aspect-ratio: 1 / 1; height: auto; max-height: 90vh; }
  }

  /* Overlay del tour con mayor opacidad (blanco semitransparente) */
  .tour-overlay { background: rgba(255, 255, 255, 0.9); }
  #tourContent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 100%;
    min-height: 0; /* permite que el hijo flexible se contraiga correctamente */
  }
  .tour-grid {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
    align-items: stretch;
  }
  .tour-cell.image, .tour-cell.text { min-width:0; min-height:0; display:flex; }
  .tour-cell.text { align-items:stretch; }
  .tour-col { display:flex; flex-direction:column; height:100%; min-height:0; }
  .tour-col.align-top { justify-content:flex-start; }
  .tour-col.align-bottom { justify-content:flex-end; }
  .tour-card { display:flex; flex-direction:column; gap:10px; max-width:100%; }
  .tour-card .tour-frame { flex:0 0 auto; }
  .tour-card .tour-image { width:100%; height:auto; max-height:32vh; object-fit:contain; }
  .tour-image-cell, .tour-text-cell { min-width: 0; min-height: 0; display:flex; }
  .tour-image-cell { align-items: stretch; }
  .tour-text-cell { align-items: center; }
  .tour-caption {
    width: 100%;
    height: 100%;
    background: #fff;
    border: 1px solid rgba(10,20,40,0.06);
    border-radius: 12px;
    padding: 16px;
    color: #374151;
    font-size: clamp(14px, 1.1vw, 18px);
    line-height: 1.6;
    box-shadow: 0 6px 16px rgba(7,32,64,0.06);
    text-align: left;
    overflow: auto;                /* permitir scroll interno */
    -webkit-overflow-scrolling: touch; /* scroll suave en iOS */
  }
  .tour-caption h4 { 
    margin: 0 0 8px 0; 
    font-size: clamp(20px, 2vw, 28px); 
    line-height: 1.25; 
    color: #072040;
    font-family: "Fredoka One", Inter, system-ui;
  }
  .tour-caption ul { 
    margin: 8px 0 0 18px; 
    padding: 0; 
  }
  .tour-caption li { 
    margin: 6px 0; 
  }
  .tour-caption p { 
    margin: 6px 0; 
    text-align: left; 
  }
  .tour-nav {
    display:flex; gap:12px; justify-content:space-between; width:100%; align-items:center; margin-top:8px;
  }
  /* Botones más grandes en Tour */
  #tourPrev, #tourNext, #tourSkip {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
  }
  /* Primario más destacado */
  #tourNext.btn-fun { font-weight: 900; }
  /* Contador centrado */
  .tour-counter { color:#072040; font-weight:800; font-size:14px; }
  /* Unificar estilo del visor del tour */
  .tour-frame {
    width: 100%;
    flex: 1 1 auto;        /* ocupar el espacio disponible sin forzar reflow */
    min-height: 0;          /* importante para que el contenido flexible funcione */
    background: #f7f9fc;
    border: 1px solid rgba(10,20,40,0.06);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 20px rgba(7, 32, 64, 0.06);
    overflow: hidden;
  }
  .tour-image {
    width: 100%;
    height: 100%;
    object-fit: contain;    /* la imagen se ajusta sin deformarse */
    border-radius: 12px;
    display: block;
  }

  /* Responsive: en móviles, apilar en una sola columna */
  @media(max-width: 900px){
    .tour-grid { grid-template-columns: 1fr; }
  }
  
  .consent-status {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    font-size: 13px;
    color: #495057;
  }
  
  .consent-status.accepted {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
  }
  
  .consent-status.declined {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
  }
  
  .consent-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
  }
  
  /* Footer styles */
  .app-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 8px;
    display: flex;
    justify-content: center;
    gap: 16px;
    border-top: 1px solid rgba(10, 20, 40, 0.06);
    z-index: 1000;
  }
  
  .footer-btn {
    background: var(--pastel-gray);
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  
  .footer-btn:hover {
    background: var(--pastel-gray-hover);
    transform: translateY(-1px);
  }

/* Mobile Detection Modal */
.mobile-detection-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25500;
  padding: 20px;
  box-sizing: border-box;
}

.mobile-detection-content {
  background: white;
  border-radius: 24px;
  padding: 2rem;
  max-width: 90vw;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: slideInUp 0.6s ease-out;
}

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

.mobile-detection-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.mobile-detection-content h2 {
  color: #2d3748;
  font-family: "Fredoka One", system-ui;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.mobile-detection-content p {
  color: #4a5568;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.mobile-detection-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 12px;
  text-align: left;
}

.feature-icon {
  font-size: 1.5rem;
  min-width: 30px;
}

.mobile-detection-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn-mobile-primary,
.btn-mobile-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 60px;
}

.btn-mobile-primary {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.btn-mobile-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-mobile-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 2px solid #e2e8f0;
}

.btn-mobile-secondary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.btn-icon {
  font-size: 1.2rem;
}

.mobile-detection-note {
  color: #64748b;
  font-size: 0.9rem;
}

/* Responsive adjustments for very small screens */
@media (max-width: 480px) {
  .mobile-detection-content {
    padding: 1.5rem;
    margin: 10px;
    border-radius: 20px;
  }
  
  .mobile-detection-icon {
    font-size: 3rem;
  }
  
  .mobile-detection-content h2 {
    font-size: 1.5rem;
  }
  
  .mobile-detection-content p {
    font-size: 1rem;
  }
  
  .mobile-detection-features {
    gap: 0.75rem;
  }
  
  .feature-item {
    padding: 0.5rem;
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  
  .btn-mobile-primary,
  .btn-mobile-secondary {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    min-height: 50px;
  }
}

@media (max-width: 320px) {
  .mobile-detection-content {
    padding: 1rem;
    margin: 5px;
  }
  
  .mobile-detection-icon {
    font-size: 2.5rem;
  }
  
  .mobile-detection-content h2 {
    font-size: 1.3rem;
  }
}

/* Session Recovery Modal */
.session-recovery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 24000;
  padding: 20px;
  box-sizing: border-box;
}

.session-recovery-content {
  background: white;
  border-radius: 24px;
  padding: 2rem;
  max-width: 90vw;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: slideInUp 0.6s ease-out;
}

.session-recovery-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s infinite;
}

.session-recovery-content h2 {
  color: #2d3748;
  font-family: "Fredoka One", system-ui;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.session-recovery-content p {
  color: #4a5568;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.session-info {
  display: flex;
  justify-content: space-around;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #f7fafc;
  border-radius: 12px;
  gap: 1rem;
}

.session-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.stat-icon {
  font-size: 1.5rem;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
}

.session-recovery-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.btn-session-primary,
.btn-session-secondary,
.btn-session-danger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 55px;
}

.btn-session-primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-session-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-session-secondary {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-session-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-session-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-session-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.session-recovery-note {
  color: #64748b;
  font-size: 0.9rem;
}

/* Responsive adjustments for session recovery modal */
@media (max-width: 480px) {
  .session-recovery-content {
    padding: 1.5rem;
    margin: 10px;
    border-radius: 20px;
  }
  
  .session-recovery-icon {
    font-size: 3rem;
  }
  
  .session-recovery-content h2 {
    font-size: 1.5rem;
  }
  
  .session-info {
    flex-direction: column;
    gap: 1rem;
  }
  
  .session-stat {
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .btn-session-primary,
  .btn-session-secondary,
  .btn-session-danger {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    min-height: 50px;
  }
}

/* Edit User Modal Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input::placeholder {
  color: #a0aec0;
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #718096;
  line-height: 1.4;
}