/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent: #E87040;
  --accent-dark: #c75e2e;
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --text2: #6C6C70;
  --text3: #AEAEB2;
  --border: #E5E5EA;
  --danger: #FF3B30;
  --success: #34C759;
  --star-on: #FFB800;
  --star-off: #D1D1D6;
  --tab-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: 44px;
}

html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }
select { font: inherit; }
textarea { font: inherit; }

body.modal-open { overflow: hidden; }

/* ===== Layout ===== */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: -webkit-fill-available;
}

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  padding-top: env(safe-area-inset-top, 0px);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
}

.app-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.3px;
}


.view-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.view {
  min-height: 100%;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
}

/* ===== Tab Nav ===== */
.tab-nav {
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: var(--tab-h);
  gap: 2px;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  transition: color 0.15s;
}

.tab-btn .tab-icon { font-size: 22px; line-height: 1; }
.tab-btn.active { color: var(--accent); }

/* ===== Bookshelf ===== */
.shelf-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

/* タブ型フィルター（種別） */
.shelf-filter-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.shelf-tab {
  flex: 1;
  padding: 10px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-align: center;
}
.shelf-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 本棚内検索 */
.shelf-search-row {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.shelf-search-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 10px;
  padding: 6px 10px;
  gap: 6px;
}
.shelf-search-icon { font-size: 14px; color: var(--text3); }
.shelf-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.shelf-search-clear {
  color: var(--text3);
  font-size: 13px;
  padding: 2px 4px;
}

/* ステータスフィルター行 */
.shelf-filter-row {
  display: flex;
  align-items: center;
  padding: 8px 12px 0;
}

/* 並び替え + 件数行 */
.shelf-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px 8px;
  gap: 8px;
}

.shelf-count {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
  flex-shrink: 0;
}

.sort-chip {
  font-size: 12px;
  padding: 4px 10px;
}

.filter-group {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
}
.filter-group::-webkit-scrollbar { display: none; }

.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--bg);
  color: var(--text2);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sort-select {
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  white-space: nowrap;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 8px;
}

.poster-grid .empty-state {
  grid-column: 1 / -1;
}

.poster-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.poster-card:active { opacity: 0.7; }

.poster-wrap {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 2/3;
  background: var(--border);
}
.poster-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  color: #fff;
}
.poster-badge.watched  { background: rgba(0,0,0,0.65); }
.poster-badge.want     { background: var(--accent); }
.poster-badge.watching { background: #007AFF; }
.poster-badge.hold     { background: var(--text3); }
.poster-badge.dropped  { background: #FF9500; }
.poster-badge.private  { background: #8E8E93; }

.poster-ratings {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  min-height: 16px;
  padding: 0 1px;
  margin-top: 2px;
}
.my-rating {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.my-rating.unrated {
  color: var(--text3);
  font-weight: 400;
}
.tmdb-score {
  font-size: 10px;
  color: var(--text);
  background: #F0F0F5;
  border-radius: 4px;
  padding: 1px 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.poster-title {
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}

.poster-type {
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  margin-top: 1px;
}

.poster-ratings {
  justify-content: center;
}

/* ===== Poster placeholder ===== */
.poster-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-placeholder span {
  font-size: 28px;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
}
.poster-placeholder.small span { font-size: 18px; }
.poster-placeholder.large {
  border-radius: 12px;
  width: 120px;
  height: 180px;
}
.poster-placeholder.large span { font-size: 36px; }

/* ===== Search ===== */
.search-header {
  background: var(--card);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 12px;
  padding: 8px 12px;
  gap: 8px;
}
.search-icon { font-size: 16px; color: var(--text3); }
.search-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.search-clear {
  color: var(--text3);
  font-size: 14px;
  padding: 2px 4px;
}

.search-list { padding: 8px; }

.search-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  active-color: var(--bg);
}
.search-card:active { background: var(--bg); }

.search-poster {
  width: 56px;
  height: 84px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border);
}
.search-poster img { width: 100%; height: 100%; object-fit: cover; }

.search-info { flex: 1; min-width: 0; }
.search-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.3; }
.search-original { font-size: 12px; color: var(--text2); margin-top: 2px; }
.search-meta { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.search-overview { font-size: 12px; color: var(--text2); margin-top: 4px; line-height: 1.4; }

.search-action { flex-shrink: 0; }
.add-badge {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 300;
}
.added-badge {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg);
  padding: 4px 6px;
  border-radius: 6px;
}

/* ===== Tags ===== */
.type-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #EEF2FF;
  color: #4F46E5;
  font-weight: 600;
}
.year-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--text2);
}
.genre-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #FFF3E8;
  color: var(--accent);
}

/* ===== Trending (Search) ===== */
.trending-section { padding: 12px 12px 0; }
.trending-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.trending-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.trending-scroll::-webkit-scrollbar { display: none; }
.trending-card {
  flex-shrink: 0;
  width: 90px;
  cursor: pointer;
}
.trending-card:active { opacity: 0.7; }
.trending-poster {
  position: relative;
  width: 90px;
  height: 135px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 5px;
}
.trending-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.trending-added {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.trending-card-title {
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}
.trending-score {
  font-size: 10px;
  color: var(--text2);
  text-align: center;
  margin-top: 2px;
}

/* ===== Recommend ===== */
.rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 4px;
}
.rec-header h2 { font-size: 20px; font-weight: 700; }

.rec-count-label {
  font-size: 12px;
  color: var(--text2);
  padding: 0 16px 8px;
}

.rec-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.rec-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; flex: 1; }

.not-interested-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text3);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  cursor: pointer;
}
.not-interested-btn:active { background: var(--border); }
.refresh-btn {
  font-size: 13px;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 20px;
}

.rec-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--card);
  margin: 0 8px 10px;
  border-radius: 14px;
  cursor: pointer;
}
.rec-card:active { opacity: 0.8; }

.rec-poster {
  width: 80px;
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border);
}
.rec-poster img { width: 100%; height: 100%; object-fit: cover; }

.rec-info { flex: 1; min-width: 0; }
.rec-title { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 4px; }
.rec-meta { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }

.sub-available {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 4px;
}
.rec-reason {
  font-size: 12px;
  color: var(--text2);
  background: #FFFBF5;
  border-left: 3px solid var(--accent);
  padding: 4px 8px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 6px;
  line-height: 1.5;
}
.rec-overview {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.4;
  margin-bottom: 6px;
}

.provider-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.provider-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.provider-btn.subscribed {
  background: #FFF3E8;
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.already-added-note {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* ===== Analysis ===== */
.analysis-wrap { padding: 16px; }
.analysis-wrap h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.analysis-wrap h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 12px 6px;
  text-align: center;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text2); margin-top: 2px; }

.analysis-section {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.bar-row:last-child { margin-bottom: 0; }
.bar-label { font-size: 12px; color: var(--text2); width: 60px; flex-shrink: 0; text-align: right; }
.bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.bar-fill.accent { background: var(--accent); }
.bar-count { font-size: 12px; color: var(--text2); width: 24px; flex-shrink: 0; }

.dub-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.dub-row:last-child { border-bottom: none; }
.dub-count { color: var(--text2); }

/* ===== Settings ===== */
.settings-wrap { padding: 16px; }
.settings-wrap h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.settings-wrap h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }

.settings-section {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.settings-note {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
  line-height: 1.5;
}

.settings-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  margin-bottom: 10px;
}

.settings-btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  margin-right: 8px;
  margin-bottom: 4px;
}
.settings-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.import-label { display: inline-block; }

.sub-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}
.sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  cursor: pointer;
}
.sub-item:last-child { border-bottom: none; }
.sub-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

.data-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* 非表示リスト */
.hidden-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.hidden-list-count {
  font-size: 13px;
  color: var(--text2);
  font-weight: 600;
}
.hidden-bulk-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.hidden-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 320px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.hidden-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.hidden-item:last-child { border-bottom: none; }
.hidden-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.hidden-checkbox {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.hidden-title { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.restore-btn {
  font-size: 12px;
  padding: 5px 10px;
  flex-shrink: 0;
}

.data-message {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 6px;
}
.data-message.success { background: #D1FAE5; color: #065F46; }
.data-message.error   { background: #FEE2E2; color: #991B1B; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0);
  display: flex;
  align-items: flex-end;
  pointer-events: none;
  transition: background 0.28s;
}
.modal-overlay.open {
  background: rgba(0,0,0,0.5);
  pointer-events: all;
}

.modal-sheet {
  background: var(--card);
  width: 100%;
  max-height: 92vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-b);
}
.modal-sheet.visible { transform: translateY(0); }

.modal-top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 12px 0;
  flex-shrink: 0;
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
.modal-close-top {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text2);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
}

.modal-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding: 0 16px 24px;
}

.modal-hero {
  display: flex;
  gap: 16px;
  padding: 16px 0 14px;
  align-items: flex-start;
}

.modal-poster-wrap {
  flex-shrink: 0;
}

.modal-poster {
  width: 110px;
  height: 165px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-hero-info { flex: 1; min-width: 0; }
.modal-title { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.modal-original { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.modal-meta { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.modal-genres { display: flex; flex-wrap: wrap; gap: 4px; }

.inline-select {
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: #4F46E5;
  font-weight: 600;
}

.modal-section {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.section-title { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }

.rating-section { display: flex; flex-direction: column; gap: 8px; }
.rating-label { font-size: 13px; font-weight: 600; color: var(--text2); }
.rating-display { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ===== Rating Slider ===== */
.rating-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rating-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) calc(var(--pct, 0%) ),
    var(--border) calc(var(--pct, 0%)),
    var(--border) 100%
  );
  outline: none;
  cursor: pointer;
}
.rating-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}
.rating-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
}
.rating-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text3);
  padding: 0 2px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  gap: 12px;
}
.field-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.field-row label { font-size: 15px; font-weight: 500; }
.field-row select {
  font-size: 15px;
  border: none;
  color: var(--accent);
  background: transparent;
  text-align: right;
}

.field-label { font-size: 13px; font-weight: 600; color: var(--text2); display: block; margin-bottom: 8px; }

.memo-input {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  resize: none;
}

.overview-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.6;
}

/* ===== Crew / Cast ===== */
.crew-list { display: flex; flex-direction: column; gap: 8px; }
.crew-row { display: flex; gap: 10px; align-items: flex-start; }
.crew-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  min-width: 52px;
  flex-shrink: 0;
  padding-top: 1px;
}
.crew-value {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
}

.action-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.action-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-btn.danger  { background: #FFF0EF; color: var(--danger); border-color: #FFCDD2; }
.action-btn:active { opacity: 0.7; }

/* ===== Common ===== */
.loading {
  text-align: center;
  color: var(--text2);
  padding: 40px 16px;
  font-size: 15px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text2);
}
.empty-state p { font-size: 16px; margin-bottom: 6px; }
.empty-state .sub { font-size: 13px; color: var(--text3); }

/* ===== Stream count / load-more ===== */
.stream-count {
  font-size: 12px;
  color: var(--text2);
  padding: 6px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.stream-load-more-wrap {
  text-align: center;
  padding: 16px;
}

/* ===== TMDB modal score ===== */
.modal-tmdb-score {
  font-size: 13px;
  color: var(--text2);
  margin-top: 4px;
}
.modal-tmdb-score .tmdb-score-badge {
  display: inline-block;
  background: #0d253f;
  color: #90cea1;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 4px;
}
.tmdb-vote-count {
  font-size: 11px;
  color: var(--text3);
}
.tmdb-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
}

/* ===== Streaming ===== */
.stream-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.stream-service-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
}
.stream-service-tabs::-webkit-scrollbar { display: none; }

.service-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.service-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.stream-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}
.stream-filters .filter-group {
  flex: 1;
}

/* Quick-add / hide buttons on streaming cards */
.stream-quick-btn {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  font-weight: 300;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  bottom: 4px;
  right: 4px;
  background: var(--accent);
}
.stream-hide-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  white-space: nowrap;
}
.stream-quick-btn:active, .stream-hide-btn:active { opacity: 0.7; }
.stream-quick-btn:disabled { background: var(--text3); }

/* 見たいリスト（検索タブ） */
.want-section { margin-top: 4px; }
.want-count {
  font-size: 12px;
  font-weight: 400;
  color: var(--text2);
  margin-left: 4px;
}
.want-card {
  flex-shrink: 0;
  width: 90px;
  cursor: pointer;
}
.want-card:active { opacity: 0.7; }
.want-card .trending-poster {
  position: relative;
  width: 90px;
  height: 135px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 5px;
}
.want-card .trending-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.want-card .trending-card-title {
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}
.want-card .trending-score {
  font-size: 10px;
  color: var(--text2);
  text-align: center;
  margin-top: 2px;
}

/* 6-tab nav */
.tab-nav .tab-btn { font-size: 9px; padding: 0 2px; }
.tab-nav .tab-btn .tab-icon { font-size: 19px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
