* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    --toss-bg: #f4f6fa;
    --toss-card: #ffffff;
    --toss-text-primary: #191f28;
    --toss-text-secondary: #4e5968;
    --toss-text-muted: #8b95a1;
    --toss-blue: #3182f6;
    --toss-red: #f04452;
    --toss-green: #00d47e;
    --toss-orange: #ff7e36;
    --toss-shadow: 0 8px 24px rgba(25, 31, 40, 0.04);
    --toss-shadow-premium: 0 12px 32px rgba(25, 31, 40, 0.08);
    --toss-radius-large: 24px;
    --toss-radius-small: 14px;
    --toss-gradient-blue: linear-gradient(135deg, #3182f6 0%, #5b9aff 100%);
    --toss-gradient-green: linear-gradient(135deg, #00d47e 0%, #00f08a 100%);
    --toss-gradient-orange: linear-gradient(135deg, #ff7e36 0%, #ff9a5c 100%);
}

@media (prefers-color-scheme: dark) {
    :root {
        --toss-bg: #10141b;
        --toss-card: #1b212c;
        --toss-text-primary: #f9fafb;
        --toss-text-secondary: #b0b8c1;
        --toss-text-muted: #6b7684;
        --toss-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    }
}

.toss-style-container {
    font-family: Pretendard, -apple-system, sans-serif;
    background-color: var(--toss-bg);
    color: var(--toss-text-primary);
    padding: 32px 20px;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    letter-spacing: -0.3px;
    overflow-x: hidden;
}

.toss-style-container strong, 
.toss-style-container b,
.toss-bold-accent {
    font-weight: 800 !important;
    color: var(--toss-blue) !important;
}

.toss-style-container * {
    overflow-wrap: break-word;
    word-break: keep-all;
}

/* 실시간 시계 배지 스타일 */
.toss-live-clock-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(49, 130, 246, 0.1);
    color: var(--toss-blue);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
}
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--toss-green);
    border-radius: 50%;
    animation: clockPulse 1.5s infinite;
}
@keyframes clockPulse {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 8px var(--toss-green); }
    100% { transform: scale(0.9); opacity: 0.6; }
}

/* 오늘의 핫뉴스 프리미엄 카드 디자인 */
.toss-news-card {
    background: linear-gradient(135deg, rgba(255,126,54,0.07) 0%, var(--toss-card) 100%);
    border-left: 5px solid var(--toss-orange) !important;
}
.news-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.news-tag { font-size: 13px; font-weight: 800; color: var(--toss-orange); }
.news-market-type { font-size: 11px; background: rgba(139,149,161,0.15); padding: 2px 6px; border-radius: 4px; color: var(--toss-text-secondary); white-space: nowrap; }
.news-body-text { font-size: 14.5px; font-weight: 700; line-height: 1.5; color: var(--toss-text-primary); }

/* 기본 구조 스켈레톤 */
.toss-skeleton { padding: 40px 20px; text-align: center; }
.sk-circle { width: 60px; height: 60px; border-radius: 50%; background: var(--toss-text-muted); opacity: 0.15; margin: 0 auto 16px; }
.sk-line { height: 16px; background: var(--toss-text-muted); opacity: 0.1; margin: 12px auto; border-radius: 8px; width: 50%; }
.sk-line.large { height: 24px; width: 30%; }

/* 히어로 보드 */
.toss-main-hero { text-align: center; padding: 24px 0 32px; width: 100%; }
.toss-sub-title { font-size: 14px; color: var(--toss-text-secondary); font-weight: 600; margin-bottom: 8px; }
.toss-hero-title { font-size: 26px; font-weight: 800; line-height: 1.4; margin: 0 0 16px; word-break: keep-all; }
.toss-score-display { display: flex; justify-content: center; align-items: baseline; gap: 4px; margin-bottom: 16px; }
.toss-huge-accent { font-size: 60px; font-weight: 900; color: var(--toss-blue); }
.toss-score-max { font-size: 18px; font-weight: 700; color: var(--toss-text-muted); }
.toss-progress-wrapper { background: rgba(139,149,161,0.2); height: 8px; border-radius: 4px; width: 100%; max-width: 300px; margin: 0 auto; overflow: hidden; }
.toss-progress-fill { height: 100%; width: 0%; background: var(--toss-blue); border-radius: 4px; transition: width 0.8s cubic-bezier(0.1, 1, 0.1, 1); }

/* 카드 코어 아키텍처 - 핵심 수정 */
.toss-card { 
    background-color: var(--toss-card); 
    border-radius: var(--toss-radius-large); 
    padding: 22px; 
    box-shadow: var(--toss-shadow-premium); 
    margin-bottom: 20px; 
    border: 1px solid rgba(139,149,161,0.08); 
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
.toss-card:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(25, 31, 40, 0.12); }
.toss-briefing-card { background: linear-gradient(135deg, var(--toss-card) 0%, var(--toss-bg) 100%); border: 1px solid rgba(49, 130, 246, 0.15); }
.toss-card-body { display: flex; gap: 14px; align-items: flex-start; width: 100%; min-width: 0; }
.toss-avatar-icon { font-size: 24px; background: var(--toss-gradient-blue); color: white; padding: 10px; border-radius: 50%; line-height: 1; box-shadow: 0 4px 12px rgba(49, 130, 246, 0.3); flex-shrink: 0; }
.toss-card-heading { font-size: 16px; font-weight: 700; margin: 0 0 6px 0; color: var(--toss-text-primary); }
.toss-briefing-text p { font-size: 14px; color: var(--toss-text-secondary); line-height: 1.6; margin: 0; }

/* 탭 컨트롤 디자인 */
.toss-tabs-container { display: flex; background: rgba(139, 149, 161, 0.12); padding: 4px; border-radius: 14px; margin: 24px 0; width: 100%; }
.toss-tab-button { flex: 1; border: none; padding: 12px; font-size: 14.5px; font-weight: 700; color: var(--toss-text-secondary); background: transparent; border-radius: 10px; cursor: pointer; transition: all 0.2s ease; min-width: 0; }
.toss-tab-button.active { background: var(--toss-card); color: var(--toss-blue); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.toss-tab-content { display: none; width: 100%; min-width: 0; }
.toss-tab-content.active-content { display: block; animation: tossFadeIn 0.3s ease-out; }
@keyframes tossFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* 그리드 및 컴포넌트 유닛 */
.toss-section { margin-top: 32px; width: 100%; min-width: 0; }
.toss-section-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; line-height: 1.3; }
.toss-style-grid { display: grid; grid-template-columns: 1fr; gap: 14px; width: 100%; }
.toss-style-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.style-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.style-name { font-size: 15.5px; font-weight: 700; line-height: 1.3; flex: 1; min-width: 0; }
.style-weight { font-size: 12.5px; font-weight: 700; color: var(--toss-blue); background: rgba(49, 130, 246, 0.08); padding: 4px 10px; border-radius: 30px; white-space: nowrap; flex-shrink: 0; }
.style-stocks-box { border-top: 1px solid var(--toss-bg); padding-top: 12px; }
.stock-label { font-size: 12px; color: var(--toss-text-muted); display: block; margin-bottom: 8px; }
.stock-chips-group { display: flex; flex-wrap: wrap; gap: 6px; }
.stock-chip { font-size: 12px; font-weight: 700; color: var(--toss-blue); background: rgba(49, 130, 246, 0.12); padding: 6px 12px; border-radius: 8px; white-space: nowrap; border: 1px solid rgba(49, 130, 246, 0.2); }

/* 지표 레이더 보드 - 핵심 수정 구간 */
.toss-indicator-grid { 
    display: grid; 
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; 
    width: 100%;
}

.toss-ind-card { 
    padding: 16px 18px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 0; 
    min-height: 92px;
    min-width: 0;
    width: 100%;
}
.ind-info { flex: 1; min-width: 0; }
.ind-info h4 { 
    font-size: 12px; 
    color: var(--toss-text-secondary); 
    margin: 0 0 6px 0; 
    font-weight: 500; 
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: keep-all;
}
.ind-val { font-size: 18px; font-weight: 800; line-height: 1.2; color: var(--toss-text-primary); }
.ind-status-badge { font-size: 11px; font-weight: 700; padding: 6px 12px; border-radius: 30px; white-space: nowrap; flex-shrink: 0; margin-left: 8px; }
.ind-status-badge.bull { background: rgba(0, 212, 126, 0.1); color: var(--toss-green); }
.ind-status-badge.bear { background: rgba(240, 68, 82, 0.1); color: var(--toss-red); }

/* 카카오페이 자산 리스트 레이아웃 */
.toss-list { list-style: none; padding: 0; margin: 0; width: 100%; }
.toss-list-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 0; border-bottom: 1px solid rgba(139,149,161,0.1); gap: 12px; min-width: 0; }
.toss-list-item:last-child { border-bottom: none; }
.sector-left { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.sector-title-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.sector-name { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.sector-stars { color: var(--toss-orange); font-size: 11px; flex-shrink: 0; }
.sector-stocks { font-size: 12px; color: var(--toss-text-muted); line-height: 1.4; word-break: break-all; }
.sector-badge { font-size: 12.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0; padding: 4px 8px; background: rgba(139,149,161,0.08); border-radius: 6px; }
.sector-badge.good { color: var(--toss-blue); background: rgba(49, 130, 246, 0.08); }
.sector-badge.normal { color: var(--toss-text-muted); }

/* 가이드 표 리펙토링 */
.toss-table-responsive { width: 100%; max-width: 100%; overflow-x: auto; background: var(--toss-card); border-radius: var(--toss-radius-large); box-shadow: var(--toss-shadow); -webkit-overflow-scrolling: touch; }
.toss-premium-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; min-width: 640px; }
.toss-premium-table th { background: rgba(139,149,161,0.06); color: var(--toss-text-secondary); font-weight: 700; padding: 14px; border-bottom: 1px solid rgba(139,149,161,0.1); }
.toss-premium-table td { padding: 14px; border-bottom: 1px solid rgba(139,149,161,0.1); color: var(--toss-text-secondary); }
.table-bold-cate { font-weight: 700; color: var(--toss-text-primary) !important; }
.table-good { color: var(--toss-blue) !important; font-weight: 700; }
.table-bad { color: var(--toss-red) !important; font-weight: 700; }

/* SEO 전용 아티클 보드 */
.toss-seo-article { background-color: var(--toss-card); border-radius: var(--toss-radius-large); padding: 28px 22px; margin-top: 40px; box-shadow: var(--toss-shadow); border-top: 4px solid var(--toss-blue); width: 100%; max-width: 100%; min-width: 0; }
.toss-seo-article h2 { font-size: 19px; font-weight: 800; color: var(--toss-text-primary); margin: 0 0 14px 0; }
.toss-seo-article h3 { font-size: 15px; font-weight: 700; color: var(--toss-blue); margin: 20px 0 8px 0; }
.toss-seo-article p { font-size: 13.5px; color: var(--toss-text-secondary); line-height: 1.7; margin: 0 0 12px 0; }

.moneybull-ad-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
    background-color: rgba(139, 149, 161, 0.03);
    border-radius: 16px;
    overflow: hidden;
    clear: both;
    min-height: 100px; 
}
.ad-top-margin { margin: 8px 0 24px 0; }
.ad-bottom-margin { margin: 32px 0 16px 0; }

@media (min-width: 768px) {
    .moneybull-ad-wrapper { min-height: 280px; }
}

@media (max-width: 600px) {
    .toss-indicator-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .toss-style-container { padding: 20px 16px; }
    .toss-hero-title { font-size: 22px; }
    .toss-huge-accent { font-size: 48px; }
    .toss-section-title { font-size: 16px; }
    .style-name { font-size: 14px; }
    .sector-name { font-size: 13px; }
    .ind-val { font-size: 16px; }
    .toss-ind-card { padding: 14px; min-height: 70px; }
    .sector-badge { font-size: 11px; padding: 3px 6px; }
}