/* Google Fonts: loaded non-blocking via <link> in HTML head */


/* ================================
   CSS VARIABLES
================================ */
:root {
  --bg:          #0f0f0f;
  --bg2:         #212121;
  --bg3:         #272727;
  --bg4:         #1f1f1f;
  --border:      rgba(255,255,255,0.1);
  --text:        #f1f1f1;
  --text2:       #aaaaaa;
  --text3:       #717171;
  --red:         #ff0000;
  --red-dark:    #cc0000;
  --chip-bg:     #272727;
  --chip-text:   #f1f1f1;
  --chip-active-bg:   #f1f1f1;
  --chip-active-text: #0f0f0f;
  --header-h:    56px;
  --sidebar-w:   240px;
  --sidebar-mini: 72px;
  --radius:      8px;
  --radius-sm:   4px;
  --radius-pill: 9999px;
  --transition:  0.15s ease;
}

body.light-mode {
  --bg:          #ffffff;
  --bg2:         #f2f2f2;
  --bg3:         #e5e5e5;
  --bg4:         #f9f9f9;
  --border:      rgba(0,0,0,0.1);
  --text:        #0f0f0f;
  --text2:       #606060;
  --text3:       #909090;
  --chip-bg:     rgba(0,0,0,0.05);
  --chip-text:   #0f0f0f;
  --chip-active-bg:   #0f0f0f;
  --chip-active-text: #ffffff;
}

body.light-mode ::-webkit-scrollbar-thumb {
  background: #ccc;
}
body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}


/* ================================
   RESET & BASE
================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', 'Noto Sans JP', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }
ul { list-style: none; }

::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ================================
   HEADER
================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  /* subtle border bottom */
  border-bottom: 1px solid var(--border);
}

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

.menu-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.menu-icon:hover { background: var(--bg3); }
.menu-icon svg { width: 24px; height: 24px; fill: var(--text); }

.logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
  font-family: 'Roboto Condensed', sans-serif;
  position: relative;
}
.logo span {
  color: var(--red);
  letter-spacing: -0.5px;
}
.logo::after {
  content: 'JP';
  position: absolute;
  top: -2px; right: -18px;
  font-size: 10px;
  color: var(--text3);
  font-weight: 400;
}

/* Search */
.header-search {
  flex: 0 1 720px;
  display: flex;
  align-items: center;
  margin: 0 32px;
}

.search-form {
  display: flex;
  flex: 1;
  height: 40px;
  border: 1px solid #333;
  border-radius: 40px;
  background: #121212;
  margin-left: 32px;
  position: relative;
  transition: border-color var(--transition);
  overflow: hidden;
  outline: none;
}
.search-form:focus-within {
  border-color: #1c62b9;
}
.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0 4px 0 16px;
  color: var(--text);
  font-size: 16px;
}
.search-input::placeholder { color: #888; }

.search-btn {
  width: 64px; height: 100%;
  background: #222;
  border: none;
  border-left: 1px solid #333;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  outline: none;
}
.search-btn:hover { background: #2a2a2a; }
.search-btn svg { width: 24px; height: 24px; fill: var(--text); }

.mic-btn {
  width: 40px; height: 40px;
  background: #181818;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: 8px;
  transition: background var(--transition);
}
.mic-btn:hover { background: #2a2a2a; }
.mic-btn svg { width: 24px; height: 24px; fill: var(--text); }

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
  justify-content: flex-end;
}

.btn-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--bg3); }
.btn-icon svg { width: 24px; height: 24px; fill: var(--text); }

.header-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #4a90e2;
  display: flex; align-items: center; justify-content: center;
  font-weight: 500;
  font-size: 14px;
  color: white;
  margin-left: 8px;
  cursor: pointer;
}

}
.mic-btn:hover { background: var(--bg2); }
.mic-btn svg { width: 20px; height: 20px; fill: var(--text); }

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.header-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b0000, #4a0000);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ================================
   LAYOUT
================================ */
.page-wrapper {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ================================
   SIDEBAR
================================ */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  z-index: 900;
  background: var(--bg);
  transition: width var(--transition), transform var(--transition);
}
.sidebar.collapsed {
  width: var(--sidebar-mini);
}

.sidebar-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-of-type { border-bottom: none; }

.sidebar-section-title {
  padding: 6px 24px 4px 24px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-section-title svg {
  width: 18px; height: 18px;
  opacity: 0.7;
}

.sidebar-footer {
  padding: 16px 24px;
  margin-top: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  margin-bottom: 12px;
}

.footer-links a {
  color: #aaa;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.8;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-copy {
  color: #717171;
  font-size: 12px;
  margin-top: 12px;
}

.collapsed .sidebar-section-title { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px;
  height: 40px;
  border-radius: var(--radius);
  margin: 0 8px;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg3); }
.nav-item.active { background: var(--bg3); font-weight: 600; }
.nav-item svg { width: 24px; height: 24px; fill: var(--text); flex-shrink: 0; }
.nav-item span { font-size: 14px; }
.collapsed .nav-item { justify-content: center; padding: 0; margin: 0 8px; }
.collapsed .nav-item span { display: none; }

/* ================================
   MAIN CONTENT
================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
  min-width: 0;
}
.main-content.expanded { margin-left: var(--sidebar-mini); }

/* ================================
   CATEGORY CHIPS
================================ */
.chips-wrapper {
  position: sticky;
  top: var(--header-h);
  background: var(--bg);
  z-index: 800;
  padding: 12px 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips-wrapper::-webkit-scrollbar { display: none; }
.chips {
  display: flex;
  gap: 12px;
  width: max-content;
}
.chip {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  border: none;
}
.chip:hover { background: var(--bg2); }
.chip.active { background: var(--chip-active-bg); color: var(--chip-active-text); }

/* ================================
   VIDEO GRID
================================ */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 8px 24px 48px;
}

/* ================================
   VIDEO CARD
================================ */
.video-card {
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition);
  position: relative;
  z-index: 1;
}
.video-card:hover { transform: translateY(-2px); }

/* Thumbnail */
.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
}
.thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.video-card:hover .thumb-wrap img { transform: scale(1.03); }
.thumb-bg {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
}
.thumb-bg-icon { font-size: 32px; }
.thumb-bg-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.7);
}
.duration-badge {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
}
.thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.video-card:hover .thumb-overlay { background: rgba(0,0,0,0.15); }
.play-icon {
  width: 48px; height: 48px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition), transform var(--transition);
}
.video-card:hover .play-icon { opacity: 1; transform: scale(1); }
.play-icon svg { width: 20px; height: 20px; fill: #fff; margin-left: 3px; }

/* Card Info */
.card-info {
  display: flex;
  gap: 12px;
  padding: 10px 0 0;
}
.channel-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b0000 0%, #300000 100%);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.card-meta { flex: 1; min-width: 0; }
.card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.card-channel {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-channel:hover { color: var(--text); }
.verified-icon { width: 14px; height: 14px; fill: var(--text2); }
.card-stats {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}
.card-stats::before { content: ''; }

/* ================================
   WATCH PAGE
================================ */
.watch-layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* Player column */
.player-col {
  flex: 1;
  min-width: 0;
}

/* Video player */
.player-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.player-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
}
.player-thumb-bg {
  width: 100%; height: 100%;
}
.player-overlay {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.player-play-btn {
  width: 72px; height: 72px;
  background: rgba(0,0,0,0.75);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), transform var(--transition);
}
.player-play-btn:hover { background: rgba(0,0,0,0.9); transform: scale(1.1); }
.player-play-btn svg { width: 32px; height: 32px; fill: #fff; margin-left: 5px; }

/* Player controls bar */
.player-controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  padding: 24px 16px 8px;
}
.progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  margin-bottom: 8px;
  position: relative;
  cursor: pointer;
}
.progress-bar::before {
  content: '';
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 0;
  right: 0;
}
.progress-fill {
  width: 30%;
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  position: relative;
}
.progress-fill::after {
  content: '';
  width: 12px; height: 12px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  right: -6px; top: 50%;
  transform: translateY(-50%);
}
.ctrl-row {
  display: flex; align-items: center; gap: 8px;
}
.ctrl-btn { opacity: 0.9; transition: opacity var(--transition); }
.ctrl-btn:hover { opacity: 1; }
.ctrl-btn svg { width: 24px; height: 24px; fill: #fff; }
.time-display { font-size: 13px; color: #fff; margin: 0 8px; flex: 1; }
.ctrl-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* Video info */
.video-info { padding: 16px 0; }
.video-title-watch {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
}
.video-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.action-group {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
}
.action-btn:hover { background: var(--bg2); }
.action-btn svg { width: 20px; height: 20px; fill: var(--text); }
.action-divider { width: 1px; height: 24px; background: var(--border); }
.action-solo {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--bg3);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  transition: background var(--transition);
}
.action-solo:hover { background: var(--bg2); }
.action-solo svg { width: 20px; height: 20px; fill: var(--text); }

/* Channel row */
.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.channel-row-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b0000 0%, #300000 100%);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  cursor: pointer;
}
.channel-row-info { flex: 1; }
.channel-row-name { font-size: 15px; font-weight: 600; cursor: pointer; }
.channel-row-name:hover { color: var(--text2); }
.channel-row-subs { font-size: 12px; color: var(--text2); margin-top: 2px; }
.subscribe-btn {
  padding: 10px 16px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
  cursor: pointer;
}
.subscribe-btn:hover { background: #ccc; }
.subscribed {
  background: var(--bg3);
  color: var(--text);
}
.subscribed:hover { background: var(--bg2); }

/* Description */
.description-box {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
}
.desc-stats {
  font-weight: 600;
  margin-bottom: 8px;
}
.desc-text { color: var(--text2); }
.desc-text.collapsed { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.desc-toggle { color: var(--text); font-weight: 600; margin-top: 8px; cursor: pointer; display: block; }
.desc-toggle:hover { text-decoration: underline; }

/* Comments */
.comments-section { margin-top: 24px; }
.comments-header {
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 20px;
}
.comments-count { font-size: 16px; font-weight: 600; }
.comment-input-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 24px; }
.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b0000, #300000);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.comment-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  padding: 4px 0;
  width: 100%;
}
.comment-input:focus { border-bottom-color: var(--text); }
.comment-input::placeholder { color: var(--text3); }

.comment {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.comment-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
}
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; display: inline; }
.comment-time { font-size: 12px; color: var(--text2); margin-left: 8px; }
.comment-text { font-size: 14px; margin-top: 4px; line-height: 1.5; }
.comment-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.comment-action-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text2);
  transition: color var(--transition);
}
.comment-action-btn:hover { color: var(--text); }
.comment-action-btn svg { width: 16px; height: 16px; fill: var(--text2); }
.comment-action-btn:hover svg { fill: var(--text); }

/* Related videos */
.related-col {
  width: 402px;
  flex-shrink: 0;
}
.related-card {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background var(--transition);
}
.related-card:hover { background: var(--bg3); }
.related-thumb {
  position: relative;
  width: 168px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg2);
}
.related-thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-thumb-bg { width: 100%; height: 100%; }
.related-duration {
  position: absolute;
  bottom: 4px; right: 4px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 2px;
}
.related-info { flex: 1; min-width: 0; }
.related-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.related-channel { font-size: 12px; color: var(--text2); }
.related-stats { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* ================================
   SHORTS SECTION
================================ */
.shorts-section {
  grid-column: 1 / -1;
  padding: 16px 0;
  border-top: 4px solid var(--bg2);
  border-bottom: 4px solid var(--bg2);
  margin: 16px 0;
}
.shorts-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 16px;
}
.shorts-header svg { width: 24px; height: 24px; fill: var(--red); }
.shorts-header h2 { font-size: 20px; font-weight: 700; }

.shorts-grid {
  display: flex;
  gap: 16px;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.shorts-grid::-webkit-scrollbar { display: none; }

.short-card {
  width: 210px;
  flex-shrink: 0;
  cursor: pointer;
}
.short-thumb {
  aspect-ratio: 9 / 16;
  background: var(--bg2);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  transition: transform var(--transition);
}
.short-card:hover .short-thumb { transform: scale(1.02); }
.short-info { padding: 12px 0; }
.short-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.short-views { font-size: 12px; color: var(--text2); }

/* ================================
   SHORTS PAGE
================================ */
.shorts-container {
  height: calc(100vh - var(--header-h));
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: #000;
  position: relative;
  overflow: hidden;
}

.short-player-wrapper {
  height: 100%;
  aspect-ratio: 9 / 16;
  position: relative;
  background: #111;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

.short-video-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.short-video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
}

/* Overlaid Info (Bottom Left) */
.short-overlay-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
  z-index: 10;
}
.short-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.short-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.short-user-name { font-weight: 600; font-size: 14px; }
.short-sub-btn {
  background: #fff; color: #000;
  padding: 6px 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700;
}
.short-video-title {
  font-size: 15px;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Floating Actions (Right Side) */
.short-actions-side {
  position: absolute;
  right: -70px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
@media (max-width: 600px) {
  .short-actions-side { right: 10px; bottom: 80px; }
}

.short-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.short-action-btn {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.short-action-btn:hover { background: rgba(255,255,255,0.2); }
.short-action-btn svg { width: 24px; height: 24px; fill: #fff; }
.short-action-label { font-size: 12px; color: #fff; font-weight: 500; }

/* Navigation buttons */
.short-nav-btns {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.nav-btn-circle {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.nav-btn-circle:hover { background: rgba(255,255,255,0.2); }
.nav-btn-circle svg { width: 24px; height: 24px; fill: #fff; }

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 1200px) {
  .related-col { width: 340px; }
  .related-thumb { width: 140px; }
}
@media (max-width: 1000px) {
  .watch-layout { flex-direction: column; }
  .related-col { width: 100%; }
  .main-content { margin-left: 0; }
}

/* ================================
   MOBILE OVERLAYS & COMPONENTS
================================ */

/* Sidebar backdrop (overlay on mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 850;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.active { display: block; }

/* Mobile search overlay (slides over header) */
.mobile-search-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg);
  align-items: center;
  padding: 0 8px;
  gap: 8px;
  z-index: 1100;
}
.mobile-search-overlay.active { display: flex; }
.mobile-search-overlay .search-form { flex: 1; margin: 0; height: 36px; }

/* Mobile bottom navigation bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 950;
}
.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text2);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
  padding: 4px 0;
}
.mobile-nav-item.active, .mobile-nav-item:hover { color: var(--text); }
.mobile-nav-item svg { width: 22px; height: 22px; fill: currentColor; }

/* Mobile search icon — hidden on desktop */
.mobile-search-btn { display: none !important; }

/* ================================
   ≤ 768px  Tablet / Mobile
================================ */
@media (max-width: 768px) {
  /* Space for bottom nav */
  body { padding-bottom: 56px; }

  /* Bottom nav */
  .mobile-bottom-nav { display: flex; }

  /* Hide desktop search bar */
  .header-search { display: none; }
  .mic-btn { display: none; }

  /* Show mobile search icon */
  .mobile-search-btn { display: flex !important; }

  /* Sidebar: slide-in overlay instead of always-on */
  .sidebar {
    display: block !important;
    transform: translateX(-100%);
    z-index: 900;
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  /* No sidebar offset */
  .main-content { margin-left: 0 !important; }

  /* Video grid: 2 columns */
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px 8px 72px;
  }

  /* Chips */
  .chips-wrapper { padding: 8px; }

  /* Shorts cards */
  .short-card { width: 140px; }
  .shorts-grid { display: flex !important; overflow-x: auto; padding: 0 8px; gap: 8px; }

  /* Watch page */
  .watch-layout { padding: 8px; gap: 16px; }

  /* Popup menus */
  #notifPanel { width: calc(100vw - 24px) !important; right: 12px !important; }
  #accountMenu { width: 200px !important; }
}

/* ================================
   ≤ 480px  Phone
================================ */
@media (max-width: 480px) {
  .logo::after { display: none; }
  .header-left { min-width: auto; gap: 8px; }
  .ura-toggle-btn { font-size: 11px !important; padding: 4px 8px !important; }

  /* 1 column */
  .video-grid { grid-template-columns: 1fr; padding: 8px 12px 72px; }

  /* Shorts */
  .short-card { width: 110px; }

  /* Watch: edge-to-edge */
  .watch-layout { padding: 0 0 16px; gap: 0; }
  .player-wrap { border-radius: 0; }
  .video-info { padding: 12px; }
  .comments-section { padding: 0 12px; }
  .video-actions { gap: 6px; }
  .action-btn, .action-solo { padding: 6px 10px; font-size: 13px; }

  /* Search results */
  .results-main { padding: 12px; }
  .search-card { flex-direction: column; }
  .search-thumb-wrap { width: 100%; min-width: unset; height: auto; aspect-ratio: 16/9; }
}

/* ================================
   HORROR EFFECTS
================================ */
.horror-mode, .ura-mode {
  --bg: #050000;
  --bg2: #1a0000;
  --bg3: #2a0000;
  --red: #8b0000;
  --text: #ddd;
  --text2: #888;
  background-image: linear-gradient(rgba(5, 0, 0, 0.75), rgba(5, 0, 0, 0.75)), url('assets/images/1.png');
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

.horror-mode .header, .ura-mode .header,
.horror-mode .sidebar, .ura-mode .sidebar,
.horror-mode .chips-wrapper, .ura-mode .chips-wrapper,
.horror-mode .channel-header, .ura-mode .channel-header,
.horror-mode .channel-tabs, .ura-mode .channel-tabs,
.horror-mode .static-page, .ura-mode .static-page,
.horror-mode .description-box, .ura-mode .description-box,
.horror-mode .subs-header, .ura-mode .subs-header,
.horror-mode .playlist-header, .ura-mode .playlist-header {
  background: rgba(5, 0, 0, 0.6) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(139, 0, 0, 0.3);
}

.horror-mode .logo-mark, .ura-mode .logo-mark {
  background: #500;
  animation: logo-flicker 3s infinite;
}

/* Stage 2 specific */
.ura-mode-2 {
  background-color: #000;
  background-image: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)), url('assets/images/2.png') !important;
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}
.ura-mode-2::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 50%, rgba(139,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 10000;
  animation: vignette-pulse 2s infinite alternate;
}

#ura-bg-text {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='200'%3E%3Ctext x='50' y='150' fill='%23ff0000' font-family='serif' font-size='120' font-weight='bold'%3E見つけた！%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

@keyframes vignette-pulse {
  from { opacity: 0.4; }
  to { opacity: 0.8; }
}

.ura-mode-2 .video-card:hover {
  transform: scale(0.98) rotate(1deg);
  filter: sepia(1) saturate(5) hue-rotate(-50deg);
}

@keyframes logo-flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
  52% { opacity: 1; }
  53% { opacity: 0.5; }
  54% { opacity: 1; }
}

.glitch-overlay {
  position: fixed;
  inset: 0;
  background: url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
  opacity: 0.05;
  pointer-events: none;
  z-index: 9999;
  animation: glitch-anim 0.2s infinite;
}

@keyframes glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-2px, 2px); }
  40% { transform: translate(-2px, -2px); }
  60% { transform: translate(2px, 2px); }
  80% { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

.horror-mode .video-title-watch {
  font-family: serif;
  letter-spacing: 2px;
  color: #b00;
}

/* ================================
   SHORTS ANIMATIONS
================================ */
.short-slide-container {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.short-content-wrapper {
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.slide-up {
  animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.slide-down {
  animation: slideDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ================================
   SEARCH RESULTS
================================ */
.results-main {
  padding: 24px 100px;
  max-width: 1200px;
  margin: 0 auto;
}

.search-card {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}

.search-thumb-wrap {
  position: relative;
  width: 360px;
  min-width: 360px;
  height: 202px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg3);
}

.search-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-thumb-bg {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content:center;
  font-size: 48px;
}

.search-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}

.search-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-title {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-meta {
  font-size: 12px;
  color: var(--text2);
}

.search-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  margin: 4px 0;
}

.search-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.search-desc {
  font-size: 13px;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .results-main { padding: 16px; }
  .search-card { flex-direction: column; }
  .search-thumb-wrap { width: 100%; min-width: unset; height: auto; aspect-ratio: 16/9; }
}

/* ================================
   SUBSCRIPTIONS
================================ */
.subs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 8px;
  max-width: 2200px;
  margin: 0 auto;
}

.subs-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.subs-header button {
  background: transparent;
  color: #3ea6ff;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
}

.subs-header button:hover {
  background: rgba(62, 166, 255, 0.1);
}

/* --- Native Video Controls Enhancements --- */
/* シークバー（タイムライン）の上下のクリック判定を広げる */
video::-webkit-media-controls-timeline {
  padding-top: 15px !important;
  padding-bottom: 15px !important;
  cursor: pointer;
}
/* コントロールパネル自体の高さを少し確保 */
video::-webkit-media-controls-panel {
  padding-bottom: 5px;
}

/* ================================
   URA MODE 3 (BLACK OUT)
================================ */
body.ura-mode-3 {
  background: #000 !important;
  overflow-x: hidden;
}

/* メインコンテンツを非表示、ヘッダーはそのまま */
body.ura-mode-3:not(.watch-page) .page-wrapper {
  display: none !important;
}

body.ura-mode-3 #ura3-escape-btn {
  /* fallback: just in case inline style gets overridden */
  display: block !important;
}

body.ura-mode-3 #ura3-container {
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-height: calc(500vh - var(--header-h));
  padding-top: var(--header-h);
  padding-bottom: 100px;
  background: #000;
  width: 100%;
}

body.ura-mode-3 #ura3-container #ura3-player-wrap {
  /* static, no animation */
}
