/* ── Custom PWA Splash Screen ── */
#itw-splash {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--bg);
    color: var(--accent);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-logo-wrap {
    position: relative;
    animation: splashScale 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.splash-svg {
    width: 160px;
    height: auto;
    stroke: currentColor;
    stroke-width: 7px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.splash-text {
    margin-top: 16px;
    font-family: var(--font-main);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1.2px;
    color: var(--accent);
    animation: splashFadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.splash-loader {
    margin-top: 24px;
    width: 140px;
    height: 4px;
    background: var(--accent-bg);
    border-radius: 2px;
    overflow: hidden;
    animation: splashFadeUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.splash-loader-bar {
    width: 35%;
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    animation: splashLoading 1.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes splashScale {
    0% {
        transform: scale(0.85);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes splashFadeUp {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes splashLoading {
    0% {
        transform: translateX(-150%);
    }

    100% {
        transform: translateX(250%);
    }
}

.splash-logo-text {
    fill: #ffffff;
    stroke: none;
}

/* ── Splash Dark Mode Fixes ── */
html[data-theme="dark"] #itw-splash {
    background-color: #121212 !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .splash-text {
    color: #ffffff !important;
}

html[data-theme="dark"] .splash-logo-text {
    fill: #121212 !important;
    /* Contrasts with white rect in dark mode */
}

html[data-theme="dark"] .splash-loader {
    background: #1a2a3a !important;
}

html[data-theme="dark"] .splash-loader-bar {
    background: #ffffff !important;
}

/* ── 로그인 페이지 전용 스타일 ── */
.login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: var(--bg);
}

.login-logo {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.login-logo img {
    width: 140px;
    display: block;
}

.login-title {
    font-size: clamp(30px, 9vmin, 39px);
    font-weight: 700;
    letter-spacing: -0.8px;
    margin-bottom: 24px;
    text-align: center;
    color: var(--accent);
}

.login-sub {
    font-size: clamp(16px, 4.5vmin, 18px);
    color: var(--text-muted);
    margin-bottom: clamp(32px, 8vmin, 48px);
    text-align: center;
    line-height: 1.6;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 28px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}

.login-field {
    margin-bottom: 14px;
}

.login-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    height: 46px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 0 14px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
    -webkit-appearance: none;
    appearance: none;
}

.login-input:focus {
    border-color: var(--accent);
}

.login-btn {
    width: 100%;
    height: 50px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 6px;
    transition: opacity .15s;
}

.login-btn:active {
    opacity: 0.85;
}

.login-demo-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.login-demo-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}

.login-footer {
    margin-top: 32px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.8;
}

/* ── [SECURITY] 시스템 다크 모드 강제 고대비 스타일 ── */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121212 !important;
        --surface: #1e1e1e !important;
        --bg-faint: #252525 !important;
        --border: #333333 !important;
        --text: #ffffff !important;
        --text-muted: #aaaaaa !important;
    }

    :root:not([data-theme="light"]) body.itw-mobile {
        background-color: #121212 !important;
        color: #ffffff !important;
    }

    :root:not([data-theme="light"]) .login-card,
    :root:not([data-theme="light"]) .hero-card,
    :root:not([data-theme="light"]) .home-notice-list,
    :root:not([data-theme="light"]) .stand-preview,
    :root:not([data-theme="light"]) .itw-notice-bar,
    :root:not([data-theme="light"]) .modal {
        background-color: #1e1e1e !important;
        border-color: #333333 !important;
    }

    :root:not([data-theme="light"]) .login-input {
        background-color: #252525 !important;
        border-color: #444 !important;
        color: #ffffff !important;
    }

    :root:not([data-theme="light"]) .hero-card-title,
    :root:not([data-theme="light"]) .home-notice-title,
    :root:not([data-theme="light"]) .stand-slot-loc,
    :root:not([data-theme="light"]) .login-label {
        color: #ffffff !important;
    }

    :root:not([data-theme="light"]) .hero-card-sub,
    :root:not([data-theme="light"]) .home-notice-meta,
    :root:not([data-theme="light"]) .stand-slot-time,
    :root:not([data-theme="light"]) .login-sub,
    :root:not([data-theme="light"]) .login-footer {
        color: #aaaaaa !important;
    }

    :root:not([data-theme="light"]) .hero-card:active,
    :root:not([data-theme="light"]) .home-notice-item:active,
    :root:not([data-theme="light"]) .login-demo-btn:active {
        background-color: #252525 !important;
    }

    :root:not([data-theme="light"]) .itw-skeleton {
        background: linear-gradient(90deg, #252525 25%, #333 50%, #252525 75%) !important;
        background-size: 200% 100% !important;
    }
}

/* ── 메인 앱 레이아웃 ── */
#app {
    display: none;
}

#app.logged {
    display: block;
}

/* ── 공지 배너 ── */
.itw-notice-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.itw-notice-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-bg);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.itw-notice-scroll {
    overflow: hidden;
    flex: 1;
}

.itw-notice-items {
    display: flex;
    gap: 24px;
    animation: itwMarquee 22s linear infinite;
    width: max-content;
}

.itw-notice-items a {
    font-size: 13px;
    white-space: nowrap;
    opacity: 0.8;
    text-decoration: none;
    color: inherit;
}

.itw-notice-more {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    text-decoration: none;
}

@keyframes itwMarquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

/* ── 홈 히어로 카드 ── */
.home-hero-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
    padding: 0;
    margin: var(--space-xs) var(--space-xs) 0;
}

.hero-card {
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 18px 16px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    transition: box-shadow .15s, transform .12s;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--hc-color, var(--accent));
}

.hero-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.hero-card-icon {
    font-size: 28px;
}

.hero-card-title {
    font-size: clamp(13.5px, 3.8vmin, 15.5px);
    font-weight: 700;
    letter-spacing: -0.2px;
}

.hero-card-sub {
    font-size: clamp(11px, 3.2vmin, 12.5px);
    color: var(--text-muted);
    line-height: 1.45;
}


/* ── 최근 공지 목록 ── */
.home-notice-list {
    margin: var(--space-xs) var(--space-xs) 0;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.home-notice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.home-notice-header-title {
    font-size: 13px;
    font-weight: 700;
}

.home-notice-header-more {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.home-notice-item {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .1s;
    text-decoration: none;
    color: inherit;
}

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

.home-notice-item:active {
    background: var(--bg);
}

.home-notice-cat-bar {
    width: 4px;
    align-self: stretch;
    flex-shrink: 0;
}

.home-notice-body {
    flex: 1;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.home-notice-top {
    display: none;
}

.home-notice-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.home-notice-new {
    font-size: 9px;
    font-weight: 700;
    color: var(--red);
    background: var(--red-bg);
    padding: 1px 5px;
    border-radius: 4px;
}

.home-notice-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-notice-meta {
    display: none;
}

.home-notice-rel-date {
    font-size: 9px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}

.home-notice-rel-date.today {
    color: var(--accent);
    background: var(--accent-bg);
}

.home-notice-rel-date.recent {
    color: var(--green);
    background: var(--green-bg);
}

.home-notice-right {
    padding: 10px 14px 10px 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* ── 전시대 미리보기 ── */
.stand-preview {
    margin: var(--space-xs) var(--space-xs) 0;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.stand-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.stand-preview-title {
    font-size: 13px;
    font-weight: 700;
}

.stand-preview-more {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.stand-slot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.stand-slot:last-child {
    border-bottom: none;
}

.stand-slot-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    font-weight: 600;
    width: 42px;
    /* 고정 폭 확보 */
    flex-shrink: 0;
    /* 좁은 화면에서도 줄어들지 않음 */
    text-align: center;
}

.stand-slot-date-sub {
    font-size: 10px;
    color: var(--text-muted);
}

.stand-slot-info {
    flex: 1;
}

.stand-slot-loc {
    font-size: 13.5px;
    font-weight: 600;
}

.stand-slot-time {
    font-size: 11.5px;
    color: var(--text-muted);
}

.stand-slot-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 8px;
    flex-shrink: 0;
}