:root {
  color-scheme: dark;
  font-family: "IBM Plex Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  --bg: #0a0c0e;
  --card: #12151a;
  --fg: #eef2f0;
  --muted-bg: #1a1f26;
  --muted-fg: #8b949e;
  --accent: #00e89a;
  --accent-fg: #04140e;
  --border: rgb(238 242 240 / 0.1);
  --live: #ff4d5a;
  --danger: #f43f5e;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-panel: 0 1px 0 rgb(255 255 255 / 0.03) inset, 0 12px 40px rgb(0 0 0 / 0.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--fg); }
body {
  background-image:
    radial-gradient(1200px 500px at 10% -10%, rgb(0 232 154 / 0.06), transparent 55%),
    radial-gradient(800px 400px at 100% 0%, rgb(255 255 255 / 0.03), transparent 50%);
  background-attachment: fixed;
}
button:not(:disabled), [role="button"] { cursor: pointer; }
h1, h2, h3, p, dl, dd, dt { margin: 0; }
::selection { background: rgb(0 232 154 / 0.28); color: var(--fg); }

#app { min-height: 100%; }

/* Top bar, mirrors the desktop app's AppShell header. */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 56px; padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgb(10 12 14 / 0.8);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; }
.brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-fg);
}
.brand-mark svg { width: 15px; height: 15px; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .who { font-size: 12px; color: var(--muted-fg); padding: 6px 12px; border-radius: 999px; background: var(--muted-bg); }
.topbar .who.you { color: var(--accent); }

main.shell { max-width: 880px; margin: 0 auto; padding: 32px 20px 96px; }

.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--accent); }
.hero h1 { margin-top: 8px; font-size: 26px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.hero p.lede { margin-top: 10px; max-width: 46em; font-size: 13px; line-height: 1.6; color: var(--muted-fg); }

/* Search */
.search { position: relative; margin-top: 24px; }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted-fg); pointer-events: none;
}
.search input {
  width: 100%; height: 46px; padding: 0 14px 0 40px;
  background: var(--card); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  font: inherit; font-size: 14px;
}
.search input:focus { outline: none; border-color: rgb(0 232 154 / 0.4); }
.search input::placeholder { color: var(--muted-fg); }
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 20;
  max-height: 340px; overflow-y: auto; padding: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}
.search-hit {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px;
  background: transparent; border: 0; border-radius: var(--radius-sm); text-align: left; font: inherit; color: var(--fg);
}
.search-hit:hover { background: rgb(255 255 255 / 0.05); }
.search-hit-body { min-width: 0; flex: 1; }
.search-hit-name { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit-meta { display: block; margin-top: 1px; font-size: 11px; color: var(--muted-fg); }
.hidden-msg { display: none; }

.notice { margin-top: 16px; padding: 13px 16px; border-radius: var(--radius-md); background: #2a2308; border: 1px solid #6b5a12; color: #f3d878; font-size: 13px; line-height: 1.6; }

.grid { margin-top: 28px; display: grid; gap: 16px; }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1fr 1fr; align-items: start; } }
/* Grid/flex items default to min-width:auto, which lets a single
   long, space-less string (a live title with no word breaks) force its
   whole column to grow past its 1fr share and squeeze the other one down
   to a sliver. min-width:0 lets these actually shrink so the ellipsis
   truncation below can do its job. */
.grid.two > * { min-width: 0; }

.panel { border: 1px solid var(--border); background: var(--card); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-panel); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head h2 { font-size: 13px; font-weight: 500; }
.panel-sub { margin-top: 4px; font-size: 12px; line-height: 1.6; color: var(--muted-fg); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; }
.badge.live { background: rgb(255 77 90 / 0.14); color: var(--live); }
.badge.mode { background: var(--muted-bg); color: var(--muted-fg); font-weight: 500; }

/* 감시 목록 (read-only) */
.watchlist { margin-top: 14px; display: flex; flex-direction: column; gap: 2px; }
.watch-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: var(--radius-sm); }
.watch-row:hover { background: rgb(255 255 255 / 0.03); }
.watch-row.dim { opacity: 0.45; }
.avatar { width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0; object-fit: cover; background: var(--muted-bg); }
.avatar-fallback {
  width: 30px; height: 30px; border-radius: 999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--muted-bg); color: var(--muted-fg); font-size: 12px; font-weight: 600;
}
.watch-row { min-width: 0; }
.watch-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.watch-name-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-meta { margin-top: 1px; font-size: 11px; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watch-col { min-width: 0; flex: 1; }

.empty { padding: 28px 4px; text-align: center; font-size: 13px; color: var(--muted-fg); }

.stat-row { margin-top: 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stat { background: var(--muted-bg); border-radius: var(--radius-sm); padding: 10px 6px; }
.stat dt { font-size: 10px; color: var(--muted-fg); }
.stat dd { margin-top: 4px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 15px; }

/* 방금 채팅 */
.chatlist { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-row { display: flex; gap: 10px; }
.chat-body { min-width: 0; flex: 1; }
.chat-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; }
.chat-line .nick { font-weight: 500; }
.chat-line .chan { color: var(--muted-fg); }
.chat-line time { margin-left: auto; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 10px; color: var(--muted-fg); }
.chat-msg { margin-top: 2px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* Gate / centered states */
.center-wrap { min-height: calc(100vh - 56px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.gate-panel { width: 100%; max-width: 380px; }
.gate-panel h1 { margin-top: 10px; font-size: 20px; font-weight: 600; }
.gate-panel p { margin-top: 8px; font-size: 12px; line-height: 1.6; color: var(--muted-fg); }
.gate-panel form { margin-top: 18px; display: grid; gap: 10px; }
.gate-panel input {
  height: 46px; padding: 0 14px; background: var(--muted-bg); color: var(--fg);
  border: 1px solid var(--border); border-radius: var(--radius-md); font: inherit; font-size: 15px;
  letter-spacing: 0.03em; text-align: center;
}
.gate-panel input:focus { outline: none; border-color: rgb(0 232 154 / 0.4); }
.btn {
  height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-md);
  background: var(--accent); color: var(--accent-fg); font: inherit; font-size: 13px; font-weight: 600;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--muted-fg); border: 1px solid var(--border); font-weight: 500; }
.error { min-height: 18px; font-size: 12px; color: var(--danger); }

@media (max-width: 560px) {
  main.shell { padding: 24px 14px 80px; }
  .chat-line time { margin-left: 0; width: 100%; order: 3; }
}
