:root {
  --brand: #c6ff00;
  --brand-dark: #9fd400;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #212121;
  --text: #f1f1f1;
  --text-dim: #aaaaaa;
  --border: #2c2c2c;
  --red: #ff2b2b;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Token bar ---------- */
.token-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.twitter-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 16px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.twitter-link:hover { background: #1d9bf0; color: #fff; transform: translateY(-1px); }
.twitter-link .icon-svg { width: 16px; height: 16px; }

.ca-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 5px 6px 5px 12px;
  max-width: 100%;
}
.ca-label { color: var(--text-dim); font-weight: 700; flex-shrink: 0; }
.ca-text {
  color: var(--text);
  font-family: "Consolas", "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.copy-ca-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--brand);
  color: #0f0f0f;
  border: none;
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}
.copy-ca-btn:hover:not(:disabled) { background: var(--brand-dark); }
.copy-ca-btn:active:not(:disabled) { transform: scale(0.95); }
.copy-ca-btn:disabled { background: var(--surface); color: var(--text-dim); cursor: not-allowed; }
.copy-ca-btn.copied { background: #3ddc84; animation: pillPop 0.3s ease; }
.copy-ca-btn .icon-svg { width: 14px; height: 14px; }

@media (max-width: 640px) {
  .ca-text { max-width: 120px; }
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }

.icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
}
.icon-svg svg { width: 100%; height: 100%; display: block; }
.nav-item .icon-svg { width: 20px; height: 20px; }
.dropdown-item .icon-svg { width: 18px; height: 18px; margin-right: 4px; vertical-align: -4px; }
.comment-like-btn .icon-svg { width: 16px; height: 16px; margin-right: 3px; vertical-align: -3px; }
.action-pill .icon-svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 2px; }

.menu-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn .icon-svg { width: 22px; height: 22px; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  white-space: nowrap;
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}
.brand span { color: var(--brand); }

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 720px;
}
.search-form {
  display: flex;
  flex: 1;
}
.search-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 20px 0 0 20px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-form input:focus { border-color: var(--brand); }
.search-form button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 0 20px 20px 0;
  padding: 0 20px;
  color: var(--text);
  transition: background 0.15s ease, color 0.15s ease;
}
.search-form button:hover { background: var(--brand); color: #0f0f0f; }
.mic-btn { flex-shrink: 0; }

.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--surface-2); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand);
  color: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
}

/* ---------- Dropdowns ---------- */
.dropdown-wrap { position: relative; }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 8px;
  display: block;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}
.dropdown-panel.open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.notif-item:hover { background: var(--surface-2); }
.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 5px;
}
.notif-title { color: var(--text); line-height: 1.4; }
.notif-time { color: var(--text-dim); font-size: 11.5px; margin-top: 2px; }

.account-panel { width: 260px; }
.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.account-header .avatar { cursor: default; }
.account-name { font-size: 14px; font-weight: 600; }
.account-email { font-size: 12px; color: var(--text-dim); }
.dropdown-item {
  display: block;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 13.5px;
}
.dropdown-item:hover { background: var(--surface-2); }

/* ---------- Layout ---------- */
.layout {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  padding: 12px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .nav-item span:last-child { display: none; }
.sidebar.collapsed .nav-item { flex-direction: column; gap: 4px; font-size: 10px; padding: 12px 4px; }

.nav-group { margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.nav-group:last-child { border-bottom: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--surface-2); font-weight: 600; color: var(--brand); }
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }

.main {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

/* ---------- Chips ---------- */
.chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.chip {
  flex-shrink: 0;
  background: var(--surface-2);
  border: none;
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.chip { transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease; }
.chip:hover { background: #2f2f2f; transform: translateY(-1px); }
.chip.active { background: var(--brand); color: #0f0f0f; }
.chip:active { transform: translateY(0) scale(0.97); }

/* ---------- Video grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px 16px;
}

.card {
  cursor: pointer;
  opacity: 0;
  animation: cardIn 0.45s ease forwards;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; opacity: 1; }
}

.thumb-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: var(--surface);
  margin-bottom: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover .thumb-wrap {
  transform: scale(1.03);
  box-shadow: 0 10px 24px rgba(0,0,0,0.45);
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.card:hover .card-title { color: var(--brand); }
.card-title { transition: color 0.15s ease; }
.thumb-wrap .duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
}
.thumb-wrap .live-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.card-body { display: flex; gap: 10px; }
.channel-avatar {
  position: relative;
  overflow: hidden;
}
.channel-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-body .channel-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #0f0f0f;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.card-info { min-width: 0; }
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.card-meta { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.card-meta .channel-name { display: flex; align-items: center; gap: 4px; }
.verified { color: var(--text-dim); font-size: 11px; }

/* ---------- Watch page ---------- */
.watch-layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  align-items: flex-start;
}
.watch-main { flex: 1; min-width: 0; max-width: 960px; }
.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.player-wrap iframe { width: 100%; height: 100%; border: none; }
.player-wrap img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.play-overlay {
  position: absolute;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 3px solid var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--brand);
  transition: transform 0.15s ease, background 0.15s ease;
}
.player-wrap:hover .play-overlay { background: var(--brand); color: #0f0f0f; transform: scale(1.08); }
.play-overlay .icon-svg { width: 34px; height: 34px; margin-left: 4px; }
.player-error {
  max-width: 480px;
  text-align: center;
  padding: 24px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
.player-error code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}
.player-error-link {
  display: inline-block;
  margin-top: 12px;
  background: var(--brand);
  color: #0f0f0f;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
}
.player-error-link:hover { background: var(--brand-dark); }
.player-duration-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.video-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; line-height: 1.3; }

.video-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.channel-row { display: flex; align-items: center; gap: 12px; }
.channel-row .channel-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: #0f0f0f;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.channel-name-lg { font-size: 15px; font-weight: 600; }
.channel-subs { font-size: 12px; color: var(--text-dim); }
.subscribe-btn {
  background: var(--brand);
  color: #0f0f0f;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 14px;
  margin-left: 12px;
  transition: background 0.15s ease, color 0.15s ease;
}
.subscribe-btn:hover { background: var(--brand-dark); }
.subscribe-btn.subscribed {
  background: var(--surface-2);
  color: var(--text);
}
.subscribe-btn.subscribed:hover { background: #2f2f2f; }

.action-buttons { display: flex; gap: 8px; }
.action-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: none;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.action-pill:hover { background: #2f2f2f; }
.action-pill.active { background: var(--brand); color: #0f0f0f; animation: pillPop 0.28s ease; }
@keyframes pillPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.comment-like-btn.active { animation: pillPop 0.28s ease; }
.like-dislike-group { display: flex; border-radius: 20px; overflow: hidden; }
.like-dislike-group .action-pill { border-radius: 0; }
.like-dislike-group .action-pill:first-child { border-right: 1px solid var(--bg); }

.description-box {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 20px;
  line-height: 1.5;
}
.description-box .views-date { color: var(--text); font-weight: 600; margin-bottom: 6px; }

.comments-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.comments-count { color: var(--text-dim); font-weight: 400; }

.comment-form {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  align-items: flex-start;
}
.comment-form .channel-avatar { width: 40px; height: 40px; font-size: 15px; flex-shrink: 0; }
.comment-form-fields { flex: 1; }
.comment-form textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 6px 0;
  resize: none;
  outline: none;
  min-height: 24px;
}
.comment-form textarea:focus { border-bottom-color: var(--brand); }
.comment-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.comment-cancel-btn, .comment-submit-btn {
  border: none;
  border-radius: 18px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}
.comment-cancel-btn { background: none; color: var(--text-dim); }
.comment-cancel-btn:hover { background: var(--surface-2); color: var(--text); }
.comment-submit-btn { background: var(--brand); color: #0f0f0f; }
.comment-submit-btn:disabled { background: var(--surface-2); color: var(--text-dim); cursor: not-allowed; }

.comment { display: flex; gap: 12px; margin-bottom: 20px; }
.comment .channel-avatar { width: 40px; height: 40px; font-size: 15px; }
.comment-author { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.comment-you-badge { font-size: 10px; font-weight: 700; background: var(--brand); color: #0f0f0f; padding: 1px 6px; border-radius: 4px; }
.comment-text { font-size: 13.5px; color: #ddd; margin-bottom: 6px; }
.comment-actions { display: flex; align-items: center; gap: 14px; }
.comment-like-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.comment-like-btn:hover { color: var(--text); }
.comment-like-btn.active { color: var(--brand); }

.watch-sidebar { width: 380px; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; }
.suggestion { display: flex; gap: 8px; cursor: pointer; }
.suggestion .thumb-wrap { width: 168px; flex-shrink: 0; margin-bottom: 0; }
.suggestion .card-title { font-size: 13.5px; }
.suggestion .card-meta { font-size: 12px; }

@media (max-width: 1100px) {
  .watch-layout { flex-direction: column; }
  .watch-sidebar { width: 100%; }
  .watch-main { max-width: 100%; }
}
@media (max-width: 900px) {
  .header-center { display: none; }
  .sidebar { display: none; }
  .main { padding: 16px; }
}
