/* ============================================================================
   My Success — Base
   リセット / タイポグラフィ / フォーカス / 共通ユーティリティ

   ここに書いてよいのは「全要素に対する既定値」だけ。
   個別の見た目はコンポーネント側の CSS に置くこと。
   ============================================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  /* 背景色の切替もモード切替の一部として滑らかに見せる */
  transition: background-color var(--duration-slow) var(--ease-inout);
}

/* ── 見出し・本文 ────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  line-height: var(--leading-tight);
}

p {
  overflow-wrap: anywhere;
}

/* 日本語の行末禁則を自然にする（対応ブラウザのみ） */
p, li, dd {
  line-break: strict;
}

/* ── 置換要素 ────────────────────────────────────────────────────────── */

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

svg {
  fill: none;
  stroke: currentColor;
  flex-shrink: 0;
}

/* ── フォーム要素 ────────────────────────────────────────────────────── */

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  border-radius: 0;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

textarea {
  resize: vertical;
}

/* iOS Safari が 16px 未満の入力欄で自動ズームするのを防ぐ */
input, select, textarea {
  font-size: max(var(--text-body), 16px);
}

/* ── リンク・リスト ──────────────────────────────────────────────────── */

a {
  color: var(--color-primary-text);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

ul, ol {
  list-style: none;
}

/* ── テーブル ────────────────────────────────────────────────────────── */

table {
  border-collapse: collapse;
  width: 100%;
}

/* ============================================================================
   FOCUS
   マウス操作では出さず、キーボード操作でのみ明示する。
   ============================================================================ */

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================================
   数値表記
   成績・ランキングで桁が揃うようにする。
   ============================================================================ */

.u-numeric {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* 主役として置く数字。My Success シリーズ共通の顔。
   スコア・成績・順位・背番号・OVR・残日数はこれを付ける。
   大きさは置く場所が決める。ここでは書体と字並びだけを決める。

   Bebas Neue は字幅が均一なので tabular-nums はほぼ効かないが、
   フォールバック（Arial Narrow 等）に落ちたときに桁が揃うよう残す。 */
.u-display {
  font-family: var(--font-display);
  font-weight: var(--weight-regular);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* ============================================================================
   英字マイクロ見出し
   My Success 本体の TEAM STATUS / NEXT GAME / OVR にあたるもの。

   【役割を分ける】
     英字 … ブランド表現。読めなくても意味が失われない。
     日本語 … 意味を伝える見出し。こちらが本体。
   英字だけで用件を伝えないこと。利用者は保護者と子どもで、
   英語を読ませる前提を置かない。
   ============================================================================ */

.eyebrow {
  display: block;
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-eyebrow);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--color-primary-text);
}

/* 濃い面の上に置くとき */
.eyebrow--on-dark { color: var(--color-on-dark-secondary); }

/* 補助として添えるとき。日本語見出しのほうが主役の場面 */
.eyebrow--muted { color: var(--color-text-tertiary); }

/* ============================================================================
   ユーティリティ（最小限。増やさないこと）
   ============================================================================ */

/* スクリーンリーダーにのみ読ませる */
.u-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 見た目が小さくてもタップ領域を 44px 確保する */
.u-tap-safe {
  position: relative;
}

.u-tap-safe::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  width: 100%;
  height: 100%;
}

/* 1行で省略 */
.u-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* n 行で省略 */
.u-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--clamp-lines, 2);
  line-clamp: var(--clamp-lines, 2);
  overflow: hidden;
}

/* 横スクロール領域（表・チップ列）。ページ本体は絶対に横スクロールさせない */
.u-scroll-x {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.u-scroll-x::-webkit-scrollbar {
  display: none;
}

/* hidden 属性はクラス由来の display より必ず勝つ必要がある。
   !important は使わず、属性を二重指定して詳細度を上げる。 */
[hidden][hidden] {
  display: none;
}

/* いま選ばれているものに付ける印。一覧の右端に置く。 */
.u-current-mark {
  color: var(--color-primary);
}

/* 目には出さないが、読み上げと操作には残す。
   display:none にすると、ファイル選択が開けなくなる。 */
.u-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
