@charset "UTF-8";

/* ============================================================
   英検 リスニング音源 — スタイル
   コンセプト: 方眼ノートに貼った音源インデックス
   スマホ（幅 360〜430px）での片手操作を基準に作り、広い画面では中央に寄せる。
   Web フォントは使わない（教室の回線でも即座に表示させるため）
   ============================================================ */

:root {
  --ink:        #16233a;
  --ink-2:      #26344e;
  --paper:      #f5f7f9;
  --tile:       #ffffff;
  --rule:       rgba(22, 35, 58, 0.10);
  --grid-line:  rgba(22, 35, 58, 0.055);
  --sub:        #5f6b84;
  --maru:       #d6302f;
  --maru-dim:   rgba(214, 48, 47, 0.32);
  --bar:        #16233a;          /* ヘッダーとプレーヤーの地色 */

  /* 級ごとの色。級を追加したら下の [data-grade] にも1行足す */
  --grade:      #16233a;
  --grade-soft: rgba(22, 35, 58, 0.08);

  --tap: 88px;
  --gutter: 16px;
  --radius: 14px;

  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic",
          "Yu Gothic", Meiryo, system-ui, -apple-system, "Segoe UI", sans-serif;
}

[data-grade="pre2"] { --grade: #0f7a5f; --grade-soft: rgba(15, 122, 95, 0.10); }
[data-grade="g3"]   { --grade: #2f56c0; --grade-soft: rgba(47, 86, 192, 0.10); }

@media (prefers-color-scheme: dark) {
  :root {
    --ink:       #e9edf3;
    --ink-2:     #c3ccdb;
    --paper:     #121721;
    --tile:      #1b2331;
    --rule:      rgba(233, 237, 243, 0.14);
    --grid-line: rgba(233, 237, 243, 0.05);
    --sub:       #9da8bc;
    --maru:      #ff5b52;
    --maru-dim:  rgba(255, 91, 82, 0.35);
    --bar:       #0b111c;
    --grade:     #c3ccdb;
    --grade-soft: rgba(233, 237, 243, 0.08);
  }
  [data-grade="pre2"] { --grade: #3fc39d; --grade-soft: rgba(63, 195, 157, 0.12); }
  [data-grade="g3"]   { --grade: #7c9cff; --grade-soft: rgba(124, 156, 255, 0.13); }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  /* 方眼ノートの罫線 */
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

button { font: inherit; color: inherit; }
a { color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--maru);
  outline-offset: 2px;
}
[tabindex="-1"]:focus { outline: none; }

/* ---------- ヘッダー ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bar);
  color: #ffffff;
  padding: calc(env(safe-area-inset-top) + 8px) calc(env(safe-area-inset-right) + var(--gutter))
           10px calc(env(safe-area-inset-left) + var(--gutter));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(9, 15, 28, 0.12);
}

/* 級のページでは、ヘッダーの下端に級の色を引く */
body[data-view="list"] .header { box-shadow: inset 0 -4px 0 var(--grade), 0 6px 18px rgba(9, 15, 28, 0.12); padding-bottom: 14px; }

.header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
}

.brand__mark {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand__mark rect { fill: #ff6a60; stroke: none; }

.brand__name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* 級のページでは「戻る」を左、ロゴを右の小さな表示にする */
body[data-view="list"] .brand { order: 2; color: rgba(255, 255, 255, 0.55); }
body[data-view="list"] .brand__name { font-size: 12px; font-weight: 600; }
body[data-view="list"] .brand__mark { width: 18px; height: 18px; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  margin-left: -8px;
  padding: 0 12px 0 4px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
}
.back:active { background: rgba(255, 255, 255, 0.10); }
.back svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
}

/* 今いる級 */
.where {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 6px 0 12px;
}

.where__grade {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

/* 級名は級の色の札にする（どの級を開いているか一目でわかるように） */
.where__badge {
  padding: 3px 12px 4px;
  border-radius: 10px;
  background: var(--grade);
  color: #ffffff;
}
@media (prefers-color-scheme: dark) { .where__badge { color: #0b111c; } }

.where__hint {
  margin: 0;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.62);
}

/* 級の色のチップ（トップと級のページで共通） */
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--grade);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  white-space: nowrap;
}
@media (prefers-color-scheme: dark) { .chip { color: #0b111c; } }

/* ---------- 範囲のタブ（前半・後半など） ---------- */

.tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.10);
}

.tab {
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: #ffffff;
  color: #16233a;
}

.tab__count {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* ---------- 本文 ---------- */

.main {
  max-width: 720px;
  margin-inline: auto;
  padding: 20px calc(env(safe-area-inset-right) + var(--gutter))
           calc(env(safe-area-inset-bottom) + 40px) calc(env(safe-area-inset-left) + var(--gutter));
}

/* 再生中はプレーヤーの高さぶん下を空ける */
body.is-open .main { padding-bottom: calc(env(safe-area-inset-bottom) + 220px); }

.status {
  margin: 32px 0;
  text-align: center;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.7;
}
.status--error { color: var(--maru); }

/* ---------- トップ ---------- */

.intro { margin: 4px 0 26px; }

.intro__eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--sub);
}

.intro__title {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.intro__lead {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
}
.intro__lead b {
  color: var(--maru);
  font-weight: 800;
}

.label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--sub);
}

.grades {
  display: grid;
  gap: 14px;
}

/* 級のカード */
.grade {
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--tile);
  box-shadow: 0 1px 2px rgba(9, 15, 28, 0.04);
}

.grade__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  border-top: 5px solid var(--grade);
  background: var(--grade-soft);
}

.grade__name {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--grade);
}

.grade__total {
  margin-left: auto;
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}

/* 範囲の入口（カードの中の行） */
.entry {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 12px 12px 16px;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink);
}
.entry:active { background: var(--grade-soft); }

.entry__body { flex: 1; min-width: 0; }

.entry__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.entry__last {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--maru);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--maru);
}

.entry__desc {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--sub);
}

.entry__count {
  flex: none;
  text-align: right;
  font-size: 11px;
  color: var(--sub);
  line-height: 1.1;
}
.entry__count b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.entry__go {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grade);
  color: #ffffff;
}
.entry__go svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round;
}
@media (prefers-color-scheme: dark) { .entry__go { color: #0b111c; } }

/* 使い方 */
.howto {
  list-style: none;
  margin: 26px 0 0;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-2);
}
.howto li { display: flex; align-items: center; gap: 10px; }
.howto__no {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid var(--maru);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  color: var(--maru);
}

/* ---------- 番号の一覧 ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  grid-auto-rows: 1fr;   /* 全タイルを同じ高さに揃え、番号を追いやすくする */
  gap: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: var(--tap);
  padding: 12px 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--tile);
  cursor: pointer;
  text-align: center;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.tile:active { border-color: var(--sub); }

.tile__no {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.tile__rule {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--grade);
  opacity: 0.55;
}

.tile__title {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--sub);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* 再生中 — 赤ペンの「まる」 */
.tile.is-current {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--tile), 0 0 0 5px var(--maru);
}
.tile.is-current .tile__no { color: var(--maru); }
.tile.is-current .tile__rule { background: var(--maru); opacity: 1; }

/* 一時停止中 — 同じ輪郭を淡く */
.tile.is-current.is-paused {
  box-shadow: 0 0 0 2px var(--tile), 0 0 0 5px var(--maru-dim);
}
.tile.is-current.is-paused .tile__no { color: var(--maru-dim); }

/* ---------- プレーヤーバー ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-width: 720px;
  margin-inline: auto;
  padding: 12px calc(env(safe-area-inset-right) + var(--gutter))
           calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + var(--gutter));
  background: var(--bar);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(9, 15, 28, 0.28);
  color: #ffffff;
}

.player__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.player__sec { flex: none; }

.player__no {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #ff6a60;
}

.player__title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.74);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player__title.is-error {
  white-space: normal;
  color: #ff8a80;
}

.player__close {
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -10px -8px 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
}

.player__close svg { width: 18px; height: 18px; }

/* ---------- シークバー ---------- */

.seek { margin-bottom: 10px; }

.seek__range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.seek__range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background:
    linear-gradient(#ff5b52, #ff5b52) 0 / var(--progress, 0%) 100% no-repeat,
    rgba(255, 255, 255, 0.18);
}
.seek__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.seek__range::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}
.seek__range::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: #ff5b52;
}
.seek__range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.seek__time {
  display: flex;
  justify-content: space-between;
  margin-top: -4px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- コントロール ---------- */

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.ctrl:active { background: rgba(255, 255, 255, 0.08); }

.ctrl svg { width: 20px; height: 20px; }

.ctrl__big {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ctrl--play {
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background: #d6302f;
  color: #ffffff;
}

.ctrl--play:active { background: #b92726; }
.ctrl--play svg { width: 26px; height: 26px; }

/* アイコン: 線で描き、再生／一時停止を状態で出し分ける */
.player svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-play { fill: currentColor; stroke: none; }
.icon-pause { stroke-width: 2.6; }

body.is-paused .icon-pause { display: none; }
body:not(.is-paused) .icon-play { display: none; }

/* ---------- 画面幅 ---------- */

/* 幅の狭いスマホ（iPhone SE など） */
@media (max-width: 359px) {
  :root { --gutter: 12px; }
  .intro__title { font-size: 30px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
}

/* タブレット・PC では中央の 720px に収める */
@media (min-width: 560px) {
  :root { --gutter: 24px; }
  .header__bar, .where, .tabs { max-width: 672px; margin-inline: auto; }
  .where { margin-block: 6px 12px; }
  .grid { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
