:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1d2125;
  --muted: #6b7280;
  --border: #d9dde3;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --error: #c62828;
  --pending: #fff7e0;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1b1f24;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --border: #2f353c;
    --accent: #4c8dff;
    --error: #ff6b6b;
    --pending: #3a3217;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans TC", sans-serif;
}

main { max-width: 720px; margin: 0 auto; padding: 16px; }

header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.logo { color: var(--text); font-weight: 600; text-decoration: none; }
#room-label { color: var(--muted); font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }

h1 { font-size: 1.5rem; margin: 8px 0; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.row input { flex: 1 1 200px; }

input, textarea {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 14px; }

button {
  font: inherit;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error { color: var(--error); white-space: pre-wrap; }
.error code { display: block; margin-top: 4px; color: var(--text); }

.pending {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--pending); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
}
.actions { display: flex; gap: 8px; }
#text-result { margin-bottom: 12px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px dashed var(--border); border-radius: 10px; padding: 24px 12px; cursor: pointer; text-align: center;
}
.drop.over { border-color: var(--accent); }

progress { width: 100%; }
#upload-progress, #file-error { margin-top: 12px; }

#file-list { list-style: none; padding: 0; margin: 12px 0 0; }
#file-list li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
#file-list .name { flex: 1 1 200px; overflow-wrap: anywhere; }
#file-empty { margin: 12px 0 0; }

.footer { margin-top: 0; }
