/* 현대미술(바우하우스·멤피스) 테마: 원색 블록, 굵은 먹선, 그림자 없이 어긋난 면(오프셋 섀도) */
:root {
  --bg: #fffdf7;
  --surface: #f6efe1;
  --surface-2: #ffffff;
  --hover: rgba(255, 210, 63, .28);
  --selected: #cfdcff;
  --selected-text: #111111;
  --text: #111111;
  --muted: #5b5750;
  --border: #111111;
  --line: #e4dccb;
  --ink: #111111;
  --primary: #2f5bff;
  --primary-text: #ffffff;
  --danger: #e5341d;
  --success: #12a05c;
  --focus: #2f5bff;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 8px 8px 0 var(--ink);
  --radius: 10px;
  --c-red: #ff4d2e; --c-blue: #2f5bff; --c-yellow: #ffd23f; --c-pink: #ff8fc7; --c-green: #1fbf75; --c-violet: #8b5cf6;
  --folder: #111111;
  --t-image: #ff5ca8; --t-video: #ff4d2e; --t-audio: #12a05c; --t-pdf: #e5341d;
  --t-archive: #c98a00; --t-code: #2f5bff; --t-text: #8b5cf6; --t-file: #6b6b6b;
  --thumb-bg: #f6efe1;
  --mark: #ffd23f;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17151f;
    --surface: #0f0e15;
    --surface-2: #211f2c;
    --hover: rgba(255, 210, 63, .14);
    --selected: #24316b;
    --selected-text: #ffffff;
    --text: #f5efe3;
    --muted: #aaa39a;
    --border: #f5efe3;
    --line: #2e2b3a;
    --ink: #ff8fc7;
    --primary: #5b7cff;
    --primary-text: #ffffff;
    --danger: #ff6b55;
    --success: #3ddc8b;
    --focus: #ffd23f;
    --folder: #f5efe3;
    --thumb-bg: #211f2c;
    --mark: rgba(255, 210, 63, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17151f;
  --surface: #0f0e15;
  --surface-2: #211f2c;
  --hover: rgba(255, 210, 63, .14);
  --selected: #24316b;
  --selected-text: #ffffff;
  --text: #f5efe3;
  --muted: #aaa39a;
  --border: #f5efe3;
  --line: #2e2b3a;
  --ink: #ff8fc7;
  --primary: #5b7cff;
  --primary-text: #ffffff;
  --danger: #ff6b55;
  --success: #3ddc8b;
  --focus: #ffd23f;
  --folder: #f5efe3;
  --thumb-bg: #211f2c;
  --mark: rgba(255, 210, 63, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 12px 16px; margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* 아이콘 */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ti { width: 22px; height: 22px; flex: none; }
.ti .fill { fill: currentColor; }
.ti .glyph { fill: #fff; }
.ti .glyph-line { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ti.big { width: 56px; height: 56px; }
.t-folder { color: var(--folder); }
.t-image { color: var(--t-image); } .t-video { color: var(--t-video); } .t-audio { color: var(--t-audio); }
.t-pdf { color: var(--t-pdf); } .t-archive { color: var(--t-archive); } .t-code { color: var(--t-code); }
.t-text { color: var(--t-text); } .t-file { color: var(--t-file); }

/* 버튼 */
.btn {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 500;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: transparent; }
.btn.primary:hover:not(:disabled) { opacity: .86; }
.btn.danger { background: var(--danger); color: var(--bg); border-color: transparent; }
.btn.text { border-color: transparent; background: none; color: var(--primary); }
.btn.text:hover { background: var(--hover); }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: var(--radius);
  background: none; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .4; cursor: default; }

/* 브랜드 */
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; fill: var(--text); }

/* ===== 로그인 ===== */
.login-page { display: grid; place-items: center; padding: 16px; background: var(--surface); }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 28px;
}
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 20px 0 16px; }
.login-card form { display: grid; gap: 10px; }
.login-card label { font-size: 13px; color: var(--muted); }
.login-card input, .text-input {
  font: inherit; width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg); color: var(--text);
}
.login-card input:focus, .text-input:focus { outline: 2px solid var(--focus); border-color: transparent; }
.login-card .btn.primary { margin-top: 8px; padding: 11px; border-radius: 8px; }
.error { color: var(--danger); min-height: 1.5em; margin: 4px 0 0; font-size: 14px; }

/* ===== 앱 레이아웃 ===== */
.app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; background: var(--surface); }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  flex: none;
}
.topbar .brand { width: 232px; }
.topbar-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }

.search {
  flex: 1; max-width: 720px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 6px 0 16px;
  height: 46px;
}
.search:focus-within { background: var(--bg); border-color: var(--text); }
.search > .i { color: var(--muted); }
.search input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  font: inherit; font-size: 15px; color: var(--text);
}
.search input::-webkit-search-cancel-button { display: none; }

.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 256px; flex: none;
  padding: 8px 12px 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.new-btn {
  display: inline-flex; align-items: center; gap: 12px;
  align-self: flex-start;
  padding: 11px 20px 11px 16px;
  border: 0; border-radius: var(--radius);
  background: var(--primary); color: var(--primary-text);
  font-weight: 500; cursor: pointer;
}
.new-btn:hover { opacity: .86; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-radius: var(--radius);
  font-weight: 500;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--selected); color: var(--selected-text); font-weight: 600; }
.usage { padding: 4px 16px; margin-top: 4px; }
.usage-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
#usage-fill { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
#usage-text { white-space: pre-line; margin: 8px 0 0; }

.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: 12px 12px 0 0;
  margin-right: 16px;
  position: relative;
  outline: none;
}
.main-head {
  display: flex; align-items: center;
  min-height: 64px; padding: 8px 16px 8px 20px;
  flex: none;
}
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.crumb { padding: 4px 10px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
a.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.current { color: var(--text); }
.crumb-sep { color: var(--muted); width: 18px; height: 18px; }
.selbar {
  flex: 1; display: flex; align-items: center; gap: 4px;
  background: var(--surface-2); border-radius: var(--radius); padding: 2px 8px;
}
.selbar #sel-count { font-weight: 500; padding: 0 8px; }
.spacer { flex: 1; }

.content { flex: 1; overflow: auto; padding: 0 16px 96px 16px; user-select: none; -webkit-user-select: none; }

/* 목록 보기 */
.list-head, .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 100px 48px;
  align-items: center; gap: 8px;
}
.list-head.with-path, .row.with-path { grid-template-columns: minmax(0, 1fr) minmax(0, .6fr) 140px 100px 48px; }
.list-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  height: 48px; padding: 0 8px;
}
.col-head {
  border: 0; background: none; text-align: left; cursor: pointer;
  font-weight: 500; color: var(--text); padding: 4px 8px; border-radius: 8px;
  justify-self: start;
}
button.col-head:hover { background: var(--hover); }
.col-head.active { color: var(--primary); }
.row {
  height: 48px; padding: 0 8px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}
.row > span { padding: 0 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .c-name { display: flex; align-items: center; gap: 14px; }
.row .c-more { padding: 0; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item:hover { background: var(--hover); }
.item.selected { background: var(--selected); color: var(--selected-text); }
.item.selected .muted { color: inherit; }
.item.drop-hover, .crumb.drop-hover { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--selected); }
.row .more { opacity: 0; width: 36px; height: 36px; }
.item:hover .more, .item.selected .more, .item .more:focus-visible { opacity: 1; }
@media (hover: none) { .row .more { opacity: 1; } }

/* 바둑판 보기 */
.section-title { font-size: 14px; font-weight: 500; margin: 8px 4px 12px; }
.grid { display: grid; gap: 12px; margin-bottom: 20px; }
.grid.folders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid.files { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); cursor: default; }
.card.folder { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 4px 0 16px; font-weight: 500; }
.card.folder .name { flex: 1; }
.card .more { width: 34px; height: 34px; }
.card.file { padding: 0 6px 6px; display: flex; flex-direction: column; }
.card-foot { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 0 0 10px; order: -1; font-weight: 500; }
.card-foot .ti { width: 20px; height: 20px; }
.card-foot .name { flex: 1; }
.thumb {
  aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden;
  background: var(--thumb-bg);
  display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.selected .thumb { background: var(--bg); }

/* 빈 화면 */
.empty { text-align: center; padding: 72px 16px; }
.empty-icon { width: 96px; height: 96px; color: var(--muted); stroke-width: 1.2; fill: none; stroke: currentColor; }
.empty p { margin: 8px 0; font-size: 16px; }
.empty p.small { font-size: 13px; }

/* 드롭 영역 */
.drop-overlay {
  position: absolute; inset: 0; z-index: 5;
  border: 2px solid var(--primary); border-radius: 12px 12px 0 0;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.drop-overlay > div {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 40px; padding: 14px 24px; border-radius: var(--radius);
  background: var(--primary); color: var(--primary-text);
}
.drop-overlay p { margin: 0; }

/* 메뉴 */
.menu {
  position: fixed; z-index: 30;
  min-width: 220px; padding: 8px 0;
  background: var(--bg); border-radius: 8px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.menu-item {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 9px 20px; border: 0; background: none; text-align: left; cursor: pointer;
}
.menu-item .i { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.danger, .menu-item.danger .i { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

/* 대화상자 */
dialog {
  border: 1px solid var(--border); border-radius: 12px; padding: 0;
  background: var(--bg); color: var(--text);
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.dlg { padding: 24px; display: grid; gap: 16px; }
.dlg h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.dlg p { margin: 0; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dlg.move { padding-bottom: 20px; }
.move-where { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.move-where strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-list { border: 1px solid var(--border); border-radius: var(--radius); height: 280px; overflow: auto; }
.move-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px 10px 16px; border: 0; background: none; text-align: left; cursor: pointer;
}
.move-item .name { flex: 1; }
.move-item > .i { color: var(--muted); }
.move-item:hover { background: var(--hover); }
.move-item:disabled { opacity: .4; cursor: default; }

/* 업로드 패널 */
.uploads {
  position: fixed; right: 24px; bottom: 0; z-index: 20;
  width: 360px; max-width: calc(100vw - 32px);
  background: var(--bg); border-radius: 12px 12px 0 0; border: 1px solid var(--border); border-bottom: 0; box-shadow: var(--shadow);
  overflow: hidden;
}
.uploads header {
  display: flex; align-items: center; gap: 2px;
  padding: 6px 6px 6px 20px; background: var(--surface-2); font-weight: 500;
}
.uploads header span { flex: 1; }
#uploads-toggle .i { transform: rotate(90deg); transition: transform .2s; }
.uploads.collapsed #uploads-toggle .i { transform: rotate(-90deg); }
.uploads.collapsed ul { display: none; }
.uploads ul { list-style: none; margin: 0; padding: 4px 0; max-height: 300px; overflow: auto; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 20px; }
.up-body { flex: 1; min-width: 0; }
.up-line { display: flex; gap: 8px; align-items: baseline; }
.up-line .name { flex: 1; }
.up-status { flex: none; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item.error .up-status { color: var(--danger); }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.up-item.done .bar, .up-item.error .bar, .up-item.cancelled .bar { display: none; }
.up-icon { margin: 0 10px; }
.up-icon.done { color: var(--success); }
.up-icon.error, .up-icon.cancelled { color: var(--danger); }

/* 알림 */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 40; display: grid; gap: 8px; }
.toast {
  background: #0a0a0a; color: #fafafa; border: 1px solid #2a2a2a;
  padding: 12px 18px; border-radius: 8px; box-shadow: var(--shadow);
  max-width: min(440px, calc(100vw - 32px));
  transition: opacity .3s, transform .3s;
}
.toast.error { background: #8c1d18; color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

.fab {
  position: fixed; right: 16px; bottom: 24px; z-index: 15;
  width: 56px; height: 56px; border: 0; border-radius: 12px;
  background: var(--primary); color: var(--primary-text); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer;
}
.fab .i { width: 26px; height: 26px; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 24; }
.only-mobile { display: none; }
.sidebar .mobile-actions { display: none; gap: 4px; margin-top: auto; }

/* ===== 모바일 ===== */
@media (max-width: 760px) {
  .only-mobile { display: grid; }
  .topbar { gap: 4px; padding: 8px 8px 8px 4px; }
  .topbar .brand { width: auto; }
  .topbar .brand span { display: none; }
  .search { height: 42px; padding-left: 12px; }
  #theme-btn, #logout-btn { display: none; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 25;
    background: var(--bg); box-shadow: var(--shadow);
    transform: translateX(-105%); transition: transform .2s;
    padding-top: 16px;
  }
  .sidebar.open { transform: none; }
  .sidebar .mobile-actions { display: grid; }
  .main { margin: 0; border-radius: 0; }
  .main-head { padding: 4px 8px 4px 8px; min-height: 52px; }
  .crumbs { font-size: 18px; }
  .content { padding: 0 4px 112px; }
  .list-head { display: none; }
  .row, .row.with-path { grid-template-columns: minmax(0, 1fr) 44px; height: 56px; }
  .row .c-date, .row .c-size, .row .c-path { display: none; }
  .grid.folders, .grid.files { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card.folder { padding-left: 12px; gap: 8px; }
  .uploads { right: 16px; }
  .toasts { left: 16px; bottom: 96px; }
}

/* ===== 공유 ===== */
.offscreen { position: fixed; left: -9999px; top: 0; }
.shared-badge { display: inline-flex; color: var(--muted); flex: none; }
.shared-badge .i { width: 15px; height: 15px; }
.item.selected .shared-badge { color: inherit; }
.icon-btn.danger:hover { color: var(--danger); }
select.text-input { appearance: auto; padding: 10px 12px; cursor: pointer; }
.dlg.share-dlg { gap: 14px; }
dialog:has(.share-dlg) { width: min(560px, calc(100vw - 32px)); }
.share-list { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.share-list > p { margin: 0; }
.share-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 6px 4px 6px 12px; border: 1px solid var(--border); border-radius: var(--radius);
}
.share-row.expired { opacity: .55; }
.share-url {
  font: 13px Consolas, "Cascadia Mono", monospace; color: var(--text);
  border: 0; background: none; min-width: 0; padding: 6px 0; outline: none;
  text-overflow: ellipsis;
}
.share-exp { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.share-exp .i { width: 14px; height: 14px; }
.share-actions { display: flex; }
.share-actions .icon-btn { width: 36px; height: 36px; }
.share-create { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.share-create .btn { display: inline-flex; align-items: center; gap: 6px; }
.share-create .btn .i { width: 18px; height: 18px; }
.expiry { display: flex; gap: 8px; flex: 1; min-width: 200px; }
.expiry > * { flex: 1; }
.share-page { display: grid; gap: 10px; padding-top: 8px; max-width: 980px; }
.share-page .share-row { grid-template-columns: minmax(140px, .8fr) minmax(0, 1fr) auto auto; padding-left: 16px; }
.share-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; }

/* 공유 페이지 (방문자용) */
.share-app .topbar .brand { width: auto; }
.share-badge { display: inline-flex; align-items: center; gap: 4px; }
.share-badge .i { width: 15px; height: 15px; }
.share-main { margin: 0 16px; }
.single { display: grid; place-items: center; padding: 48px 16px; }
.v-card.share-card { background: var(--surface-2); color: var(--text); }
.v-card.share-card .muted { color: var(--muted); }
.single-actions { display: flex; gap: 8px; margin-top: 12px; }
.single-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.single-actions .btn .i { width: 18px; height: 18px; }
@media (max-width: 760px) {
  .share-row, .share-page .share-row { grid-template-columns: minmax(0, 1fr) auto; }
  .share-row .share-exp { grid-column: 1; grid-row: 2; }
  .share-row .share-actions { grid-column: 2; grid-row: 1 / span 2; }
  .share-page .share-row .share-url { display: none; }
  .share-main { margin: 0; }
  .share-app .topbar .brand span { display: inline; }
}

/* ===== 미리보기 ===== */
.viewer-open { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(14, 14, 16, .97); color: #e8eaed;
  display: flex; flex-direction: column;
  --hover: rgba(255, 255, 255, .1);
}
.viewer .icon-btn { color: #e8eaed; }
.v-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 8px; flex: none; min-width: 0; }
.v-icon { display: flex; }
.v-title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.v-counter { flex: none; color: #9aa0a6; }
.v-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 72px 24px; overflow: auto;
}
.v-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; }
.v-img.zoom { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.v-media { max-width: 100%; max-height: 100%; background: #000; border-radius: 4px; outline: none; }
.v-frame { width: min(1000px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.v-card {
  display: grid; justify-items: center; gap: 4px; text-align: center;
  background: #1c1c1c; border: 1px solid #2a2a2a; border-radius: 12px; padding: 32px 40px; max-width: 420px;
}
.v-card p { margin: 4px 0; }
.v-card .muted { color: #9aa0a6; }
.v-card .btn { margin-top: 12px; }
.v-card audio { margin-top: 12px; width: 320px; max-width: 100%; }
.v-name { font-size: 16px; font-weight: 500; overflow-wrap: anywhere; }
.v-text {
  width: min(1000px, 100%); height: 100%;
  background: #1e1f22; border-radius: 8px; overflow: auto;
  font: 13px/1.6 Consolas, "D2Coding", "Cascadia Mono", monospace;
}
.v-codewrap { display: flex; min-width: max-content; }
.v-gutter {
  white-space: pre; text-align: right; color: #6b6f76;
  padding: 12px 12px 12px 16px; user-select: none;
  position: sticky; left: 0; background: #1e1f22; border-right: 1px solid #33353a;
}
.v-code { margin: 0; padding: 12px 16px; color: #e3e3e3; white-space: pre; tab-size: 4; user-select: text; }
.v-note { margin: 0; padding: 8px 16px; background: #3c3a1e; color: #fde293; font: 13px "Segoe UI", "Malgun Gothic", sans-serif; }
.v-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(60, 64, 67, .8); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.v-nav:hover { background: rgba(95, 99, 104, .95); }
.v-nav.prev { left: 12px; }
.v-nav.next { right: 12px; }
@media (max-width: 760px) {
  .v-stage { padding: 0 0 8px; }
  .v-nav { width: 40px; height: 40px; background: rgba(60, 64, 67, .6); }
  .v-nav.prev { left: 4px; }
  .v-nav.next { right: 4px; }
  .v-text, .v-frame { border-radius: 0; }
}

.placeholder { padding: 48px 16px; text-align: center; }

/* ===== 현대미술 테마 ===== */
/* 배경: microbes.js가 그리는 떠다니는 미생물 캔버스 (클릭은 통과, 반응은 문서 클릭으로 처리) */
.app, .login-page { position: relative; isolation: isolate; }
.microbes { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.microbes-fx { position: fixed; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }

.brand { font-size: 19px; font-weight: 900; letter-spacing: -.03em; }
.brand svg { width: 30px; height: 30px; fill: none; }
.logo .s1 { fill: var(--c-red); } .logo .s2 { fill: var(--c-blue); } .logo .s3 { fill: var(--c-yellow); }

/* 버튼: 먹선 + 어긋난 면, 누르면 면이 들어간다 */
.btn, .new-btn, .fab {
  border: 2px solid var(--border); box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover:not(:disabled), .new-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active:not(:disabled), .new-btn:active, .fab:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn { font-weight: 700; }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--border); }
.btn.primary:hover:not(:disabled) { opacity: 1; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--border); }
.btn.text { border-color: transparent; box-shadow: none; color: var(--text); text-decoration: underline 2px var(--c-yellow); text-underline-offset: 4px; }
.btn.text:hover:not(:disabled), .btn.text:active:not(:disabled) { transform: none; box-shadow: none; }
.new-btn { background: var(--c-yellow); color: #111; font-weight: 800; border-radius: 999px; padding: 11px 22px 11px 16px; }
.new-btn:hover { opacity: 1; background: var(--c-yellow); }
.fab { background: var(--c-yellow); color: #111; border-radius: 50%; }
.icon-btn { border-radius: 50%; }
.icon-btn:hover { background: var(--c-yellow); color: #111; }

/* 검색창 */
.search { background: var(--surface-2); border: 2px solid var(--border); border-radius: 999px; }
.search:focus-within { background: var(--surface-2); border-color: var(--border); box-shadow: var(--shadow); }

/* 사이드바 */
.nav-item { border: 2px solid transparent; border-radius: 999px; font-weight: 700; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--c-blue); color: #fff; border-color: var(--border); box-shadow: 3px 3px 0 var(--ink); }
.usage-bar { height: 10px; border-radius: 999px; border: 2px solid var(--border); background: var(--surface-2); }
#usage-fill { background: repeating-linear-gradient(-45deg, var(--c-red) 0 6px, var(--c-yellow) 6px 12px); }

/* 본문 판: 액자처럼 */
/* 반투명 + 흐림이라 뒤에서 미생물이 비쳐 보인다 */
.main {
  background: color-mix(in srgb, var(--bg) 30%, transparent);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  border: 2px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
}
.list-head { background: color-mix(in srgb, var(--bg) 45%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.crumbs { font-size: 26px; font-weight: 900; letter-spacing: -.035em; }
.crumb.current { color: var(--text); border-radius: 0; background: linear-gradient(transparent 60%, var(--mark) 60% 88%, transparent 88%); }
.selbar { background: var(--c-yellow); color: #111; border: 2px solid var(--border); border-radius: 999px; }
.selbar .icon-btn { color: #111; }
.selbar .icon-btn:hover { background: #fff; }

/* 목록 */
.col-head { font-weight: 800; text-transform: uppercase; letter-spacing: .02em; font-size: 12px; }
.col-head.active { color: var(--text); text-decoration: underline 3px var(--c-red); text-underline-offset: 5px; }
.item.selected { background: var(--selected); color: var(--selected-text); box-shadow: inset 4px 0 0 var(--c-blue); }
.item.drop-hover, .crumb.drop-hover { outline: 2px dashed var(--text); background: var(--c-yellow); color: #111; }

/* 바둑판: 카드마다 다른 원색 블록 */
.section-title { font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.card { background: var(--surface-2); border: 2px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); transition: transform .1s, box-shadow .1s; }
.card.item:hover { background: var(--surface-2); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.card.item.selected { background: var(--selected); }
.card.folder { font-weight: 700; border-left-width: 10px; }
.grid.folders .card:nth-child(5n+1) { border-left-color: var(--c-red); }
.grid.folders .card:nth-child(5n+2) { border-left-color: var(--c-blue); }
.grid.folders .card:nth-child(5n+3) { border-left-color: var(--c-yellow); }
.grid.folders .card:nth-child(5n+4) { border-left-color: var(--c-green); }
.grid.folders .card:nth-child(5n+5) { border-left-color: var(--c-pink); }
.thumb { border: 2px solid var(--border); border-radius: 8px; }
.grid.files .card:nth-child(5n+1) .thumb { background: var(--c-yellow); }
.grid.files .card:nth-child(5n+2) .thumb { background: var(--c-pink); }
.grid.files .card:nth-child(5n+3) .thumb { background: var(--c-blue); }
.grid.files .card:nth-child(5n+4) .thumb { background: var(--c-green); }
.grid.files .card:nth-child(5n+5) .thumb { background: var(--c-red); }
.thumb .ti.big { color: #111; }

/* 빈 화면 */
.empty p:first-of-type { font-size: 22px; font-weight: 900; letter-spacing: -.03em; }

/* 드롭 영역 */
.drop-overlay { border: 3px dashed var(--text); border-radius: 18px 18px 0 0; background: rgba(255, 210, 63, .25); }
.drop-overlay > div { background: var(--c-blue); color: #fff; border: 2px solid var(--border); box-shadow: var(--shadow); font-weight: 700; }

/* 메뉴·대화상자·업로드 */
.menu { border: 2px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.menu-item:hover, .menu-item:focus-visible { background: var(--c-yellow); color: #111; }
.menu-item:hover .i, .menu-item:focus-visible .i { color: #111; }
dialog { border: 2px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(47, 91, 255, .35); }
.dlg h2 { font-size: 22px; font-weight: 900; letter-spacing: -.03em; }
.text-input, .login-card input { border: 2px solid var(--border); border-radius: 10px; }
.text-input:focus, .login-card input:focus { outline: 0; border-color: var(--border); box-shadow: 3px 3px 0 var(--c-blue); }
.move-list, .share-row { border: 2px solid var(--border); }
.uploads { border: 2px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); }
.uploads header { background: var(--c-yellow); color: #111; border-bottom: 2px solid var(--border); font-weight: 800; }
.uploads header .icon-btn { color: #111; }
.uploads header .icon-btn:hover { background: #fff; }
.bar { height: 8px; border-radius: 999px; border: 1.5px solid var(--border); }
.bar-fill { background: var(--c-blue); }
.toast { background: #111; color: #fff; border: 2px solid #111; border-radius: 12px; box-shadow: 4px 4px 0 var(--c-yellow); font-weight: 600; }
.toast.error { background: var(--danger); box-shadow: 4px 4px 0 #111; }

/* 로그인 */
.login-card {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 2px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 34px; font-weight: 900; letter-spacing: -.04em; }
.login-card .btn.primary { border-radius: 10px; }

/* 공유 페이지 */
.v-card.share-card { border: 2px solid var(--border); box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .main { margin: 0; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .crumbs { font-size: 20px; }
  .sidebar { border-right: 2px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .new-btn, .fab, .card { transition: none; }
}

/* 배경 미생물 설정 창 */
.bg-panel {
  position: fixed; top: 64px; right: 16px; z-index: 35;
  width: min(320px, calc(100vw - 32px)); max-height: calc(100dvh - 80px); overflow: auto;
  display: grid; gap: 12px; padding: 14px 18px 16px;
  background: var(--bg); color: var(--text);
  border: 2px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg);
}
.bg-panel header { display: flex; align-items: center; justify-content: space-between; margin-right: -8px; }
.bg-panel h2 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: -.03em; }
.bg-panel footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bg-label { margin: 0 0 -4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.bg-switch { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.bg-switch input, .bg-chip input { accent-color: var(--c-blue); width: 18px; height: 18px; margin: 0; }
.bg-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.bg-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 12px 5px 8px; border: 2px solid var(--border); border-radius: 999px; font-weight: 700; font-size: 13px;
}
.bg-chip:has(input:checked) { background: var(--c-yellow); color: #111; }
.bg-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-weight: 700; }
.bg-row output { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.bg-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--c-red); margin: 4px 0 0; }
@media (max-width: 760px) {
  #bg-btn { display: none; }
  .bg-panel { top: auto; bottom: 16px; right: 16px; }
}
