/**
 * ACBubbles.css - Bubble Game Styles for Amedeo Chinese
 * All classes prefixed with "bubble-" to avoid conflicts
 */

/* ========== GAME OVERLAY ========== */

.bubble-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.bubble-game-overlay.bubble-active {
    display: flex;
}

.bubble-game-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-width: 600px;
    max-height: 90vh;
    width: 100%;
}

.bubble-game-stage {
    width: 500px;
    height: 500px;
    max-width: 100%;        /* Don't exceed screen */
    max-height: 100%;       /* Don't exceed screen */
    aspect-ratio: 1 / 1;    /* Keep it square */
    position: relative;
    background: linear-gradient(180deg, #f7f9fc, #eef3f9);
    overflow: hidden;
    margin: 0 auto;
}

/* ========== BUBBLES ========== */

.bubble {
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.12);
    user-select: none;
    will-change: transform;
    font-weight: normal !important; /* Never bold */
}

.bubble:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* ========== EXIT BUTTON ========== */

.bubble-exit-btn {
    position: absolute;
    top: 10px;
    right: 50px; /* Moved another 20px to the left */
    background: #ff6b35;
    color: white;
    border: none;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bubble-exit-btn:hover {
    background: #ff5722;
}

/* ========== CONTROLS ========== */

.bubble-controls {
    background: white;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #e0e0e0;
}

.bubble-control-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.bubble-control-item label {
    font-size: 13px;
    font-weight: 400;
    color: #333;
    min-width: 110px;
    text-align: left;
}

.bubble-control-item input[type="range"] {
    flex: 1;
}

.bubble-control-item input[type="checkbox"] {
    margin-left: auto;
}

.bubble-control-value {
    min-width: 50px;
    font-size: 13px;
    color: #666;
    text-align: right;
}

/* ========== MINI CARD ========== */

.bubble-mini-card {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.bubble-mini-card.bubble-show {
    display: flex;
}

.bubble-mini-card-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.bubble-mini-card-content {
    position: relative;
    background: white;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow: auto;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    padding: 60px 20px 20px 20px;
    text-align: center;
}

.bubble-mini-card-buttons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bubble-mini-card-buttons button {
    width: 80px;
    min-height: 50px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.bubble-btn-export {
    margin-top: 12px;
    background: #2196F3;
    color: white;
}

.bubble-btn-export:hover {
    background: #1976D2;
}

.bubble-btn-i-knew {
    background: #f44336;
    color: white;
}

.bubble-btn-i-knew:hover {
    background: #e53935;
}

.bubble-btn-again {
    background: #e9eef4;
    color: #000;
}

.bubble-btn-again:hover {
    background: #d5dce4;
}

.bubble-character {
    font-size: 3rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.bubble-pinyin {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 16px;
}

.bubble-translation {
    font-size: 1rem;
    color: #666;
    margin-bottom: 16px;
}

.bubble-speaker-btn {
    margin-top: 16px;
    background: #2196F3;
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bubble-speaker-btn:hover {
    background: #1976D2;
}

/* ========== SUCCESS TOAST ========== */

.bubble-success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(67, 160, 71, 0.95);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 11000;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: none;
}

.bubble-success-toast.bubble-show {
    display: block;
    animation: bubbleFadeInOut 1.5s ease-in-out;
}

@keyframes bubbleFadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* ========== KAITI FONT ========== */

.bubble-kaiti-on .bubble,
.bubble-kaiti-on .bubble-character,
.bubble-kaiti-on .bubble-translation {
    font-family: 'KaiTi', 'STKaiti', 'BiauKai', 'DFKai-SB', serif !important;
}

/* ========== LAUNCH BUTTON (in main app) ========== */

.bubble-launch-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-left: 10px;
}

.bubble-launch-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.bubble-launch-btn:active {
    transform: translateY(0);
}

/* ========== MOBILE STYLES ========== */

@media (max-width: 768px) {
    .bubble-control-item label {
        min-width: auto; /* Remove fixed width on mobile for tighter layout */
    }
    
    .bubble-launch-btn {
        width: 25px;
        height: 25px;
        padding: 0;
        margin-left: 0;
        margin-top: 8px;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Step 4: Subtle toast variant for Export feedback.
   Much less intrusive than the main success toast (which is for game completion).
   Small, semi-transparent, bottom-center, fast fade. */
.bubble-export-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: rgba(255, 255, 255, 0.95);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 400;
    z-index: 11000;
    display: none;
    pointer-events: none;
}

.bubble-export-toast.bubble-show {
    display: block;
    animation: bubbleExportFade 0.8s ease-in-out;
}

@keyframes bubbleExportFade {
    0%   { opacity: 0; transform: translateX(-50%) translateY(8px); }
    15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    85%  { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(8px); }
}


/**
 * ACBubbles Mobile Fix
 * Add this AFTER ACBubbles.css to fix mobile overflow
 */

@media (max-width: 600px) {
  .bubble-game-overlay {
    padding: 0; /* Remove padding on mobile */
  }
  
  .bubble-game-container {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .bubble-game-stage {
    width: 100%;  /* Full width of container, not viewport */
    height: calc(100vh - 320px); /* More room for browser UI + controls */
    max-width: 100%;
    aspect-ratio: unset; /* Don't force square on mobile */
    margin: 0; /* Remove auto margins */
  }
  
  .bubble-controls {
    padding: 12px 16px;
  }
}
/* ========== WORD CHUNK SELECTOR (inside bubble controls) ========== */

.bubble-controls .word-chunk-selector {
  display: flex !important;
  justify-content: center;
  background: white;
  border-radius: 25px;
  padding: 4px;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: 0.75rem;
  width: 100%;
}

.bubble-controls .word-chunk-selector .chunk-pill {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: #666;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 50px;
  text-align: center;
}

.bubble-controls .word-chunk-selector .chunk-pill:hover {
  color: #667eea;
}

.bubble-controls .word-chunk-selector .chunk-pill.active {
  background: linear-gradient(135deg, #d32f2f 0%, #f57c00 100%);
  color: white;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}