:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --panel-2: #232730;
  --text: #e6e8eb;
  --muted: #9aa3af;
  --accent: #4f9dff;
  --accent-2: #2f6fd0;
  --ok: #2ecc71;
  --warn: #ffb454;
  --border: #2c3039;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,17,21,0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); padding: 12px 16px;
}
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header h1 { margin: 0; font-size: 17px; font-weight: 650; }
header p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.badge {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--text);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.badge b { font-weight: 700; }
.badge .sub { color: var(--muted); }

main { max-width: 820px; margin: 0 auto; padding: 16px; padding-bottom: 220px; }

.msg { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.msg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.msg-meta { font-size: 12px; color: var(--muted); }
.msg-author { color: var(--accent); font-weight: 600; }
.msg-body {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; background: var(--panel-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto;
}
.msg-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg-body a:hover { color: #7db4ff; }
.line { display: flex; align-items: flex-start; gap: 8px; border-radius: 5px; padding: 1px 4px; margin: 0 -4px; }
.line:hover { background: rgba(255,255,255,0.04); }
.line-text { flex: 1; white-space: pre-wrap; word-break: break-word; }
.line-copy { flex: none; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1.4; padding: 0 4px; opacity: 0.35; transition: opacity .12s, color .12s; }
.line:hover .line-copy { opacity: 1; }
.line-copy:hover { color: var(--text); }
.line-copy.copied { color: var(--ok); opacity: 1; }
.copy-btn { flex: none; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; transition: background .15s, border-color .15s; }
.copy-btn:hover { background: #2c313c; }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }
.empty { color: var(--muted); text-align: center; margin-top: 40px; font-size: 14px; }

.composer { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(15,17,21,0.96); backdrop-filter: blur(8px); border-top: 1px solid var(--border); padding: 10px 12px; }
.composer-inner { max-width: 820px; margin: 0 auto; }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row input { flex: 1; min-width: 0; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
textarea { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 14px; resize: vertical; min-height: 54px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.send-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.btn { flex: none; background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--accent-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #2c313c; }
.btn.danger { background: #c0392b; }
.btn.danger:hover { background: #a93226; }
.status { font-size: 12px; color: var(--muted); }
.status.err { color: #ff6b6b; }
.status.ok { color: var(--ok); }
.hint { font-size: 11px; color: var(--muted); margin-top: 6px; }
.notice {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,180,84,0.12);
  border: 1px solid rgba(255,180,84,0.5);
  color: #ffce8a;
  border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-weight: 600;
}
.notice .ico { flex: none; }

/* admin specific */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 14px; font-weight: 650; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font-size: 14px; }
.gate { max-width: 380px; margin: 80px auto; }
.stat-grid { display: flex; gap: 12px; }
.stat { flex: 1; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; text-align: center; }
.stat .num { font-size: 28px; font-weight: 700; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.adminbar { background: var(--warn); color: #1a1206; text-align: center; font-size: 12px; font-weight: 600; padding: 4px; }
.room-item { display: flex; align-items: center; gap: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.room-item.active { border-color: var(--accent); }
.room-item .rcode { font-family: ui-monospace, monospace; font-weight: 700; color: var(--accent); }
.room-item .rname { color: var(--text); }
.room-item .rmeta { color: var(--muted); font-size: 12px; }
.room-item .spacer { flex: 1; }
.room-item .mini { border: 1px solid var(--border); background: var(--panel); color: var(--text); border-radius: 7px; padding: 5px 9px; font-size: 12px; cursor: pointer; text-decoration: none; }
.room-item .mini:hover { background: #2c313c; }
