:root {
  color-scheme: dark;
  font-family: Inter, "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --bg: #0d1016;
  --panel: #151922;
  --panel-2: #1a1f29;
  --line: rgba(255,255,255,.075);
  --muted: #8d96a6;
  --text: #f5f7fb;
  --accent: #7cf0b0;
  --accent-strong: #45dd8a;
}

* { box-sizing: border-box; }
#appRoot { display: contents; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(77,111,255,.16), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(69,221,138,.1), transparent 34%),
    #080a0f;
}

button, input { font: inherit; }
button { color: inherit; }

.widget {
  width: min(960px, calc(100vw - 24px));
  height: min(650px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(13,16,22,.96);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.03);
}

.titlebar, .status-summary, .view-tabs, .tab-toolbar, .footer-actions { flex: 0 0 auto; }

.titlebar {
  min-height: 62px;
  padding: 10px 16px 9px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { margin: 0; font-size: 16px; letter-spacing: .02em; }
.beta-badge { display: inline-block; margin-left: 4px; padding: 2px 5px; vertical-align: 2px; color: #b9c3d2; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.11); border-radius: 5px; font-size: 7px; letter-spacing: .09em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.brand-mark { width: 33px; height: 33px; padding: 8px 7px; display: flex; gap: 3px; align-items: flex-end; justify-content: center; background: linear-gradient(145deg,#1d4331,#183225); border: 1px solid rgba(124,240,176,.24); border-radius: 10px; }
.brand-mark i { width: 4px; background: var(--accent); border-radius: 3px; box-shadow: 0 0 10px rgba(124,240,176,.35); }
.brand-mark i:nth-child(1) { height: 8px; opacity: .55; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; opacity: .78; }

.window-actions { display: flex; gap: 4px; }
.icon-button { width: 34px; height: 34px; padding: 8px; display: grid; place-items: center; border: 0; border-radius: 9px; color: #8992a2; background: transparent; cursor: pointer; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.icon-button.active { color: var(--accent); background: rgba(124,240,176,.08); }
.icon-button svg, .primary-button svg, .feedback-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-button svg { width: 14px; height: 14px; fill: currentColor; }

.status-summary { min-height: 39px; padding: 6px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.live-summary { display: flex; align-items: center; gap: 8px; color: var(--text); white-space: nowrap; }
.status-summary strong { font-size: 13px; }
.live-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(124,240,176,.09), 0 0 12px var(--accent); }
.supported-sites { display: flex; align-items: center; justify-content: center; gap: 5px; }
.supported-sites > span { margin-right: 2px; color: #697383; font-size: 9px; font-weight: 700; }
.supported-sites b { padding: 3px 7px; color: #dce1e9; border: 1px solid color-mix(in srgb,var(--site),transparent 60%); border-radius: 999px; background: color-mix(in srgb,var(--site),transparent 89%); font-size: 8px; letter-spacing: .02em; }
.supported-sites .yt { --site: #ff5d66; }.supported-sites .tw { --site: #aa86ff; }.supported-sites .kc { --site: #65e43b; }.supported-sites .tc { --site: #59c9ff; }

.view-tabs { min-height: 40px; padding: 0 14px; display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.view-tab { min-width: 128px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; }
.view-tab span { margin-left: 5px; opacity: .65; }
.view-tab:hover { color: var(--text); }
.view-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-toolbar { min-height: 38px; padding: 5px 14px 6px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tab-toolbar p { margin: 0; color: #778191; font-size: 10px; }
.favorite-sort { padding: 2px; display: flex; gap: 2px; background: #10141b; border: 1px solid var(--line); border-radius: 9px; }
.favorite-sort[hidden] { display: none; }
.sort-mode { height: 25px; padding: 0 11px; border: 0; border-radius: 6px; color: #7f8998; background: transparent; font-size: 10px; cursor: pointer; }
.sort-mode.active { color: var(--text); background: #242a35; }

.streamer-list {
  min-height: 0;
  flex: 1 1 auto;
  padding: 0 12px 10px;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  grid-auto-rows: 126px;
  align-content: start;
  gap: 9px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #343b49 transparent;
  border: 1px solid transparent;
}

.streamer-card {
  position: relative;
  height: 126px;
  overflow: hidden;
  background: linear-gradient(145deg,rgba(25,30,40,.94),rgba(18,22,30,.94));
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: opacity .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.streamer-card.is-live { border-color: rgba(124,240,176,.38); box-shadow: inset 0 0 32px rgba(69,221,138,.045), 0 0 0 1px rgba(69,221,138,.035); }
.streamer-card.is-pinned { background: linear-gradient(145deg,rgba(31,35,43,.98),rgba(21,26,33,.98)); }
.streamer-card.can-drag { cursor: grab; }
.streamer-card.can-drag:active { cursor: grabbing; }
.streamer-card.dragging { opacity: .28; }
.streamer-card.swap-target { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,240,176,.2), 0 0 22px rgba(124,240,176,.14); transform: scale(.985); }

.streamer-main { width: 100%; height: 100%; padding: 12px; display: grid; grid-template-columns: 38px minmax(0,1fr) 58px; grid-template-rows: 42px 1fr; column-gap: 7px; align-items: center; text-align: left; }
.avatar { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #e7eaf2; font-size: 11px; font-weight: 800; background: linear-gradient(145deg,#343b4b,#252b38); }
.avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.avatar img[hidden] { display: none; }
.avatar i { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border: 2px solid var(--panel); border-radius: 50%; background: #545d6b; }
.is-live .avatar i { background: var(--accent-strong); box-shadow: 0 0 8px rgba(69,221,138,.6); }
.streamer-copy { min-width: 0; }
.streamer-copy strong, .streamer-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.streamer-copy strong { font-size: 12px; }
.streamer-copy small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.is-live .streamer-copy small { color: #a7eac3; font-weight: 700; }
.elapsed-time { display: block; margin-top: 2px; color: #7fb291; }
.card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.pin-button, .notify-button { width: 28px; height: 29px; padding: 6px; display: grid; place-items: center; color: #4e5664; background: transparent; border: 0; border-radius: 8px; cursor: pointer; opacity: .72; }
.pin-button:hover { color: #d4bd8f; background: rgba(255,194,103,.05); opacity: 1; }
.pin-button svg, .notify-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.is-pinned .pin-button { color: #c8aa72; background: rgba(255,194,103,.045); opacity: .85; }
.notify-button:hover { color: #9eeec2; background: rgba(124,240,176,.05); opacity: 1; }
.is-notified .notify-button { color: var(--accent); background: rgba(124,240,176,.07); opacity: .95; }

.platform-row { grid-column: 1 / -1; align-self: end; display: flex; flex-wrap: wrap; gap: 5px; }
.platform-link { width: 31px; height: 27px; display: grid; place-items: center; position: relative; border: 1px solid var(--line); border-radius: 7px; color: #596271; background: rgba(255,255,255,.018); font-size: 8px; font-weight: 800; letter-spacing: .02em; text-decoration: none; cursor: pointer; }
.platform-link::after { content: ""; position: absolute; top: 3px; right: 3px; width: 4px; height: 4px; border-radius: 50%; background: #424957; }
.platform-link.online { width: auto; min-width: 49px; padding: 0 10px; color: #fff; border-color: color-mix(in srgb,var(--platform),transparent 28%); background: color-mix(in srgb,var(--platform),#151922 55%); box-shadow: 0 0 13px color-mix(in srgb,var(--platform),transparent 76%), inset 0 1px rgba(255,255,255,.12); font-size: 10px; letter-spacing: 0; }
.platform-link.online::after { background: var(--platform); box-shadow: 0 0 6px var(--platform); }
.platform-link:hover { transform: translateY(-1px); filter: brightness(1.15); }
.platform-link.yt { --platform: #ff5d66; }
.platform-link.tw { --platform: #aa86ff; }
.platform-link.kc { --platform: #65e43b; }
.platform-link.tc { --platform: #59c9ff; }
.add-platform-button { height: 27px; padding: 0 8px; color: #91a0b3; background: transparent; border: 1px dashed rgba(255,255,255,.16); border-radius: 7px; font-size: 8px; cursor: pointer; }
.add-platform-button:hover { color: var(--accent); border-color: rgba(124,240,176,.38); background: rgba(124,240,176,.045); }

.empty-state { grid-column: 1 / -1; padding: 70px 22px; text-align: center; color: var(--muted); font-size: 12px; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 13px; }

.footer-actions { padding: 9px 14px 11px; display: flex; gap: 8px; border-top: 1px solid var(--line); background: rgba(10,12,17,.72); }
.primary-button, .secondary-button, .feedback-button, .share-button, .x-share-confirm { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; cursor: pointer; }
.primary-button { flex: 1; border: 1px solid rgba(124,240,176,.25); color: #07130d; background: linear-gradient(135deg,#8af5bb,#56dfa0); font-size: 12px; font-weight: 800; }
.primary-button:hover { filter: brightness(1.04); }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; filter: none; opacity: .48; }
.secondary-button { border: 1px solid var(--line); color: #c5cad4; background: var(--panel-2); font-size: 11px; }
.primary-button.compact { flex: 0 0 auto; min-height: 34px; }
.feedback-button { flex: 0 0 auto; padding-inline: 11px; border: 1px solid rgba(255,194,103,.14); color: #d7bd95; background: rgba(255,194,103,.055); font-size: 10px; }
.feedback-button:hover { color: #ffe0ad; border-color: rgba(255,194,103,.3); background: rgba(255,194,103,.09); }
.share-button { flex: 0 0 auto; padding-inline: 12px; border: 1px solid rgba(255,255,255,.12); color: #e8ebf0; background: rgba(255,255,255,.045); font-size: 10px; }
.share-button:hover { color: #fff; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.09); }
.x-share-confirm { border: 1px solid rgba(255,255,255,.2); color: #fff; background: #050505; font-size: 11px; font-weight: 800; }
.x-share-confirm:hover { background: #1b1b1b; }
.footer-icon { flex: 0 0 38px; height: 38px; border: 1px solid var(--line); background: var(--panel); }

.dialog { width: min(420px,calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow-y: auto; padding: 0; color: var(--text); background: #11151d; border: 1px solid rgba(255,255,255,.11); border-radius: 18px; box-shadow: 0 30px 100px rgba(0,0,0,.7); }
.dialog::backdrop { background: rgba(3,5,8,.72); backdrop-filter: blur(5px); }
.dialog form, .dialog-form { padding: 20px; }
.dialog-heading { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-heading span { color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 18px; }
.dialog-close { font-size: 21px; line-height: 1; }
.dialog label { display: block; margin-bottom: 13px; color: #b9c0cc; font-size: 11px; }
.dialog .optional { margin-left: 5px; color: var(--muted); font-size: 9px; }
.dialog input[type="url"], .dialog input[type="text"], .dialog input[type="search"], .dialog input[type="email"] { width: 100%; height: 39px; margin-top: 6px; padding: 0 11px; color: var(--text); outline: none; background: #0b0e14; border: 1px solid var(--line); border-radius: 9px; }
.dialog input:focus { border-color: rgba(124,240,176,.45); box-shadow: 0 0 0 3px rgba(124,240,176,.06); }
.dialog textarea { width: 100%; min-height: 120px; margin-top: 7px; padding: 11px; resize: vertical; color: var(--text); line-height: 1.55; outline: none; background: #0b0e14; border: 1px solid var(--line); border-radius: 9px; }
.dialog textarea:focus { border-color: rgba(255,194,103,.4); box-shadow: 0 0 0 3px rgba(255,194,103,.05); }
.platform-fields label { position: relative; padding-left: 36px; }
.platform { position: absolute; left: 0; top: 2px; width: 27px; height: 21px; display: grid; place-items: center; border-radius: 6px; color: white; font-size: 8px; }
.platform.yt { background: #c83b46; }.platform.tw { background: #7051b6; }.platform.kc { background: #397f24; }.platform.tc { background: #24789d; }
.form-note { margin: 0; color: var(--muted); font-size: 10px; }
.dialog-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .primary-button { flex: 0 0 auto; }
.settings-tabs { margin: -5px 0 15px; padding: 3px; display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; background: #0b0e14; border: 1px solid var(--line); border-radius: 10px; }
.settings-tab { min-height: 32px; padding: 0 6px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.settings-tab.active { color: var(--text); background: #242a35; }
.settings-panel[hidden] { display: none; }
.settings-intro, .settings-footnote, .sync-description p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.65; }
.sync-description strong { display: block; margin-bottom: 5px; color: var(--text); font-size: 12px; }
.notification-modes { margin: 12px 0 0; padding: 0; display: grid; gap: 7px; border: 0; }
.notification-modes legend { margin-bottom: 7px; color: #b9c0cc; font-size: 10px; }
.notification-modes label { margin: 0; padding: 10px 11px; display: flex; gap: 9px; align-items: center; background: #0d1118; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.notification-modes input { flex: 0 0 auto; accent-color: var(--accent-strong); }
.notification-modes span, .notification-modes strong, .notification-modes small { display: block; }
.notification-modes strong { color: var(--text); font-size: 10px; }
.notification-modes small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.notification-modes label:has(input:checked) { border-color: rgba(124,240,176,.28); background: rgba(124,240,176,.04); }
.danger-text-button { margin-top: 12px; padding: 4px 0; border: 0; color: #bd7f86; background: transparent; font-size: 9px; cursor: pointer; }
.danger-text-button:hover { color: #ff9aa5; }
.danger-text-button[hidden] { display: none; }
.settings-footnote { margin-top: 12px; }
.conflict-options { display: grid; gap: 8px; }
.conflict-option { padding: 13px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--text); background: #0d1118; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.conflict-option:hover { border-color: rgba(124,240,176,.34); background: rgba(124,240,176,.045); }
.conflict-option strong, .conflict-option small { display: block; }
.conflict-option strong { font-size: 11px; }
.conflict-option small { color: var(--muted); font-size: 8px; }
.conflict-dialog .form-note { margin-top: 12px; line-height: 1.6; }
.toggle-row { min-height: 60px; padding: 12px 0; display: flex !important; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.toggle-row strong, .toggle-row small, .demo-box strong, .demo-box small, .install-box strong, .install-box small, .sync-box strong, .sync-box small { display: block; }
.toggle-row strong, .demo-box strong, .install-box strong, .sync-box strong { color: var(--text); font-size: 12px; }
.toggle-row small, .demo-box small, .install-box small, .sync-box small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.toggle-row input { width: 38px; height: 21px; accent-color: var(--accent-strong); }
.beta-box { margin-top: 14px; padding: 12px 13px; color: var(--muted); background: rgba(255,194,103,.035); border: 1px solid rgba(255,194,103,.13); border-radius: 11px; }
.beta-box strong { color: #e5d3b5; font-size: 11px; }
.beta-box p { margin: 5px 0 0; font-size: 9px; line-height: 1.65; }
.demo-box { margin-top: 18px; padding: 13px; display: flex; gap: 12px; justify-content: space-between; align-items: center; background: rgba(124,240,176,.04); border: 1px solid rgba(124,240,176,.12); border-radius: 11px; }
.install-box { margin-top: 9px; padding: 13px; display: flex; gap: 12px; justify-content: space-between; align-items: center; background: rgba(89,201,255,.035); border: 1px solid rgba(89,201,255,.11); border-radius: 11px; }
.sync-box { margin-top: 9px; padding: 13px; display: flex; gap: 12px; justify-content: space-between; align-items: center; background: rgba(170,134,255,.035); border: 1px solid rgba(170,134,255,.13); border-radius: 11px; }
.sync-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.text-button { padding: 5px 2px; border: 0; color: var(--muted); background: transparent; font-size: 9px; cursor: pointer; }
.text-button:hover { color: var(--text); }
.sync-lead { margin: -5px 0 17px; color: #d9dde5; font-size: 11px; line-height: 1.65; }
.sync-privacy { margin: 4px 0 0; padding: 11px 12px; color: var(--muted); background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 10px; font-size: 9px; line-height: 1.65; }
.feedback-lead { margin: -5px 0 17px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.share-lead { margin: -5px 0 12px; color: #d9dde5; font-size: 12px; line-height: 1.7; }
.share-note { margin: 0; padding: 11px 12px; color: var(--muted); background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 10px; font-size: 10px; line-height: 1.65; }
.feedback-types { margin: 0 0 15px; padding: 0; display: flex; gap: 7px; border: 0; }
.feedback-types legend { margin-bottom: 7px; color: #b9c0cc; font-size: 11px; }
.feedback-types label { margin: 0; cursor: pointer; }
.feedback-types input { position: absolute; opacity: 0; pointer-events: none; }
.feedback-types span { display: block; padding: 7px 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.feedback-types input:checked + span { color: #ffe0ad; background: rgba(255,194,103,.08); border-color: rgba(255,194,103,.27); }


.site-dialog { width: min(510px,calc(100vw - 28px)); }
.quick-site-panel { margin: 3px 0 15px; padding: 13px; background: rgba(124,240,176,.04); border: 1px solid rgba(124,240,176,.14); border-radius: 12px; }
.quick-site-panel > strong { display: block; margin-bottom: 9px; font-size: 12px; }
.quick-site-panel label { margin: 0; }
.quick-site-panel p { margin: -5px 0 0; color: #89a698; font-size: 9px; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; max-width: min(420px,calc(100vw - 32px)); padding: 11px 15px; color: #e9fff2; background: rgba(18,43,30,.97); border: 1px solid rgba(124,240,176,.28); border-radius: 10px; box-shadow: 0 12px 45px rgba(0,0,0,.5); font-size: 11px; transform: translate(-50%,18px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { transform: translate(-50%,0); opacity: 1; }

@media (max-width: 760px) {
  body { place-items: stretch; background: var(--bg); }
  .widget { width: 100%; height: 100vh; border: 0; border-radius: 0; }
  .streamer-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .supported-sites > span { display: none; }
}

@media (max-width: 440px) {
  .streamer-list { grid-template-columns: 1fr; }
  .view-tab { min-width: 0; flex: 1; }
  .tab-toolbar p { max-width: 58%; }
  .supported-sites { gap: 3px; }
  .supported-sites b { padding-inline: 5px; font-size: 7px; }
  #updatedAt { display: none; }
  .footer-actions { padding-inline: 9px; gap: 5px; }
  .feedback-button, .share-button { padding-inline: 9px; }
}
