/* ===== 基本リセット・全体 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: #FFF8E7;
  color: #2C3E50;
  font-size: 16px;
  line-height: 1.6;
  padding-bottom: 100px;
}

/* ===== ヘッダー ===== */
#appHeader {
  background: linear-gradient(135deg, #FF8C42, #FFB347);
  color: white;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.headerTitle { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
#appHeader h1 { font-size: 22px; margin-bottom: 0; cursor: pointer; transition: opacity 0.15s; }
#appHeader h1:hover { opacity: 0.75; }
.versionBadge {
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.25);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
}
#appHeader nav { display: flex; gap: 8px; }
.navBtn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid transparent;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}
.navBtn.active { background: white; color: #FF8C42; }
#appHeader nav { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== ページ ===== */
.page { display: none; padding: 16px; max-width: 900px; margin: 0 auto; }
.page.active { display: block; }

/* ===== カード ===== */
.card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.card h2 { font-size: 18px; color: #FF8C42; margin-bottom: 14px; }

/* ===== 時間スライダー ===== */
.timeRow { display: flex; align-items: center; gap: 16px; }
#timeRange { flex: 1; height: 40px; }
.bigNum { font-size: 48px; font-weight: 700; color: #FF8C42; min-width: 80px; text-align: right; }

/* ===== カテゴリ・備品グリッド ===== */
.catGrid, .propsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.catItem, .propItem {
  background: #FAFAFA;
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  font-size: 14px;
}
.catItem.active, .propItem.active {
  background: #FFF3E0;
  border-color: #FF8C42;
  color: #E65100;
  font-weight: 600;
}
.catItem input, .propItem input { display: none; }
.catItem .catEmoji { font-size: 22px; }

/* ===== 締めスタイル 2段階 ===== */
.closingStep { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.closingStepLabel {
  font-weight: 700;
  font-size: 14px;
  color: #FF8C42;
  min-width: 70px;
  padding-top: 10px;
}
.closingArrow {
  text-align: center;
  font-size: 22px;
  color: #FFBC8A;
  margin: 4px 0;
  padding-left: 70px;
}

/* ===== 状況選択ボタングループ ===== */
.condRow { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.condRow label { font-weight: 600; min-width: 60px; }
.btnGroup { display: flex; gap: 8px; flex-wrap: wrap; }
.btnGroup button {
  background: white;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
  color: #555;
}
.btnGroup button.active {
  background: #FF8C42;
  border-color: #FF8C42;
  color: white;
  font-weight: 600;
}
.btnGroup.big button { padding: 14px 20px; font-size: 16px; }

/* ===== チェックボックス行 ===== */
.checkRow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  cursor: pointer;
  border-radius: 8px;
}
.checkRow:hover { background: #FAFAFA; }
.checkRow input { width: 22px; height: 22px; cursor: pointer; }
.checkRow span { font-size: 15px; }

/* ===== プリセット ===== */
.presets #presetList { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.presetItem {
  background: #FFF3E0;
  border: 2px solid #FFB347;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.presetItem .delPreset {
  background: #F44336;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.presetActions { display: flex; gap: 8px; flex-wrap: wrap; }
.presetActions input {
  flex: 1; min-width: 200px;
  padding: 10px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-size: 14px;
}

/* ===== ボタン共通 ===== */
button.primary {
  background: #FF8C42;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: #E67E22; }
button.huge {
  font-size: 22px;
  padding: 20px 40px;
  font-weight: 700;
  border-radius: 16px;
  width: 100%;
  border: none;
  cursor: pointer;
}
.generateArea { padding: 20px 0; }
#generateBtn {
  background: linear-gradient(135deg, #FF6B35, #F7931E);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
}
#generateBtn:active { transform: translateY(2px); }

/* ===== プレイリスト ===== */
.playlistHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.totalTime { font-size: 18px; color: #FF8C42; font-weight: 600; }
.totalTime span { font-size: 24px; font-weight: 700; }
.playlistActions { display: flex; gap: 8px; flex-wrap: wrap; }
.playlistActions button { flex: 1; min-width: 120px; padding: 12px; border-radius: 10px; border: 2px solid #FF8C42; background: white; color: #FF8C42; font-size: 14px; cursor: pointer; font-weight: 600; }
.playlistActions button.primary { background: #FF8C42; color: white; }

.playlist { list-style: none; }
.playlistItem {
  background: white;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: 24px 26px 1fr auto;
  gap: 10px;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: opacity 0.15s;
}
.playlistItem.is-dragging { opacity: 0.25; }

/* ドラッグハンドル */
.dragHandle {
  font-size: 20px;
  color: #CCC;
  cursor: grab;
  text-align: center;
  user-select: none;
  touch-action: none;  /* ハンドルを掴んだ時だけドラッグ（スクロールは項目側で有効） */
  line-height: 1;
  padding: 2px 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dragHandle:hover { color: #FF8C42; }
.dragHandle:active { cursor: grabbing; color: #FF8C42; }

/* ドロップ位置インジケーター */
.drag-indicator {
  height: 3px;
  background: #FF8C42;
  border-radius: 2px;
  margin: 2px 8px;
  pointer-events: none;
}
.playlistItem .idx { font-size: 16px; font-weight: 700; color: #FF8C42; text-align: center; }
.playlistItem .pbody { min-width: 0; }
.playlistItem .pname {
  font-weight: 600; font-size: 15px; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.playlistItem .pmeta { font-size: 11px; color: #888; line-height: 1.3; }
.playlistItem .pdur { font-weight: 700; color: #555; font-size: 14px; }
.playlistItem .pactions { display: flex; gap: 5px; margin-top: 5px; }
.playlistItem .pactions button {
  background: #F5F5F5;
  border: none;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  line-height: 1.2;
}
.playlistItem .pactions button:hover { background: #FFE0B2; }

/* ===== 再生画面 ===== */
.player {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #FFE5B4 0%, #FFB347 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 20px;
}
.player.hidden { display: none; }
.playerTop { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.progressOverall { flex: 1; display: flex; flex-direction: column; gap: 6px; }
#trackNum { font-size: 14px; color: #5D4037; font-weight: 600; }
.overallBar { height: 8px; background: rgba(255,255,255,0.5); border-radius: 4px; overflow: hidden; }
#overallFill { height: 100%; background: #4CAF50; width: 0%; transition: width 0.3s; }
.exitBtn {
  background: rgba(255,255,255,0.8);
  border: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

/* ===== 再生画面 メインエリア（縦向きデフォルト） ===== */
.playerMain {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-areas:
    "header"
    "image"
    "footer";
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  overflow: hidden;
  place-items: center;
}

/* 縦向き：テキストエリア（上） */
.playerHeader {
  grid-area: header;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  width: 100%;
}

/* 縦向き：タイムバー＋ボタン（下） */
.playerFooter {
  grid-area: footer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
/* 再生画面では子供が見るのでシンプルに：カテゴリ・いいね・使わない・差替は非表示 */
#categoryBadge { display: none; }
#playerLikeBtn { display: none !important; }
#playerBanBtn  { display: none !important; }
#replaceBtn    { display: none !important; }

.catBadge {
  background: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  color: #FF6B35;
  font-weight: 600;
}
.activityName {
  font-size: clamp(26px, 7vw, 52px);
  font-weight: 800;
  color: #2C3E50;
  line-height: 1.15;
}
.hiraganaText {
  font-size: clamp(15px, 4.5vw, 26px);
  color: #5D4037;
  font-weight: 600;
  line-height: 1.4;
  background: rgba(255,255,255,0.7);
  padding: 10px 18px;
  border-radius: 16px;
  max-width: 92%;
}
.activityImage {
  grid-area: image;
  width: min(46vh, 80vw, 380px);
  height: auto;
  aspect-ratio: 1 / 1;
  max-height: 100%;
  max-width: 100%;
  background: white;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 150px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
  padding: 8px;
}
.activityImage img { width: 100%; height: 100%; object-fit: contain; }

.timeBar {
  width: 100%;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255,255,255,0.7);
  padding: 18px 28px;
  border-radius: 40px;
}
.timeBar .bar { flex: 1; height: 48px; background: #FFE0B2; border-radius: 24px; overflow: hidden; }
#barFill { height: 100%; background: linear-gradient(90deg, #FF6B35, #FFB347); width: 0%; transition: width 0.2s linear; }
.timeBar span { font-size: 46px; font-weight: 800; color: #5D4037; min-width: 112px; text-align: center; }

.playerControls {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.playerControls button {
  background: white;
  border: none;
  border-radius: 50%;
  width: 70px; height: 70px;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.playerControls button.big {
  width: 90px; height: 90px;
  font-size: 36px;
  background: #FF6B35;
  color: white;
}
.playerControls button#replaceBtn {
  font-size: 13px;
  font-weight: 600;
}

/* ===== モーダル ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.hidden { display: none; }
.modalContent {
  background: white;
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* モーダル内のスクロール領域 */
#programsList,
#addCandidates {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS慣性スクロール */
  padding-bottom: 16px;
}
.modalHeader {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #EEE;
}
.modalFilter {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
}
.modalFilter select, .modalFilter input {
  padding: 8px 12px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-size: 14px;
}
.modalFilter input { flex: 1; }
.addCandidates {
  list-style: none;
  overflow-y: auto;
  padding: 0 16px 16px;
}
.addCandidates li {
  padding: 12px;
  border-bottom: 1px solid #F0F0F0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.addCandidates li:hover { background: #FFF3E0; }
.addCandidates .addBtn {
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* ===== クレジット ===== */
.creditsList { list-style: none; }
.creditsList li {
  padding: 8px 0;
  border-bottom: 1px solid #F0F0F0;
  font-size: 14px;
}
.creditsList li a { color: #2196F3; }
.inputRow { display: block; margin-bottom: 12px; }
.inputRow span { display: block; font-weight: 600; margin-bottom: 4px; }
.inputRow input {
  width: 100%;
  padding: 10px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-size: 14px;
  font-family: monospace;
}
.muted { color: #888; font-size: 13px; margin-top: 8px; }

/* ===== オフライン対応 ===== */
.swStatus {
  background: #F5F5F5;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  font-family: monospace;
}
.swStatus.ok { background: #E8F5E9; color: #2E7D32; }
.swStatus.warn { background: #FFF3E0; color: #E65100; }
.precacheProgress { margin-top: 12px; }
.precacheBar {
  height: 12px;
  background: #FFE0B2;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 6px;
}
#precacheFill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A);
  width: 0%;
  transition: width 0.3s;
}
#precacheText { text-align: center; font-size: 13px; color: #555; font-weight: 600; }

/* ===== インストール手順 ===== */
.installStep {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid #F0E6D2;
}
.installStep:last-child { border-bottom: none; }
.installStepIcon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
  line-height: 1.2;
  padding-top: 2px;
}
.installList {
  margin: 6px 0 0 18px;
  line-height: 2;
  font-size: 15px;
}

/* ===== オフライン手順 ===== */
.offlineSteps { display: flex; flex-direction: column; gap: 0; }
.offlineStep {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px dashed #F0E6D2;
}
.offlineStep:last-child { border-bottom: none; }
.offlineStepNum {
  background: #FF8C42;
  color: white;
  font-weight: 800;
  font-size: 18px;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hidden { display: none; }
code {
  background: #FFE0B2;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
}

/* ===== いいねボタン ===== */
.likeBtn {
  background: white;
  border: 2px solid #FFCDD2;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.likeBtn:hover { background: #FFEBEE; }

/* プレイヤー上のいいねボタン */
#playerLikeBtn {
  background: white !important;
  font-size: 28px !important;
  width: 70px !important;
  height: 70px !important;
}

/* プレイヤー上の封印ボタン */
#playerBanBtn {
  background: white !important;
  font-size: 16px !important;
  width: 70px !important;
  height: 70px !important;
  border: 2px solid #ccc !important;
  border-radius: 50% !important;
  cursor: pointer;
}
#playerBanBtn:hover { background: #ffeaea !important; border-color: #e57373 !important; }

/* 封印ボタン（曲一覧） */
.banBtn {
  background: #f5f5f5;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.banBtn:hover { background: #ffeaea; border-color: #e57373; }

/* 封印中の曲アイテム */
.browseSongItem.banned {
  opacity: 0.45;
  background: #fafafa;
}
.browseSongItem.banned .bname { text-decoration: line-through; color: #999; }

/* ===== 試聴ボタン ===== */
.previewBtn {
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.previewBtn:hover { background: #45a049; }
.previewBtn.playing { background: #F44336; }

/* ===== 曲一覧 凡例 ===== */
.browseLegend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  margin-bottom: 4px;
}
.legendItem {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #FFF8E7;
  border: 1px solid #FFE0B2;
  border-radius: 10px;
  padding: 8px 12px;
  flex: 1;
  min-width: 130px;
  font-size: 13px;
  line-height: 1.5;
}
.legendIcon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1.3;
}
.browseFilterCheck { border-radius: 8px; }
.browseFilterCheck:has(input:checked) {
  background: #FFF3E0;
  outline: 2px solid #FF8C42;
}

/* ===== 曲一覧 ===== */
.browseCatBlock {
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.browseCatTitle {
  font-size: 18px;
  color: #FF8C42;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid #FFE0B2;
  padding-bottom: 8px;
}
.browseCatTitle .count { font-size: 13px; color: #888; font-weight: normal; }
.browseSongItem {
  padding: 10px 8px;
  border-bottom: 1px solid #F5F5F5;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.browseSongItem:last-child { border-bottom: none; }
.browseSongItem .bname { font-weight: 600; font-size: 15px; }
.browseSongItem .bhira { font-size: 13px; color: #666; margin-top: 2px; }
.browseSongItem .bdur { font-size: 13px; color: #555; }
.browseSongItem .bflags {
  display: inline-flex; gap: 4px; flex-wrap: wrap; margin-top: 4px;
}
.bflag {
  background: #F0F0F0; color: #555;
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}
.bflag.wheel { background: #E3F2FD; color: #1976D2; }
.bflag.indoor { background: #FCE4EC; color: #C2185B; }
.bflag.low { background: #F3E5F5; color: #7B1FA2; }
.bflag.dango { background: #FFF3E0; color: #E65100; }
.bflag.props { background: #E8F5E9; color: #2E7D32; }

/* ===== プログラム一覧モーダル ===== */
.programSectionTitle {
  font-size: 14px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 4px 6px;
  border-bottom: 1px solid #F0F0F0;
  margin-bottom: 8px;
}
.programItem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 8px;
  border-bottom: 1px solid #F5F5F5;
}
.programItem:last-child { border-bottom: none; }
.programInfo { flex: 1; min-width: 0; }
.programName {
  font-size: 16px;
  font-weight: 700;
  color: #2C3E50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.programDesc {
  font-size: 12px;
  color: #888;
  margin-top: 3px;
  line-height: 1.4;
}
.programBtns {
  display: flex;
  gap: 6px;
  align-items: center;
}
.programDelBtn {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  color: #888;
}
.programDelBtn:hover { background: #ffeaea; border-color: #e57373; color: #D32F2F; }
.programLoadBtn {
  white-space: nowrap;
}

/* ===== クレジットページ セクション区切り ===== */
.creditSectionTitle {
  font-size: 15px;
  font-weight: 700;
  color: #FF8C42;
  letter-spacing: 0.5px;
  padding: 20px 4px 8px;
  border-bottom: 2px solid #FFE0B2;
  margin-bottom: 12px;
}

/* ===== 利用規約 ===== */
.termsBody {
  font-size: 14px;
  line-height: 1.8;
  color: #2C3E50;
  margin-top: 8px;
}
.termsBody h3 {
  font-size: 15px;
  font-weight: 700;
  color: #FF8C42;
  margin: 18px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #FFE0B2;
}
.termsBody h3:first-child { margin-top: 4px; }
.termsBody p {
  margin-bottom: 4px;
  color: #444;
}
.termsList {
  list-style: disc;
  margin: 4px 0 10px 20px;
  color: #444;
}
.termsList li { margin-bottom: 2px; }

/* ===== はじめての方へ（折りたたみ） ===== */
.manualCard {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 16px;
  overflow: hidden;
  border: 2px solid #FFE0B2;
}
.manualSummary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #FF8C42;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.manualSummary::-webkit-details-marker { display: none; }
.manualSummary::after {
  content: '▼';
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.2s;
}
details[open] .manualSummary::after { transform: rotate(180deg); }
.manualInner {
  padding: 0 20px 18px;
  border-top: 1px solid #FFE0B2;
}
.manualFlowH {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 14px 0 10px;
}
.manualFlowItem {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.manualFlowArrow { color: #FFBB77; font-size: 16px; font-weight: 700; }

/* ===== 使い方マニュアル ===== */
.manualFlow { display: flex; flex-direction: column; gap: 0; }
.manualStep {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #F5F5F5;
}
.manualStep:last-child { border-bottom: none; }
.manualNum {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #FF8C42;
  color: white;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.manualContent { flex: 1; }
.manualContent b { font-size: 15px; }
.manualContent p { font-size: 13px; color: #666; margin-top: 4px; }
.manualArrow { text-align: center; color: #FFBB77; font-size: 20px; line-height: 1; padding: 2px 0; }
.manualTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.manualTable tr { border-bottom: 1px solid #F5F5F5; }
.manualTable tr:last-child { border-bottom: none; }
.manualTable th {
  text-align: left;
  padding: 10px 12px 10px 0;
  white-space: nowrap;
  font-weight: 700;
  color: #FF8C42;
  vertical-align: top;
  width: 130px;
}
.manualTable td {
  padding: 10px 0;
  color: #444;
  line-height: 1.6;
  vertical-align: top;
}

/* ===== 情報ページ 目次 ===== */
.tocCard {
  background: white;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 4px solid #FF8C42;
}
.tocTitle {
  font-size: 15px;
  font-weight: 700;
  color: #FF8C42;
  margin-bottom: 10px;
}
.tocNav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tocItem {
  display: block;
  padding: 8px 14px;
  background: #FFF8E7;
  border-radius: 8px;
  color: #E65100;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #FFE0B2;
  transition: background 0.15s;
}
.tocItem:hover, .tocItem:active { background: #FFE0B2; }

/* ===== フッター ===== */
#appFooter {
  text-align: center;
  padding: 24px 16px 40px;
  font-size: 13px;
  color: #aaa;
  border-top: 1px solid #F0E8D8;
  margin-top: 16px;
}
#appFooter p { margin-bottom: 4px; font-weight: 600; color: #888; }
.footerSub { font-weight: normal !important; color: #bbb !important; font-size: 12px !important; }

/* ===== iPad横向き対応 ===== */
@media (min-width: 768px) {
  #appHeader h1 { font-size: 26px; }
  .page { padding: 24px; }
  .card h2 { font-size: 20px; }
  .activityName { font-size: clamp(40px, 6vw, 68px); }
  .hiraganaText { font-size: clamp(20px, 3vw, 34px); }
}

/* ===== 横向き：2カラムレイアウト（左=イラスト・右=テキスト+ボタン） ===== */
@media (orientation: landscape) and (max-height: 700px) {
  .playerMain {
    grid-template-areas:
      "image header"
      "image footer";
    grid-template-columns: auto 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 8px 28px;
    padding: 0 8px;
    align-items: center;
  }
  #activityImage {
    grid-area: image;
    grid-row: 1 / 3;           /* 上下両行にまたがる */
    align-self: center;
    width: min(78vh, 42vw, 300px);
    height: auto;
    aspect-ratio: 1 / 1;
    max-height: 100%;
    font-size: 100px;
    flex-shrink: 0;
  }
  .playerHeader {
    grid-area: header;
    align-items: flex-start;
    text-align: left;
    align-self: end;
    gap: 6px;
  }
  .playerFooter {
    grid-area: footer;
    align-items: flex-start;
    align-self: start;
    gap: 10px;
    width: 100%;
  }
  .activityName  { font-size: 34px; line-height: 1.1; }
  .hiraganaText  { font-size: 18px; padding: 8px 14px; max-width: 100%; }
  .timeBar       { width: 100%; padding: 12px 20px; }
  .timeBar .bar  { height: 32px; border-radius: 16px; }
  .timeBar span  { font-size: 34px; min-width: 80px; }
  .playerControls {
    justify-content: flex-start;
    gap: 10px;
  }
  .playerControls button       { width: 54px; height: 54px; font-size: 22px; }
  .playerControls button.big   { width: 68px; height: 68px; font-size: 28px; }
  .playerControls button#replaceBtn { font-size: 12px; }
}

/* ===== タップ即時フィードバック（サクサク感） ===== */
.navBtn:active,
.playlistActions button:active,
.playlistItem .pactions button:active,
.btnGroup button:active,
button.primary:active { transform: scale(0.97); opacity: 0.9; }

/* ===== スマホ最優先：縦の余白を詰めて一覧性UP ===== */
@media (max-width: 600px) {
  body { font-size: 15px; }
  #appHeader { padding: 10px 14px; }
  #appHeader h1 { font-size: 19px; }
  .headerTitle { margin-bottom: 6px; }
  .navBtn { padding: 7px 14px; font-size: 14px; }
  .page { padding: 12px; }
  .card { padding: 16px; border-radius: 14px; margin-bottom: 12px; }
  .playlistActions button { min-width: 0; padding: 10px 8px; }

  /* 曲一覧：縦画面では曲名を全幅にして、時間＆ボタンを下段へ（1文字ずつ折り返す不具合の修正） */
  .browseSongItem {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name name"
      "dur  acts";
    gap: 4px 10px;
    align-items: center;
  }
  .browseSongItem > :first-child { grid-area: name; min-width: 0; }
  .browseSongItem > .bdur { grid-area: dur; }
  .browseSongItem > :last-child { grid-area: acts; justify-content: flex-end; flex-wrap: wrap; }
}
