:root {
  --rumble-green: #85c742;
  --rumble-green-hover: #77b23b;
  --darkest: #000;
  --bg: #06111a;
  --surface: #0b1721;
  --surface-2: #101f2d;
  --surface-3: #172a3a;
  --border: #1f3344;
  --border-soft: rgba(136, 160, 184, 0.26);
  --text: #f7fafc;
  --muted: #9fb4c8;
  --muted-2: #71889d;
  --danger: #f23160;
  --sponsored: #f4b942;
  --header-height: 72px;
  --menu-width: 80px;
  --content-max: 1720px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; }
[hidden] { display: none !important; }

.rumble-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-height);
  display: grid;
  grid-template-columns: auto minmax(280px, 720px) auto;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: #0a141e;
  border-bottom: 1px solid var(--border);
}
.header-left, .header-actions { display: flex; align-items: center; gap: 12px; }
.main-menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
}
.main-menu-toggle:hover { background: rgba(255,255,255,0.06); }
.main-menu-toggle span { width: 20px; height: 2px; border-radius: 2px; background: var(--text); }
.rumble-logo { display: flex; align-items: center; gap: 7px; font-weight: 900; letter-spacing: -0.05em; }
.rumble-play {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--rumble-green);
  color: #071017;
  font-size: 14px;
}
.rumble-word { font-size: 28px; color: var(--rumble-green); }
.rumble-logo strong { font-size: 13px; letter-spacing: 0; padding: 4px 7px; border-radius: 999px; background: rgba(133,199,66,0.13); color: var(--rumble-green); }
.rumble-search {
  height: 44px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #071018;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--muted);
}
.rumble-search input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--text); background: transparent; }
.search-icon { margin-right: 10px; font-size: 20px; transform: rotate(-12deg); }
.header-actions { justify-content: flex-end; }
.header-pill, .upload-button, .green-button, .ghost-button, .header-icon-button, .avatar-button, .text-button, .icon-button {
  border-radius: 999px;
  font-weight: 850;
  transition: transform 130ms ease, background 130ms ease, border-color 130ms ease;
}
.header-pill, .upload-button { padding: 10px 14px; background: rgba(255,255,255,0.06); color: var(--text); }
.header-pill--tailor { background: rgba(133,199,66,0.15); color: var(--rumble-green); }
.upload-button:hover, .header-pill:hover, .ghost-button:hover, .header-icon-button:hover, .avatar-button:hover { background: rgba(255,255,255,0.10); }
.header-icon-button, .avatar-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.avatar-button { background: var(--surface-3); color: var(--rumble-green); }
.green-button { padding: 10px 16px; background: var(--rumble-green); color: #071017; }
.green-button:hover { background: var(--rumble-green-hover); }
.ghost-button { padding: 9px 13px; background: rgba(255,255,255,0.055); color: var(--text); border: 1px solid var(--border-soft); }
.text-button { background: transparent; color: var(--rumble-green); padding: 3px 0; }
.icon-button { width: 38px; height: 38px; background: rgba(255,255,255,0.06); color: var(--text); font-size: 24px; }

.rumble-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  z-index: 45;
  width: var(--menu-width);
  padding: 12px 8px 18px;
  background: #071018;
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  transition: width 150ms ease, transform 150ms ease;
  scrollbar-width: none;
}
.rumble-sidebar::-webkit-scrollbar { display: none; }
body.menu-open .rumble-sidebar, .rumble-sidebar:hover { width: 320px; scrollbar-width: thin; }
.main-nav { display: grid; gap: 4px; }
.main-menu-item, .main-menu-item-channel {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 18px;
  padding: 10px 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.main-menu-item:hover, .main-menu-item-channel:hover { background: #142536; color: var(--text); }
.main-menu-item.active { background: rgba(133,199,66,0.12); color: var(--rumble-green); }
.menu-icon {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.055);
  font-weight: 900;
}
.main-menu-item-label { opacity: 0; transition: opacity 120ms ease; }
body.menu-open .main-menu-item-label, .rumble-sidebar:hover .main-menu-item-label { opacity: 1; }
.main-menu-heading {
  margin: 18px 6px 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-weight: 900;
}
.user-image {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 950;
  border: 2px solid transparent;
}
.channel-live { border-color: var(--danger); }
.main-menu-item-channel-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.main-menu-item-channel-live-wrapper {
  margin-left: auto;
  display: none;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255,255,255,0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
body.menu-open .main-menu-item-channel-live-wrapper, .rumble-sidebar:hover .main-menu-item-channel-live-wrapper { display: inline-flex; }
.main-menu-item-channel-live-dot { width: 6px; height: 6px; border-radius: 99px; background: var(--danger); }
.nav-note {
  display: none;
  margin: 18px 6px 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 12px;
}
body.menu-open .nav-note, .rumble-sidebar:hover .nav-note { display: grid; gap: 4px; }
.nav-note strong { color: var(--rumble-green); }

.rumble-main {
  margin-left: var(--menu-width);
  padding: calc(var(--header-height) + 20px) 28px 64px;
  max-width: calc(var(--content-max) + var(--menu-width));
}
.notice-bar {
  max-width: var(--content-max);
  margin: 0 auto 18px;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(133,199,66,0.12);
  border: 1px solid rgba(133,199,66,0.22);
  color: #c8edaa;
  font-size: 13px;
}
.homepage-feature, .home-shelf { max-width: var(--content-max); margin: 0 auto; }
.homepage-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.75fr);
  gap: 18px;
  margin-bottom: 28px;
}
.feature-primary, .mini-profile-card, .tailor-card {
  border-radius: 22px;
  border: 1px solid var(--border-soft);
  background: linear-gradient(145deg, #111f2d, #071018);
  box-shadow: 0 12px 44px rgba(0,0,0,0.22);
}
.feature-primary { min-height: 390px; overflow: hidden; }
.feature-loading { height: 100%; min-height: 390px; display: grid; place-items: center; color: var(--muted); }
.feature-side { display: grid; gap: 18px; align-content: stretch; }
.mini-profile-card, .tailor-card { padding: 18px; }
.mini-profile-top, .profile-stats, .shelf-head, .shelf-actions, .modal-section-head, .tailor-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-label, .tailor-card-kicker, .eyebrow { color: var(--rumble-green); font-size: 12px; font-weight: 950; text-transform: uppercase; letter-spacing: 0.06em; }
.mini-profile-card code, .profile-string {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.25);
  color: #d7e8f5;
  white-space: normal;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
}
.profile-stats { justify-content: flex-start; margin-top: 12px; color: var(--muted); font-size: 13px; }
.profile-stats strong { color: var(--text); }
.tailor-card h2 { margin: 8px 0; font-size: 24px; letter-spacing: -0.03em; }
.tailor-card p { color: var(--muted); line-height: 1.55; margin: 0 0 18px; }

.home-shelf { margin-top: 30px; }
.shelf-head { margin-bottom: 14px; align-items: flex-end; }
.shelf-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.04em; }
.shelf-head p { margin: 4px 0 0; color: var(--muted); }
.shelf-head a { color: var(--rumble-green); font-weight: 850; }
.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: rgba(133,199,66,0.14); color: var(--rumble-green); font-weight: 950; font-size: 12px; }
.sponsored-pill { background: rgba(244,185,66,0.14); color: #ffdda0; }
.video-grid { display: grid; gap: 18px; }
.rec-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.home-mini-grid, .shorts-grid, .sponsored-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.four-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.video-card {
  min-width: 0;
  border-radius: 14px;
  overflow: hidden;
  background: transparent;
  position: relative;
}
.video-card:hover .thumb { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(0,0,0,0.28); }
.video-card.is-muted { opacity: 0.45; }
.thumb {
  aspect-ratio: 16 / 9;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 12px;
  border-radius: 14px;
  overflow: hidden;
  background: radial-gradient(circle at 72% 20%, rgba(133,199,66,0.30), transparent 22%), linear-gradient(135deg, #1c3548, #071018 70%);
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 130ms ease, box-shadow 130ms ease;
}
.thumb::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(0,0,0,0.75)); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-category { position: relative; z-index: 1; color: var(--rumble-green); font-weight: 950; text-shadow: 0 1px 6px rgba(0,0,0,0.45); }
.live-badge, .format-badge, .score-badge, .sponsored-badge {
  position: absolute;
  z-index: 2;
  top: 9px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.02em;
}
.live-badge { left: 9px; background: var(--danger); color: white; }
.format-badge { left: 9px; background: rgba(255,255,255,0.14); color: var(--text); }
.score-badge { right: 9px; background: rgba(0,0,0,0.64); color: var(--rumble-green); border: 1px solid rgba(133,199,66,0.28); }
.sponsored-badge { left: 9px; background: rgba(244,185,66,0.22); color: #ffdda0; border: 1px solid rgba(244,185,66,0.28); }
.card-body { padding: 10px 2px 0; }
.video-title { margin: 0 0 5px; font-size: 15px; line-height: 1.25; font-weight: 850; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-title:hover { color: var(--rumble-green); }
.video-meta { color: var(--muted); font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.video-signal { display: none; margin-top: 8px; color: var(--muted-2); font-size: 11px; line-height: 1.35; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.card-actions button { padding: 6px 8px; border-radius: 999px; color: var(--text); background: rgba(255,255,255,0.055); font-size: 11px; font-weight: 850; }
.card-actions button:hover { background: rgba(255,255,255,0.11); }
.card-actions button.primary-action { background: var(--rumble-green); color: #071017; }
.card-actions button.negative-action:hover { background: rgba(242,49,96,0.16); color: #ffd6df; }
.feature-card-large { height: 100%; display: grid; grid-template-rows: minmax(250px, 1fr) auto; }
.feature-card-large .thumb { border-radius: 22px 22px 0 0; aspect-ratio: auto; min-height: 260px; }
.feature-card-large .card-body { padding: 18px; background: linear-gradient(180deg, rgba(9,18,27,0.96), rgba(6,14,22,0.98)); }
.feature-card-large .video-title { font-size: 27px; line-height: 1.15; }
.feature-card-large .video-meta { font-size: 14px; }
.feature-card-large .video-signal { display: block; }
.feature-card-large .card-actions button { font-size: 12px; padding: 8px 10px; }
.sponsored-panel { padding-bottom: 8px; }
.category-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.category-tile, .category-chip {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255,255,255,0.045);
  padding: 14px;
  color: var(--text);
  text-align: left;
}
.category-tile strong, .category-chip strong { display: block; font-size: 15px; margin-bottom: 5px; }
.category-tile span, .category-chip span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.category-chip { min-height: 90px; cursor: pointer; }
.category-chip[aria-pressed="true"] { border-color: rgba(133,199,66,0.62); background: rgba(133,199,66,0.13); }
.category-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 410px; overflow: auto; padding-right: 4px; }

.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.64);
  backdrop-filter: blur(5px);
}
.tailor-modal, .why-modal, .profile-drawer {
  background: #08131d;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
}
.tailor-modal {
  position: fixed;
  z-index: 90;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(1180px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  border-radius: 24px;
  padding: 24px;
}
.tailor-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.tailor-modal-head h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: -0.04em; }
.tailor-modal-head p { margin: 0; color: var(--muted); max-width: 760px; }
.tailor-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.tailor-step { display: flex; gap: 12px; padding: 13px; border-radius: 16px; border: 1px solid var(--border-soft); background: rgba(255,255,255,0.04); }
.step-number { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: var(--rumble-green); color: #071017; font-weight: 950; }
.tailor-step h3, .modal-section-head h3 { margin: 0; }
.tailor-step p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.tailor-grid-layout { display: grid; grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr); gap: 20px; }
.modal-section-head { margin-bottom: 10px; }
.tailor-footer { justify-content: flex-end; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.four-grid .video-card { padding: 0; border: 1px solid var(--border-soft); border-radius: 16px; background: rgba(255,255,255,0.035); }
.four-grid .card-body { padding: 10px; }
.four-grid .video-signal { display: block; }

.profile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(520px, 100vw);
  height: 100vh;
  padding: 24px;
  border-left: 1px solid var(--border-soft);
  overflow: auto;
  transform: translateX(105%);
  transition: transform 180ms ease;
}
.profile-drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.drawer-head h2 { margin: 0; }
.drawer-copy { color: var(--muted); line-height: 1.55; }
.weight-list { display: grid; gap: 8px; }
.weight-row { display: grid; grid-template-columns: 120px 1fr 48px; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.weight-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; }
.weight-bar > span { display: block; height: 100%; background: var(--rumble-green); border-radius: inherit; }
.drawer-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric { padding: 12px; border-radius: 14px; background: rgba(255,255,255,0.045); border: 1px solid var(--border-soft); }
.metric strong { display: block; font-size: 24px; }
.why-modal {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 95;
  width: min(620px, calc(100vw - 28px));
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 22px;
  border-radius: 22px;
}
.score-table { display: grid; gap: 8px; margin: 12px 0; }
.score-line { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); text-transform: capitalize; }
.score-line strong { color: var(--text); }
.why-list { color: var(--muted); padding-left: 20px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 120;
  max-width: 420px;
  padding: 13px 16px;
  border-radius: 16px;
  background: rgba(133,199,66,0.96);
  color: #071017;
  box-shadow: var(--shadow);
  font-weight: 850;
}
body.modal-open { overflow: hidden; }

@media (max-width: 1480px) {
  .rec-grid, .home-mini-grid, .shorts-grid, .sponsored-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .category-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .rumble-header { grid-template-columns: auto 1fr auto; gap: 12px; }
  .homepage-feature, .tailor-grid-layout { grid-template-columns: 1fr; }
  .feature-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-grid, .home-mini-grid, .shorts-grid, .sponsored-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 880px) {
  :root { --menu-width: 0px; --header-height: 64px; }
  .rumble-header { grid-template-columns: auto 1fr; padding: 0 12px; }
  .rumble-search { display: none; }
  .header-actions { gap: 6px; }
  .upload-button, .header-icon-button { display: none; }
  .rumble-sidebar { transform: translateX(-105%); width: 290px; }
  body.menu-open .rumble-sidebar { transform: translateX(0); width: 290px; }
  .main-menu-item-label, body.menu-open .main-menu-item-label, .rumble-sidebar:hover .main-menu-item-label { opacity: 1; }
  .main-menu-item-channel-live-wrapper { display: inline-flex; }
  .rumble-main { margin-left: 0; padding: calc(var(--header-height) + 14px) 14px 48px; }
  .feature-side, .tailor-steps { grid-template-columns: 1fr; }
  .rec-grid, .home-mini-grid, .shorts-grid, .sponsored-grid, .four-grid, .category-list, .category-picker { grid-template-columns: 1fr; }
  .shelf-head { align-items: flex-start; flex-direction: column; }
  .tailor-modal { padding: 18px; }
  .tailor-modal-head { align-items: flex-start; }
}
@media (max-width: 560px) {
  .rumble-word { font-size: 22px; }
  .header-pill { padding: 8px 10px; }
  .feature-card-large .video-title { font-size: 22px; }
  .drawer-metrics { grid-template-columns: 1fr; }
}

/* === Phase 4: centered content and card alignment === */
:root {
  --content-max: 1680px;
  --card-max: 310px;
}

.rumble-main {
  width: calc(100% - var(--menu-width));
  max-width: none;
  margin-left: var(--menu-width);
  padding-left: clamp(18px, 3vw, 48px);
  padding-right: clamp(18px, 3vw, 48px);
}

.notice-bar,
.homepage-feature,
.home-shelf {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

.homepage-feature {
  justify-content: center;
}

.video-grid {
  justify-content: center;
}

.video-card {
  width: 100%;
  max-width: var(--card-max);
}

.feature-primary .video-card,
.feature-primary .feature-card-large {
  max-width: none;
}

.feature-side,
.feature-primary {
  min-width: 0;
}

@media (min-width: 1181px) {
  .rec-grid,
  .home-mini-grid,
  .shorts-grid,
  .sponsored-grid {
    grid-template-columns: repeat(5, minmax(0, var(--card-max)));
    justify-content: center;
  }

  .category-list {
    grid-template-columns: repeat(5, minmax(0, var(--card-max)));
    justify-content: center;
  }
}

@media (max-width: 1180px) and (min-width: 881px) {
  .rec-grid,
  .home-mini-grid,
  .shorts-grid,
  .sponsored-grid {
    grid-template-columns: repeat(3, minmax(0, var(--card-max)));
    justify-content: center;
  }

  .category-list {
    grid-template-columns: repeat(3, minmax(0, var(--card-max)));
    justify-content: center;
  }
}

.four-grid {
  grid-template-columns: repeat(2, minmax(0, 330px));
  justify-content: center;
}

.rumble-logo {
  min-width: max-content;
}

.rumble-word {
  white-space: nowrap;
  font-size: clamp(20px, 1.6vw, 27px);
}

@media (max-width: 880px) {
  .rumble-main {
    width: 100%;
    margin-left: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .rec-grid,
  .home-mini-grid,
  .shorts-grid,
  .sponsored-grid,
  .four-grid,
  .category-list {
    grid-template-columns: minmax(0, min(100%, 440px));
    justify-content: center;
  }

  .video-card {
    max-width: 440px;
  }
}

@media (max-width: 640px) {
  .rumble-logo strong {
    display: none;
  }

  .rumble-word {
    font-size: 18px;
  }
}
/* === End Phase 4 centered content and card alignment === */
