/* =========================================================
   TechniShorts - YouTube Shorts Inspired Styling (Widescreen 16:9 Optimized)
   ========================================================= */

/* Root & Page Container */
.shorts-page-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: calc(100vh - 56px);
  position: relative;
  overflow: hidden;
  background-color: var(--yt-bg, #0f0f0f);
  user-select: none;
}

/* Feed Container */
.shorts-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.shorts-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Individual Shorts Slide / Card */
.shorts-slide {
  flex: 0 0 calc(100vh - 56px);
  height: calc(100vh - 56px);
  width: 100%;
  max-width: 1600px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  padding: 16px 24px;
  box-sizing: border-box;
  position: relative;
}

/* Main Layout Unit (Video Card + Action Rail) */
.shorts-card-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: min(calc((100vh - 88px) * 16 / 9 + 80px), calc(100vw - 120px));
  height: min(calc(100vh - 88px), 880px);
  max-height: 94vh;
  position: relative;
}

/* Video Stage (Player Frame - 16:9 Full Widescreen Format) */
.shorts-video-frame {
  position: relative;
  height: 100%;
  aspect-ratio: 16 / 9;
  max-width: calc((100vh - 88px) * 16 / 9);
  width: 100%;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 1 1 auto;
}

/* Ambient Glow Background Layer */
.shorts-ambient-bg {
  position: absolute;
  top: -30px;
  left: -30px;
  right: -30px;
  bottom: -30px;
  background-size: cover;
  background-position: center;
  filter: blur(50px) brightness(0.6);
  opacity: 0.65;
  transform: scale(1.15);
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* Video Element */
.shorts-video-element {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  background: transparent;
  pointer-events: auto;
}

.shorts-video-element.cover-mode {
  object-fit: cover;
}

/* Big Play/Pause Animated Splash Indicator */
.shorts-play-splash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
}

.shorts-play-splash .material-icons {
  font-size: 52px;
}

.shorts-play-splash.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Top Control Bar */
.shorts-top-controls {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

.shorts-ctrl-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.shorts-btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.shorts-btn-icon:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.08);
}

.shorts-btn-icon .material-icons {
  font-size: 22px;
}

/* Volume Slider Overlay */
.volume-control-wrap {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  padding: 0 6px 0 0;
  transition: all 0.2s ease;
}

.volume-slider {
  width: 0;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.25s ease;
  accent-color: #3ea6ff;
  cursor: pointer;
  height: 4px;
}

.volume-control-wrap:hover .volume-slider {
  width: 75px;
  opacity: 1;
  margin: 0 10px 0 6px;
}

/* Bottom Overlay Info Area */
.shorts-bottom-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 24px 16px 24px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  color: #fff;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shorts-bottom-overlay > * {
  pointer-events: auto;
}

/* Author Row */
.shorts-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shorts-author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}

.shorts-author-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.shorts-author-name {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shorts-author-handle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.shorts-author-name:hover,
.shorts-author-handle:hover {
  text-decoration: underline;
}

.shorts-follow-btn {
  background: #ffffff;
  color: #0f0f0f;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.shorts-follow-btn:hover {
  background: #f0f0f0;
  transform: scale(1.04);
}

.shorts-follow-btn.following {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* Title & Description */
.shorts-title-row {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #f8f8f8;
  max-height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  cursor: pointer;
  max-width: 85%;
}

.shorts-title-row:hover {
  color: #fff;
}

.shorts-desc-preview {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  display: none;
  max-height: 100px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  max-width: 85%;
}

.shorts-desc-preview.expanded {
  display: block;
}

/* Sound / BGM Badge with Marquee */
.shorts-sound-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  padding: 5px 14px;
  border-radius: 14px;
  width: fit-content;
  max-width: 80%;
  overflow: hidden;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.shorts-sound-badge:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.02);
}

.shorts-sound-badge .material-icons {
  font-size: 16px;
  animation: rotateSound 4s linear infinite;
}

@keyframes rotateSound {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.shorts-sound-text-marquee {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress / Timeline Bar */
.shorts-progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 20;
  transition: height 0.15s ease;
}

.shorts-video-frame:hover .shorts-progress-container,
.shorts-progress-container:hover {
  height: 8px;
}

.shorts-progress-fill {
  height: 100%;
  width: 0%;
  background: #ff0000;
  position: relative;
  transition: width 0.1s linear;
}

.shorts-progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff0000;
  transition: transform 0.15s ease;
}

.shorts-video-frame:hover .shorts-progress-thumb,
.shorts-progress-container:hover .shorts-progress-thumb {
  transform: translateY(-50%) scale(1);
}

/* =========================================================
   Right Floating Action Rail (Techniclip 3-Axis Rating)
   ========================================================= */
.shorts-action-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: 4px;
  z-index: 15;
  flex-shrink: 0;
}

.shorts-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

.shorts-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--yt-bg-secondary, #212121);
  border: 1px solid var(--yt-border, rgba(255, 255, 255, 0.12));
  color: var(--yt-text-primary, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  outline: none;
  position: relative;
}

.shorts-action-btn:hover {
  background: var(--yt-hover, rgba(255, 255, 255, 0.15));
  transform: scale(1.1);
}

.shorts-action-btn:active {
  transform: scale(0.92);
}

.shorts-action-btn .material-icons {
  font-size: 24px;
}

/* 3-Axis Rating Highlight States */
.shorts-action-btn.rated-audio {
  color: #3ea6ff !important;
  background: rgba(62, 166, 255, 0.2) !important;
  border-color: rgba(62, 166, 255, 0.6) !important;
}

.shorts-action-btn.rated-visual {
  color: #2ba640 !important;
  background: rgba(43, 166, 64, 0.2) !important;
  border-color: rgba(43, 166, 64, 0.6) !important;
}

.shorts-action-btn.rated-idea {
  color: #f9a825 !important;
  background: rgba(249, 168, 37, 0.2) !important;
  border-color: rgba(249, 168, 37, 0.6) !important;
}

/* Rating Sparkle Particle */
.rate-sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.8;
  pointer-events: none;
  animation: sparkleAnim 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes sparkleAnim {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(0);
    opacity: 0;
  }
}

.shorts-action-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--yt-text-primary, #ffffff);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  line-height: 1.2;
}

.shorts-author-rail-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--yt-blue, #3ea6ff);
  object-fit: cover;
  transition: transform 0.2s ease;
}

.shorts-author-rail-avatar:hover {
  transform: scale(1.1);
}

/* =========================================================
   Desktop Up / Down Arrow Navigation Buttons
   ========================================================= */
.shorts-nav-arrows {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

.shorts-nav-arrow-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--yt-bg-secondary, #212121);
  border: 1px solid var(--yt-border, rgba(255, 255, 255, 0.15));
  color: var(--yt-text-primary, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  transition: all 0.2s ease;
  outline: none;
}

.shorts-nav-arrow-btn:hover {
  background: var(--yt-blue, #3ea6ff);
  color: #fff;
  transform: scale(1.12);
}

.shorts-nav-arrow-btn:active {
  transform: scale(0.92);
}

/* =========================================================
   Slide-in Comment Drawer
   ========================================================= */
.shorts-comment-drawer {
  position: fixed;
  top: 56px;
  right: 0;
  width: 420px;
  max-width: 100vw;
  height: calc(100vh - 56px);
  background: var(--yt-bg-secondary, #1e1e1e);
  border-left: 1px solid var(--yt-border, #3f3f3f);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}

.shorts-comment-drawer.open {
  transform: translateX(0);
}

.shorts-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--yt-border, #3f3f3f);
}

.shorts-drawer-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--yt-text-primary, #ffffff);
}

.shorts-drawer-close {
  background: transparent;
  border: none;
  color: var(--yt-text-secondary, #aaa);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 4px;
  transition: color 0.15s ease;
}

.shorts-drawer-close:hover {
  color: var(--yt-text-primary, #fff);
  background: var(--yt-hover, rgba(255,255,255,0.1));
}

.shorts-comments-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.shorts-comment-item {
  display: flex;
  gap: 12px;
  font-size: 13px;
}

.shorts-comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.shorts-comment-content {
  flex: 1;
  min-width: 0;
}

.shorts-comment-author {
  font-weight: 600;
  color: var(--yt-text-primary, #ffffff);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.shorts-comment-time {
  font-size: 11px;
  font-weight: normal;
  color: var(--yt-text-secondary, #888);
}

.shorts-comment-text {
  color: var(--yt-text-primary, #eee);
  line-height: 1.4;
  word-break: break-word;
}

.shorts-comment-input-wrap {
  padding: 14px 20px;
  border-top: 1px solid var(--yt-border, #3f3f3f);
  background: var(--yt-bg, #141414);
}

.shorts-comment-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shorts-comment-input {
  flex: 1;
  background: var(--yt-bg-secondary, #282828);
  border: 1px solid var(--yt-border, #444);
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--yt-text-primary, #fff);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.shorts-comment-input:focus {
  border-color: var(--yt-blue, #3ea6ff);
}

.shorts-comment-send-btn {
  background: var(--yt-blue, #065fd4);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.shorts-comment-send-btn:hover {
  background: #3ea6ff;
  transform: scale(1.08);
}

/* =========================================================
   Share Modal
   ========================================================= */
.shorts-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeInBackdrop 0.2s ease;
}

.shorts-modal-backdrop.open {
  display: flex;
}

.shorts-modal-card {
  width: 90%;
  max-width: 440px;
  background: var(--yt-bg-secondary, #212121);
  border: 1px solid var(--yt-border, #3f3f3f);
  border-radius: 16px;
  padding: 24px;
  color: var(--yt-text-primary, #fff);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  animation: scaleInModal 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleInModal {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.shorts-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.shorts-modal-title {
  font-size: 18px;
  font-weight: 600;
}

.shorts-share-buttons {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.shorts-share-btn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--yt-text-primary, #fff);
  text-decoration: none;
  cursor: pointer;
}

.shorts-share-btn-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--yt-hover, #333);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.shorts-share-btn-circle:hover {
  transform: scale(1.1);
}

.shorts-copy-box {
  display: flex;
  gap: 8px;
  background: var(--yt-bg, #141414);
  border: 1px solid var(--yt-border, #444);
  border-radius: 8px;
  padding: 6px 12px;
  align-items: center;
}

.shorts-copy-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--yt-text-secondary, #aaa);
  font-size: 13px;
  outline: none;
}

.shorts-copy-action-btn {
  background: var(--yt-blue, #065fd4);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Toast Message */
.shorts-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.shorts-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =========================================================
   Responsive Breakpoints
   ========================================================= */
@media (max-width: 900px) {
  .shorts-nav-arrows {
    display: none;
  }
}

@media (max-width: 680px) {
  .shorts-slide {
    padding: 0;
  }
  
  .shorts-card-wrapper {
    width: 100vw;
    height: calc(100vh - 56px);
    max-height: 100vh;
    max-width: 100vw;
    gap: 0;
  }
  
  .shorts-video-frame {
    width: 100vw;
    height: 100%;
    max-width: 100vw;
    border-radius: 0;
  }
  
  .shorts-action-rail {
    position: absolute;
    right: 12px;
    bottom: 30px;
    gap: 10px;
  }
  
  .shorts-action-btn {
    width: 42px;
    height: 42px;
    background: rgba(0, 0, 0, 0.65);
  }
  
  .shorts-comment-drawer {
    top: auto;
    bottom: 0;
    width: 100vw;
    height: 70vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  
  .shorts-comment-drawer.open {
    transform: translateY(0);
  }
}

/* =========================================================
   NicoNico-style Danmaku Floating Comments (ニコニコ風弾幕)
   ========================================================= */
.shorts-danmaku-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 8;
}


.shorts-danmaku-container.paused .danmaku-item {
  animation-play-state: paused !important;
}

.shorts-danmaku-container.disabled {
  display: none !important;
}

.danmaku-item {
  position: absolute;
  white-space: nowrap;
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 900;
  font-size: 52px;
  color: #ffffff;
  text-shadow: 
    -3px -3px 0 #000,  
     3px -3px 0 #000,
    -3px  3px 0 #000,
     3px  3px 0 #000,
    -4px  0px 0 #000,
     4px  0px 0 #000,
     0px -4px 0 #000,
     0px  4px 0 #000,
     0px  6px 12px rgba(0, 0, 0, 0.95);
  will-change: transform;
  letter-spacing: 1px;
  line-height: 1;
  pointer-events: none;
  animation: danmakuScroll 4.8s linear forwards;
}

.danmaku-item.my-comment {
  color: #facc15 !important;
  border: 2.5px solid rgba(250, 204, 21, 0.95);
  background: rgba(0, 0, 0, 0.55);
  padding: 4px 16px;
  border-radius: 10px;
  z-index: 9;
}

@keyframes danmakuScroll {
  0% {
    transform: translateX(calc(100% + 60px));
  }
  100% {
    transform: translateX(calc(-100vw - 100%));
  }
}

@media (max-width: 680px) {
  .danmaku-item {
    font-size: 34px;
    letter-spacing: 0.6px;
    animation-duration: 3.8s;
    text-shadow: 
      -2px -2px 0 #000,  
       2px -2px 0 #000,
      -2px  2px 0 #000,
       2px  2px 0 #000,
      -3px  0px 0 #000,
       3px  0px 0 #000,
       0px  4px 8px rgba(0, 0, 0, 0.95);
  }
}
