@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600&display=swap');

    :root {
        --primary-color: #011EF6;
        --white: #ffffff;
    }

    @font-face {
        font-family: 'alte_haas_groteskbold';
        src: url('https://cdn.nsqkk.com/fonts/AlteHaasGroteskBold.woff2') format('woff2'),
             url('https://cdn.nsqkk.com/fonts/AlteHaasGroteskBold.woff') format('woff');
        font-display: block;
    }

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

    html, body {
      background: rgb(255, 255, 255);
      min-height: 100dvh;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden !important;
    }

    .card-section {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100vw;
      max-width: 1400px;
    }

    .click-hint {
      font-family: 'alte_haas_groteskbold', sans-serif;
      font-size: clamp(11px, 1.4vw, 14px);
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: rgba(0,0,0,0.4);
      text-align: center;
      margin-bottom: 14px;
      animation: hint-pulse 2.2s ease-in-out infinite;
      pointer-events: none;
      transition: opacity 0.4s ease;
    }
    .click-hint.hidden { opacity: 0; }
    @keyframes hint-pulse {
      0%, 100% { opacity: 0.4; transform: translateY(0); }
      50%       { opacity: 0.85; transform: translateY(-4px); }
    }

    .card-wrapper {
      position: relative;
      display: inline-block;
      width: 100%;
      cursor: pointer;
    }

    .model-switcher {
      display: none;
      align-items: center;
      gap: 6px;
      padding: 10px 0 4px;
      background: rgba(255,255,255,0.95);
      border: 1px solid rgba(0,0,0,0.08);
      border-radius: 16px;
      padding: 6px 14px;
      margin-top: 12px;
      box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    }

    .model-switcher-label {
      font-family: 'alte_haas_groteskbold', sans-serif;
      font-size: clamp(9px, 1vw, 11px);
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: rgba(0,0,0,0.4);
      margin-right: 4px;
      white-space: nowrap;
    }

    .model-dot {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: 2px solid var(--primary-color);
      background: transparent;
      cursor: pointer;
      padding: 0;
      transition: background 0.2s ease, color 0.2s ease;
      flex-shrink: 0;
      font-family: 'alte_haas_groteskbold', sans-serif;
      font-size: 13px;
      color: var(--primary-color);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .model-dot.active {
      background: var(--primary-color);
      color: #fff;
    }

    .model-dot:hover:not(.active) {
      background: rgba(1, 30, 246, 0.1);
    }

    .card-wrapper img.bg-card {
      width: 100%;
      height: auto;
      display: block;
      transition: opacity 0.4s ease, visibility 0.4s ease;
      position: relative;
      z-index: 5; 
      pointer-events: none; 
    }

    .card-wrapper img.edit-card {
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      visibility: hidden;
      z-index: 8; 
    }

    .field-input {
      position: absolute;
      font-family: 'Caveat', cursive;
      font-size: clamp(17px, 3.2vw, 55px);
      color: #000000;
      background: transparent;
      border: none;
      outline: none;
      padding: 0;
      margin: 0;
      line-height: 1;
      width: 33%;
      direction: rtl;
      text-align: left;
      overflow: hidden;
      white-space: nowrap;
      caret-color: #1a1a2e;
      z-index: 10; 
    }

    .field-input[readonly] {
      cursor: pointer;
    }

    .field-input::placeholder {
      color: #1a1a2e;
    }

    .field-nombre { top: 31%; left: 58%; }
    .field-fecha  { top: 46%; left: 58%; }
    .field-lugar  { top: 61%; left: 58%; }

    .field-overlay {
      position: absolute;
      font-family: 'Caveat', cursive;
      font-size: clamp(17px, 3.2vw, 55px);
      color: #000000;
      background: transparent;
      line-height: 1;
      white-space: nowrap;
      z-index: 12;
      pointer-events: none;
      display: none;
    }

    .photo-slot {
      position: absolute;
      top: 9.2%;
      left: 6.7%;
      width: 29.3%;
      height: 51%;
      border: 2px dashed rgba(26, 26, 46, 0.4);
      border-radius: 8px;
      display: flex; 
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.4s ease, visibility 0.4s ease;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      cursor: pointer;
      z-index: 7;
      background-color: rgba(255, 255, 255, 0.2);
    }

    .photo-slot span {
      font-family: 'Caveat', cursive;
      font-size: clamp(14px, 2vw, 30px);
      color: #1a1a2e;
      pointer-events: none;
    }

    .photo-slot img {
      display: none !important; 
    }

    .photo-slot::after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-radius: inherit;
      pointer-events: none;
      z-index: 2; 
      background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.35) 120%);
    }

    .photo-slot.capturing::after {
      background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.15) 120%);
    }

    .signature-slot {
      position: absolute;
      top: 66%; 
      left: 43%; 
      width: 40%;
      height: 13%; 
      border: none; 
      border-radius: 8px;
      display: flex; 
      align-items: center;
      justify-content: center;
      z-index: 10;
      cursor: pointer;
    }

    #defaultSig {
      font-family: 'Caveat', cursive;
      font-size: clamp(14px, 2.5vw, 40px);
      color: #1a1a2e;
      pointer-events: none;
      transform: rotate(-5deg); 
      transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    #signatureText {
      font-family: 'Caveat', cursive;
      font-size: clamp(10px, 2vw, 24px);
      color: rgba(26, 26, 46);
      position: absolute;
      pointer-events: none;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    #signatureCanvas {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      z-index: 11;
      opacity: 0;
      visibility: hidden;
      transition: opacity 0.4s ease, visibility 0.4s ease;
    }

    .card-wrapper.is-editing #cardImg {
      opacity: 0;
      visibility: hidden;
    }

    .card-wrapper.is-editing img.edit-card,
    .card-wrapper.is-editing .photo-slot,
    .card-wrapper.is-editing #signatureText,
    .card-wrapper.is-editing #signatureCanvas {
      opacity: 1;
      visibility: visible;
    }

    .card-wrapper.is-editing #defaultSig {
      opacity: 0;
      visibility: hidden;
    }

    .suggestions-dropdown {
        position: absolute;
        top: 68%; 
        left: 58%;
        width: 30%;
        background: rgba(255, 255, 255, 0.98);
        border-radius: 8px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        max-height: 150px;
        overflow-y: auto;
        z-index: 20;
        display: none;
        flex-direction: column;
        direction: ltr;
        border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .suggestions-dropdown::-webkit-scrollbar {
        width: 6px;
    }
    .suggestions-dropdown::-webkit-scrollbar-thumb {
        background: rgba(1, 30, 246, 0.3);
        border-radius: 4px;
    }

    .suggestion-item {
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: clamp(10px, 1.2vw, 16px);
        color: #1a1a2e;
        padding: 8px 12px;
        cursor: pointer;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        text-align: left;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .suggestion-item:last-child {
        border-bottom: none;
    }

    .suggestion-item:hover {
        background: rgba(1, 30, 246, 0.1);
        color: var(--primary-color);
    }

    .bottom-bar {
        position: fixed;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%);
        width: 90%;
        max-width: 1000px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
        z-index: 100;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 10px 40px -5px rgba(0,0,0,0.15), 0 0 2px rgba(0,0,0,0.1);
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 24px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        gap: 15px; 
    }

    .loguito-footer { 
        height: 40px; 
        width: auto; 
        cursor: pointer; 
        transition: transform 0.2s ease;
        display: block;
        flex-shrink: 0; 
    }
    .loguito-footer:hover { transform: scale(1.05); }

    .controls-wrapper {
        display: flex;
        justify-content: center;
        align-items: center;
        flex: 1;
    }

    .btn-radio-footer {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        background: rgba(255,255,255,0.5);
        border: 1px solid var(--primary-color);
        padding: 4px 12px;
        border-radius: 20px;
        text-decoration: none;
        color: var(--primary-color);
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 11px;
        letter-spacing: 0.5px;
        transition: all 0.2s ease;
        white-space: nowrap;
    }
    .btn-radio-footer:hover {
        background: var(--primary-color);
        color: #fff;
        transform: scale(1.05);
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .custom-control {
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 1rem;
        height: 48px;
        padding: 0 30px;
        border: 2px solid var(--primary-color);
        border-radius: 12px;
        background: transparent;
        color: var(--primary-color);
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        outline: none;
        min-width: 140px; 
    }
    
    .custom-control:hover {
        background: var(--primary-color);
        color: #fff;
        box-shadow: 0 5px 15px rgba(1, 30, 246, 0.3);
    }

    .custom-control:disabled {
        border-color: #aaa;
        color: #aaa;
        cursor: not-allowed;
        opacity: 0.5;
    }

    .custom-control:disabled:hover {
        background: transparent;
        color: #aaa;
        box-shadow: none;
    }

    .toast-msg {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(-100px);
        background: #1a1a2e;
        color: #fff;
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 0.9rem;
        padding: 12px 28px;
        border-radius: 14px;
        z-index: 9999;
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
        pointer-events: none;
        white-space: nowrap;
        box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    }

    .toast-msg.show {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    .dl-spinner {
        display: inline-block;
        width: 18px;
        height: 18px;
        border: 2.5px solid rgba(255,255,255,0.3);
        border-top-color: #fff;
        border-radius: 50%;
        animation: spin 0.6s linear infinite;
        margin-right: 8px;
        vertical-align: middle;
    }

    .corner-img {
      position: fixed;
      height: auto;
      z-index: 2;
      pointer-events: none;
      user-select: none;
    }

    .corner-img.tl { top: -100px; left: -150px; transform: rotate(180deg); width: clamp(500px, 10vw, 180px)}
    .corner-img.tr { top: -100px; right: -150px; transform: rotate(270deg); width: clamp(500px, 10vw, 180px)}
    .corner-img.bl { bottom: -100px; left: -150px; transform: rotate(180deg); width: clamp(500px, 10vw, 180px);}
    .corner-img.br { bottom: -100px; right: -150px; width: clamp(500px, 10vw, 180px);}

    /* ── MODAL POST-DOWNLOAD ── */
    .dl-modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 9000;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .dl-modal-overlay.open { opacity: 1; visibility: visible; }

    .dl-modal {
        background: #fff;
        border-radius: 20px;
        padding: 32px 28px 24px;
        max-width: 340px;
        width: 90vw;
        text-align: center;
        box-shadow: 0 24px 60px rgba(0,0,0,0.25);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 14px;
        transform: translateY(12px);
        transition: transform 0.3s ease;
    }
    .dl-modal-overlay.open .dl-modal { transform: translateY(0); }

    .dl-modal-icon { width: 44px; height: 44px; color: rgba(0,0,0,0.55); }

    .dl-modal-title {
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 15px;
        color: #111;
        line-height: 1.4;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .dl-modal-sub {
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 10px;
        letter-spacing: 0.25em;
        text-transform: uppercase;
        color: rgba(0,0,0,0.35);
        line-height: 1.5;
    }

    .dl-modal-actions { display: flex; gap: 8px; width: 100%; margin-top: 4px; }

    .dl-modal-btn-map {
        flex: 1;
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 12px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        padding: 12px 0;
        border-radius: 12px;
        border: none;
        background: var(--primary-color);
        color: #fff;
        cursor: pointer;
        text-decoration: none;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: opacity 0.2s ease;
    }
    .dl-modal-btn-map:hover { opacity: 0.85; }

    .dl-modal-btn-close {
        font-family: 'alte_haas_groteskbold', sans-serif;
        font-size: 12px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        padding: 12px 16px;
        border-radius: 12px;
        border: 1.5px solid rgba(0,0,0,0.15);
        background: transparent;
        color: rgba(0,0,0,0.5);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .dl-modal-btn-close:hover { border-color: rgba(0,0,0,0.3); color: #111; }

    @keyframes spin {
        to { transform: rotate(360deg); }
    }

    @media (max-width: 991px) {
        body { padding-bottom: 70px; }
        .bottom-bar {
            bottom: 15px;
            width: 95%;
            padding: 0.5rem 0.75rem;
            border-radius: 18px;
            background: rgba(255, 255, 255, 0.98);
            gap: 8px;
        }
        .controls-wrapper { flex: 1; width: auto; flex-direction: row !important; gap: 6px; flex-wrap: wrap; }
        .custom-control { font-size: 0.75rem; height: 36px; padding: 0 10px; flex: 1; min-width: unset; }
        .loguito-footer { height: 24px; width: auto; }
        #nsqkChartsX .loguito-footer { display: block !important; }
    }

    @media (max-width: 400px) {
        .bottom-bar { gap: 6px; padding: 0.4rem 0.5rem; }
        .loguito-footer { height: 20px; }
        .custom-control { font-size: 0.7rem; height: 32px; }
    }

    @media (max-height: 950px) {
        html, body {
            overflow-y: auto;
            overflow-x: hidden;
        }
        body {
            justify-content: flex-start;
            align-items: center;
            padding-top: 20px;
            padding-bottom: 100px;
        }

        .card-section {
            max-width: min(92vw, calc((100dvh - 320px) * 1.58));
        }
    }