/**
 * FG Event Platform — 共通デザイン体系
 * 大会カラー / CSS変数 / 共通コンポーネント
 */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@700&display=swap');

/* ── CSS変数 ────────────────────────────────────── */
:root {
  --fg-blue:         #3520D0;   /* ロゴ GYMKHANA ボックス実測値 */
  --fg-blue-light:   #4535D8;
  --fg-navy:         #0F1040;   /* ロゴに合わせ青紫寄りに */
  --fg-black:        #141617;   /* 黒ヘッダー背景 */
  --fg-dark:         #212326;   /* 濃色テキスト */
  --fg-gray:         #434549;   /* 中間グレー */
  --fg-white:        #ffffff;
  --fg-bg:           #F2F3F5;   /* 公式サイト寄せ（旧 #EEF2F7） */
  --fg-bg-soft:      #F9F9FB;
  --fg-card:         #ffffff;
  --fg-text:         #1A2733;
  --fg-muted:        #6B7280;
  --fg-line:         #DDE1E7;   /* 統一（旧 #E2E8F0） */
  --fg-blue-soft:    #EEEEFF;
  --fg-blue-border:  #CCCAFB;
  --fg-success-bg:   #EAF8F0;
  --fg-success:      #1A6640;
  --fg-success-border:#CDEEDC;
  --fg-warning-bg:   #FFF7E6;
  --fg-warning:      #8A5A00;
  --fg-warning-border:#FFE0A3;
  --fg-error-bg:     #FBEAEA;
  --fg-error:        #9A2A2A;
  --fg-error-border: #F1C2C2;
  --fg-disabled:     #B0BAC8;
  --radius-card:     18px;      /* 角丸を少し締める（旧 20px） */
  --radius-ui:       8px;       /* ボタン等をシャープに（旧 12px） */
  --shadow-card:     0 12px 32px rgba(20,22,23,0.10);
  --shadow-sm:       0 1px 4px rgba(11,37,69,0.08);
}

/* ── ベース ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--fg-bg);
  color: var(--fg-text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── カード ─────────────────────────────────────── */
.card {
  background: var(--fg-card);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 390px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ── 学生向けヘッダー（白背景・青下線アクセント） ───── */
.fg-header {
  background: #fff;
  color: var(--fg-text);
  padding: 18px 24px 14px;
  display: block;
  border-bottom: 3px solid var(--fg-blue);
}

.fg-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

/* PNGロゴ（FORMULA GYMKHANA + College Students RD 一体型）。高さ基準で表示。
   max-width:100% は親(.fg-logo)のシュリンクラップと循環参照し幅0に潰れるため付けない */
.fg-logo-img {
  height: 40px;
  width: auto;
  display: block;
}

.fg-logo-mark {
  font-family: 'Oswald', Impact, 'Arial Narrow Bold', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #111827;
  line-height: 1;
  display: flex;
  align-items: center;
}

.fg-logo-mark span {
  background: var(--fg-blue);
  color: #fff;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 0;
  display: flex;
  align-items: center;
}

.fg-logo-sub {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10px;
  font-weight: 400;
  color: #111827;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.fg-page-name {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

/* ── セクション見出し（英字大見出し＋日本語） ───────── */
.section-label {
  text-align: left;
  margin-bottom: 20px;
}
.section-en {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--fg-black);
  line-height: 1;
}
.section-ja {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-blue);
}

/* ── カードボディ ────────────────────────────────── */
.card-body {
  padding: 28px 26px 32px;
  text-align: center;
}

/* ── state-icon（淡い青カード） ─────────────────── */
.state-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--fg-blue-soft);
  color: var(--fg-blue);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.state-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg-navy);
  margin-bottom: 8px;
}

.state-msg {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.75;
  margin-bottom: 24px;
}

/* ── ボタン ─────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 15px;
  background: var(--fg-blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-ui);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s;
  text-decoration: none;
  text-align: center;
}

.btn-primary:active {
  background: #2210B0;
}

.btn-primary:disabled {
  background: var(--fg-disabled);
  cursor: not-allowed;
}

/* PC操作・アクセシビリティ用フォーカスリング */
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.action-link:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(0, 87, 184, 0.25);
  outline-offset: 3px;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 14px;
  background: #fff;
  color: var(--fg-blue);
  border: 1.5px solid var(--fg-blue-border);
  border-radius: var(--radius-ui);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s;
}

.btn-secondary:active {
  background: var(--fg-blue-soft);
}

/* ── スピナー ────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--fg-line);
  border-top-color: var(--fg-blue);
  border-radius: 50%;
  animation: fg-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes fg-spin {
  to { transform: rotate(360deg); }
}

/* ── アクションリンク ─────────────────────────────── */
.action-link {
  display: block;
  margin-top: 12px;
  padding: 13px;
  border-radius: var(--radius-ui);
  font-size: 14px;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  transition: background 0.15s;
}

.action-link.primary {
  background: var(--fg-blue);
  color: #fff;
}

.action-link.secondary {
  background: var(--fg-blue-soft);
  color: var(--fg-blue);
  border: 1px solid var(--fg-blue-border);
}

/* ── 進捗円形ゲージ ─────────────────────────────── */
.progress-ring {
  --pct: 0;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  background: conic-gradient(var(--fg-blue) calc(var(--pct) * 1%), var(--fg-line) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto 28px;
}

.ring-inner {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-count {
  font-size: 40px;
  font-weight: 700;
  color: var(--fg-navy);
  line-height: 1;
}

.ring-label {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ── ステータスカード（成功/情報/警告/エラー/達成） ── */
.status-card {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
}

.status-card.success {
  background: var(--fg-success-bg);
  border: 1px solid var(--fg-success-border);
  color: var(--fg-success);
}

.status-card.info {
  background: var(--fg-blue-soft);
  border: 1px solid var(--fg-blue-border);
  color: var(--fg-navy);
}

.status-card.warning {
  background: var(--fg-warning-bg);
  border: 1px solid var(--fg-warning-border);
  color: var(--fg-warning);
}

.status-card.error {
  background: var(--fg-error-bg);
  border: 1px solid var(--fg-error-border);
  color: var(--fg-error);
}

.status-card.neutral {
  background: var(--fg-bg);
  border: 1px solid var(--fg-line);
  color: var(--fg-muted);
}

/* 達成（青グラデ・progress/stampの達成バナー） */
.status-card.cleared {
  background: linear-gradient(135deg, var(--fg-blue), #5545E0);
  color: #fff;
}

.status-card .status-sub,
.status-card .sub {
  font-size: 11px;
  font-weight: 400;
  margin-top: 2px;
  opacity: 0.9;
  white-space: nowrap;
}

/* ── 企業ブースカード / 完了カード（stamp.html用） ── */
.booth-card {
  background: var(--fg-blue-soft);
  border: 1px solid var(--fg-blue-border);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 22px;
  text-align: center;
}

.booth-name {
  color: var(--fg-blue);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.booth-msg {
  color: var(--fg-navy);
  font-size: 14px;
  font-weight: 700;
}

.complete-card {
  background: var(--fg-success-bg);
  border: 1px solid var(--fg-success-border);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.complete-label {
  color: var(--fg-success);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.complete-main {
  color: var(--fg-navy);
  font-size: 20px;
  font-weight: 800;
}

.complete-sub {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 12px;
}

/* ── スタッフバッジ ─────────────────────────────── */
.staff-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--fg-blue-soft);
  color: var(--fg-blue);
  border: 1px solid var(--fg-blue-border);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

/* ── QRスキャン枠（start.html / exchange.html 共通） ── */
.scan-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-guide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scan-frame {
  width: 60%;
  aspect-ratio: 1 / 1;
  position: relative;
}

.scan-frame::before, .scan-frame::after,
.scan-frame-inner::before, .scan-frame-inner::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #fff;
  border-style: solid;
}

.scan-frame::before       { top: 0;    left: 0;  border-width: 3px 0 0 3px; }
.scan-frame::after        { top: 0;    right: 0; border-width: 3px 3px 0 0; }
.scan-frame-inner::before { bottom: 0; left: 0;  border-width: 0 0 3px 3px; }
.scan-frame-inner::after  { bottom: 0; right: 0; border-width: 0 3px 3px 0; }

.scan-line {
  position: absolute;
  left: 5%;
  right: 5%;
  height: 2px;
  background: rgba(255,255,255,0.7);
  animation: scanMove 2s ease-in-out infinite;
  top: 10%;
}

@keyframes scanMove {
  0%, 100% { top: 10%; }
  50%      { top: 85%; }
}

.scan-label {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}

.cancel-btn {
  width: 100%;
  padding: 13px;
  background: var(--fg-bg);
  color: var(--fg-muted);
  border: none;
  font-size: 13px;
  cursor: pointer;
  border-top: 1px solid var(--fg-line);
}

.cancel-btn:active {
  background: #D4DBE6;
}

/* ── アプリ型固定レイアウト（固定ヘッダー＋スクロール中央＋固定フッター） ── */
.app-fixed {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 420px;
  /* svh = アドレスバー表示込みの安定した最小高さ。dvhはバー伸縮で動くため不使用 */
  height: 100vh;   /* フォールバック */
  height: 100dvh;
  height: 100svh;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
}
.app-fixed-header { flex: 0 0 auto; }
.app-fixed-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.app-fixed-footer {
  flex: 0 0 auto;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 480px) {
  body { padding: 24px; }
  .app-fixed {
    height: calc(100vh - 48px);
    height: calc(100dvh - 48px);
    height: calc(100svh - 48px);
    max-height: 820px;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
  }
}

/* ── スタンプグリッド（progress.html・スタンプ帳スタイル） ── */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 8px;
  padding: 18px 16px 24px;
}
.stamp-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.stamp-circle {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.stamp-circle.got {
  border: 2px solid var(--fg-blue);
  background: #fff;
}
.stamp-circle.empty {
  border: 2px dashed #CBD5E1;
  background: #fff;
}
.stamp-circle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  box-sizing: border-box;
}
.stamp-initial {
  font-size: 22px;
  font-weight: 800;
  color: var(--fg-blue);
}
.stamp-num {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg-line);
}
.stamp-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg-dark);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stamp-name.empty {
  color: var(--fg-muted);
}

/* ── マイルストーンバー ───────────────────────────── */
.milestone-bar-section {
  padding: 0 28px 2px 20px;
}
.milestone-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  text-align: center;
  margin-top: 4px;
}
.milestone-track {
  position: relative;
  height: 8px;
  background: var(--fg-line);
  border-radius: 100px;
  margin: 16px 0 22px;
}
.milestone-fill {
  height: 100%;
  background: var(--fg-blue);
  border-radius: 100px;
  transition: width 0.6s ease;
}
.milestone-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--fg-line);
}
.milestone-marker.reached {
  background: var(--fg-blue);
  box-shadow: 0 0 0 2px var(--fg-blue);
}
.milestone-marker.unreached {
  background: var(--fg-bg);
}
.milestone-label {
  text-align: center;
  transform: translateX(-50%);
  position: absolute;
  top: 14px;
  white-space: nowrap;
}
.milestone-label .m-count {
  font-weight: 800;
  color: var(--fg-blue);
  font-size: 11px;
}

/* コンプリート演出 */
@keyframes milestone-shimmer {
  0%   { opacity: 1; }
  50%  { opacity: 0.65; }
  100% { opacity: 1; }
}
@keyframes milestone-pulse {
  0%   { box-shadow: 0 0 0 0px rgba(53, 32, 208, 0.5), 0 0 0 2px var(--fg-blue); }
  70%  { box-shadow: 0 0 0 7px rgba(53, 32, 208, 0),   0 0 0 2px var(--fg-blue); }
  100% { box-shadow: 0 0 0 0px rgba(53, 32, 208, 0),   0 0 0 2px var(--fg-blue); }
}
.milestone-track.complete .milestone-fill {
  animation: milestone-shimmer 2s ease-in-out infinite;
}
.milestone-marker.complete-star {
  animation: milestone-pulse 1.6s ease-out infinite;
  width: 18px;
  height: 18px;
}
.milestone-complete {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-blue);
  letter-spacing: 0.05em;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* ── fg-list（進捗リスト・公式サイト日程表スタイル） ── */
.fg-list {
  border-top: 1px solid var(--fg-line);
  margin: 0 20px;
}
.fg-list-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--fg-line);
  text-align: left;
}
.fg-list-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--fg-dark);
}
.fg-list-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-muted);
}
