:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1d2330;
  --muted: #6b7385;
  --line: #e2e5eb;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --danger: #d6453d;
  --drop: #eef3ff;
  --radius: 12px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --card: #1d2129;
    --text: #e8ebf1;
    --muted: #9099aa;
    --line: #2d333e;
    --accent: #5b8cff;
    --danger: #ff6b62;
    --drop: #1c2538;
  }
}

* { box-sizing: border-box; }
/* display:grid 같은 규칙이 hidden 속성을 덮어쓰지 않게 */
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; margin: 0; }
.muted { color: var(--muted); }
kbd {
  font: inherit; font-size: .85em;
  padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  background: var(--card);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: .9rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }

/* ---- 로그인 ---- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px;
}
.login-card form { display: grid; gap: 10px; margin-top: 18px; }
.login-card input[type="password"] {
  font: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.message { min-height: 1.5em; margin: 0; color: var(--danger); font-size: .9rem; }

/* ---- 메인 ---- */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card);
}
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 18px; }

.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--drop);
  padding: 26px 16px; text-align: center; display: grid; gap: 8px; justify-items: center;
}
.drop:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-title { margin: 0; font-weight: 600; }
.drop .muted { margin: 0; font-size: .88rem; }
.progress { width: 100%; max-width: 360px; display: grid; gap: 4px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.compose { display: flex; gap: 8px; align-items: stretch; }
.compose textarea {
  flex: 1; font: inherit; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text);
}

.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
}
.thumb, .file-badge, .text-preview {
  width: 96px; height: 72px; border-radius: 8px; overflow: hidden; margin: 0;
  border: 1px solid var(--line); background: var(--bg);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-badge { display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--accent); }
.text-preview {
  font: 11px/1.35 ui-monospace, Menlo, Consolas, monospace; padding: 6px;
  white-space: pre-wrap; word-break: break-all; color: var(--muted);
}
.meta { min-width: 0; }
.name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info { font-size: .82rem; }
.actions { display: flex; gap: 6px; }
.empty { text-align: center; padding: 30px 0; }

.drag-overlay {
  position: fixed; inset: 0; background: rgba(47, 111, 237, .15);
  border: 3px dashed var(--accent); display: grid; place-items: center; pointer-events: none;
}
.drag-overlay p { background: var(--card); padding: 12px 20px; border-radius: 10px; font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  color: #fff; background: #222; padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (max-width: 600px) {
  .item { grid-template-columns: 72px 1fr; }
  .thumb, .file-badge, .text-preview { width: 72px; height: 56px; }
  .actions { grid-column: 1 / -1; justify-content: flex-end; }
  .compose { flex-direction: column; }
}
