/* FootLog v2 components (docs/v2/02_design_system.md「コンポーネント」).
   Class naming: .block, .block__element, .block--modifier. Colours via tokens only. */

/* ── Icons ─────────────────────────────────────────────────────────────── */
.icon { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon--16 { width: 16px; height: 16px; }
.icon--20 { width: 20px; height: 20px; }
.icon--28 { width: 28px; height: 28px; }

/* ── Top bar (logo + icon buttons) ─────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-6) 0 var(--sp-4); }
.topbar__actions { display: flex; gap: var(--sp-2); }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: .14em; text-decoration: none; }
.page-title { margin-top: var(--sp-6); }
.page-title + .page-lead { margin-top: var(--sp-2); }
.page-lead { font-size: var(--fs-small); color: var(--muted); }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 52px; padding: 0 var(--sp-6); border-radius: var(--r-pill);
  font-size: 15px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap;
  border: 1.5px solid var(--ink); -webkit-tap-highlight-color: transparent;
}
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--secondary { background: transparent; color: var(--ink); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 44px; padding: 0 var(--sp-4); font-size: 13px; }
.follow-form { display: inline-flex; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--surface); color: var(--ink); text-decoration: none; flex: none;
}

/* ── Segmented control ─────────────────────────────────────────────────── */
.segment { display: flex; gap: 0; padding: 4px; background: var(--surface); border-radius: 26px; }
.segment__item {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 var(--sp-3);
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-pill); background: transparent;
  color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.segment__item[aria-selected="true"], .segment__item[aria-current="page"], .segment__item.is-selected {
  background: var(--ink); color: var(--bg); font-weight: 700;
}
/* Team-coloured selection (lineup home/away): the item carries --team. */
.segment--team .segment__item[aria-selected="true"] { background: var(--team, var(--ink)); color: var(--on-team); }

/* ── Chips & tags ──────────────────────────────────────────────────────── */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 18px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.2;
}
.chip .icon { width: 16px; height: 16px; }
.chip--strong { background: var(--ink); color: var(--bg); }
.chip--outline { background: transparent; border: 1px solid var(--line); padding: 2px 8px; border-radius: 10px; font-size: 11px; color: var(--muted); }
.tag {
  display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 16px;
  border: 1.5px solid var(--ink); font-size: 13px; font-weight: 700; line-height: 1.3; text-decoration: none;
}
.tag::before { content: "#"; }

/* ── Labels (mono) ─────────────────────────────────────────────────────── */
.label {
  font-family: var(--font-mono); font-weight: 500; font-size: var(--fs-label);
  letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--muted); line-height: 1.4;
}
.label--lg { font-size: var(--fs-label-lg); }

/* ── Section heading ───────────────────────────────────────────────────── */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.section-head__aside { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--muted); }

/* ── Stat tiles ────────────────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile { background: var(--surface); border-radius: var(--r-card); padding: 14px 16px; min-width: 0; }
.stat-tile__label { font-size: 12px; color: var(--muted); }
.stat-tile__value { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.2; }

/* ── Card ──────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--r-card); padding: var(--sp-4); }

/* ── Ticket (list stub) ────────────────────────────────────────────────── */
.ticket-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.ticket {
  position: relative; display: grid; grid-template-columns: 116px minmax(0, 1fr) 46px;
  height: 120px; background: var(--surface); border-radius: var(--r-ticket);
  color: var(--ink); text-decoration: none;
}
.ticket__visual {
  position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  border-radius: var(--r-ticket) 0 0 var(--r-ticket); overflow: hidden;
  background: linear-gradient(135deg, var(--home, var(--surface-2)) 0 60%, var(--away, var(--surface-2)) 60% 100%);
  color: var(--on-team);
}
.ticket__visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ticket__visual--empty { background: var(--surface-2); color: var(--muted); }
.ticket__visual--empty .label { color: var(--muted); }
.ticket__score { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: .02em; }
.ticket__body { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 14px 0 16px; min-width: 0; }
.ticket__team { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: 15px; font-weight: 700; line-height: 1.45; }
.ticket__team-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticket__team-score { font-family: var(--font-display); flex: none; }
.ticket__meta { display: flex; align-items: center; gap: var(--sp-2); margin-top: 4px; font-size: 12px; color: var(--muted); min-width: 0; white-space: nowrap; }
.ticket__meta > * { flex: none; }
.ticket__date { font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); }
.ticket__rating { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.ticket__rating .icon { width: 13px; height: 13px; fill: currentColor; }
.ticket__stub { position: relative; display: flex; align-items: center; justify-content: center; border-left: 1.5px dashed var(--line); }
.ticket__stub::before, .ticket__stub::after {
  content: ""; position: absolute; left: -8.75px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg);
}
.ticket__stub::before { top: -8px; }
.ticket__stub::after { bottom: -8px; }
.barcode { width: 28px; height: 72px; color: var(--ink); fill: currentColor; }

/* ── Star rating ───────────────────────────────────────────────────────── */
.rating { display: inline-flex; align-items: center; gap: var(--sp-3); }
.stars { display: inline-flex; gap: 4px; }
.star { position: relative; width: 24px; height: 24px; flex: none; }
.star svg { position: absolute; top: 0; left: 0; width: 24px; height: 24px; max-width: none; } /* max-width: none — base.css caps svg at 100%, which shrank the clipped half star instead of cropping it */
.star__empty { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.star__fill { fill: var(--ink); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.star__clip { position: absolute; top: 0; left: 0; bottom: 0; overflow: hidden; width: 0; }
.star--full .star__clip { width: 100%; }
.star--half .star__clip { width: 50%; }
.stars--sm .star, .stars--sm .star svg { width: 14px; height: 14px; }
.rating__value { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1; }
.rating__value--none { color: var(--muted); }
.rating-input { touch-action: none; cursor: pointer; border-radius: 6px; }
.rating-input .star { width: 36px; height: 36px; }
.rating-input .star svg { width: 36px; height: 36px; }

/* ── Match row ─────────────────────────────────────────────────────────── */
.match-list { background: var(--surface); border-radius: var(--r-card); padding: 4px var(--sp-4); }
.match-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3);
  min-height: 64px; padding: 10px 0; color: var(--ink); text-decoration: none;
}
.match-row + .match-row { border-top: 1px solid var(--line); }
.match-row__time { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--muted); line-height: 1.3; }
.match-row__time--live { color: var(--ink); font-weight: 700; }
.match-row__time--live::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--ink); vertical-align: middle; }
.match-row__teams { display: flex; flex-direction: column; min-width: 0; }
.match-row__team { display: flex; align-items: center; gap: var(--sp-2); font-size: 15px; font-weight: 500; line-height: 1.6; min-width: 0; }
.match-row__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.team-bar { width: 4px; height: 16px; border-radius: 2px; flex: none; background: var(--team, var(--muted)); }
.match-row__mine { display: inline-flex; color: var(--ink); }
.match-row__team--winner { font-weight: 700; }
.team-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--team, var(--muted)); }
.match-row__scores { display: flex; flex-direction: column; align-items: flex-end; font-family: var(--font-display); font-weight: 700; font-size: 15px; line-height: 1.6; }
.match-row__status { font-size: 12px; color: var(--muted); }

/* ── Lineup pitch ──────────────────────────────────────────────────────── */
.pitch {
  position: relative; height: 470px; border-radius: var(--r-pitch); overflow: hidden;
  background: var(--team); color: var(--on-team);
}
.pitch__line { position: absolute; border: 1.5px solid var(--pitch-line); pointer-events: none; }
.pitch--light .pitch__line { border-color: var(--pitch-line-on-light); }
.pitch--light .player__name { background: var(--pitch-label-bg-on-light); }
.pitch--light .player__number { box-shadow: 0 0 0 1px var(--pitch-line-on-light); }
.pitch--light .player--mom .player__number { box-shadow: 0 0 0 3px var(--accent-mom); }
.pitch__outline { inset: 12px; border-radius: 2px; }
.pitch__half { left: 12px; right: 12px; top: 50%; height: 0; border-width: 1.5px 0 0; }
.pitch__circle { left: 50%; top: 50%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%; }
.pitch__box { left: 50%; width: 180px; height: 62px; margin-left: -90px; }
.pitch__box--top { top: 12px; border-top: 0; }
.pitch__box--bottom { bottom: 12px; border-bottom: 0; }
.player { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4px; transform: translate(-50%, -50%); width: 76px; }
.player__number {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; background: var(--pitch-disc); color: var(--team);
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
}
.player__name { max-width: 76px; padding: 1px 6px; border-radius: 6px; background: var(--pitch-label-bg); color: var(--on-team); font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player--mom .player__number { box-shadow: 0 0 0 3px var(--accent-mom); }
.player__mom { position: absolute; top: -12px; right: -22px; padding: 1px 6px; border-radius: 6px; background: var(--accent-mom); color: var(--accent-mom-ink); font-size: 9px; font-weight: 700; letter-spacing: .04em; line-height: 1.5; }
.lineup-list { display: grid; gap: var(--sp-2); }
.lineup-list__group { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ── Bottom navigation (floating) ──────────────────────────────────────── */
.bottom-nav {
  position: fixed; z-index: 50; left: 20px; right: 20px; bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(var(--content-max) - 40px); margin: 0 auto;
  height: var(--nav-height); padding: 0 10px; border-radius: var(--r-nav);
  background: var(--nav-bg); box-shadow: var(--nav-shadow);
  display: flex; align-items: center; justify-content: space-around;
}
.bottom-nav__item {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  border-radius: 50%; color: var(--nav-muted); text-decoration: none;
}
.bottom-nav__item[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-ink); }
.bottom-nav__add { width: 72px; height: 50px; border-radius: var(--r-pill); background: var(--nav-plus-bg); color: var(--nav-plus-ink); }

/* ── Flash messages ────────────────────────────────────────────────────── */
.flash-stack { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.flash { display: flex; align-items: flex-start; gap: var(--sp-3); padding: 12px 16px; border-radius: var(--r-card); background: var(--surface); font-size: var(--fs-small); line-height: var(--lh-small); }
.flash__text { flex: 1; }
.flash--error { color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.flash__close { border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; margin: -4px -8px -4px 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.icon--flip { transform: scaleX(-1); }

/* ── Segment as radio group (works without JS) ─────────────────────────── */
.segment--radio { position: relative; }
.segment--radio input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.segment--radio input[type="radio"]:checked + .segment__item { background: var(--ink); color: var(--bg); font-weight: 700; }
.segment--radio input[type="radio"]:focus-visible + .segment__item { outline: 2px solid var(--focus); outline-offset: 2px; }
.segment--radio .segment__item { cursor: pointer; }

/* ── Bottom sheet / dialog ─────────────────────────────────────────────── */
.sheet {
  width: 100%; max-width: var(--content-max); max-height: 85vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0; background: var(--bg); color: var(--ink); overflow: auto;
}
.sheet::backdrop { background: rgba(0, 0, 0, .45); }
.sheet__handle { width: 40px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--line); }
.sheet__body { padding: var(--sp-3) var(--gutter) calc(var(--sp-6) + env(safe-area-inset-bottom)); }
.sheet--small { max-height: 70vh; }

/* ── Forms (record editor, settings, auth) ─────────────────────────────── */
.field { margin-top: var(--sp-6); border: 0; padding: 0; min-width: 0; }
.field > * + * { margin-top: var(--sp-2); }
.field__label { display: block; font-weight: 700; font-size: 15px; padding: 0; }
.field__label--sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.field__req { margin-left: 6px; font-size: 11px; font-weight: 500; color: var(--muted); }
.field__count { margin-left: 6px; font-family: var(--font-display); font-size: 13px; color: var(--muted); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__sub { margin-top: var(--sp-3); }
.field-error { font-size: 13px; color: var(--danger); }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 16px; }
.input:focus { border-color: var(--ink); outline: none; }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.textarea { min-height: 140px; line-height: var(--lh-prose); resize: vertical; }
.chip-choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip-choices input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip--choice { cursor: pointer; min-height: 40px; border: 1.5px solid transparent; }
.chip-choices input:checked + .chip--choice { background: var(--ink); color: var(--bg); }
.chip-choices input:focus-visible + .chip--choice { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; min-height: 44px; font-weight: 700; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle__track { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--surface-2); transition: background .15s; flex: none; }
.toggle__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.toggle input:checked + .toggle__track { background: var(--ink); }
.toggle input:checked + .toggle__track::after { transform: translateX(20px); background: var(--bg); }
.toggle input:focus-visible + .toggle__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.text-danger { border: 0; background: none; color: var(--danger); font-weight: 700; min-height: 44px; padding: 0 var(--sp-4); }

/* ── Progress bar (stadium conquest) ───────────────────────────────────── */
.progress { display: block; height: 8px; margin-top: var(--sp-2); border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress__fill { display: block; height: 100%; border-radius: 4px; background: var(--ink); }

/* Site footer: language switch + legal links (phase 7, 06_i18n.md). Sits above
   the floating nav's clearance, quiet like the page lead. */
.site-footer { margin-top: var(--section-gap); padding-top: var(--sp-4); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-small); color: var(--muted); }
.lang-switch { display: flex; align-items: center; gap: var(--sp-1); }
.lang-switch__item { font: inherit; color: var(--muted); background: none; border: 0; padding: 6px 8px; border-radius: var(--r-pill); cursor: pointer; min-height: 32px; }
.lang-switch__item:hover { color: var(--ink); }
.lang-switch__item[aria-current="true"] { color: var(--ink); background: var(--surface-2); font-weight: 700; cursor: default; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.site-footer__links a { color: inherit; }
