:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2128;
  --muted: #667085;
  --border: #e3e6eb;
  --accent: #c0392b;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok-bg: #ecfdf3;
  --ok: #067647;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1d2128;
    --text: #e8eaed;
    --muted: #98a2b3;
    --border: #2d333c;
    --accent: #e5604f;
    --danger: #f97066;
    --danger-bg: #2c1a19;
    --ok-bg: #12261b;
    --ok: #4ade80;
  }
}

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

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

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 4px;
}

h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
h1 span { color: var(--accent); }
h2 { margin: 0 0 8px; font-size: 16px; }

main { max-width: 960px; margin: 0 auto; padding: 12px 16px 48px; }

.account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; min-width: 0; }
.account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 16px;
}
.card.narrow { max-width: 440px; margin: 48px auto 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.muted { color: var(--muted); }
.error { color: var(--danger); background: var(--danger-bg); padding: 8px 12px; border-radius: 8px; }
.notice { color: var(--ok); background: var(--ok-bg); padding: 8px 12px; border-radius: 8px; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 7px 14px;
}
button.ghost { padding: 4px 10px; font-size: 14px; }
button.danger { color: var(--danger); border-color: var(--danger); }
button:hover { border-color: var(--muted); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.6; cursor: default; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.tile .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; }
.tile .value.small { font-size: 18px; padding-top: 7px; }
.tile .label { color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 0 16px; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

.videos { list-style: none; margin: 0; padding: 0; }
.videos li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}
.videos li:first-child { border-top: 0; }
.videos a { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-decoration: none; }
.videos a:hover { text-decoration: underline; }
.videos .count { color: var(--muted); white-space: nowrap; }
.videos li.rich { align-items: center; justify-content: flex-start; }
.videos li.rich .count { margin-left: auto; }
.videos .thumb { flex: none; width: 80px; height: 45px; border-radius: 4px; background: var(--border); object-fit: cover; }
.videos .video-text { min-width: 0; }
.videos a.video-title { font-family: inherit; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.videos .video-text .muted { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px 9px 0; border-top: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; border-top: 0; }
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--ok-bg);
  color: var(--ok);
}
