:root {
    --bg: #f5f7fb;
    --surface: rgba(255, 255, 255, .84);
    --surface-strong: rgba(255, 255, 255, .96);
    --text: #111827;
    --muted: #64748b;
    --line: rgba(15, 23, 42, .10);
    --purple: #6d28d9;
    --sky: #0284c7;
    --radius: 18px;
    --shadow: 0 18px 60px rgba(15, 23, 42, .10);
    --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
            "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    font: 13px/1.5 var(--sans);
    background:
        radial-gradient(1000px 650px at 12% 8%, rgba(109, 40, 217, .13), transparent 58%),
        radial-gradient(900px 600px at 88% 24%, rgba(2, 132, 199, .12), transparent 58%),
        radial-gradient(800px 500px at 55% 100%, rgba(16, 185, 129, .08), transparent 60%),
        var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button:disabled, input:disabled, select:disabled { opacity: .52; cursor: not-allowed; }

.wrap {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 28px 20px 22px;
}

.top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 15px;
}

.brand { min-width: 220px; }
.kicker {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.brand h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: clamp(19px, 2vw, 24px);
    font-weight: 900;
    letter-spacing: -.035em;
}

.pill {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #312e81;
    background: linear-gradient(90deg, rgba(109, 40, 217, .15), rgba(2, 132, 199, .13));
    font-size: 11px;
    letter-spacing: .02em;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 9px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-box svg {
    position: absolute;
    left: 12px;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.8;
    pointer-events: none;
}
.search, .ctl, .btn, .meta {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--text);
    background: var(--surface-strong);
    outline: none;
}
.search {
    width: 280px;
    padding: 9px 12px 9px 38px;
}
.ctl { padding: 8px 32px 8px 11px; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    cursor: pointer;
}
.meta {
    padding: 10px 12px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
}
.meta-sep { padding: 0 5px; }
.mini { color: var(--muted); font-family: var(--mono); font-size: 10px; }

.search:focus, .ctl:focus, .btn:hover {
    border-color: rgba(109, 40, 217, .34);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, .09);
}

.card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface-strong), var(--surface));
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    min-height: 60px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .67);
}
.crumbs a {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    transition: .15s ease;
}
.crumbs a:hover {
    border-color: rgba(109, 40, 217, .28);
    transform: translateY(-1px);
}
.sep { color: #94a3b8; }
.crumb-divider { margin-left: 4px; }

.grid-wrap {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 16px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.file-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 124px;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .91);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.file-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    content: "";
    background: rgba(15, 23, 42, .10);
}
.file-card:hover {
    z-index: 1;
    border-color: rgba(109, 40, 217, .27);
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(15, 23, 42, .11);
}
.file-card[hidden] { display: none; }

.tg-folder {
    border-color: rgba(109, 40, 217, .26);
    background:
        linear-gradient(180deg, rgba(109, 40, 217, .105), rgba(2, 132, 199, .07)),
        rgba(255, 255, 255, .96);
}
.tg-folder::before { background: linear-gradient(90deg, #7c3aed, #0ea5e9); }
.tg-archive::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.tg-image::before { background: linear-gradient(90deg, #22c55e, #10b981); }
.tg-video::before { background: linear-gradient(90deg, #ec4899, #f472b6); }
.tg-audio::before { background: linear-gradient(90deg, #3b82f6, #93c5fd); }
.tg-pdf::before { background: linear-gradient(90deg, #ef4444, #fca5a5); }
.tg-doc::before { background: linear-gradient(90deg, #6366f1, #a5b4fc); }
.tg-code::before { background: linear-gradient(90deg, #0f172a, #64748b); }

.file-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.file-copy { min-width: 0; flex: 1; }
.ico {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: #475569;
    background: rgba(15, 23, 42, .04);
}
.ico svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.tg-folder .ico {
    border-color: rgba(109, 40, 217, .22);
    color: var(--purple);
    background: linear-gradient(180deg, rgba(109, 40, 217, .16), rgba(2, 132, 199, .12));
}
.file-name {
    overflow: hidden;
    color: #1e293b;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tg-folder .file-name { color: #4338ca; }
.sub {
    overflow: hidden;
    margin-top: 3px;
    color: var(--muted);
    font: 10px var(--mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    margin-top: 13px;
}
.badge {
    display: inline-flex;
    max-width: 60%;
    align-items: center;
    padding: 5px 9px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #475569;
    background: rgba(15, 23, 42, .035);
    font: 10px var(--mono);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.date { color: var(--muted); font: 10px var(--mono); white-space: nowrap; }
.sz-cool { border-color: rgba(14, 165, 233, .23); background: rgba(14, 165, 233, .09); }
.sz-warm { border-color: rgba(245, 158, 11, .24); background: rgba(245, 158, 11, .11); }
.sz-hot { border-color: rgba(236, 72, 153, .24); background: rgba(236, 72, 153, .10); }
.sz-danger { border-color: rgba(239, 68, 68, .25); background: rgba(239, 68, 68, .10); }

#no-results[hidden] {
    display: none !important;
}

.empty {
    display: grid;
    min-height: 280px;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 38px 18px;
    color: var(--muted);
    text-align: center;
}
.empty strong { color: #334155; font-size: 16px; }
.empty-icon { font-size: 34px; }
.empty code {
    margin-top: 5px;
    padding: 5px 8px;
    border-radius: 8px;
    color: #4338ca;
    background: rgba(109, 40, 217, .08);
}

.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 3px 0;
    color: var(--muted);
    font-size: 11px;
}
.refers { display: inline-flex; align-items: center; gap: 8px; }
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--purple), var(--sky));
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .10);
}
.hint { font-family: var(--mono); }

.lock-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: none;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, .34);
    backdrop-filter: blur(5px);
}
.lock-backdrop.show { display: grid; }
.lock-modal {
    width: min(460px, 100%);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 19px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 30px 100px rgba(15, 23, 42, .28);
}
.lock-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, rgba(109, 40, 217, .12), rgba(2, 132, 199, .09));
}
.lock-title { font-size: 15px; font-weight: 900; }
.lock-mini { color: var(--muted); font: 10px var(--mono); }
.lock-body { padding: 18px; }
.lock-desc { margin: 0 0 12px; color: #475569; }
.lock-input {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid rgba(15, 23, 42, .15);
    border-radius: 12px;
    outline: none;
}
.lock-input:focus {
    border-color: rgba(109, 40, 217, .36);
    box-shadow: 0 0 0 4px rgba(109, 40, 217, .09);
}
.lock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 13px;
}
.lock-btn {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}
.lock-btn.primary {
    border-color: rgba(109, 40, 217, .22);
    font-weight: 800;
    background: linear-gradient(90deg, rgba(109, 40, 217, .14), rgba(2, 132, 199, .11));
}
.lock-err {
    display: none;
    margin-top: 9px;
    color: #dc2626;
    font-size: 11px;
}

.error-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}
.error-card {
    width: min(500px, 100%);
    padding: 35px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-strong);
    box-shadow: var(--shadow);
    text-align: center;
}
.error-card h1 { margin: 10px 0 4px; }
.error-card p { color: var(--muted); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .grid-wrap { width: min(900px, 100%); }
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
    .wrap { padding: 20px 14px; }
    .top { flex-direction: column; }
    .brand { min-width: 0; }
    .toolbar { width: 100%; justify-content: flex-start; }
    .search-box { flex: 1 1 100%; }
    .search { width: 100%; }
    .grid-wrap { width: min(630px, 100%); }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    .grid { grid-template-columns: 1fr; }
    .ctl { flex: 1; }
    .meta { width: 100%; }
    .file-card { min-height: 112px; }
}
