/* 휴대폰 화면 정리 (2026-11). 다른 CSS보다 마지막에 불러온다.
   원칙(UI UX Pro Max 점검 + 드리블 일정 앱 레퍼런스): 탭마다 흰 시트 한 장(어둡게 모드는 남색). 시트 안에 상자를
   또 두지 않고, 묶음은 구분선·전환 버튼·진행 막대 같은 구조로 나눈다. 흰 바탕이라 보조 글씨 대비가 4.5:1을 넘는다.
   버튼 높이 40px, 화살표 누르는 칸 44px. 노래책은 예전 판 구조 그대로. 게임 탭은 건드리지 않는다. */
.story-progress { display: none; }
@media (max-width: 760px) {
  html body { --m-card: #fbfdfd; --m-gap: 12px; }
  html body[data-theme=dark] { --m-card: var(--c-navy); }

  /* ---------- 공통: 바깥 판 없애기 ---------- */
  html body[data-theme] :is(.viewer-board, .story-board) {
    margin: 0 12px !important; padding: 16px 14px 18px !important; border: 0 !important; border-radius: var(--r-xl) !important;
    background: var(--m-card) !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  }
  html body[data-theme] :is(.calendar-card, .story-card) {
    margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
    background: transparent !important; box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  }

  /* ---------- 공통: 버튼 모양 ---------- */
  /* 게임 탭(게임 진입 연출 포함)은 위쪽 버튼·메뉴까지 원래 모양 그대로 둔다 */
  html body:not([data-page=game]):not(.game-entering) :is(.mobile-view-toggle, .calendar-search-trigger, .mobile-day-edit-button, .story-edit-toggle, .top-actions > button) {
    height: 40px !important; min-height: 40px !important; padding: 0 14px !important;
    border: 1px solid var(--rn-line) !important; border-radius: var(--r-md) !important;
    background: var(--rn-surface) !important; color: var(--rn-ink) !important; box-shadow: none !important;
    font-size: var(--fs-13) !important; font-weight: 700 !important; line-height: 1 !important;
  }
  html body:not([data-page=game]):not(.game-entering) .calendar-search-trigger, html body:not([data-page=game]):not(.game-entering) .top-actions > .settings-button { width: 40px !important; padding: 0 !important; }
  /* 로그인은 구글 표시만 남긴 네모 버튼으로 */
  html body:not([data-page=game]):not(.game-entering) .top-actions > .top-auth-button-google:not(.hidden) { width: 40px !important; padding: 0 !important; font-size: 0 !important; }
  html body:not([data-page=game]):not(.game-entering) .top-actions > .top-auth-button-google:not(.hidden) { display: inline-flex !important; align-items: center; justify-content: center; gap: 0 !important; }
  html body:not([data-page=game]):not(.game-entering) .top-actions > .top-auth-button-google span { display: none !important; }
  html body:not([data-page=game]):not(.game-entering) .top-actions > .top-auth-button-google svg { width: 16px; height: 16px; margin: 0 !important; }

  /* 밝게 모드 홈 글씨용 그림자(seaside-home.css)가 흰 버튼·밝은 펼침 메뉴 안 글씨에도 걸리던 것 */
  html body :is(.side-nav-item, .top-actions > button) { text-shadow: none !important; }

  /* ---------- 메뉴(왼쪽 위 펼침) ---------- */
  html:not(.nd-x)[data-seaside=v11][data-seaside-scene] body[data-page] .side-nav { width: 200px !important; padding: 6px !important; }
  html:not(.nd-x)[data-seaside=v11][data-seaside-scene] body[data-page] .side-nav-item { height: 42px !important; min-height: 42px !important; padding: 0 12px !important; }
  html:not(.nd-x)[data-seaside=v11][data-seaside-scene] body[data-page] .side-nav-item,
  html:not(.nd-x)[data-seaside=v11][data-seaside-scene] body[data-page] .side-nav-item span { font-size: var(--fs-15) !important; font-weight: 600 !important; }

  /* ---------- 일정 ---------- */
  /* 시트 한 장 안: 달 이름·주간|월간 전환 → 주간 날짜(또는 월간 달력) → 구분선 → 고른 날의 일정 */
  html body .calendar-footnote { display: none !important; }
  html body .calendar-head { display: grid !important; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; margin: 0 !important; padding: 0 0 6px !important; background: transparent !important; }
  html body .calendar-head > .calendar-nav-wrap { grid-column: 1; grid-row: 1; min-width: 0; }
  html body .calendar-head > .calendar-head-actions { grid-column: 2; grid-row: 1; display: flex !important; align-items: center; gap: 8px !important; margin: 0 !important; }
  html body .calendar-head > .calendar-notice-link { grid-column: 1 / -1; grid-row: 2; margin: 0 !important; }
  html body :is(.mobile-day-view, .mobile-day-panel, .mobile-month-view) { margin: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  html body .mobile-day-panel { display: grid !important; gap: 0 !important; }
  .mday-week-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; margin: 0 -8px; padding: 2px 0 12px; border-bottom: 1px solid var(--rn-line); }
  html body .mday-week { padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
  .mday-week-arrow { width: 32px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--rn-muted); font-size: 22px; line-height: 1; cursor: pointer; }
  .mday-card { display: grid; gap: 12px; padding: 16px 0 0; }
  html body .mday-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 !important; }
  html body .mday-head .mobile-day-edit-button { flex: none; margin: 0 !important; }
  /* 주간 | 월간 두 칸 전환 버튼 */
  html body:not([data-page=game]):not(.game-entering) .calendar-head-actions .mobile-view-toggle { display: inline-flex !important; align-items: stretch; gap: 0; padding: 3px !important; border-radius: var(--r-md) !important; background: rgb(var(--c-accent-rgb) / 0.08) !important; }
  .mobile-view-toggle span { display: inline-flex; align-items: center; padding: 0 11px; border-radius: 6px; color: var(--rn-muted); font-weight: 700; }
  .mobile-view-toggle span.is-on { background: var(--m-card); color: var(--rn-ink); box-shadow: 0 1px 2px rgb(var(--c-ink-deep-rgb) / 0.12); }
  /* 일정은 상자 대신 왼쪽 색 줄 */
  html body .mobile-entry-list { display: grid; gap: 8px !important; }
  html body .mobile-entry-card {
    margin: 0 !important; padding: 8px 0 8px 12px !important; border: 0 !important; border-left: 3px solid var(--mobile-entry-color, var(--rn-line)) !important;
    border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
  }
  html body .mobile-entry-category { padding: 0 !important; border: 0 !important; background: transparent !important; color: var(--rn-muted) !important; font-size: var(--fs-12) !important; font-weight: 700; }
  html body .mobile-day-empty { padding: 6px 0 !important; border: 0 !important; background: transparent !important; text-align: left; }
  html body :is(.mobile-day-note-card, .mobile-day-image-card) { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; }

  /* 월간: 달력은 카드 1에 이어지고, 고른 날 일정은 카드 2 */
  .mobile-month-grid { margin: 0 -6px; padding: 2px 0 12px; border-bottom: 1px solid var(--rn-line); }
  html body .mobile-month-week { gap: 2px; }
  html body .mobile-month-day { position: relative; display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; min-height: 66px !important; padding: 7px 0 4px !important; border: 0 !important; border-radius: var(--r-md) !important; background: transparent !important; box-shadow: none !important; text-align: center; }
  html body .mobile-month-day-number { position: relative; display: inline-block; }
  html body .mobile-month-day .anniversary-date-mark { position: absolute !important; top: -2px !important; right: -6px !important; left: auto !important; }
  html body .mobile-month-day.is-selected { background: rgb(var(--c-accent-rgb) / 0.16) !important; }
  html body .mobile-month-day.is-today .mobile-month-day-number { color: var(--c-teal-ink); font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
  html body .mobile-month-chips { display: grid !important; gap: 2px; width: 100%; margin-top: 4px; padding: 0 1px; }
  .mobile-month-line {
    display: block; padding-left: 3px; border-left: 2px solid var(--line); overflow: hidden; white-space: nowrap; text-align: left;
    color: var(--rn-ink); font-size: var(--fs-11); font-weight: 600; line-height: 14px;
    -webkit-mask-image: linear-gradient(90deg, #000 78%, transparent); mask-image: linear-gradient(90deg, #000 78%, transparent);
  }
  html body .mobile-month-more { display: block; padding-left: 5px; color: var(--rn-muted); font-size: var(--fs-11); font-weight: 600; line-height: 13px; text-align: left; }
  .mobile-month-detail { display: grid; gap: 12px; padding: 16px 0 0; }
  .mobile-month-note { margin: 0; color: var(--rn-muted); font-size: var(--fs-13); white-space: pre-wrap; }

  /* 주말 색: 일요일 빨강, 토요일 파랑(요일 글자와 날짜 숫자 모두). 오늘·고른 날은 원래 색 유지 */
  html body .mday-date.is-sun:not(.is-active) .mday-number { color: #d1495b; }
  html body .mday-date.is-sat:not(.is-active) .mday-number { color: #3f73c8; }
  html body .mday-date.is-outside .mday-number { opacity: .55; }
  html body .mobile-month-weekday-row > span:first-child { color: #d1495b; }
  html body .mobile-month-weekday-row > span:last-child { color: #3f73c8; }
  html body .mobile-month-week > :first-child:not(.is-today) .mobile-month-day-number { color: #d1495b; }
  html body .mobile-month-week > :last-child:not(.is-today) .mobile-month-day-number { color: #3f73c8; }
  html body[data-theme=dark] :is(.mday-date.is-sun:not(.is-active) .mday-number, .mobile-month-weekday-row > span:first-child, .mobile-month-week > :first-child:not(.is-today) .mobile-month-day-number, .mday-date.is-sun .mday-weekday) { color: #f08a96; }
  html body[data-theme=dark] :is(.mday-date.is-sat:not(.is-active) .mday-number, .mobile-month-weekday-row > span:last-child, .mobile-month-week > :last-child:not(.is-today) .mobile-month-day-number, .mday-date.is-sat .mday-weekday) { color: #8fb4f0; }

  /* ---------- 노래책 ---------- */
  /* 판 구조는 예전(바깥 판 + 흰 카드) 그대로 두고, 겹치는 버튼과 페이지 스크롤바만 정리한다 */
  html body #song-search { display: none !important; } /* 바로 아래 검색창과 같은 기능 */
  html body .renewal-song-search > label { display: none !important; }
  html body .song-pagination { overflow: visible !important; justify-content: center; gap: 6px !important; }
  html body .song-pagination > .song-pagination-arrow:first-child,
  html body .song-pagination > .song-pagination-arrow:last-child { display: none !important; } /* 처음·끝 화살표는 빼고 5칸만 */
  html body .song-pagination-pages { overflow: visible !important; }
  /* 정렬 버튼은 칩 줄에 같이 넣으면 이름 길이에 따라 넘쳐서, 폰에서는 칩 아래 오른쪽에 따로 한 줄로 둔다 */
  html body .song-tag-filter-bar.is-collapsed { flex-wrap: wrap; max-height: none; overflow: visible; }
  html body .song-tag-filter-bar::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  html body .song-sort-trigger { order: 2; height: 30px; font-size: var(--fs-12); }

  /* ---------- 스토리 ---------- */
  /* 시트 한 장 안: 게임 탭 → 진행 막대 + 필터 → 챕터 선택(위에 붙음) → 진행 목록 */
  html body #story-hero { display: none !important; } /* 진행 막대와 같은 내용 */
  html body .story-game-tabs { display: flex !important; margin: 0 0 12px !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  html body #story-filters { display: flex !important; flex-wrap: wrap; align-items: center; gap: 6px !important; margin: 0 !important; padding: 0 0 14px !important; border-bottom: 1px solid var(--rn-line); background: transparent !important; }
  html body #story-filters .story-progress { display: grid; flex: 1 0 100%; gap: 6px; margin-bottom: 6px; }
  .story-progress-text { color: var(--rn-muted); font-size: var(--fs-13); font-weight: 600; }
  .story-progress-text b { color: var(--rn-ink); font-size: var(--fs-16); font-weight: 800; }
  .story-progress-track { display: block; height: 6px; border-radius: var(--r-pill); background: rgb(var(--c-accent-rgb) / 0.16); overflow: hidden; }
  .story-progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--c-accent); }
  html body .story-filter-count { display: none; }
  html body[data-theme] .story-journey { margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  /* 챕터 선택은 스크롤해도 위에 붙어 있으므로 시트와 같은 색을 깔아 아래 내용이 비치지 않게 한다 */
  html body .story-chapter-picker { top: 0 !important; z-index: 4 !important; margin: 0 -14px !important; padding: 12px 14px !important; border: 0 !important; border-radius: 0 !important; background: var(--m-card) !important; }
  html body .story-chapter-picker > span { display: none !important; } /* '챕터 선택' 제목: 선택 상자만으로 충분 */
  html body #story-columns { padding: 0 !important; margin: 0 !important; }
  html body .story-card-head.has-image { border-radius: var(--r-md); overflow: hidden; }
  html body .story-card-foot { border: 0 !important; }
  /* 막·막간 표시는 한 가지 색 */
  html body .story-tag-type { border: 0 !important; background: rgb(var(--c-ink-rgb, 25 53 73) / 0.08) !important; color: var(--rn-muted) !important; }
  html body .story-replay-icon { color: inherit !important; background: transparent !important; }

  /* ---------- 재첩 도우미 ---------- */
  html body .assistant-suggestions button { max-width: 78vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body .assistant-about h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; cursor: pointer; }
  html body .assistant-about h2::after { content: "펼치기"; color: var(--rn-muted); font-size: var(--fs-12); font-weight: 600; }
  html body .assistant-about.is-open h2::after { content: "접기"; }
  html body .assistant-about:not(.is-open) details { display: none; }

  /* ---------- 편집 창 ---------- */
  html body .editor-time-grid { justify-content: start !important; }
  html body .editor-modal textarea { overflow-y: hidden !important; resize: none; }
  html body .editor-slot {
    padding: 12px 0 !important; border: 0 !important; border-top: 1px solid var(--rn-line) !important;
    border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
  }
}
