/* 鹿サポ参戦ボード（非公式） - 鹿島カラーの深紅基調・モバイル向け */
:root {
  --antlers-red: #b8193f;
  --antlers-dark: #7a0f2a;
  --antlers-deep: #4d0819;
  --gold: #c9a227;
  --ink: #1d1d22;
  --muted: #6b6b74;
  --bg: #f6f2f3;
  --card: #ffffff;
  --line: #e7dde0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

/* ---------- ヘッダー ---------- */
.app-header {
  background: linear-gradient(135deg, var(--antlers-dark), var(--antlers-red));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(77, 8, 25, .35);
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-title { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.header-subtitle { font-size: 12px; font-weight: 600; letter-spacing: .18em; opacity: .85; margin-top: 2px; }
.header-badge {
  font-size: 11px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}

main { max-width: 640px; margin: 0 auto; padding: 14px 12px 28px; }

/* ---------- カード ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(29, 29, 34, .05);
}
.card h2 { margin: 0 0 10px; font-size: 17px; color: var(--antlers-dark); }

/* ---------- ヒーロー（次の試合） ---------- */
.hero-card {
  background: linear-gradient(160deg, var(--antlers-deep), var(--antlers-red));
  color: #fff;
  border: none;
  text-align: center;
}
.hero-label { font-size: 12px; letter-spacing: .3em; opacity: .85; }
.hero-match { font-size: 19px; font-weight: 800; margin: 8px 0 2px; line-height: 1.5; }
.hero-sub { font-size: 13px; opacity: .9; }
.countdown { font-size: 26px; font-weight: 800; margin-top: 10px; font-variant-numeric: tabular-nums; }
.hero-weather { margin-top: 12px; background: rgba(255,255,255,.16); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.65; }
.hero-weather .hw-credit { font-size: 10.5px; opacity: .75; margin-top: 2px; }
.countdown small { font-size: 13px; font-weight: 600; opacity: .85; }

.hero-in-panel {
  margin-top: 14px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 10px;
  padding: 10px;
}
.in-total { font-size: 17px; font-weight: 800; }
.in-total span { font-size: 24px; color: #ffd968; }
.in-breakdown {
  display: flex; justify-content: center; gap: 16px;
  font-size: 13px; margin-top: 4px; flex-wrap: wrap;
}
.live-dot { color: #ff8f8f; font-size: 11px; margin-top: 6px; letter-spacing: .15em; }

/* ---------- タブ ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  flex: 1;
  padding: 11px 4px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { background: var(--antlers-red); border-color: var(--antlers-red); color: #fff; }

/* ---------- 試合リスト ---------- */
.fixture {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--antlers-red);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.fixture.away { border-left-color: #565661; }
.fixture-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fixture-comp { font-size: 12px; color: var(--antlers-red); font-weight: 700; }
.fixture.away .fixture-comp { color: var(--muted); }
.fixture-date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fixture-main { font-size: 17px; font-weight: 800; margin: 4px 0; }
.fixture-venue { font-size: 13px; color: var(--muted); }
.ha-badge {
  font-size: 11px; font-weight: 700; color: #fff; background: var(--antlers-red);
  border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.fixture.away .ha-badge { background: #565661; }
.today-badge {
  font-size: 11px; font-weight: 800; color: var(--antlers-deep);
  background: #ffd968; border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px;
}
.result-card { margin-bottom: 10px; }
.result-seasons { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.season-chip {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; cursor: pointer;
}
.season-chip.active { background: var(--antlers-red); border-color: var(--antlers-red); color: #fff; }
.result-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.result-empty { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.result-badge {
  font-size: 11px; font-weight: 800; color: #fff;
  border-radius: 4px; padding: 1px 6px; margin-left: 8px; vertical-align: 2px;
}
.result-badge.win { background: var(--antlers-red); }
.result-badge.draw { background: #8a8a93; }
.result-badge.lose { background: #3d3d46; }

/* ---------- スタジアムIN ---------- */
.in-desc, .in-note { font-size: 13px; color: var(--muted); line-height: 1.6; }
.in-status {
  font-size: 15px; font-weight: 700; text-align: center;
  background: var(--bg); border-radius: 8px; padding: 10px; margin: 10px 0;
}
.in-buttons { display: flex; gap: 8px; }
.btn {
  appearance: none; border: none; cursor: pointer;
  border-radius: 10px; padding: 13px 10px;
  font-size: 15px; font-weight: 800;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-queue { flex: 1; background: #fff; color: var(--antlers-dark); border: 2px solid var(--antlers-red); }
.btn-entered { flex: 1; background: var(--antlers-red); color: #fff; }
.btn-queue.selected { background: #fbe9ee; box-shadow: inset 0 0 0 2px var(--antlers-dark); }
.btn-entered.selected { background: var(--antlers-dark); box-shadow: inset 0 0 0 2px var(--gold); }
.btn-cancel {
  width: 100%; margin-top: 8px; background: #fff; color: var(--muted);
  border: 1px solid var(--line); font-size: 13px; padding: 10px;
}
.my-stamp {
  margin: 14px auto 2px;
  width: 92px; height: 92px;
  border: 4px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-size: 26px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-10deg);
  letter-spacing: .1em;
  background: rgba(201, 162, 39, .06);
}

/* ---------- 掲示板 ---------- */
#post-form label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
#post-form input, #post-form select, #post-form textarea {
  width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.btn-post { width: 100%; background: var(--antlers-red); color: #fff; }
.btn-link {
  display: block; text-align: center; text-decoration: none;
  background: var(--antlers-red); color: #fff; margin-top: 10px;
}
.post-msg { font-size: 13px; color: var(--antlers-dark); min-height: 1.2em; }
.post {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
}
.post-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.post-name { font-weight: 800; color: var(--ink); font-size: 14px; }
.post-body { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.post-actions { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.post-images { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.post-images.imgs-1 { grid-template-columns: 1fr; }
.post-images img { width: 100%; height: auto; border-radius: 8px; display: block; cursor: pointer; }
.image-previews { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.image-preview-cell { position: relative; width: 64px; height: 64px; }
.image-preview-cell img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; display: block; }
.image-preview-remove {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border-radius: 50%; border: none; background: #333; color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
}
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 999;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.btn-mini {
  font-size: 12px; font-weight: 700; padding: 5px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.btn-mini-primary { background: var(--antlers-red); border-color: var(--antlers-red); color: #fff; }
.btn-mini-danger { color: #b00020; border-color: #e3a7b0; }
.btn-mini-confirm { background: #b00020; border-color: #b00020; color: #fff; }
.confirm-text { font-size: 12px; font-weight: 700; color: #b00020; align-self: center; }
.post-thread { margin-bottom: 2px; }
.post-replies { margin-left: 18px; padding-left: 10px; border-left: 3px solid var(--line); }
.post-replies .post { margin-bottom: 8px; }
.reply-form {
  margin: 4px 0 12px 18px; background: #faf7f2; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px;
}
.reply-form input, .reply-form textarea {
  width: 100%; box-sizing: border-box; margin-bottom: 8px;
  font-size: 14px; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
}
.reply-form-row { display: flex; gap: 8px; }
.board-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.empty-note { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 0; }

/* ---------- スタメン予想 ---------- */
.pred-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 10px; }
.field-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.field-label input, .field-label select {
  width: 100%; margin-top: 4px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.pred-deadline {
  font-size: 13px; font-weight: 700; border-radius: 8px;
  padding: 9px 10px; margin-bottom: 12px; text-align: center;
}
.pred-deadline.open { background: #fbe9ee; color: var(--antlers-dark); }
.pred-deadline.closed { background: #eeeef1; color: var(--muted); }

.picker-counts {
  display: flex; gap: 8px; margin: 6px 0 10px;
  font-size: 14px; font-weight: 800;
}
.picker-count {
  flex: 1; text-align: center; border-radius: 8px; padding: 8px 4px;
  background: var(--bg); border: 1px solid var(--line);
}
.picker-count.full { background: #fbe9ee; border-color: var(--antlers-red); color: var(--antlers-dark); }
.picker-count .num { font-size: 18px; font-variant-numeric: tabular-nums; }

.pos-group { margin-bottom: 12px; }
.pos-head {
  font-size: 12px; font-weight: 800; letter-spacing: .12em;
  color: #fff; background: #565661; border-radius: 6px;
  padding: 4px 10px; margin-bottom: 6px;
}
.pos-head.gk { background: #8a6d1d; }
.pos-head.df { background: #31517d; }
.pos-head.mf { background: #2e6e4e; }
.pos-head.fw { background: var(--antlers-dark); }

.player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 6px; background: #fff;
}
.player-row.in-starters { border-color: var(--antlers-red); background: #fdf3f5; }
.player-row.in-subs { border-color: var(--gold); background: #fffdf2; }
.player-no {
  font-size: 12px; font-weight: 800; color: var(--muted);
  min-width: 26px; text-align: center; font-variant-numeric: tabular-nums;
}
.player-name { flex: 1; font-size: 15px; font-weight: 700; word-break: break-all; }
.player-hit { color: var(--gold); font-weight: 900; margin-left: 4px; }
.pick-btns { display: flex; gap: 6px; }
.pick-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 800;
  white-space: nowrap;
}
.pick-btn:disabled { opacity: .4; cursor: not-allowed; }
.pick-btn.on-starter { background: var(--antlers-red); border-color: var(--antlers-red); color: #fff; }
.pick-btn.on-sub { background: var(--gold); border-color: var(--gold); color: #fff; }

#btn-pred-submit { width: 100%; margin-top: 4px; }

.pred-score {
  margin-top: 12px; text-align: center; font-size: 16px; font-weight: 800;
  background: #fbe9ee; border-radius: 10px; padding: 12px 10px; color: var(--antlers-dark);
}
.pred-score .score-num { font-size: 22px; color: var(--antlers-red); }
.pred-my-list { margin-top: 10px; font-size: 14px; line-height: 1.7; }
.pred-my-list .list-title { font-weight: 800; color: var(--antlers-dark); margin-top: 8px; }
.pred-my-list .hit-name { color: var(--antlers-dark); font-weight: 800; }
.pred-my-list .miss-name { color: var(--muted); }

.answer-box {
  border: 1px solid var(--gold); background: #fffdf4;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
  font-size: 13px; line-height: 1.7;
}
.answer-box .answer-title { font-weight: 800; color: #8a6d1d; margin-bottom: 4px; }

.rank-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rank-table th, .rank-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.rank-table th { font-size: 12px; color: var(--muted); }
.rank-table td.rank-num { font-weight: 800; color: var(--antlers-red); white-space: nowrap; width: 2.4em; }
.rank-table td.rank-score { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-table tr.is-me { background: #fdf3f5; }
.rank-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ---------- フォーメーション図 ---------- */
.formation-block { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.formation-main { flex: 1 1 270px; min-width: 250px; }
.formation-label {
  text-align: center; font-size: 14px; font-weight: 800;
  color: var(--antlers-dark); margin-bottom: 8px;
}
.formation-label .formation-name { font-size: 20px; color: var(--antlers-red); letter-spacing: .08em; }
.formation-picker-title { font-weight: 700; font-size: 13px; margin: 14px 0 6px; }
.formation-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.formation-chip { border: 1.5px solid var(--antlers-red); background: #fff; color: var(--antlers-red); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; }
.formation-chip.on { background: var(--antlers-red); color: #fff; }
.formation-chip:disabled { opacity: .45; cursor: default; }
.formation-label .formation-count { font-size: 12px; color: var(--muted); font-weight: 700; }

.pitch {
  position: relative;
  background: linear-gradient(180deg, #9c1538, var(--antlers-red) 55%, var(--antlers-dark));
  border: 2px solid var(--antlers-deep);
  border-radius: 12px;
  padding: 14px 4px;
  min-height: 360px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
}
.pitch-lines { position: absolute; inset: 0; pointer-events: none; }
.pitch-lines::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  border-top: 2px solid rgba(255, 255, 255, .35);
}
.pitch-lines::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 84px; height: 84px; border: 2px solid rgba(255, 255, 255, .35);
  border-radius: 50%; transform: translate(-50%, -50%);
}
.pitch-row {
  display: flex; justify-content: space-evenly; align-items: flex-start;
  position: relative; z-index: 1; min-height: 62px;
}
.pitch-player { flex: 1 1 0; max-width: 72px; text-align: center; }
.pitch-marker {
  position: relative;
  width: 38px; height: 38px; margin: 0 auto;
  border-radius: 50%;
  background: #fff; color: var(--antlers-dark);
  border: 2px solid var(--antlers-deep);
  font-size: 15px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.pitch-marker.pos-gk { background: var(--gold); color: #4d3a05; border-color: #8a6d1d; }
.pitch-marker.hit { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .65); }
.pitch-marker.empty {
  background: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .85);
  border: 2px dashed rgba(255, 255, 255, .65);
}
.pitch-player.tappable { cursor: pointer; }
.pitch-player.swap-selected .pitch-marker {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(201, 162, 39, .9);
  transform: scale(1.14);
}
.swap-hint {
  font-size: 13px; font-weight: 700; color: #8a0f2e;
  background: #fdeef2; border: 1px solid #e8b7c3; border-radius: 8px;
  padding: 7px 10px; margin-top: 8px; line-height: 1.5;
}
.swap-guide {
  background: #fff8e1; border: 2px solid var(--gold); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px;
}
.swap-guide-title { font-size: 14px; font-weight: 900; color: #7a5b00; margin-bottom: 5px; }
.swap-guide-step { font-size: 13px; font-weight: 600; color: #4d3a05; line-height: 1.65; }
.pitch-hit-badge {
  position: absolute; top: -7px; right: -7px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold); color: #4d3a05;
  font-size: 11px; font-weight: 900; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #fff;
}
.pitch-name {
  margin-top: 3px; font-size: 10px; font-weight: 700; color: #fff;
  line-height: 1.3; word-break: break-all;
  text-shadow: 0 1px 2px rgba(77, 8, 25, .6);
}
.pitch-name.empty { color: rgba(255, 255, 255, .65); text-shadow: none; }

/* サブ一覧（ピッチの横／狭い画面では下） */
.formation-subs { flex: 1 1 170px; min-width: 160px; }
.subs-title { font-size: 13px; font-weight: 800; color: var(--antlers-dark); margin-bottom: 6px; }
.subs-item {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--gold); background: #fffdf2;
  border-radius: 8px; padding: 6px 8px; margin-bottom: 5px;
  font-size: 13px;
}
.subs-item .player-no { min-width: 22px; }
.subs-name { flex: 1; font-weight: 700; word-break: break-all; }
.subs-pos { font-size: 10px; font-weight: 800; color: var(--muted); }
.subs-item.hit { background: #fdf6da; box-shadow: inset 0 0 0 1px var(--gold); }
.subs-item.miss { border-color: var(--line); background: #fff; color: var(--muted); }
.subs-item.miss .subs-name { font-weight: 400; }
.subs-hit { color: #8a6d1d; font-weight: 900; white-space: nowrap; }
.subs-item.empty {
  border-style: dashed; border-color: var(--line); background: #fff;
  color: var(--muted); font-size: 12px; justify-content: center;
}

/* ランキングの展開行 */
.rank-table tr.rank-row { cursor: pointer; }
.rank-toggle {
  color: var(--antlers-red); font-size: 11px; font-weight: 800;
  margin-left: 6px; white-space: nowrap;
}
.rank-table tr.rank-detail td { background: #fdf7f8; padding: 10px 8px 4px; }
.rank-detail .formation-block { margin-top: 0; }

.admin-card { border-style: dashed; }

/* ---------- フッター ---------- */
.app-footer {
  max-width: 640px; margin: 0 auto; padding: 8px 16px 36px;
  font-size: 12px; color: var(--muted); line-height: 1.7; text-align: center;
}
.app-footer a { color: var(--antlers-red); }

.setup-card { border-color: var(--gold); background: #fffdf4; }

/* マスコット（べにくん） */
.mascot-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.mascot-wrap { display: flex; flex-direction: column; align-items: center; flex: none; }
.mascot-img {
  width: 74px; height: auto; border-radius: 14px; flex: none;
  animation: benikun-bob 1.8s ease-in-out infinite;
  transform-origin: 50% 90%;
}
.mascot-name { font-size: 12px; font-weight: 800; color: #fff; margin-top: 3px; letter-spacing: .08em; }
@keyframes benikun-bob {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  25% { transform: translateY(-11px) rotate(-3.5deg) scale(1.03); }
  50% { transform: translateY(0) rotate(0deg) scale(1); }
  75% { transform: translateY(-11px) rotate(3.5deg) scale(1.03); }
}
.mascot-bubble {
  position: relative; background: #fdf3e3; color: #5a4632; border-radius: 14px;
  padding: 9px 12px; font-size: 13px; font-weight: 700; line-height: 1.5;
}
.mascot-bubble::before {
  content: ""; position: absolute; left: -7px; top: 50%; transform: translateY(-50%);
  border: 7px solid transparent; border-right-color: #fdf3e3; border-left: 0;
}
