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

.hidden {
  display: none !important;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}


/* ナビゲーションバー */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  padding: 12px 16px 24px;
  transition: background 0.2s;
}

#navbar.search-active {
  background: rgba(0,0,0,0.85);
}

.nav-row {
  display: flex;
  align-items: center;
  position: relative;
  padding: 0 12px;
  gap: 12px;
}

.nav-top {
  justify-content: space-between;
}

.nav-bottom {
  justify-content: center;
  margin-top: 12px;
}

.nav-logo-wrap {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.nav-logo {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  white-space: nowrap;
  background: linear-gradient(135deg, #f97316, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tagline {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  background: linear-gradient(135deg, #f97316, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.nav-tab {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 4px;
  position: relative;
  transition: color 0.2s;
}

.nav-tab.active {
  color: #fff;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
}

.search-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 0 8px;
}

.search-bar.hidden {
  display: none;
}

.search-bar input {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 14px;
  outline: none;
}

.search-bar input::placeholder {
  color: rgba(255,255,255,0.5);
}

.search-bar button {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  background: #ff4757;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ユーザーボタン */
.user-btn {
  position: absolute;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
}

.user-btn.logged-in {
  background: #ff4757;
}

/* ユーザーメニュー */
.user-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  background: rgba(0,0,0,0.5);
}

.user-menu.hidden {
  display: none;
}

.user-menu-content {
  position: absolute;
  top: 56px;
  right: 16px;
  background: #222;
  border-radius: 12px;
  padding: 8px 0;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.user-menu-name {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}

.user-menu-item:hover {
  background: rgba(255,255,255,0.1);
}

/* 認証モーダル */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal.hidden {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
}

.auth-modal-box {
  position: relative;
  background: #1a1a1a;
  border-radius: 16px;
  padding: 32px 24px 24px;
  width: 90%;
  max-width: 360px;
}

.auth-close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

.auth-message {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
}

.auth-message.hidden {
  display: none;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  position: relative;
}

.auth-tab.active {
  color: #fff;
}

.auth-tab.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: #ff4757;
  border-radius: 1px;
}

#auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#auth-form input {
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 15px;
  outline: none;
}

#auth-form input:focus {
  border-color: #ff4757;
}

.auth-error {
  color: #ff4757;
  font-size: 13px;
  text-align: center;
  margin: 0;
}

.auth-error.hidden {
  display: none;
}

.auth-submit-btn {
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #ff4757;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.auth-submit-btn:disabled {
  opacity: 0.5;
}

/* お気に入りボタン */
.action-btn .icon.fav-active {
  background: #ff4757;
}

/* 動画フィード */
#video-feed {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

#video-feed::-webkit-scrollbar {
  display: none;
}

/* 動画カード */
.video-card {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  scroll-snap-align: start;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-card video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* 左上の詳細リンク */
.detail-link {
  position: absolute;
  top: 180px;
  left: 12px;
  z-index: 10;
  padding: 5px 12px;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.8);
  font-size: 12px;
  font-weight: 600;
  border-radius: 14px;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.detail-link:active {
  opacity: 0.7;
}

/* サムネイル（動画ロード前） */
.video-card .thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  transition: opacity 0.3s;
}

.video-card .thumbnail.hidden {
  opacity: 0;
  pointer-events: none;
}

/* 動画情報オーバーレイ */
.video-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 80px 64px 40px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  z-index: 10;
}

.video-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.4);
  text-underline-offset: 2px;
}

.video-title:active {
  opacity: 0.7;
}

.video-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.tag:active {
  opacity: 0.7;
}

.tag-actress {
  background: rgba(255,71,87,0.8);
  color: #fff;
}

.tag-maker {
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.9);
}

.tag-genre {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
}

.tag-more {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,0.3);
  cursor: pointer;
}

.tag-more:active {
  opacity: 0.7;
}

/* タグモーダル */
.tags-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.tags-modal.hidden {
  display: none;
}

.tags-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
}

.tags-modal-box {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  background: #1a1a1a;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 32px;
  overflow-y: auto;
}

.tags-modal-section {
  margin-bottom: 16px;
}

.tags-modal-label {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 10px;
  font-weight: 600;
}

.tags-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 年齢確認モーダル */
.age-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
}

.age-modal.hidden {
  display: none;
}

.age-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
}

.age-modal-box {
  position: relative;
  width: 90%;
  max-width: 360px;
  background: #1a1a1a;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
}

.age-modal-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.age-modal-text {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
  margin-bottom: 24px;
}

.age-modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.age-btn {
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.age-btn-yes {
  background: #3b82f6;
  color: #fff;
}

.age-btn-no {
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
}

/* トレンド表示 */
.trending-container {
  padding: 160px 20px 40px;
  max-width: 480px;
  margin: 0 auto;
}

.trending-section {
  margin-bottom: 24px;
}

.trending-label {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.trending-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trending-tag {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 20px;
  cursor: pointer;
  border: none;
  font-weight: 600;
}

.trending-tag-word {
  background: rgba(255,71,87,0.15);
  color: #ff6b7a;
}

.trending-tag-genre {
  background: rgba(59,130,246,0.15);
  color: #6da3f7;
}

.trending-tag:active {
  opacity: 0.7;
}

/* サイドアクション */
.video-actions {
  position: absolute;
  right: 12px;
  bottom: 120px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}

.action-btn .icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.action-btn .label {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

/* ミュートインジケータ */
.mute-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  font-size: 48px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mute-indicator.show {
  opacity: 1;
}

/* スキップインジケータ */
.skip-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  font-size: 18px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  background: rgba(0,0,0,0.6);
  border-radius: 20px;
  padding: 8px 16px;
  color: #fff;
}

.skip-indicator.show {
  opacity: 1;
}

/* シークバー */
.progress-bar {
  position: absolute;
  bottom: 20px;
  left: 12px;
  right: 12px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  z-index: 15;
  cursor: pointer;
  padding: 10px 0;
  background-clip: content-box;
  border-radius: 3px;
  transition: height 0.15s, padding 0.15s;
}

.progress-bar.active {
  height: 10px;
}

.progress-bar .progress {
  height: 6px;
  background: #ff4757;
  width: 0%;
  position: absolute;
  top: 10px;
  left: 0;
  border-radius: 3px;
  transition: height 0.15s;
  pointer-events: none;
}

.progress-bar.active .progress {
  height: 10px;
}

.progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  background: #ff4757;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s;
  pointer-events: none;
  z-index: 1;
}

.progress-bar.active .progress-handle {
  transform: translate(-50%, -50%) scale(1);
}

/* ローディングスピナー */
.video-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 初期ローディング */
.initial-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.initial-loading.hidden {
  display: none;
}

.initial-loading p {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
}

/* 追加ローディング（フィード下部） */
.loading {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
}

.loading.hidden {
  display: none;
}

/* エラー画面 */
.error-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.error-screen.hidden {
  display: none;
}

.error-screen p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 0 32px;
}

.error-screen button {
  padding: 12px 32px;
  border: none;
  border-radius: 24px;
  background: #ff4757;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* お気に入り空メッセージ */
.fav-empty-message {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;
  padding: 0 40px;
  font-size: 15px;
  color: rgba(255,255,255,0.6);
  text-align: center;
  line-height: 1.8;
}

/* ========== Fantia Cards ========== */
.fantia-card {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  position: relative;
  scroll-snap-align: start;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 100px 12px 40px;
}

.fantia-widget-wrap {
  width: 100%;
  max-width: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.fantia-widget-wrap .fantia-card-container {
  width: 100% !important;
  max-width: 100% !important;
}

.fantia-widget-wrap .fantia-card {
  min-height: auto;
  padding: 0;
  background: none;
  display: block;
  scroll-snap-align: unset;
}

/* エラー表示（動画カード内） */
.video-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 5;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  background: rgba(255, 71, 87, 0.85);
  padding: 14px 24px;
  border-radius: 10px;
  white-space: nowrap;
}

/* ========== Manga Cards ========== */
.manga-card {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  position: relative;
  scroll-snap-align: start;
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* カバー画像表示 */
.manga-page {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manga-page img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* 漫画情報オーバーレイ */
.manga-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 80px 64px 40px 16px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
  z-index: 10;
}

.manga-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #fff;
}

.manga-author {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
}

.manga-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manga-genre-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}

/* 漫画サイドアクション */
.manga-actions {
  position: absolute;
  right: 12px;
  bottom: 120px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.manga-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}

.manga-action-btn .manga-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.manga-action-btn .label {
  font-size: 11px;
  color: rgba(255,255,255,0.8);
}

