/* ===== CSS Variables ===== */
:root {
    /* Colors */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #059669;
    --secondary-dark: #047857;
    --bg-color: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Typography */
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 0;
}

/* ===== Layout (1100 표준) ===== */
.wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-xl);
}

.main-content {
    flex: 1;
    min-width: 0;
}

.app-sidebar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: var(--spacing-lg);
    max-height: calc(100vh - var(--spacing-xl));
    overflow-y: auto;

    /* 스크롤바 숨기기 (기능은 유지) */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.app-sidebar::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* ===== Header (풀블리드 · 좌측 정렬 · 다크 오렌지) ===== */
.main-header {
    width: 100%;
    background: linear-gradient(135deg, #EA580C 0%, #9A3412 100%);
    color: #fff;
    padding: 2.2rem 1rem 1.8rem;
    text-align: left;
    position: relative;
    overflow: hidden;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: none;
}
.main-header::before {
    content: '';
    position: absolute;
    top: -40%; right: -10%;
    width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(251,191,36,.22), transparent 70%);
    pointer-events: none;
}
.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.header-text { flex: 1; min-width: 0; }
.main-header h1 {
    font-size: 1.65rem;
    color: #fff;
    margin: 0 0 .25rem;
    font-weight: 800;
    letter-spacing: -.3px;
    line-height: 1.25;
}
.main-header h1 a, .main-header h1 a.logo-link, .main-header h1 a.header-link {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.main-header .logo-emoji { font-size: 1.5rem; }
.main-header .subtitle, .subtitle {
    font-size: .95rem;
    color: rgba(255,255,255,.85);
    margin: 0;
    font-weight: 400;
    opacity: 1;
}

.btn-share-header {
    background: rgba(255,255,255,.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,.25);
    backdrop-filter: blur(4px);
    padding: .55rem 1rem;
    font-size: .9rem;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .15s;
    margin: 0;
}
.btn-share-header:hover {
    background: rgba(255,255,255,.28);
    transform: translateY(-1px);
}

/* Top AdSense (풀블리드) */
.ad-container.top-ad {
    width: 100%;
    background: #f9fafb;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
    margin: 0;
    max-width: none;
}

@media (max-width: 600px) {
    .header-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .main-header h1 { font-size: 1.4rem; }
    .btn-share-header { align-self: stretch; text-align: center; }
}

.header-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.header-link:hover {
    opacity: 0.9;
}

/* ===== Sections ===== */
.calculator-section,
.history-section,
.info-section,
.faq-section {
    background: var(--card-bg);
    padding: var(--spacing-xl);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-lg);
}

/* ===== Calculator ===== */
.calc-mode {
    margin-bottom: var(--spacing-lg);
}

.mode-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
}

.mode-btn {
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.calc-input {
    margin-bottom: var(--spacing-lg);
}

.calc-input label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-color);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    flex: 1;
    padding: var(--spacing-md);
    padding-right: 3rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--font-size-xl);
    font-weight: 600;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.currency {
    position: absolute;
    right: var(--spacing-md);
    font-weight: 600;
    color: var(--text-light);
}

/* ===== Results ===== */
.calc-result {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(5, 150, 105, 0.05));
    padding: var(--spacing-lg);
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.calc-result h3 {
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

.result-items {
    margin-bottom: var(--spacing-md);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.result-label {
    font-weight: 500;
    color: var(--text-light);
}

.result-value {
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--primary-color);
}

/* ===== History ===== */
.history-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: rgba(37, 99, 235, 0.05);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateX(4px);
}

.history-info {
    flex: 1;
}

.history-mode {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-bottom: var(--spacing-xs);
}

.history-amount {
    font-weight: 600;
    color: var(--text-color);
}

.history-delete {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: var(--font-size-lg);
    transition: color 0.3s ease;
}

.history-delete:hover {
    color: #dc2626;
}

/* ===== Buttons ===== */
.btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: var(--font-size-base);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-text {
    background: transparent;
    color: var(--text-light);
    padding: var(--spacing-sm);
}

.btn-text:hover {
    color: var(--primary-color);
}

/* ===== Info Cards ===== */
.info-section h2,
.faq-section h2 {
    margin-bottom: var(--spacing-lg);
    color: var(--text-color);
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.info-card {
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(5, 150, 105, 0.05));
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.info-card h3 {
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
    font-size: var(--font-size-lg);
}

.info-card p {
    color: var(--text-light);
    line-height: 1.7;
}

/* ===== FAQ ===== */
.faq-item {
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.faq-item summary {
    padding: var(--spacing-md);
    cursor: pointer;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.05);
    transition: background 0.3s ease;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item summary:hover {
    background: rgba(37, 99, 235, 0.1);
}

.faq-item p {
    padding: var(--spacing-md);
    color: var(--text-light);
    line-height: 1.7;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-light);
    font-size: var(--font-size-sm);
}

.disclaimer {
    margin-top: var(--spacing-sm);
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ===== Ads ===== */
.ad-container {
    margin: var(--spacing-md) auto;
    min-height: 100px;
    text-align: center;
}

.top-ad {
    margin-bottom: var(--spacing-md);
}

.middle-ad {
    margin: var(--spacing-lg) auto;
}

.bottom-ad {
    margin-top: var(--spacing-lg);
}

/* ===== Sidebar ===== */
.sidebar-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow);
}

.sidebar-card h3 {
    color: var(--text-color);
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    margin-bottom: var(--spacing-sm);
}

.sidebar-list a {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
    padding: var(--spacing-sm);
    border-radius: 8px;
}

.sidebar-list a:hover {
    background-color: rgba(37, 99, 235, 0.05);
    color: var(--primary-color);
    transform: translateX(4px);
}

.link-icon {
    font-size: 1.25rem;
    line-height: 1.5;
    flex-shrink: 0;
}

.link-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.link-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
}

.link-text {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-color);
}

.link-desc {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.recommended-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03), rgba(5, 150, 105, 0.03));
}


/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 8px;
    font-weight: 500;
    transition: bottom 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.toast.show {
    bottom: 30px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .wrapper {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .wrapper {
        padding: var(--spacing-md);
    }

    .main-header h1 {
        font-size: var(--font-size-2xl);
    }

    .mode-buttons {
        grid-template-columns: 1fr;
    }

    .info-cards {
        grid-template-columns: 1fr;
    }

    .calculator-section,
    .history-section,
    .info-section,
    .faq-section {
        padding: var(--spacing-md);
    }
}
/* ===== 중앙 광고 슬롯 시스템 (W35 표준 · 오렌지) ===== */
.ad-slot { display: block; width: 100%; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #EA580C, #9A3412); color: #fff; position: relative; box-shadow: 0 2px 8px rgba(0,0,0,.08); margin: 12px auto; }
.ad-slot.banner-wide { aspect-ratio: 4/1; max-width: 800px; }
.ad-slot.banner-square { aspect-ratio: 1/1; max-width: 320px; }
.ad-slot .ad-inner { position: absolute; inset: 0; padding: 16px 22px; display: flex; flex-direction: column; justify-content: center; z-index: 1; }
.ad-slot.has-image .ad-inner { background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,0)); }
.ad-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.ad-slot .ad-label { position: absolute; top: 6px; right: 10px; font-size: 10px; opacity: .8; z-index: 2; }
.ad-slot .ad-title { font-size: 18px; font-weight: 800; line-height: 1.3; }
.ad-slot .ad-subtitle { font-size: 13px; opacity: .9; line-height: 1.4; }
.ad-slot .ad-cta { display: inline-block; align-self: flex-start; margin-top: 8px; padding: 6px 14px; background: rgba(255,255,255,.25); border-radius: 20px; font-size: 13px; font-weight: 700; }

.ad-slot.kakao-channel,
.ad-slot[data-ad-type="kakao-channel"] { background: #FEE500; }
.ad-slot.kakao-channel .ad-title,
.ad-slot[data-ad-type="kakao-channel"] .ad-title { color: #3C1E1E; }
.ad-slot.kakao-channel .ad-subtitle,
.ad-slot[data-ad-type="kakao-channel"] .ad-subtitle { color: rgba(60,30,30,.85); }
.ad-slot.kakao-channel .ad-cta,
.ad-slot[data-ad-type="kakao-channel"] .ad-cta { background: #3C1E1E; color: #FEE500; }

/* AdSense ad-container max-width contain (W58 사고 학습) */
.ad-container.middle-ad,
.ad-container.bottom-ad {
  max-width: 800px;
  margin: 2rem auto;
  overflow: hidden;
}
.ad-container.middle-ad ins.adsbygoogle,
.ad-container.bottom-ad ins.adsbygoogle {
  display: block !important;
  width: 100%;
  max-width: 800px;
}

/* ===== controltower sidebar.js inject 마크업 ===== */
.sidebar-card { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); border: 1px solid #e5e7eb; }
.sidebar-card h3 { font-size: 14.5px; font-weight: 700; margin: 0 0 10px; color: #9A3412; display: flex; align-items: center; gap: 6px; }
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li { margin-bottom: 8px; }
.sidebar-list li:last-child { margin-bottom: 0; }
.sidebar-list a { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; color: #1e293b; text-decoration: none; border-radius: 8px; transition: background .2s ease; }
.sidebar-list a:hover { background: #fff7ed; }
.link-content { flex: 1; min-width: 0; }
.link-title { display: block; font-size: 13.5px; font-weight: 600; color: #9A3412; }
.link-desc { display: block; font-size: 12px; color: #64748b; margin-top: 2px; line-height: 1.4; }

/* ===== Scenario / Popular / Related / Info ===== */
.scenario-section, .popular-section, .related-section, .info-section-link, .changelog-section {
  background: #fff; padding: 1.8rem; border-radius: 16px; box-shadow: 0 4px 20px rgba(234,88,12,.10); margin-bottom: 1.5rem;
}
.scenario-section h2, .popular-section h2, .related-section h2, .info-section-link h2, .changelog-section h2 {
  color: #9A3412; margin: 0 0 12px; font-size: 1.4rem; font-weight: 800;
}
.scenario-section .section-intro, .popular-section .section-intro, .changelog-section .section-intro {
  color: #64748b; margin-bottom: 1rem; font-size: 14px;
}

.scenario-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.scenario-card { display: block; padding: 14px 16px; background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa; border-radius: 12px; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
.scenario-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(234,88,12,.15); border-color: #EA580C; }
.scenario-head { font-weight: 800; color: #9A3412; font-size: 15px; }
.scenario-sub { font-size: 13px; color: #475569; margin-top: 2px; }
.scenario-note { font-size: 12px; color: #64748b; margin-top: 4px; }

.popular-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.popular-tag { display: inline-flex; align-items: center; padding: 6px 12px; background: #ffedd5; border: 1px solid #fed7aa; border-radius: 999px; font-size: 13px; color: #9A3412; text-decoration: none; transition: all .15s; }
.popular-tag:hover { background: #EA580C; color: #fff; border-color: #EA580C; }

.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.related-link { display: flex; gap: 12px; padding: 14px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s; }
.related-link:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-1px); border-color: #EA580C; }
.rel-emoji { font-size: 28px; flex-shrink: 0; }
.rel-body { flex: 1; min-width: 0; }
.rel-title { font-size: 14.5px; font-weight: 700; color: #9A3412; margin-bottom: 2px; }
.rel-desc { font-size: 12.5px; color: #64748b; line-height: 1.4; }

.info-grid-link { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.gov-link { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; text-decoration: none; color: #9A3412; font-size: 14px; transition: all .15s; }
.gov-link:hover { background: #fff7ed; border-color: #EA580C; }
.gov-emoji { font-size: 22px; flex-shrink: 0; }

/* ===== Bracket Table ===== */
.table-scroll { overflow-x: auto; }
.bracket-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.bracket-table th { background: #EA580C; color: #fff; padding: 10px 12px; text-align: left; font-weight: 700; }
.bracket-table td { padding: 10px 12px; border-bottom: 1px solid #e5e7eb; }
.bracket-table tr:hover { background: #fff7ed; }
.bracket-table .amt { font-weight: 800; color: #9A3412; }
.bracket-table .muted { color: #64748b; font-size: 12.5px; display: block; margin-top: 2px; }
.bracket-note { background: #fff7ed; border-left: 3px solid #EA580C; padding: 12px 14px; margin: 12px 0; font-size: 13.5px; color: #9A3412; border-radius: 0 8px 8px 0; line-height: 1.7; }

/* ===== Hero Stats ===== */
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
.hero-stat { background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa; border-radius: 12px; padding: 14px; text-align: center; }
.hero-stat-num { font-size: 22px; font-weight: 900; color: #9A3412; }
.hero-stat-lbl { font-size: 13px; color: #475569; margin-top: 2px; }

/* ===== CTA Banner ===== */
.cta-banner { background: linear-gradient(135deg, #EA580C 0%, #9A3412 100%); color: #fff; padding: 1.6rem; border-radius: 14px; margin: 1rem 0 1.5rem; text-align: center; }
.cta-banner h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; }
.cta-banner p { font-size: 14px; opacity: .92; margin-bottom: 12px; }
.cta-banner a { display: inline-block; background: #FBBF24; color: #1f2937; padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: 14px; text-decoration: none; }

/* ===== FAQ ===== */
.faq-section { background: #fff; padding: 1.8rem; border-radius: 16px; box-shadow: 0 4px 20px rgba(234,88,12,.10); margin-bottom: 1.5rem; }
.faq-section h2 { color: #9A3412; margin: 0 0 12px; font-size: 1.4rem; font-weight: 800; }
.faq-item { padding: 14px 0; border-bottom: 1px solid #e5e7eb; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { font-weight: 700; color: #9A3412; cursor: pointer; padding: 6px 0 6px 1.2rem; font-size: 15px; position: relative; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; content: ""; }
.faq-item summary::before { content: "▶"; position: absolute; left: 0; font-size: .8rem; color: #EA580C; transition: transform .2s; }
.faq-item[open] summary::before { transform: rotate(90deg); }
.faq-item p { color: #475569; padding: 8px 0 4px 1.2rem; line-height: 1.8; font-size: 14px; }
