/* 디지털 사이니지 — 키오스크 전용 */

:root {
    --bg: #0b1220;
    --surface: #111827;
    --text: #f3f4f6;
    --muted: #9ca3af;
    --accent: #38bdf8;
    --danger: #f87171;
    --warn: #fbbf24;
    --ok: #34d399;
    --border: #1f2937;
    --sg-topbar-h: 3.1rem;
    --sg-ticker-h: 2.5rem;
    --sg-ticker-duration: 80s;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.sg-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sg-overlay-top {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 8200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 1rem;
    background: rgba(2, 6, 23, 0.55);
    color: #e5e7eb;
    pointer-events: none;
    backdrop-filter: blur(3px);
    min-height: var(--sg-topbar-h);
}

/* 상단 중앙: 이전/다음 (pointer-events 켜짐 — 오버레이는 나머지 영역만 통과) */
.sg-overlay-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    pointer-events: auto;
    z-index: 1;
}

.sg-overlay-nav[hidden] {
    display: none !important;
}

.sg-overlay-nav__btn {
    width: 2.35rem;
    height: 2.35rem;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    font-size: 1.35rem;
    font-weight: 400;
    line-height: 1;
    color: #fff;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.92;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.sg-overlay-nav__btn:hover {
    background: rgba(30, 41, 59, 0.9);
    opacity: 1;
}

.sg-overlay-nav__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.sg-overlay-company {
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: clamp(1rem, 2.8vw, 1.35rem);
}

.sg-overlay-clock {
    font-variant-numeric: tabular-nums;
    color: #cbd5e1;
    font-size: clamp(0.9rem, 2.2vw, 1.1rem);
}

.sg-stage {
    position: relative;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sg-topbar-h) 0 0 0;
    z-index: 1;
}

.sg-body.sg-has-ticker .sg-stage {
    padding-bottom: var(--sg-ticker-h);
}

.sg-stage__frame {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    isolation: isolate;
}

.sg-stage__viewport {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.sg-stage__arrows {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(0.25rem, 1.5vw, 1.25rem);
    pointer-events: none;
    z-index: 3;
    /* 비디오/iframe이 별도 레이어로 올라가도 위에 보이도록 */
    transform: translateZ(0);
    /* iframe·전체화면 미디어 위에서는 부모 :hover가 안 먹는 경우가 많아 기본도 반투명 표시 */
    opacity: 0.82;
    transition: opacity 0.22s ease;
}

.sg-stage__frame:hover .sg-stage__arrows:not([hidden]),
.sg-stage__frame:focus-within .sg-stage__arrows:not([hidden]),
.sg-stage__frame--nav .sg-stage__arrows:not([hidden]) {
    opacity: 1;
}

/* 호버 없는 터치 키오스크 */
@media (hover: none) and (pointer: coarse) {
    .sg-stage__arrows:not([hidden]) {
        opacity: 0.88;
    }
}

.sg-stage__arrows[hidden] {
    display: none !important;
    opacity: 0;
}

.sg-stage__arrow {
    pointer-events: auto;
    flex-shrink: 0;
    width: clamp(2.5rem, 7vw, 3.75rem);
    height: clamp(3.5rem, 12vh, 5.5rem);
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 300;
    line-height: 1;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(6px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.sg-stage__arrow:hover {
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
}

.sg-stage__arrow:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sg-stage__arrow:active {
    background: rgba(15, 23, 42, 0.75);
}

.sg-slide {
    width: 100%;
    max-width: min(96vw, 1920px);
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 이미지·동영상: 비율 유지, 가로·세로 중 필요한 쪽을 화면에 맞춰 꽉 채움(잘리는 부분은 중앙 기준) */
.sg-slide:has(> img),
.sg-slide:has(> video) {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    overflow: hidden;
}

.sg-slide:has(> img) img,
.sg-slide:has(> video) video {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
    border-radius: 0;
    display: block;
}

.sg-slide--pdf iframe {
    width: min(96vw, 1200px);
    height: min(70vh, 900px);
    border: none;
    border-radius: 8px;
    background: #fff;
}

.sg-slide--text {
    text-align: center;
    padding: 2rem;
    font-size: clamp(1.25rem, 4vw, 2.5rem);
    line-height: 1.4;
    white-space: pre-wrap;
}

.sg-slide--placeholder {
    color: var(--muted);
    font-size: 1.15rem;
    text-align: center;
    padding: 1.25rem 2rem;
    line-height: 1.45;
}

.sg-slide--welcome {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    border-radius: 0;
    background: #ffffff;
    color: #0f172a;
}

.sg-welcome {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.15rem 2.25rem;
    gap: 0.45rem;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 0%, rgba(239,68,68,0.10), transparent 40%),
        radial-gradient(circle at 85% 0%, rgba(239,68,68,0.07), transparent 42%),
        linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", "Apple SD Gothic Neo", Arial, sans-serif;
}

.sg-welcome::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(82vw, 980px);
    height: min(62vh, 520px);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(15,23,42,0.04) 0%, rgba(239,68,68,0.03) 100%);
    z-index: 0;
    pointer-events: none;
}

.sg-welcome__title,
.sg-welcome__main,
.sg-welcome__line,
.sg-welcome__when,
.sg-welcome__date,
.sg-welcome__kind,
.sg-welcome__footerBrand {
    width: 100%;
    max-width: min(60vw, 760px);
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.sg-welcome__title {
    font-weight: 900;
    font-size: clamp(2.6rem, 6.6vw, 5.2rem);
    letter-spacing: 0.01em;
    line-height: 1.05;
    text-align: center;
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.sg-welcome__titlePrefix {
    display: inline-block;
    color: #0f172a;
    font-weight: 800;
    margin-right: 0.05rem;
}

.sg-welcome__titleBrand {
    /* 레드 타이틀을 조금 더 세련되게(단, 이탤릭은 유지하지 않음) */
    /* background-clip 텍스트용 */
    color: transparent;
    -webkit-text-fill-color: transparent;
    font-style: normal;
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.sg-welcome__main {
    font-weight: 900;
    font-size: clamp(2.0rem, 4.9vw, 4.1rem);
    text-align: center;
    letter-spacing: 0.01em;
}

.sg-welcome__line {
    font-size: clamp(1.08rem, 2.8vw, 2.25rem);
    font-weight: 800;
    color: #0f172a;
    text-align: center;
    line-height: 1.25;
}

.sg-welcome__muted {
    color: #334155;
    font-weight: 700;
}

.sg-welcome__when {
    font-size: clamp(1.0rem, 2.35vw, 1.7rem);
    color: #0f172a;
    font-weight: 800;
    text-align: center;
    margin-top: 0;
}

.sg-welcome__date {
    font-size: clamp(1.25rem, 2.85vw, 2.05rem);
    font-weight: 900;
    color: #ef4444;
    margin-top: 0;
}

.sg-welcome__kind {
    font-size: clamp(0.95rem, 2vw, 1.3rem);
    color: #64748b;
    font-weight: 700;
}

.sg-welcome__footerBrand {
    margin-top: 0.1rem;
    font-size: clamp(1.9rem, 4.25vw, 3.4rem);
    font-weight: 900;
    color: #0f172a;
    text-align: center;
}

.sg-welcome__fire {
    position: absolute;
    width: 190px;
    height: 190px;
    top: 7%;
    opacity: 0.98;
    filter: drop-shadow(0 12px 22px rgba(0,0,0,0.18));
    animation: sg-fire-anim 1.9s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

.sg-welcome__fire svg {
    width: 100%;
    height: 100%;
    display: block;
}

.sg-welcome__fire--left { left: 2.2%; transform-origin: center; }
.sg-welcome__fire--right { right: 2.2%; transform-origin: center; animation-delay: 0.25s; }

@keyframes sg-fire-anim {
    0% { transform: scale(0.96) rotate(-2deg); opacity: 0.75; }
    35% { transform: scale(1.04) rotate(6deg); opacity: 1; }
    100% { transform: scale(0.96) rotate(-2deg); opacity: 0.75; }
}

.sg-placeholder__msg > div {
    margin: 0.25rem 0;
}

.sg-placeholder__detail {
    font-size: 0.88rem;
    color: var(--muted);
    word-break: break-word;
    max-width: 42rem;
    margin-left: auto;
    margin-right: auto;
}

.sg-slide--schedule {
    padding: 0;
}

.sg-ticker-wrap {
    overflow: hidden;
    background: #0f172a;
    border-top: 1px solid var(--border);
    height: 2.5rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8300;
}

.sg-ticker-wrap[hidden] {
    display: none !important;
}

.sg-ticker {
    display: inline-block;
    white-space: nowrap;
    padding: 0.5rem 0;
    animation: sg-marquee var(--sg-ticker-duration) linear infinite;
    font-size: 0.95rem;
    color: #e2e8f0;
}

@keyframes sg-marquee {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

.sg-urgent-full {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.92);
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 800;
    text-align: center;
    line-height: 1.3;
}

.sg-urgent-bar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 8500;
    padding: 0.75rem 1rem;
    background: #7f1d1d;
    color: #fecaca;
    font-weight: 600;
    text-align: center;
}

.sg-popup {
    position: fixed;
    inset: 0;
    z-index: 8000;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* hidden 속성 우선 적용: 초기 로드시 오버레이가 보이지 않도록 */
.sg-popup[hidden],
.sg-banner[hidden],
.sg-bottom-alert[hidden],
.sg-urgent-full[hidden],
.sg-urgent-bar[hidden],
.sg-ticker-wrap[hidden] {
    display: none !important;
}

.sg-popup__box {
    position: relative;
    max-width: 480px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.sg-popup__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.sg-popup h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.sg-popup p { margin: 0; color: var(--muted); line-height: 1.5; }

.sg-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 7500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: #422006;
    color: #fde68a;
    font-weight: 600;
}

.sg-banner button {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid #fde68a;
    color: #fde68a;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
}

.sg-bottom-alert {
    position: fixed;
    left: 1rem; right: 1rem; bottom: 4rem;
    z-index: 7600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: #14532d;
    color: #bbf7d0;
    border-radius: 10px;
    border: 1px solid #166534;
    font-weight: 600;
}

.sg-bottom-alert button {
    flex-shrink: 0;
    background: #22c55e;
    border: none;
    color: #052e16;
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

/* 우상단 50×50 숨은 관리자 진입 (§13) */
.sg-admin-hit {
    position: fixed;
    top: 0;
    right: 0;
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: default;
    z-index: 10000;
    opacity: 0;
}

.sg-admin-hit:focus { outline: none; }
