/* @import url(https://cdn.jsdelivr.net/gh/moonspam/NanumSquareNeo@1.0/nanumsquareneo.css); */

/* 로컬 폰트 설정 (woff2 전용) */
@font-face {
    font-family: 'NanumSquareNeo';
    font-weight: 400;
    /* Regular */
    src: url('https://testconsole.snowballabs.com/font/NanumSquareNeoTTF-bRg.woff2') format('woff2');
}

@font-face {
    font-family: 'NanumSquareNeo';
    font-weight: 700;
    /* Bold */
    src: url('https://testconsole.snowballabs.com/font/NanumSquareNeoTTF-cBd.woff2') format('woff2');
}

@font-face {
    font-family: 'NanumSquareNeo';
    font-weight: 800;
    /* ExtraBold */
    src: url('https://testconsole.snowballabs.com/font/NanumSquareNeoTTF-dEb.woff2') format('woff2');
}

@font-face {
    font-family: 'NanumSquareNeo';
    font-weight: 900;
    /* Heavy */
    src: url('https://testconsole.snowballabs.com/font/NanumSquareNeoTTF-eHv.woff2') format('woff2');
}

body {
    font-family: 'NanumSquareNeo', sans-serif;
    background-color: #f1f5f9;
    color: #1e293b;
}

/* 엑스트라 볼드 유틸리티 */
.font-neo-bd {
    font-weight: 700;
}

.font-neo-eb {
    font-weight: 800;
}

.font-neo-hv {
    font-weight: 900;
}

.panel {
    background-color: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

.data-card {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.data-card:hover {
    border-color: #6366f1;
    transform: translateY(-2px);
}

.loading-spinner {
    border-top-color: #6366f1;
    animation: spin 1s linear infinite;
}

.result-card {
    background-color: white;
    border: 1px solid #e2e8f0;
}

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 220px;
    background-color: #1e293b;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 10;
    bottom: 140%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.75rem;
    /* text-xs */
    line-height: 1.5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

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

/* AI 결과물 스타일 커스텀 */
.prose-custom table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    background: #fdfdfd;
}

.prose-custom th {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    /* text-xs */
    color: #475569;
}

.prose-custom td {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    /* text-xs */
}

.prose-custom p {
    margin-bottom: 0.875rem;
    line-height: 1.6;
}

.prose-custom ul,
.prose-custom ol {
    margin-bottom: 1rem;
    padding-left: 1.25rem;
    list-style-type: disc;
}

.prose-custom ol {
    list-style-type: decimal;
}

.prose-custom li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.prose-custom h3 {
    font-size: 1.125rem;
    font-weight: 800;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.prose-custom h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: #4f46e5;
    border-radius: 2px;
}

.prose-custom code {
    background-color: #eef2ff;
    color: #4338ca;
    padding: 0.2em 0.4em;
    font-size: 0.75rem;
    /* text-xs */
    border-radius: 3px;
}

.prose-custom blockquote {
    border-left-color: #4f46e5;
    background-color: #f1f5f9;
    padding: 0.5rem 1rem;
}

.prose-custom strong {
    color: #312e81;
}

.prose-custom a {
    color: #4f46e5;
    text-decoration: none;
}

.prose-custom a:hover {
    text-decoration: underline;
}

/* Deep Chat Customization */
#chat-container {
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
    padding-top: 2rem;
}

#chat-element {
    width: 100% !important;
    max-width: none !important;
    height: 600px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0 !important;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1) !important;
    overflow: hidden;
    background-color: white !important;
}

/* 스크롤바 숨기기 */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 초소형 텍스트 유틸리티 (최소 text-xs로 상향 조정) */
.text-xs-xxs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-xxs {
    font-size: 0.625rem;
    line-height: 0.875rem;
}

.text-xxxs {
    font-size: 0.75rem;
    line-height: 1rem;
}

/* 슬라이드 패널 스타일 */
#analysis-side-panel {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    overscroll-behavior: contain;
}

.side-panel-open {
    transform: translateX(0) !important;
}

/* 선택된 경기 카드 하이라이트 */
.panel.selected-match {
    border: 2px solid #4f46e5 !important;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.15) !important;
    background-color: #f8fafc !important;
}

/* Push 레이아웃: 패널 오픈 시 메인 영역 여백 확보 */
@media (min-width: 1024px) {
    #main-container {
        transition: margin-right 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        width: auto;
    }

    body.side-panel-active #main-container {
        margin-right: 450px;
    }

    /* 모달들이 사이드 패널을 가리지 않고 가용 영역 중앙에 오도록 조정 */
    body.side-panel-active .fixed.inset-0.z-50 {
        right: 450px;
        transition: right 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* 모달 애니메이션 기본 설정 */
    .fixed.inset-0.z-50 {
        transition: right 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

.side-predict-btn.active {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: white !important;
}

.side-predict-btn.active * {
    color: white !important;
}

/* 아코디언(열기/접기) 분석글 스타일 */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.master-pinned-card {
    border: 2px solid #4f46e5 !important;
    background-color: #ffffff !important;
    cursor: pointer;
}

.master-pinned-card:hover {
    background-color: #f8fafc !important;
}

@keyframes slow-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.toto-floating-btn {
    animation: slow-float 3s ease-in-out infinite;
}

/* 토토 마킹 슬롯 패널 스타일 */
#toto-slot-side-panel {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 60;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    background-color: white;
    width: 100%;
    max-width: 450px;
    overscroll-behavior: contain;
}

.toto-slot-row {
    border-bottom: 1px solid #f8fafc;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.slot-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    /* text-xxs */
    color: #334155;
    transition: all 0.2s;
    background-color: #fff;
}

.slot-btn:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.slot-btn.active-win {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.slot-btn.active-draw {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.slot-btn.active-lose {
    background-color: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

/* 결과 강조 (테두리 색상만 변경) */
.slot-btn.result-highlight {
    border-color: #f59e0b !important;
    z-index: 10;
}

/* Make deep-chat occupy full screen */
deep-chat {
    width: 100% !important;
    height: calc(100vh - 280px) !important;
}

/* Gemini-style Chat Custom UI */
.gemini-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.gemini-bubble {
    max-width: 85%;
    padding: 1.25rem 1.5rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    position: relative;
    animation: bubble-in 0.3s ease-out;
}

@keyframes bubble-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.gemini-bubble-user {
    align-self: flex-end;
    background: #4f46e5;
    color: white;
    border-radius: 1rem;
    border-bottom-right-radius: 0.25rem !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

/* Deep Insight 탭 전용: 좌상단이 각진 형태 (아이콘이 위에 있는 레이아웃용) */
#chat-history-list .gemini-bubble-user {
    border-top-left-radius: 0.25rem !important;
    border-bottom-right-radius: 1rem !important;
}

.gemini-bubble-ai {
    align-self: flex-start;
    background: #f8fafc !important;
    color: #1e293b;
    border: none !important;
    border-radius: 1rem !important;
    border-top-left-radius: 0 !important;
    max-width: 95%;
    padding: 1.25rem 1.5rem !important;
    margin: 0 0 1.5rem 0 !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05);
}

.gemini-bubble-ai .prose-custom {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* AI 답변 내의 표 선은 유지 */
.gemini-bubble-ai .prose-custom table {
    border: 1px solid #f1f5f9 !important;
    width: 100%;
    border-collapse: collapse;
}

/* 모바일 전용 AI 답변 최적화 (따로 관리) */
@media (max-width: 767px) {

    /* 말풍선 내부 여백 통일 (AI와 동일하게) */
    .gemini-bubble {
        padding: 0.625rem 0.75rem !important;
    }

    .gemini-bubble-ai {
        padding: 0.625rem 0.75rem !important;
    }

    .gemini-bubble-ai.prose-custom,
    .gemini-bubble-ai .prose-custom {
        display: block !important;
        width: 100% !important;
    }

    .prose-custom table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        font-size: 0.8rem;
    }

    .prose-custom th,
    .prose-custom td {
        min-width: 80px;
        padding: 6px 10px !important;
        white-space: nowrap !important;
        text-align: center !important;
        border: 1px solid #e2e8f0 !important;
    }
}

.gemini-input-area {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.gemini-input {
    box-sizing: border-box;
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    outline: none;
    transition: height 0.1s ease;
    resize: none;
    max-height: 200px !important;
    overflow-y: auto;
    line-height: 1.5;
}

.gemini-input:focus {
    border-color: #4f46e5;
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.gemini-send-btn {
    width: 2.75rem;
    height: 2.75rem;
    background: #4f46e5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gemini-send-btn:hover {
    background: #4338ca;
    transform: scale(1.05);
}

.gemini-send-btn:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

.gemini-thinking {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem;
}

.gemini-dot {
    width: 0.375rem;
    height: 0.375rem;
    background: #94a3b8;
    border-radius: 50%;
    animation: thinking-dot 1.4s infinite ease-in-out both;
}

.gemini-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.gemini-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-dot {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Scroll to Top Button */
#scroll-to-top.visible {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Chat UI Styles */
.chat-item {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    margin-bottom: 0.8rem;
}

.chat-info {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
    color: #64748b;
    /* slate-500 */
}

.chat-bubble {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    line-height: 1.4;
    word-break: break-all;
}

.chat-left {
    align-self: flex-start;
}

.chat-left .chat-bubble {
    background-color: transparent;
    border: none !important;
    color: #1e293b;
    border-top-left-radius: 0;
}

.chat-right {
    align-self: flex-end;
}

.chat-right .chat-info {
    flex-direction: row-reverse;
    text-align: right;
}

.chat-right .chat-bubble {
    background-color: transparent;
    border: none !important;
    color: #1e293b;
    border-top-right-radius: 0;
}

/* 사이드바 토글 및 전용 애니메이션 */
#store-map-sidebar {
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    width: 400px;
    /* PC 기본 너비 */
    min-width: 400px;
    /* 너비 고정 보강 */
    flex-shrink: 0;
    /* 절대 수축 방지 */
}

#store-map-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    opacity: 0 !important;
    border-right: none !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

#toto-slot-list,
#proto-slot-list,
#store-map-side-list,
#side-panel-content {
    overscroll-behavior: contain;
}

#sidebar-toggle-floating {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#sidebar-toggle-floating:hover {
    transform: scale(1.1);
}

/* 지도 높이 강제 고정 (공백 제거) */
#store-map-view,
#store-map-view>div,
#store-map-view .gm-style,
#store-map-view .gm-style>div:first-child {
    height: 100% !important;
    min-height: 700px !important;
}

/* 커스텀 팝업 애니메이션 */
@keyframes popup-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -100%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -120%) scale(1);
    }
}

.custom-popup-animate {
    animation: popup-appear 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#store-custom-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0;
    border-style: solid;
    border-color: white transparent transparent;
    filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.05));
}

/* 토토 적중 결과 탭 레이아웃 */
.toto-result-view-container {
    height: 700px;
    display: grid;
    grid-template-columns: 400px 1fr;
}

.toto-result-sidebar-panel {
    width: 400px;
    min-width: 400px;
    max-width: 400px;
    height: 700px;
    overflow: hidden;
}

.toto-result-map-area {
    height: 700px;
    width: 100%;
}

/* 모바일 적응형 대응 */
@media (max-width: 768px) {
    .toto-result-view-container {
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
        grid-template-columns: none !important;
    }

    .toto-result-sidebar-panel {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 300px !important;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0 !important;
    }

    .toto-result-map-area {
        height: 400px !important;
        width: 100% !important;
    }

    #toto-tab-result-map {
        height: 400px !important;
    }

    /* 상단 지역 칩 컨테이너 여백 조정 */
    #toto-result-filter-container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Mobile Bottom Sheet for Power Analysis */
.mobile-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0.4s;
}

.mobile-bottom-sheet.active {
    visibility: visible;
    pointer-events: auto;
    transition: none;
}

.mobile-bottom-sheet .sheet-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-bottom-sheet.active .sheet-backdrop {
    opacity: 1;
}

.mobile-bottom-sheet .sheet-container {
    position: relative;
    width: 100%;
    height: 85vh;
    background: white;
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.1), 0 -8px 10px -6px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.33, 1, 0.68, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-bottom-sheet.active .sheet-container {
    transform: translateY(0);
}

.sheet-handle-container {
    padding: 1rem 0 0.5rem;
    display: flex;
    justify-content: center;
    cursor: grab;
}

.sheet-handle {
    width: 40px;
    height: 5px;
    background: #e2e8f0;
    border-radius: 999px;
}