/*
 * サイト全体の色・文字・ふつうの部品（app/assets/stylesheets/application.css）
 *
 * Figma「tune me デザイン（黒）」の「色・文字」ページと同じ値。
 * ここの変数（--bg-base など）を変えると、サイト全体の色がまとめて変わる。
 * このファイルはいちばん先に読まれる（ほかの CSS ファイルが、ページごとの部品の形を決める）。
 *
 * 決まり（Figma の「使い方の決まり」と同じ）
 *   ・地は黒と灰色だけ。白くぬるのは、大事なボタン1つだけ
 *   ・ピンク（--accent）は「推し（♥）」にだけ使う
 *   ・ボタンは小さく（高さ 28〜32px）。光・グラデーションは使わない
 */
:root {
  color-scheme: dark;

  /* 色 */
  --bg-base: #0a0a0b;        /* ページの地 */
  --bg-surface: #121214;     /* カード・ミニプレイヤー・チップ */
  --bg-raised: #19191c;      /* カードの中の箱・ジャケットの仮の四角 */
  --bg-input: #222226;       /* 入力欄 */
  --border-subtle: #222226;  /* 行の区切り線 */
  --border-default: #2e2e33; /* ボタン・チップのふち */
  --text-primary: #ededea;   /* ふつうの文字 */
  --text-secondary: #9d9da2; /* アーティスト名・説明 */
  --text-tertiary: #6b6b71;  /* 入力のヒント・えらんでいないタブ */
  --text-inverse: #0a0a0b;   /* 白いボタンの上の文字 */
  --fill-strong: #ededea;    /* 白いボタン・えらんだチップ */
  --accent: #ff5c93;         /* 推し（♥）だけ */
  --warning: #ffb84d;        /* お知らせ（試聴がない など） */
  --danger: #ff6b6b;         /* 出さないアーティストにしたとき */

  /* 角の丸み */
  --radius-s: 6px;   /* ジャケット */
  --radius-m: 10px;  /* 小さな箱 */
  --radius-l: 14px;  /* カード・ミニプレイヤー */

  /* 文字 */
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 白い線の矢印・虫めがね（CSS の中で使う絵） */
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M9.5 6l6 6-6 6'/%3E%3C/svg%3E");
  --icon-play: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4.5v15l12.5-7.5z'/%3E%3C/svg%3E");
  --icon-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 4.5h4.5v15H6zM13.5 4.5H18v15h-4.5z'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%236b6b71' d='M10 3a7 7 0 0 1 5.6 11.2l5.1 5.1-1.4 1.4-5.1-5.1A7 7 0 1 1 10 3zm0 2a5 5 0 1 0 0 10 5 5 0 0 0 0-10z'/%3E%3C/svg%3E");
}

html {
  background: var(--bg-base);
}

body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ページの中身：左右に 16px のすきま。パソコンでは まん中に寄せる */
main {
  box-sizing: border-box;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== 見出し・文字 ===== */
h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  font-weight: bold;
  line-height: 1.35;
}

h1 {
  margin: 20px 0 8px;
  font-size: 22px; /* 見出し/大 */
}

h2 {
  margin: 28px 0 6px;
  font-size: 17px; /* 見出し/中 */
}

h3,
h4 {
  margin: 24px 0 6px;
  font-size: 15px;
}

p {
  margin: 0 0 10px;
}

small {
  color: var(--text-secondary);
}

code,
kbd {
  font-family: var(--font-mono);
}

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

/* リンク：文字の色のまま、細い下線 */
a {
  color: var(--text-primary);
  text-decoration-color: var(--border-default);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--text-secondary);
}

::selection {
  background: rgba(237, 237, 234, 0.25);
}

/* ===== お知らせ（ページの上） ===== */
.notice,
.alert {
  margin: 12px 0;
  padding: 10px 14px;
  border-radius: var(--radius-m);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  font-size: 13px;
}

.alert {
  border-color: rgba(255, 107, 107, 0.45);
}

ul.alert {
  padding-left: 32px;
}

/* ===== 入力欄・ボタン（形の決まっていないもの） ===== */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="tel"],
select,
textarea {
  box-sizing: border-box;
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 16px; /* スマホで押したときに、画面が大きくならないように */
  line-height: 1.4;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-tertiary);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--text-tertiary);
}

/* 検索の欄：丸い形で、左に虫めがね */
input[type="search"] {
  padding-left: 40px;
  border-radius: 999px;
  background: var(--bg-input) var(--icon-search) no-repeat 14px center / 18px 18px;
  -webkit-appearance: none;
  appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  filter: invert(0.6);
}

/* 送信ボタン・形の決まっていないボタン：白い丸いボタン（Figma の「文字ボタン」Solid） */
input[type="submit"],
button:not([class]) {
  min-height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-strong);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

input[type="submit"]:hover,
button:not([class]):hover {
  opacity: 0.88;
}

input[type="submit"]:disabled,
button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ラジオ・チェック（Figma の「ラジオ」「チェック」：20px、えらぶと白） */
input[type="radio"],
input[type="checkbox"] {
  flex: none;
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid var(--border-default);
  background: none;
  vertical-align: -4px;
  cursor: pointer;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"] {
  border-radius: 5px;
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
  border-color: var(--fill-strong);
  background: var(--fill-strong);
}

input[type="radio"]:checked::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-inverse);
}

input[type="checkbox"]:checked::before {
  content: "";
  width: 10px;
  height: 6px;
  margin-top: -2px;
  border-left: 2px solid var(--text-inverse);
  border-bottom: 2px solid var(--text-inverse);
  transform: rotate(-45deg);
}

input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

input[type="range"] {
  accent-color: var(--fill-strong);
}

/* ===== 白い丸いボタン・ふちだけの丸いボタン（どこでも使える形） ===== */
.button-solid,
.button-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-sizing: border-box;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button-solid {
  border: 0;
  background: var(--fill-strong);
  color: var(--text-inverse);
}

.button-outline {
  border: 1px solid var(--border-default);
  background: none;
  color: var(--text-primary);
}

.button-outline:hover {
  border-color: var(--text-tertiary);
}

/* ===== ふつうの表（辞書に足す曲など） ===== */
table {
  border-collapse: collapse;
}

th,
td {
  border-color: var(--border-subtle);
}

/* ===== たたむ欄の ▸ ===== */
summary {
  cursor: pointer;
}

/* ===== Devise（ログイン・登録・パスワード）の画面 ===== */
#error_explanation {
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 107, 107, 0.45);
  border-radius: var(--radius-m);
  background: var(--bg-surface);
  font-size: 13px;
}

#error_explanation h2 {
  margin: 0 0 4px;
  font-size: 14px;
}

.field {
  margin: 0 0 14px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  max-width: 400px;
}

.field em {
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: normal;
}

.actions {
  margin: 18px 0;
}

/* 入力欄の下の小さな説明 */
.hint {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* 「ログインしたままにする」：チェックと文字を横に並べる */
.field input[type="checkbox"] + label {
  display: inline;
  margin: 0 0 0 8px;
  color: var(--text-primary);
  font-size: 13px;
}

/* Google でログイン・登録（ふちだけの丸いボタン） */
.google-button {
  min-height: 32px;
  padding: 0 16px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.google-button:hover {
  border-color: var(--text-tertiary);
}

/* アカウントの削除など、取り消せないボタン（白くぬらない） */
.danger-button {
  min-height: 32px;
  padding: 0 16px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 999px;
  background: none;
  color: var(--danger);
  font-size: 13px;
  cursor: pointer;
}

/* ===== 横にすべらせる列：下にスクロールバーを出さない =====
   指・トラックパッドは、そのままなぞれば横に動く。マウスは、押したまま左右に動かす（player.js の「横にすべらせる列」）
   .found-grid（Tune Meで出会った推し曲）・.featured-list（今日のいちおし）・.mood-chips（気分）・.history-scroll（ジャンルの表）
   ほかの列も、data-drag-scroll を付けると同じになる */
.found-grid,
.featured-list,
.mood-chips,
.history-scroll,
[data-drag-scroll] {
  scrollbar-width: none;
}

.found-grid::-webkit-scrollbar,
.featured-list::-webkit-scrollbar,
.mood-chips::-webkit-scrollbar,
.history-scroll::-webkit-scrollbar,
[data-drag-scroll]::-webkit-scrollbar {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .found-grid,
  .featured-list,
  .mood-chips,
  .history-scroll,
  [data-drag-scroll] {
    cursor: grab;
  }
}

.is-drag-scrolling {
  cursor: grabbing;
  user-select: none;
}

/* ぼかしの光（.section-glow・.song-hero-glow）が画面の横にはみ出しても、ページが横にスクロールしないようにする
   画面のはしで切るだけなので、見た目は変わらない（clip は、たてのスクロールや、上にくっつく見出しには影響しない） */
html,
body {
  overflow-x: clip;
}

/* スマホ：ページの中身を、全体に少しだけ小さくする（文字・ジャケット・ボタンを まとめて 92%）
   下のプレイヤー・タブのバーは、そのままの大きさ（押しやすさのため） */
@media (max-width: 640px) {
  .app-header,
  main {
    zoom: 0.92;
  }

  /* 入力する欄だけは、92% をかけたあとに 16px になる大きさにしておく。
     iPhone は「16px より小さい字の欄」を押すと、画面を勝手に大きく（ズーム）してしまうため。
     見た目の大きさは、今までと同じ 16px のまま */
  .app-header input[type="text"],
  .app-header input[type="email"],
  .app-header input[type="password"],
  .app-header input[type="search"],
  .app-header input[type="url"],
  .app-header input[type="number"],
  .app-header input[type="tel"],
  .app-header select,
  .app-header textarea,
  main input[type="text"],
  main input[type="email"],
  main input[type="password"],
  main input[type="search"],
  main input[type="url"],
  main input[type="number"],
  main input[type="tel"],
  main select,
  main textarea {
    font-size: calc(16px / 0.92);
  }
}
