﻿:root {
    --bg: #0F1115;
    --panel: #151922;
    --panel2: #0E121B;
    --line: #273043;
    --text: #E6E8EB;
    --muted: #94A3B8;
    --accent: #5AC8FA;
    --danger: #FF5A5F;
    --hi: #FFD84D;
    --dot: #ff4d4f;
    /* ✅ iOS 노치/상단바 Safe Area (PWA/사파리 공통) */
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --sal: env(safe-area-inset-left, 0px);
    --sar: env(safe-area-inset-right, 0px);
}

* {
    box-sizing: border-box;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,"Noto Sans KR",sans-serif;
}

body {
    margin: 0;
    background: radial-gradient(1200px 700px at 20% -10%, rgba(90,200,250,.12), transparent 55%), radial-gradient(1000px 600px at 90% 0%, rgba(255,90,95,.08), transparent 55%), var(--bg);
    color: var(--text);
    /* ✅ 좌/우 안전영역도 혹시 모를 PWA 화면 잘림 방지 */
    padding-left: var(--sal);
    padding-right: var(--sar);
}

a {
    color: inherit;
    text-decoration: none;
}

.wrap {
    max-width: 1040px;
    margin: 0 auto;
    /* ✅ 핵심: 기존 14px 유지 + Safe Area 만큼 더 확보 */
    padding: calc(14px + var(--sat)) 14px calc(14px + var(--sab)) 14px;
}

.card {
    background: linear-gradient(180deg, rgba(21,25,34,.95), rgba(21,25,34,.88));
    border: 1px solid rgba(39,48,67,.95);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 10px 28px rgba(0,0,0,.22);
}

.topbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    min-width: 0;
    flex: 1;
}


.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: start center;
    background: rgba(0,0,0,.55);
}

.modalHidden {
    display: none;
}



.logoDot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(90,200,250,.18);
    flex: 0 0 auto;
}

/* 공통 삭제 버튼 */
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 30px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid #3a1f1f;
    background: #1b0f10;
    color: #ff6b6b;
    cursor: pointer;
    user-select: none;
}

    .btn-danger:hover {
        filter: brightness(1.1);
    }

    .btn-danger:active {
        transform: translateY(1px);
    }


.titleBlock {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

h1 {
    margin: 0;
    font-size: 18px;
    letter-spacing: .2px;
}

.sub {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.spacer {
    margin-left: auto;
}

input, select, button, textarea {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(39,48,67,.95);
    background: rgba(14,18,27,.92);
    color: var(--text);
    padding: 12px;
    font-size: 15px;
    outline: none;
    transition: border-color .08s ease, background .08s ease, transform .08s ease;
}

    input:focus, select:focus, textarea:focus {
        border-color: rgba(90,200,250,.45);
        background: rgba(14,28,38,.75);
    }

button {
    cursor: pointer;
    background: rgba(19,27,39,.92);
}

    button:active {
        transform: scale(.992);
    }

    button.primary {
        border-color: rgba(43,107,133,.9);
        background: rgba(14,28,38,.9);
    }

    button.danger {
        border-color: rgba(122,42,51,.9);
        background: rgba(34,16,22,.9);
    }

    button:hover {
        border-color: rgba(90,200,250,.35);
        background: rgba(14,28,38,.62);
    }

    button.danger:hover {
        border-color: rgba(255,90,95,.55);
        background: rgba(34,16,22,.95);
    }

.pill {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid rgba(39,48,67,.95);
    background: rgba(14,18,27,.9);
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

    .pill.ok {
        color: var(--accent);
        border-color: rgba(90,200,250,.35);
    }

    .pill.bad {
        color: var(--danger);
        border-color: rgba(255,90,95,.35);
    }

.small {
    font-size: 12px;
    color: var(--muted);
}

.mono {
    font-family: ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 860px) {
    .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .grid {
        grid-template-columns: 1fr;
    }

    /* ✅ 모바일에서도 safe-area 유지하면서 기존 12px 감성 유지 */
    .wrap {
        padding: calc(12px + var(--sat)) 12px calc(12px + var(--sab)) 12px;
    }

    .card {
        padding: 12px;
        border-radius: 14px;
    }
}

.cardBtn {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(39,48,67,.95);
    background: rgba(14,18,27,.72);
    cursor: pointer;
    transition: transform .08s ease, border-color .08s ease, background .08s ease;
}

    .cardBtn:hover {
        border-color: rgba(90,200,250,.35);
        background: rgba(14,28,38,.55);
    }

    .cardBtn:active {
        transform: scale(.992);
    }

    .cardBtn .title {
        font-size: 16px;
        font-weight: 700;
    }

    .cardBtn .desc {
        font-size: 12px;
        color: var(--muted);
        line-height: 1.35;
    }

.toastWrap {
    position: fixed;
    left: 12px;
    right: 12px;
    /* ✅ 하단 홈 인디케이터 영역 피하기 */
    bottom: calc(12px + var(--sab));
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 99999;
}

.toast {
    pointer-events: none;
    max-width: 560px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(39,48,67,.95);
    background: rgba(14,18,27,.96);
    padding: 12px 14px;
    box-shadow: 0 18px 40px rgba(0,0,0,.35);
    color: var(--text);
    font-size: 14px;
}

    .toast.bad {
        border-color: rgba(255,90,95,.35);
    }

    .toast.ok {
        border-color: rgba(90,200,250,.35);
    }


/* ✅ iPhone/PWA에서 상단바 겹침 방지 */
.topbar {
    align-items: flex-start;
}

/* ✅ 모바일에서 topbar 레이아웃 안정화: 2행 그리드 */
@media (max-width: 520px) {
    .topbar {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand brand"
            "server logout";
        gap: 10px;
        align-items: center;
    }

    .sub {
        min-width: 0;
    }


    .brand {
        grid-area: brand;
    }

    #pillServer {
        grid-area: server;
        justify-self: start;
        min-width: 0; /* ✅ 말줄임 확정 */
        max-width: 70vw;
        overflow: hidden;
        text-overflow: ellipsis;
    }


    #btnLogout {
        grid-area: logout;
        width: auto !important; /* button 기본 width:100% 무시 */
        max-width: 160px !important; /* 너가 원래 쓰던 감성 유지 */
        justify-self: end;
    }
}
