/* #region BASE */

/* ===== BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  font-feature-settings: "palt" 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
}

:root {
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "YuGothic", sans-serif;
  --bg: #fff;
  --bg2: #fafafa;
  --bg3: #f1f1f1;
  --text: #111;
  --text2: #666;
  --text3: #aaa;
  --border: rgba(0, 0, 0, 0.07);
  --border2: rgba(0, 0, 0, 0.13);
  --dot: #222;
  --today-bg: #111;
  --today-text: #fff;
  --handle: #ddd;
  --overlay: rgba(0, 0, 0, 0.18);
  --sun: #e5503a;
  --sat: #3a7ee5;
  --r: 10px;
  --rs: 20px;
  --dur: 0.46s;
  --sab: env(safe-area-inset-bottom, 0px);
  --tab-h: 64px;
  --title-h: 44px;
  --header-h: 48px;
  --week-h: 30px;
  --accent: #3a7ee5;
  --accent2: #6c4fd4;
  --accent-rgb: 58, 126, 229;
  --accent2-rgb: 108, 79, 212;

  --z-base: 1;

  --z-calendar-header: 4;
  --z-dropdown: 5;
  --z-header: 6;

  --z-tabbar: 10;
  --z-title-bar: 20;

  --z-overlay: 500;

  --z-date-sheet: 600;
  --z-detail-overlay: 650;
  --z-detail-sheet: 700;

  --z-toast: 800;
}
html,
body {
  height: 100%;
  overflow: hidden;
  touch-action: none;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* #endregion */

/* #region APP LAYOUT */

/* ===== APP LAYOUT ===== */
.app-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: var(--title-h);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  position: relative;
  z-index: var(--z-title-bar);
  order: 0;
}
.app-title-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  font-family: var(--font);
}
.tab-bar {
  position: relative;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-evenly;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  min-height: var(--tab-h);
  flex-shrink: 0;
  background: var(--bg);
  z-index: var(--z-tabbar);
  overflow: visible;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  order: 2;
}
@media (display-mode: standalone) {
  :root {
    --title-h: calc(44px + env(safe-area-inset-top, 0px));
  }
  .app-title-bar {
    padding-top: env(safe-area-inset-top, 0px);
  }
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0px;
  padding-top: 0px;
  margin-top: -8px;
  cursor: pointer;
  position: relative;
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}
.tab-icon::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: transparent;
  transition:
    background 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}
.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--text3);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    stroke 0.2s,
    transform 0.2s;
  position: relative;
  z-index: 1;
}
.tab-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  transition:
    color 0.2s,
    opacity 0s;
  letter-spacing: 0.02em;
  margin-top: -2px;
}
.tab.active .tab-icon::before {
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0) 45%
    ),
    linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  transform: scale(1.27);
}
.tab.active .tab-icon svg {
  stroke: #fff;
  transform: scale(1.15);
}
.tab.active .tab-label {
  opacity: 0;
}
.pages {
  flex: 1;
  overflow: hidden;
  order: 1;
  position: relative;
}
.tab-page {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.tab-page.active {
  display: flex;
}
/* #endregion */

/* #region CALENDAR */

/* ===== CALENDAR ===== */

/* --- Header --- */
.cal-header-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: var(--z-calendar-header);
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px;
  background: var(--bg);
  height: var(--header-h);
}
.cal-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Filter --- */
.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  border-radius: 6px;
  transition: background 0.15s;
  height: 27px;
  box-sizing: border-box;
}
.filter-btn:active {
  background: #f0f0f0;
}
.filter-btn svg {
  stroke: var(--text3);
  fill: none;
  stroke-linecap: round;
  transition: stroke 0.15s;
}
.filter-btn.active {
  background: #e8e8e8;
}
.filter-btn.active svg {
  stroke: #222;
}
.filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  padding: 0 14px;
  border-bottom: 0.5px solid var(--border);
  z-index: var(--z-dropdown);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s cubic-bezier(0.2, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.2, 0, 0.2, 1);
}
.filter-dropdown.open {
  max-height: 200px;
  padding: 10px 14px 12px;
}
.cal-body.filter-open .cal-track-outer {
  pointer-events: none;
}
.filter-tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-tag-btn {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid #ddd;
  background: var(--bg2);
  cursor: pointer;
  color: var(--text2);
  font-family: var(--font);
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.filter-tag-btn.on {
  border-color: transparent;
}
.filter-reset-btn {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--font);
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}
.today-btn {
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 4px 9px;
  cursor: pointer;
  font-family: var(--font);
  white-space: nowrap;
  letter-spacing: 0.02em;
  color: var(--text2);
  border: 1px solid var(--border2);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
.today-btn:active {
  background: var(--bg3);
}
/* iOSで:activeを発火させるためにtouchstartをJS側で追加 */
.ym-label-display {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
  pointer-events: none;
}
.ym-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ym-chevron {
  color: var(--text2);
  flex-shrink: 0;
  pointer-events: none;
  margin-top: 1px;
}

/* --- Calendar Body --- */
.cal-body {
  flex: 1;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
}
.cal-track-outer {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.cal-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.cal-panel {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--bg);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 6px 10px 2px;
  background: var(--bg);
  flex-shrink: 0;
}
.cal-weekday {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  padding: 2px 0;
}
.cal-weekday:first-child {
  color: var(--sun);
}
.cal-weekday:last-child {
  color: var(--sat);
}
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  padding: 4px 10px 16px;
}

/* --- Day Cell --- */
.day {
  height: 68px;
  border-radius: var(--r);
  padding: 6px 5px 4px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg2);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  transition: background 0.1s;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.day.other {
  opacity: 0.4;
}
.day.sun,
.day.hol {
  color: var(--sun);
}
.day.sat {
  color: var(--sat);
}
.day.today .day-num {
  background: var(--today-bg);
  color: var(--today-text);
}
.day.selected {
  background: var(--bg3);
}

.day-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.dots {
  display: flex;
  gap: 3px;
  justify-content: center;
  max-width: calc(4 * 5px + 3 * 3px);
  margin: 2px auto 0;
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.list-item:active,
.list-item.touched {
  background: #f0f0f0;
}
.list-item:has(.fav-btn:active) {
  background: none !important;
}
/* #endregion */

/* #region SEARCH */

/* ===== SEARCH ===== */

/* --- Header --- */
.search-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.search-header {
  padding: 10px 14px 0;
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-header);
  background: var(--bg);
}
.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border-radius: 10px;
  padding: 0 10px;
  gap: 6px;
}
.search-input-wrap svg {
  width: 16px;
  height: 16px;
  stroke: #aaa;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  flex-shrink: 0;
}
.search-input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font);
  padding: 9px 0;
}
.search-input::placeholder {
  color: #bbb;
}
.search-input:focus::placeholder {
  color: transparent;
}
.search-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: none;
  color: #aaa;
  font-size: 16px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* --- Detail Search --- */
.detail-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 6px 0 4px 2px;
  padding: 4px 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  font-family: var(--font);
  border-radius: 6px;
  transition:
    color 0.15s,
    background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.detail-search-toggle:active {
  background: #f0f0f0;
}
.detail-search-toggle.open {
  color: var(--text2);
}
/* 詳細検索ドロップダウン（position:absolute で検索結果に重なる） */
.detail-search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  z-index: var(--z-dropdown);
  overflow: hidden;
  max-height: 0;
  transition:
    max-height 0.3s cubic-bezier(0.2, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.2, 0, 0.2, 1),
    box-shadow 0.3s;
  padding: 0 14px;
  box-shadow: none;
}
.detail-search-dropdown.open {
  max-height: 300px;
  padding: 8px 14px 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
/* 詳細検索: タグ横スクロール行 */
.detail-tag-row-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-row-label {
  font-size: 11px;
  color: var(--text3);
  flex-shrink: 0;
  width: 44px;
}
.detail-tag-scroll {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
  touch-action: pan-x;
}
.detail-tag-scroll::-webkit-scrollbar {
  display: none;
}
.detail-tag-scroll .filter-tag-btn {
  white-space: nowrap;
  flex-shrink: 0;
}
/* 詳細検索: 期間指定 */
.detail-date-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.detail-date-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.detail-date-input {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg2);
  outline: none;
  -webkit-appearance: none;
}
.detail-date-input:focus {
  border-color: #aaa;
  background: #fff;
}
.detail-date-input:disabled {
  background: #f2f2f2;
  color: var(--text3);
  border-color: #e8e8e8;
}
.detail-date-sep {
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}
/* 詳細検索: 既刊チェック */
.detail-check-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  padding-left: 54px;
}
.detail-check-label {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.detail-check-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}
/* 詳細検索: ボタン行 */
.detail-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-reset-btn {
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--font);
  text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}
.detail-search-exec-btn {
  padding: 7px 20px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  -webkit-tap-highlight-color: transparent;
}
.detail-search-exec-btn:active {
  opacity: 0.8;
}
/* 検索結果ヘッダー（スクロール固定） */
.search-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
}
.search-result-count {
  font-size: 12px;
  color: var(--text3);
}

/* --- Sort --- */
.sort-wrap {
  position: relative;
}
.sort-btn {
  display: flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  font-family: var(--font);
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sort-btn:active,
.sort-btn.open {
  background: #f0f0f0;
}
.sort-btn svg {
  width: 13px;
  height: 13px;
  stroke: var(--text2);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.sort-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  overflow: hidden;
  min-width: 110px;
  z-index: 20;
  display: none;
}
.sort-dropdown.open {
  display: block;
}
.sort-option {
  padding: 11px 16px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 0.5px solid var(--border);
  -webkit-tap-highlight-color: transparent;
}
.sort-option:last-child {
  border-bottom: none;
}
.sort-option:active {
  background: #f5f5f5;
}
.sort-option.selected {
  color: var(--accent);
  font-weight: 600;
}
.sort-option .sort-check {
  font-size: 12px;
  color: var(--accent);
  width: 14px;
  flex-shrink: 0;
}
.search-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  transition: opacity 0.22s ease;
}
.search-page.detail-open .search-body {
  pointer-events: none;
}
.search-body .list-view,
.search-body .search-history-item {
  touch-action: manipulation;
}
.search-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.search-history-item:active {
  background: #f8f8f8;
}
.search-history-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text3);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.search-history-text {
  flex: 1;
  font-size: 14px;
  color: var(--text2);
}
.search-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text3);
  font-size: 14px;
}
/* #endregion */

/* #region FAVORITES */

/* ===== FAVORITES ===== */
.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  align-self: center;
  gap: 3px;
  min-width: 32px;
}
.fav-btn svg {
  width: 20px;
  height: 20px;
  stroke: #ccc;
  fill: none;
  stroke-width: 1.8;
  transition:
    stroke 0.15s,
    fill 0.15s;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.fav-btn.active svg {
  stroke: #ff6b8a;
  fill: #ff6b8a;
}
.fav-count {
  font-size: 11px;
  font-weight: 600;
  color: #ccc;
  transition: color 0.15s;
  line-height: 1;
}
.fav-btn.active .fav-count {
  color: #ff6b8a;
}
.fav-like-count {
  font-size: 11px;
  font-weight: 400;
  color: #bbb;
  align-self: flex-end;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 4px 2px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}
.fav-like-count svg {
  stroke: #bbb;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  display: block;
}
.fav-like-count span {
  position: relative;
  top: 1px;
}
.detail-title-row .fav-btn {
  align-self: flex-start;
  margin-top: -5px;
  background: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 6px;
}

/* ─── お気に入りページ ─── */
.fav-page {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.fav-subtab-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.fav-subtab {
  display: flex;
  background: var(--bg3);
  border-radius: 20px;
  padding: 3px;
  gap: 0;
  position: relative;
}
/* スライドするアクティブ背景 */
.fav-subtab-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  bottom: 3px;
  width: calc(50% - 3px);
  background: var(--bg);
  border-radius: 17px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: transform 0.36s cubic-bezier(0.2, 0, 0.2, 1);
  pointer-events: none;
}
.fav-subtab-btn {
  flex: 1;
  padding: 6px 24px;
  border: none;
  background: none;
  border-radius: 17px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.fav-subtab-btn.active {
  color: var(--text);
}
.fav-list {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.fav-list .list-view {
  touch-action: manipulation;
}
.update-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e53a3a;
  pointer-events: none;
  z-index: 2;
}
.update-dot.on-active {
  background: #fff;
}
.fav-update-badge {
  font-size: 10px;
  font-weight: 400;
  color: #e53a3a;
  flex-shrink: 0;
  align-self: flex-end;
  padding: 0 0 2px 4px;
  margin-right: 6px;
}
.fav-update-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e53a3a;
  flex-shrink: 0;
}
.fav-track-outer {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.fav-track {
  display: flex;
  height: 100%;
  will-change: transform;
  transition: transform 0.36s cubic-bezier(0.2, 0, 0.2, 1);
}
.fav-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text3);
  font-size: 14px;
  padding: 40px;
  text-align: center;
}
.fav-empty .big {
  font-size: 36px;
}
.fav-date-sep {
  padding: 3px 16px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  background: #f8f8f8;
}
.list-item:has(+ .fav-date-sep) {
  border-bottom: none;
}
/* #endregion */

/* #region OVERLAY */

/* ===== OVERLAY ===== */
#overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
}
#overlay.active {
  opacity: 1;
  pointer-events: all;
}
#detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: var(--z-detail-overlay);
  opacity: 0;
  pointer-events: none;
}
#detail-overlay.active {
  opacity: 1;
  pointer-events: all;
}
/* #endregion */

/* #region SHEETS */

/* ===== SHEETS ===== */
.sheet {
  position: fixed;
  left: 0;
  width: 100%;
  bottom: 0;
  background: var(--bg);
  will-change: transform;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-touch-callout: none;
  visibility: hidden;
}
.sheet.open {
  visibility: visible;
}
.sheet.animating {
  pointer-events: none;
}
#date-sheet {
  z-index: var(--z-date-sheet);
  top: calc(var(--title-h) + var(--header-h) + var(--week-h));
  border-radius: var(--rs) var(--rs) 0 0;
}
#detail-sheet {
  z-index: var(--z-detail-sheet);
  top: calc(var(--title-h) + var(--header-h) + var(--week-h) + 20px);
  border-radius: 12px 12px 0 0;
  transition: border-radius 0.38s cubic-bezier(0.2, 0, 0.2, 1);
}
.handle-wrap {
  padding: 10px 0 4px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
}
.handle {
  width: 40px;
  height: 4px;
  background: var(--handle);
  border-radius: 2px;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px 10px;
  flex-shrink: 0;
}
.sheet-title {
  font-size: 15px;
  font-weight: 700;
}

/* ─── DATE SHEET ─── */
.date-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.date-track {
  display: flex;
  height: 100%;
  will-change: transform;
}
.date-track.swiping > * {
  pointer-events: none;
}
.date-panel {
  flex: 0 0 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.view-toggle-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f2f2f2;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* #endregion */

/* #region COMPONENTS */

/* ===== COMPONENTS ===== */

/* --- List --- */
.list-view {
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.list-item:last-child {
  border-bottom: none;
}
.list-info {
  flex: 1;
  min-width: 0;
  align-self: flex-start;
}
.list-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  line-height: 1.45;
}
.list-title.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Thumbnail --- */
.thumb {
  width: 68px;
  height: 95px;
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  border-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* --- Tags --- */
.tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 20px;
}

/* --- Grid / Card --- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 12px;
  row-gap: 22px;
  padding: 8px;
  padding-bottom: 80px;
  box-sizing: border-box;
  width: 100%;
  align-items: start;
}
@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
.card {
  aspect-ratio: 1/1.3;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: transform 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
}
.card:active,
.card.touched {
  transform: scale(0.97);
}
.card img {
  display: block;
  border-radius: 8px;
  corner-shape: squircle;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
  max-width: 100%;
  max-height: 100%;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.card-caption {
  position: absolute;
  bottom: 0;
  padding: 10px 6px 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  border-radius: 0 0 8px 8px;
  corner-shape: squircle;
  pointer-events: none;
}
.card-caption-text {
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Empty State --- */
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}
/* #endregion */

/* #region DETAIL */

/* ===== DETAIL ===== */
.detail-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  justify-content: space-between;
  padding: 16px 0 6px;
}
.detail-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.55;
  flex: 1;
}
.detail-cover-zone {
  position: relative;
  overflow: hidden;
  height: 220px;
  flex-shrink: 0;
}
.detail-cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(22px);
  transform: scale(1.18);
  opacity: 0.85;
}
.detail-cover-front {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.detail-cover-front img {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.detail-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.detail-body {
  padding: 0 20px 32px;
}
.detail-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-tag {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
}
.detail-tag-category {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fff;
  color: #555;
  border: 1px solid #999;
  display: inline-block;
}
.meta-rows {
  display: flex;
  flex-direction: column;
}
.meta-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}
.meta-row:last-of-type {
  border-bottom: none;
}
.meta-label {
  color: var(--text3);
  font-size: 11px;
  width: 58px;
  flex-shrink: 0;
}
.meta-val {
  color: var(--text);
  flex: 1;
}
.amazon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  background: #ffb347;
  color: #111;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  padding: 11px;
  border-radius: 9px;
  border: none;
}
.errata-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text3);
  text-decoration: none;
  border-bottom: 1px solid var(--text3);
  padding-bottom: 0;
}
.errata-link svg {
  width: 11px;
  height: 11px;
  stroke: var(--text3);
  flex-shrink: 0;
  transform: translateY(0.5px);
}
.related-books-section {
  margin-top: 16px;
}
.related-books-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 8px;
}
.related-books-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
  touch-action: pan-x;
}
.related-books-scroll::-webkit-scrollbar {
  display: none;
}
.related-book-img {
  display: block;
  height: 80px;
  width: auto;
  flex-shrink: 0;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.timestamps {
  margin-top: 14px;
  font-size: 11px;
  color: var(--text3);
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
}
.timestamps table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}
.timestamps td {
  padding: 0;
  line-height: 1.9;
  vertical-align: baseline;
}
.timestamps .ts-time {
  padding-left: 0.5em;
}
/* #endregion */

/* #region FEEDBACK */

/* ===== FEEDBACK ===== */

/* --- Loading --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: opacity 0.3s;
}
.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #666;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-overlay p {
  color: #999;
  font-size: 13px;
}

/* --- Toast --- */
.copy-toast {
  position: fixed;
  top: calc(var(--title-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 20px;
  white-space: nowrap;
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* #endregion */

/* #region DROPDOWN */

/* ===== DROPDOWN ===== */

/* --- hamburger --- */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 30px;
  height: 30px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-right: 0;
}
.hamburger-btn.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger-btn.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}
.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: var(--dur);
}

/* --- dropdown --- */
.dropdown-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-title-bar) + 1);
  display: none;
}
.dropdown-overlay.active {
  display: block;
}
.dropdown-panel {
  position: fixed;
  top: var(--title-h);
  left: 0;
  right: 0;
  z-index: calc(var(--z-title-bar) + 2);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.36s cubic-bezier(0.2, 0, 0.2, 1);
}
.dropdown-panel.open {
  max-height: 320px;
}
.dropdown-main {
  padding: 8px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 20px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
}
.dropdown-item:active {
  background: rgba(0, 0, 0, 0.06);
}
.dropdown-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #fff;
}
.dropdown-item-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dropdown-item-text {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
}
.dropdown-item-arrow {
  font-size: 18px;
  color: var(--text3);
}
.dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--border);
}
.dropdown-footer-link {
  font-size: 11px;
  color: var(--text3);
  text-decoration: none;
  font-family: var(--font);
}
.dropdown-footer-link:active {
  color: var(--text);
}
.dropdown-footer-sep {
  font-size: 11px;
  color: var(--text3);
}
.x-icon {
  width: 10px;
  height: 10px;
  display: block;
  fill: currentColor;
}
/* #endregion */
