@charset "UTF-8";

/* ============================================================
   英検準2級 リスニング — スタイル
   コンセプト: 方眼ノートに貼った音源インデックス
   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:        #6d7891;
  --maru:       #d6302f;
  --maru-dim:   rgba(214, 48, 47, 0.32);

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

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

@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:       #98a3b8;
    --maru:      #ff5b52;
    --maru-dim:  rgba(255, 91, 82, 0.35);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  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; }

:focus-visible {
  outline: 3px solid var(--maru);
  outline-offset: 2px;
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #16233a;
  padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.72);
}

/* ---------- タブ ---------- */

.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: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  font-weight: 600;
  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;
}

/* ---------- シート（グリッド領域） ---------- */

.sheet {
  padding: 16px var(--gutter) 40px;
  transition: padding-bottom 0.2s ease;
}

body.is-open .sheet { padding-bottom: 210px; }

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

.status--error { color: var(--maru); }

.panel[hidden] { display: none; }

.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: 2px;
  border-radius: 1px;
  background: var(--rule);
}

.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); }

/* 一時停止中 — 同じ輪郭を淡く */
.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;
  padding: 12px var(--gutter) calc(env(safe-area-inset-bottom) + 12px);
  background: #16233a;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 28px rgba(9, 15, 28, 0.28);
  color: #ffffff;
}

.player[hidden] { display: none; }

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

.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: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  align-self: center;
  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: 28px;
  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: 18px;
  height: 18px;
  margin-top: -6px;
  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: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
}

.seek__time {
  display: flex;
  justify-content: space-between;
  margin-top: -2px;
  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; }

/* ---------- 画面幅が広い場合 ---------- */

@media (min-width: 560px) {
  :root { --gutter: 24px; }
  .header, .sheet, .player { max-width: 720px; margin-inline: auto; }
  .player { border-radius: 16px 16px 0 0; }
  .grid { gap: 10px; }
}

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