/**
 * WIA Braille - 모바일 스타일
 */

/* 모바일 기본 */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 10px;
        padding-bottom: calc(10px + var(--safe-area-inset-bottom, 0px));
    }

    .container {
        padding: 15px;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* 입력창 최적화 */
    #text-input {
        font-size: 18px;
        min-height: 120px;
        border-radius: 12px;
    }

    /* 버튼 터치 영역 확대 */
    button, .btn {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 12px;
        touch-action: manipulation;
    }

    /* 점자 셀 확대 */
    .braille-cell {
        width: 60px;
        height: 90px;
        margin: 8px;
        border-radius: 10px;
    }

    .dot {
        width: 14px;
        height: 14px;
    }

    /* TTS/햅틱 버튼 그룹 */
    .tts-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .tts-controls button {
        flex: 1 1 calc(50% - 10px);
        max-width: 150px;
    }

    /* 설치 버튼 */
    #install-btn {
        width: 100%;
        margin-top: 15px;
        background: linear-gradient(135deg, #667eea, #764ba2);
        color: white;
        border: none;
        animation: none;
    }

    #install-btn.pulse {
        animation: pulse 2s infinite;
    }

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

    /* 출력 섹션 */
    .output-section {
        margin-bottom: 20px;
    }

    .output {
        font-size: 1rem;
        padding: 12px;
    }

    .braille-output {
        font-size: 2rem !important;
    }

    /* 촉각 패턴 출력 */
    .tactile-output {
        gap: 10px;
        padding: 15px;
    }
}

/* 가로 모드 */
@media (max-width: 768px) and (orientation: landscape) {
    body.landscape {
        padding: 5px 20px;
    }

    body.landscape .container {
        max-height: 100vh;
        overflow-y: auto;
    }

    body.landscape .tactile-output {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* iOS 안전 영역 */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .container {
        margin-bottom: env(safe-area-inset-bottom);
    }
}

/* 터치 피드백 */
button:active, .btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* 포커스 스타일 (접근성) */
button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    body.is-mobile {
        background: linear-gradient(135deg, #1a1a2e, #16213e);
    }

    .container {
        background: rgba(30, 30, 50, 0.95);
        color: #f0f0f0;
    }

    #text-input, .output {
        background: rgba(255, 255, 255, 0.1);
        color: #f0f0f0;
        border-color: rgba(255, 255, 255, 0.2);
    }

    button:not(.btn-primary) {
        background: rgba(255, 255, 255, 0.1);
        color: #f0f0f0;
        border-color: rgba(255, 255, 255, 0.2);
    }

    .braille-cell {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .dot {
        background: rgba(255, 255, 255, 0.2);
    }

    .dot.active {
        background: #667eea;
    }
}

/* 소형 모바일 (iPhone SE 등) */
@media (max-width: 375px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }

    .braille-cell {
        width: 50px;
        height: 75px;
        margin: 5px;
    }

    .dot {
        width: 12px;
        height: 12px;
    }
}

/* 초대형 모바일 (iPad Pro 등) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 700px;
    }

    .tactile-output {
        justify-content: center;
    }
}
