/* ── EVENT STRIP ── fixed, 스크롤 시 위로 숨김 */
.event-strip {
    position: fixed;
    left: 0; right: 0;
    top: calc(var(--topbar-h) + var(--hdr-h) + 48px); /* 36+70+48 = 154px */
    z-index: 188;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 60px;
    transition: transform 0.3s ease, top 0.3s ease;
}
/* topbar 사라진 후 */
body.ci-topbar-gone .event-strip {
    top: calc(var(--hdr-h) + 48px); /* 70+48 = 118px */
}
/* 스크롤로 숨김 */
body.ci-eventstrip-gone .event-strip {
    transform: translateY(-100%);
    pointer-events: none;
}

.event-chips-wrap { flex: 1; overflow: hidden; position: relative; }
.event-chips-wrap::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 16px; background: linear-gradient(to right, transparent, var(--white)); pointer-events: none; z-index: 1; }
.event-chips { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; align-items: center; -webkit-overflow-scrolling: touch; }
.event-chips::-webkit-scrollbar { display: none; }
.echip { flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 12px; height: 40px; border-radius: 10px; cursor: pointer; transition: all 0.12s; user-select: none; background: transparent; gap: 2px; }
.echip:hover { background: var(--blue-pale); }
.echip.active { background: var(--ink); }
.echip-top { display: flex; align-items: center; gap: 5px; }
.echip-name { font-size: 11px; font-weight: 600; color: var(--logo); white-space: nowrap; }
.echip-date { font-size: 9px; color: var(--mid); white-space: nowrap; }
.echip.active .echip-name { color: #fff; }
.echip.active .echip-date { color: rgba(255,255,255,0.55); }
.echip-badge { font-size: 8.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.echip-badge.pre-b { background: rgba(66,133,244,0.1); color: var(--ink); }
.echip-badge.gen-b { background: rgba(52,168,83,0.1); color: var(--green); }
.echip.active .echip-badge { background: rgba(255,255,255,0.2); color: #fff; }
.echip.echip-all { justify-content: center; }
.echip.echip-all .echip-name { font-size: 12px; color: var(--ink); font-weight: 700; }
.echip.echip-all.active .echip-name { color: #fff; }
.echip-sep { width: 1px; height: 16px; background: var(--line); flex-shrink: 0; margin: 0 4px; }

/* ══════════════════════════════════════════════
   PRE LAYOUT
   fixed 스택: topbar(36) + hdr(70) + tabnav(48) + event-strip(60) = 214px
   ══════════════════════════════════════════════ */

/* 사이드바: event-strip 포함 top */
.pre-sidebar {
    position: fixed;
    top: calc(var(--topbar-h) + var(--hdr-h) + 48px + 60px + 16px); /* 230px */
    width: 200px;
    max-height: calc(100vh - var(--topbar-h) - var(--hdr-h) - 48px - 60px - 32px);
    overflow-y: auto;
    scrollbar-width: none;
    transition: top 0.3s ease, max-height 0.3s ease;
}
.pre-sidebar::-webkit-scrollbar { display: none; }

/* topbar 사라진 후 */
body.ci-topbar-gone .pre-sidebar {
    top: calc(var(--hdr-h) + 48px + 60px + 16px); /* 194px */
    max-height: calc(100vh - var(--hdr-h) - 48px - 60px - 32px);
}
/* event-strip 사라진 후: 60px 위로 올라옴 */
body.ci-eventstrip-gone .pre-sidebar {
    top: calc(var(--topbar-h) + var(--hdr-h) + 48px + 16px); /* 170px */
    max-height: calc(100vh - var(--topbar-h) - var(--hdr-h) - 48px - 32px);
}
body.ci-topbar-gone.ci-eventstrip-gone .pre-sidebar {
    top: calc(var(--hdr-h) + 48px + 16px); /* 134px */
    max-height: calc(100vh - var(--hdr-h) - 48px - 32px);
}

.pre-sidebar-left {
    left: max(24px, calc(50vw - 720px + 24px));
}
.pre-sidebar-right {
    right: max(24px, calc(50vw - 720px + 24px));
}

/* pre-layout: 사이드바(200) + gap(24) + outer(24) = 248px 양쪽 */
.pre-layout {
    max-width: 1440px;
    margin: 0 auto;
    margin-bottom: 48px;
    padding: 0 248px;
}
.pre-layout .ci-container {
    max-width: none;
    padding: 0;
}

/* ── PRE BODY ── */
.pre-body { padding-top: 28px; padding-bottom: 60px; }
.pre-section-head { display: flex; align-items: center; gap: 8px; margin: 20px 0; }
.pre-section-title { font-size: 15px; font-weight: 700; color: var(--logo); }
.pre-section-count { font-size: 12px; color: var(--mid); }

.pre-sort { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.pre-sort-btn { font-size: 12px; font-weight: 500; color: var(--mid); text-decoration: none; padding: 4px 8px; border-radius: 6px; transition: background 0.1s, color 0.1s; }
.pre-sort-btn:hover { background: var(--gray); color: var(--ink); }
.pre-sort-btn.active { color: var(--ink); font-weight: 700; background: var(--gray); }
.pre-sort-select { display: none; font-size: 12px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 28px 5px 10px; background: var(--white);
    margin-left: auto; appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; cursor: pointer; }

/* ── CARD GRID ── */
.pre-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.pre-card { display: block; text-decoration: none; background: var(--white); border-radius: 8px; overflow: hidden; transition: box-shadow 0.2s, transform 0.2s; }
.pre-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); transform: translateY(-2px); }
.pre-card-thumb { position: relative; width: 100%; aspect-ratio: 1/1; background: var(--gray); overflow: hidden; }
.pre-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.pre-card:hover .pre-card-thumb img { transform: scale(1.03); }
.pre-card-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--line); }
.pre-card-type { position: absolute; top: 8px; left: 8px; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.pre-card-type.pre-b { background: rgba(66,133,244,0.9); color: #fff; }
.pre-card-type.gen-b { background: rgba(52,168,83,0.9); color: #fff; }
.pre-card-status { position: absolute; top: 8px; right: 8px; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.pre-card-status.soon { background: rgba(245,166,35,0.9); color: #fff; }
.pre-card-status.closed { background: rgba(0,0,0,0.5); color: #fff; }
.pre-card-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.pre-card-fare { font-size: 10px; color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pre-card-name { font-size: 13px; font-weight: 700; color: var(--logo); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
.pre-card-period { font-size: 10px; color: var(--ink); margin-top: 4px; }
.pre-card-period i { margin-right: 3px; }
.pre-card-ship { font-size: 10px; color: var(--mid); }
.pre-card-ship i { margin-right: 3px; }
.pre-empty { grid-column: 1 / -1; text-align: center; padding: 80px 0; font-size: 14px; color: var(--mid); }

.pre-card-like { position: absolute; bottom: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: none; background: rgba(255,255,255,0.85); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 13px; color: var(--mid); transition: background 0.1s, color 0.1s; }
.pre-card-like:hover { background: #fff; color: var(--red, #e84040); }
.pre-card-like.on { background: #fff; color: var(--red, #e84040); }

/* ── PAGINATION ── */
.pre-pag { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 40px; padding-bottom: 8px; }
.pre-pag-btn, .pre-pag-num { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; transition: background 0.12s, color 0.12s; cursor: pointer; }
.pre-pag-btn { font-size: 11px; color: var(--mid); }
.pre-pag-btn:hover { background: var(--gray); color: var(--ink); }
.pre-pag-btn.disabled { color: var(--line); pointer-events: none; }
.pre-pag-num:hover { background: var(--gray); }
.pre-pag-num.active { background: var(--ink); color: #fff; pointer-events: none; }



/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */

@media (min-width: 641px) { .event-chips { justify-content: safe center; } }

/* ≤960px */
@media (max-width: 960px) {
    .event-strip {
        top: calc(var(--hdr-h) + 48px) !important;
    }
    .pre-sidebar {
        top: calc(var(--hdr-h) + 48px + 60px + 16px) !important;
        max-height: calc(100vh - var(--hdr-h) - 48px - 60px - 32px);
    }
    body.ci-eventstrip-gone .pre-sidebar {
        top: calc(var(--hdr-h) + 48px + 16px) !important;
        max-height: calc(100vh - var(--hdr-h) - 48px - 32px);
    }

}

/* 1281~1400 */
@media (max-width: 1400px) {
    .pre-sidebar { width: 160px; }
    .pre-layout { padding: 0 208px; }
}

/* 맥북 에어 */
@media (min-width: 1101px) and (max-width: 1280px) {
    .pre-sidebar { width: 160px; }
    .pre-layout { padding: 0 220px; }
    .pre-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

/* 그리드 3열 */
@media (max-width: 1300px) { .pre-grid { grid-template-columns: repeat(3, 1fr); } }

/* ≤1100: 사이드바 숨김 */
@media (max-width: 1100px) {
    .pre-sidebar-left { display: none; }
    .pre-sidebar-right { display: none; }
    .pre-layout { padding: 0 24px; }
}

/* iPad Pro */
@media (max-width: 1024px) {
    .event-strip { padding: 0 16px; }
    .pre-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
}

/* iPad Air */
@media (max-width: 820px) {
    .pre-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .event-strip { padding: 0 12px; }
}

/* 모바일 640px */
@media (max-width: 640px) {
    .event-strip {
        top: calc(var(--hdr-h) + 48px) !important;
        height: 54px;
        padding: 0 12px;
    }
    .echip { height: 36px; padding: 0 10px; }
    .event-chips { padding: 8px 16px 8px 0; }
    .pre-layout { padding: 0; }
    .pre-body { padding-top: 12px; padding-bottom: 48px; }
    .pre-section-head { padding: 0 14px; margin: 10px 0; }
    .pre-sort { display: none; }
    .pre-sort-select { display: block; margin-left: auto; }
    .pre-grid { grid-template-columns: repeat(2, 1fr); gap: 2px; }
    .pre-card { border: none; border-radius: 0; background: transparent; box-shadow: none; }
    .pre-card:hover { box-shadow: none; transform: none; }
    .pre-card-thumb { border-radius: 0; }
    .pre-card-info { padding: 7px 6px 10px; gap: 2px; }
    .pre-card-fare { font-size: 9.5px; }
    .pre-card-name { font-size: 12px; }
    .pre-card-period { font-size: 9.5px; margin-top: 3px; }
    .pre-card-ship { font-size: 9.5px; }
    .pre-card-type { top: 6px; left: 6px; }
    .pre-card-status { top: 6px; right: 6px; }
    .pre-pag { gap: 2px; margin-top: 28px; }
    .pre-pag-btn, .pre-pag-num { min-width: 30px; height: 30px; font-size: 12px; }
    
}

/* ══════════════════════════════════════════════
   SIDEBAR 내부 스타일
   ══════════════════════════════════════════════ */
.side-ttl { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; color: var(--mid); margin-bottom: 4px; margin-top: 20px; text-transform: uppercase; }
.side-ttl:first-child { margin-top: 0; }
.side-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.side-item:hover .side-lbl { color: var(--logo); }
.side-lbl { font-size: 12px; color: var(--mid); transition: color 0.12s; }
.side-lbl.on { color: var(--ink); font-weight: 700; }
.side-cnt { font-size: 10px; color: var(--mid); }
.side-ad { margin-top: 24px; background: var(--ink); border-radius: 8px; padding: 10px; position: relative; overflow: hidden; }
.side-ad::before { content: 'CW'; font-size: 80px; font-weight: 900; color: rgba(255,255,255,0.04); position: absolute; bottom: -10px; right: -4px; line-height: 1; pointer-events: none; }
.side-ad-label { font-size: 9px; font-weight: 700; letter-spacing: 2px; color: #ffffff; margin-bottom: 6px; text-transform: uppercase; }
.side-ad-title { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.4; margin-bottom: 6px; }
.side-ad-desc { font-size: 10px; color: rgba(255,255,255,0.5); margin-bottom: 14px; line-height: 1.6; }
.side-ad-btn { display: block; background: #ffffff; color: #000000; font-size: 11px; font-weight: 700; padding: 7px; text-align: center; border-radius: 4px; cursor: pointer; text-decoration: none; }

/* ── RIGHT PANEL ── */
.rp-block { margin-bottom: 28px; }
.rp-title { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--ink); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); display: flex; align-items: center; justify-content: space-between; }
.rp-title-sub { font-size: 10px; color: var(--mid); font-weight: 400; letter-spacing: 0; }
.hot-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.hot-item:last-child { border-bottom: none; }
.hot-rank { font-size: 14px; font-weight: 800; color: var(--line); flex-shrink: 0; width: 16px; text-align: center; }
.hot-rank.top { color: var(--red, #e84040); }
.hot-thumb { width: 32px; height: 32px; border-radius: 4px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--gray); overflow: hidden; }
.hot-name { font-size: 11px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.hot-creator { font-size: 10px; color: var(--mid); }
.dday-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.dday-item:last-child { border-bottom: none; }
.dday-name { font-size: 11px; color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.dday-badge { font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--gray); color: var(--ink); flex-shrink: 0; }
.dday-badge.today { background: rgba(232,64,64,0.1); color: var(--red, #e84040); }