:root {
  --navy: #10233f;
  --navy-2: #18365f;
  --blue: #2e73d2;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #6b778c;
  --line: #dbe2ec;
  --strike: #2878d5;
  --ball: #df4e4e;
  --foul: #8258c8;
  --inplay: #e89a27;
  --shadow: 0 12px 32px rgba(16, 35, 63, .09);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, video { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top);
  color: white;
  background: rgba(16, 35, 63, .96);
  backdrop-filter: blur(14px);
  box-shadow: 0 4px 18px rgba(16,35,63,.18);
}
.header-inner {
  max-width: 960px;
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: 44px 1fr 60px;
  align-items: center;
}
.header-spacer { width: 44px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 9px; }
.brand-mark { font-size: 24px; }
.brand strong { display: block; font-size: 17px; line-height: 1.15; }
.brand span { display: block; margin-top: 2px; font-size: 9px; letter-spacing: .12em; opacity: .65; }
.icon-button, .install-button {
  border: 0;
  color: white;
  background: transparent;
  cursor: pointer;
}
.icon-button { width: 40px; height: 40px; font-size: 26px; border-radius: 12px; }
.icon-button:active { background: rgba(255,255,255,.12); }
.install-button {
  justify-self: end;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,.15);
}
.hidden { display: none !important; }

.page { max-width: 960px; margin: 0 auto; padding: 18px 16px; }
.page-bottom-pad { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
.player-page { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }

.hero {
  margin: 8px 0 24px;
  padding: 28px;
  border-radius: 28px;
  color: white;
  background:
    radial-gradient(circle at 90% 10%, rgba(82,150,238,.65), transparent 34%),
    linear-gradient(135deg, #10233f, #1c4d83);
  box-shadow: var(--shadow);
}
.compact-hero h1, .school-hero h1 { margin: 8px 0 9px; font-size: clamp(27px, 8vw, 40px); }
.hero p { margin: 0; color: rgba(255,255,255,.78); line-height: 1.55; font-size: 14px; }
.eyebrow { display: block; color: #6f8db6; font-weight: 800; font-size: 10px; letter-spacing: .14em; }
.hero .eyebrow { color: #9bc6ff; }
.school-hero { display: flex; align-items: center; gap: 20px; }
.hero-emblem {
  flex: 0 0 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 22px;
  font-size: 31px;
  font-weight: 900;
  background: rgba(255,255,255,.13);
}

.section-block { margin-top: 24px; }
.section-block.no-side-padding { padding: 0 2px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title-row h2 { margin: 0; font-size: 18px; }
.count-badge, .video-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  color: #42648d;
  background: #e9f0f8;
  font-size: 12px;
  font-weight: 800;
}

.card-list, .pa-list { display: grid; gap: 12px; }
.school-card, .pitcher-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: white;
  box-shadow: 0 5px 18px rgba(16,35,63,.04);
  cursor: pointer;
}
.school-card:active, .pitcher-card:active { transform: scale(.99); }
.school-emblem, .uniform-number {
  flex: 0 0 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  font-size: 22px;
  font-weight: 900;
  background: linear-gradient(145deg, var(--navy), #3473b4);
}
.uniform-number { color: #18365f; background: #edf3fa; }
.card-copy { min-width: 0; flex: 1; }
.card-copy strong { display: block; font-size: 17px; }
.card-copy span, .card-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.card-copy small { font-size: 11px; }
.chevron { color: #9aa7b7; font-size: 28px; }

.player-hero {
  margin: 2px 0 12px;
  padding: 20px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(135deg, #10233f, #22598f);
  box-shadow: var(--shadow);
}
.player-number {
  width: 64px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #10233f;
  background: white;
  font-size: 29px;
  font-weight: 950;
}
.player-heading span { color: #a9c7e8; font-size: 12px; }
.player-heading h1 { margin: 4px 0 3px; font-size: 29px; }
.player-heading p { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; }
.player-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.player-stats div { padding: 10px 6px; text-align: center; border-radius: 14px; background: rgba(255,255,255,.1); }
.player-stats strong, .player-stats span { display: block; }
.player-stats strong { font-size: 19px; }
.player-stats span { margin-top: 2px; color: rgba(255,255,255,.65); font-size: 10px; }

.game-strip {
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.game-strip small, .game-strip strong { display: block; }
.game-strip small { color: var(--muted); font-size: 10px; }
.game-strip strong { margin-top: 3px; font-size: 13px; }
.game-strip a { color: var(--blue); font-size: 11px; font-weight: 800; text-decoration: none; white-space: nowrap; }

.tab-bar {
  position: sticky;
  top: calc(64px + env(safe-area-inset-top));
  z-index: 30;
  margin: 14px 0;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(244,247,251,.94);
  backdrop-filter: blur(10px);
}
.tab-button {
  border: 0;
  padding: 10px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.tab-button.active { color: white; background: var(--navy); box-shadow: 0 5px 14px rgba(16,35,63,.18); }
.tab-content { min-height: 480px; }

.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 1px 12px;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: 999px;
  color: #53667e;
  background: white;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.filter-chip.active { border-color: var(--navy); color: white; background: var(--navy); }

.analysis-card, .runner-summary, .video-card, .timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 6px 20px rgba(16,35,63,.045);
}
.analysis-card { padding: 18px 14px 16px; }
.analysis-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 4px; }
.analysis-heading h2 { margin: 4px 0 0; font-size: 19px; }
.text-button { border: 0; color: var(--blue); background: transparent; font-size: 12px; font-weight: 800; cursor: pointer; }
.metric-row { margin: 14px 0 8px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.metric-row div { padding: 10px 5px; text-align: center; border-radius: 13px; background: #f3f6fa; }
.metric-row strong, .metric-row span { display: block; }
.metric-row strong { font-size: 18px; }
.metric-row span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.zone-wrap {
  position: relative;
  width: min(100%, 430px);
  margin: 8px auto 2px;
  padding: 35px 46px 38px;
}
.zone-field { position: relative; aspect-ratio: 1 / 1.15; width: 100%; }
.strike-zone {
  position: absolute;
  left: 18%; top: 10%;
  width: 64%; height: 76%;
  border: 3px solid #26384e;
  background: rgba(247,249,252,.72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8);
}
.strike-zone > i { position: absolute; display: block; background: #b8c3d1; }
.strike-zone .v1, .strike-zone .v2 { top: 0; bottom: 0; width: 1px; }
.strike-zone .v1 { left: 33.333%; }
.strike-zone .v2 { left: 66.666%; }
.strike-zone .h1, .strike-zone .h2 { left: 0; right: 0; height: 1px; }
.strike-zone .h1 { top: 33.333%; }
.strike-zone .h2 { top: 66.666%; }
.belt-line { position: absolute; left: -4%; right: -4%; top: 40%; height: 2px; background: #e39a2e; }
.belt-line span { position: absolute; right: -33px; top: -9px; padding: 2px 4px; color: #9d6410; background: white; font-size: 8px; font-weight: 800; }
.zone-label { position: absolute; z-index: 2; color: #748196; font-size: 10px; font-weight: 800; }
.zone-label.top { top: 9px; left: 50%; transform: translateX(-50%); }
.zone-label.bottom { bottom: 7px; left: 50%; transform: translateX(-50%); }
.zone-label.left { top: 50%; left: 2px; transform: translateY(-50%); }
.zone-label.right { top: 50%; right: 2px; transform: translateY(-50%); }
.pitch-point {
  position: absolute;
  z-index: 5;
  width: 31px;
  height: 31px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 3px 10px rgba(17,32,51,.28);
  cursor: pointer;
}
.pitch-point.confidence-mid::after {
  content: '';
  position: absolute;
  inset: -9px;
  border: 2px dashed currentColor;
  border-radius: 50%;
  opacity: .42;
}
.pitch-point.strike { color: #fff; background: var(--strike); }
.pitch-point.ball { color: #fff; background: var(--ball); }
.pitch-point.foul { color: #fff; background: var(--foul); }
.pitch-point.inplay { color: #fff; background: var(--inplay); }
.zone-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 13px; margin-top: -1px; color: var(--muted); font-size: 10px; }
.zone-legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.strike { background: var(--strike); }
.legend-dot.ball { background: var(--ball); }
.legend-dot.foul { background: var(--foul); }
.legend-dot.inplay { background: var(--inplay); }

.pa-card { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.pa-card.selected { border-color: #6c96c8; box-shadow: 0 0 0 3px rgba(46,115,210,.09); }
.pa-topline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.side-pill { padding: 4px 7px; border-radius: 8px; font-weight: 900; }
.side-pill.left { color: #7d4a19; background: #fff0d9; }
.side-pill.right { color: #295989; background: #e5f0fc; }
.pa-card h3 { margin: 11px 0 5px; font-size: 19px; }
.pa-card p { margin: 0; color: var(--muted); font-size: 13px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.primary-button, .secondary-button {
  min-height: 42px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--navy); color: white; background: var(--navy); }
.secondary-button { border: 1px solid var(--line); color: #38516d; background: #f7f9fc; }
.primary-button.full { width: 100%; }

.runner-summary { padding: 18px; }
.runner-summary h2 { margin: 4px 0 0; font-size: 23px; }
.runner-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 15px; }
.runner-metrics div { padding: 12px 4px; text-align: center; border-radius: 14px; background: #f3f6fa; }
.runner-metrics strong, .runner-metrics span { display: block; }
.runner-metrics strong { font-size: 20px; }
.runner-metrics span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.split-zone-list { display: grid; gap: 12px; margin-top: 12px; }
.compact-zone-card .zone-wrap { max-width: 380px; }

.timeline-card { margin-top: 12px; padding: 15px; }
.timeline-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.timeline-header strong, .timeline-header span { display: block; }
.timeline-header strong { font-size: 14px; }
.timeline-header span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.timeline-header b { color: #38516d; font-size: 11px; }
.timeline { position: relative; margin-top: 14px; padding-left: 12px; }
.timeline::before { content: ''; position: absolute; left: 19px; top: 15px; bottom: 15px; width: 2px; background: #dbe3ed; }
.timeline-event {
  position: relative;
  width: 100%;
  min-height: 54px;
  border: 0;
  padding: 8px 48px 8px 34px;
  display: block;
  text-align: left;
  background: transparent;
  cursor: pointer;
}
.event-dot { position: absolute; left: 1px; top: 18px; width: 14px; height: 14px; border: 3px solid white; border-radius: 50%; background: var(--strike); box-shadow: 0 0 0 2px #aec0d4; }
.timeline-event.pickoff .event-dot { background: #75859a; }
.timeline-event strong, .timeline-event small { display: block; }
.timeline-event strong { font-size: 12px; }
.timeline-event small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.timeline-event em { position: absolute; right: 0; top: 18px; color: #8b98a8; font-size: 10px; font-style: normal; }

.video-card { overflow: hidden; }
.video-heading { padding: 17px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.video-heading h2 { margin: 5px 0 4px; font-size: 20px; }
.video-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.video-frame { position: relative; background: #07101c; }
.video-frame video { display: block; width: 100%; aspect-ratio: 16/9; background: #07101c; }
.clip-indicator { position: absolute; left: 12px; top: 12px; padding: 6px 9px; border-radius: 9px; color: white; background: rgba(226,71,71,.88); font-size: 10px; font-weight: 800; }
.video-controls-row { padding: 9px; display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.video-controls-row button { flex: 1 0 auto; border: 1px solid var(--line); padding: 8px 9px; border-radius: 10px; color: #425a75; background: #f7f9fc; font-size: 10px; font-weight: 800; cursor: pointer; }
.event-grid { padding: 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.event-button { position: relative; min-height: 76px; border: 1px solid var(--line); padding: 11px 46px 10px 11px; border-radius: 14px; text-align: left; background: white; cursor: pointer; }
.event-button strong, .event-button span, .event-button em { display: block; }
.event-button strong { font-size: 13px; }
.event-button span { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.event-button em { position: absolute; top: 10px; right: 8px; color: #7d8da0; font-size: 9px; font-style: normal; }
.event-button.pickoff { background: #f5f6f8; }
.video-pa-list { display: grid; gap: 8px; }
.video-pa-button { width: 100%; border: 1px solid var(--line); padding: 13px 14px; display: grid; grid-template-columns: 80px 1fr; gap: 3px 8px; border-radius: 15px; text-align: left; background: white; cursor: pointer; }
.video-pa-button.active { border-color: #5e8dc4; box-shadow: 0 0 0 3px rgba(46,115,210,.08); }
.video-pa-button span { grid-row: 1 / 3; align-self: center; color: #52677f; font-size: 11px; font-weight: 800; }
.video-pa-button strong { font-size: 14px; }
.video-pa-button small { color: var(--muted); font-size: 10px; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; background: rgba(7,16,28,.52); backdrop-filter: blur(3px); }
.bottom-sheet { position: relative; width: min(100%, 540px); margin: 0 auto; padding: 25px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; background: white; box-shadow: 0 -18px 55px rgba(7,16,28,.25); animation: sheetUp .22s ease-out; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 42px; height: 4px; margin: -12px auto 18px; border-radius: 99px; background: #cbd4df; }
.sheet-close { position: absolute; top: 15px; right: 15px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #53667e; background: #eef2f7; font-size: 22px; cursor: pointer; }
.bottom-sheet h2 { margin: 5px 0 14px; font-size: 24px; }
.pitch-detail-list { margin: 0 0 16px; border-top: 1px solid var(--line); }
.pitch-detail-list div { padding: 11px 2px; display: grid; grid-template-columns: 120px 1fr; gap: 12px; border-bottom: 1px solid var(--line); }
.pitch-detail-list dt { color: var(--muted); font-size: 11px; }
.pitch-detail-list dd { margin: 0; text-align: right; font-size: 12px; font-weight: 800; }
.confidence-pill { padding: 4px 8px; border-radius: 999px; font-size: 10px; }
.confidence-pill.high { color: #176b4c; background: #dff5eb; }
.confidence-pill.mid { color: #866011; background: #fff1cc; }

.empty-state { padding: 28px; border: 1px dashed #cbd5e1; border-radius: 17px; color: var(--muted); text-align: center; font-size: 13px; }
.toast { position: fixed; z-index: 150; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 10px 15px; border-radius: 12px; color: white; background: rgba(16,35,63,.94); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .player-hero { grid-template-columns: 80px 1fr 330px; align-items: center; }
  .player-number { width: 80px; height: 90px; }
  .player-stats { grid-column: auto; margin: 0; }
  .split-zone-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pa-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-pa-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .event-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 관리자 페이지 */
.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 74px;
}
.admin-header-button {
  border: 1px solid rgba(255,255,255,.22);
  padding: 7px 9px;
  border-radius: 10px;
  color: white;
  background: rgba(255,255,255,.1);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.admin-page { max-width: 1080px; }
.admin-hero {
  margin: 6px 0 14px;
  padding: 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(135deg, #10233f, #2a659b);
  box-shadow: var(--shadow);
}
.admin-hero h1 { margin: 7px 0 7px; font-size: clamp(25px, 6vw, 36px); }
.admin-hero p { margin: 0; max-width: 650px; color: rgba(255,255,255,.76); line-height: 1.5; font-size: 13px; }
.admin-status {
  flex: 0 0 180px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.1);
}
.admin-status strong, .admin-status span { display: block; }
.admin-status strong { font-size: 12px; }
.admin-status span { margin-top: 5px; color: rgba(255,255,255,.7); font-size: 10px; line-height: 1.4; }

.admin-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.file-label {
  display: grid;
  place-items: center;
  text-align: center;
  cursor: pointer;
}
.file-label input { display: none; }

.admin-card {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 5px 18px rgba(16,35,63,.04);
}
.admin-details > summary,
.admin-event-row > summary {
  list-style: none;
  cursor: pointer;
}
.admin-details > summary::-webkit-details-marker,
.admin-event-row > summary::-webkit-details-marker { display: none; }
.admin-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-details > summary strong { font-size: 17px; }
.admin-details > summary span { color: var(--muted); font-size: 12px; }
.admin-details[open] > summary { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.admin-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.admin-selector-grid label,
.admin-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-selector-grid label > span,
.admin-field > span {
  color: #53667e;
  font-size: 11px;
  font-weight: 850;
}
.admin-selector-grid select,
.admin-field input,
.admin-field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd9e6;
  border-radius: 11px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}
.admin-selector-grid select:focus,
.admin-field input:focus,
.admin-field select:focus {
  border-color: #5b8fca;
  box-shadow: 0 0 0 3px rgba(46,115,210,.1);
}
.admin-create-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.admin-create-grid button:disabled { opacity: .45; cursor: not-allowed; }
.compact-create-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 520px;
}
.admin-section-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.admin-registration-card .section-title-row { align-items: flex-start; }
.admin-registration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.admin-registration-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid #cfd9e6;
  border-radius: 16px;
  background: #f8fafc;
}
.admin-registration-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.admin-registration-title > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.admin-registration-title strong { font-size: 15px; }
.admin-registration-title small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.registration-step {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy, #10233f);
  font-size: 13px;
  font-weight: 900;
}
.admin-registration-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.registration-submit {
  width: 100%;
  margin-top: auto;
}
.registration-submit:disabled { opacity: .45; cursor: not-allowed; }

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.admin-field.wide { grid-column: 1 / -1; }
.admin-pa-card .section-title-row { margin-bottom: 16px; }
.admin-subheading { margin-top: 26px; }
.secondary-button.compact { min-height: 36px; padding: 6px 11px; }

.admin-video-box {
  margin-top: 18px;
  padding: 15px;
  border: 1px dashed #b8c6d8;
  border-radius: 15px;
  background: #f7f9fc;
}
.admin-video-box > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.admin-video-box > div strong { font-size: 14px; }
.admin-video-box > div span { color: var(--muted); font-size: 11px; text-align: right; word-break: break-all; }
.video-upload-label {
  min-height: 45px;
  margin-top: 10px;
  display: grid;
  place-items: center;
  border: 1px solid #9db3cf;
  border-radius: 11px;
  color: #234c7a;
  background: #eaf2fb;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.video-upload-label input { display: none; }
.admin-video-box p { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.admin-event-list { display: grid; gap: 10px; }
.admin-event-row {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfcfe;
  overflow: hidden;
}
.admin-event-row > summary {
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #f2f5f9;
}
.admin-event-row > summary strong { flex: 0 0 auto; color: #18365f; font-size: 14px; }
.admin-event-row > summary span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.admin-event-row[open] > summary { border-bottom: 1px solid var(--line); }
.event-form-grid { padding: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.coordinate-hint { margin: 0 14px 12px; color: #6a778b; font-size: 10px; line-height: 1.45; }

.admin-coordinate-field {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid #d3deea;
  border-radius: 15px;
  background: #f7f9fc;
}
.coordinate-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.coordinate-picker-header strong,
.coordinate-picker-header span { display: block; }
.coordinate-picker-header strong { color: #18365f; font-size: 14px; }
.coordinate-picker-header span { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.coordinate-center-button {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid #b9c9dc;
  padding: 6px 11px;
  border-radius: 10px;
  color: #315b88;
  background: white;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.coordinate-board {
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #c6d2e1;
  border-radius: 18px;
  background:
    linear-gradient(rgba(255,255,255,.72), rgba(255,255,255,.72)),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(118,139,164,.08) 24px 25px),
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(118,139,164,.08) 24px 25px),
    #edf2f7;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.8);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.coordinate-board:focus-visible { outline: 3px solid rgba(46,115,210,.28); outline-offset: 2px; }
.coordinate-strike-zone {
  position: absolute;
  left: 20%;
  top: 15%;
  width: 60%;
  height: 70%;
  border: 3px solid #243a54;
  background: rgba(255,255,255,.74);
  box-shadow: 0 6px 22px rgba(16,35,63,.08);
}
.coordinate-strike-zone > i { position: absolute; display: block; background: #b8c5d4; }
.coordinate-strike-zone .v1,
.coordinate-strike-zone .v2 { top: 0; bottom: 0; width: 1px; }
.coordinate-strike-zone .v1 { left: 33.333%; }
.coordinate-strike-zone .v2 { left: 66.666%; }
.coordinate-strike-zone .h1,
.coordinate-strike-zone .h2 { left: 0; right: 0; height: 1px; }
.coordinate-strike-zone .h1 { top: 33.333%; }
.coordinate-strike-zone .h2 { top: 66.666%; }
.coordinate-belt-line { position: absolute; left: -5%; right: -5%; top: 40%; height: 2px; background: #e39a2e; }
.coordinate-belt-line span { position: absolute; right: -30px; top: -9px; padding: 2px 4px; color: #93600f; background: white; font-size: 8px; font-weight: 850; }
.coordinate-axis-label {
  position: absolute;
  z-index: 3;
  color: #617289;
  font-size: 10px;
  font-weight: 900;
  pointer-events: none;
}
.coordinate-axis-label.top { top: 3%; left: 50%; transform: translateX(-50%); }
.coordinate-axis-label.bottom { bottom: 3%; left: 50%; transform: translateX(-50%); }
.coordinate-axis-label.left { left: 2.5%; top: 50%; transform: translateY(-50%); }
.coordinate-axis-label.right { right: 2.5%; top: 50%; transform: translateY(-50%); }
.coordinate-marker {
  position: absolute;
  z-index: 5;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  border: 4px solid white;
  border-radius: 50%;
  background: #e64949;
  box-shadow: 0 4px 13px rgba(20,38,60,.34), 0 0 0 2px rgba(230,73,73,.25);
  pointer-events: none;
}
.coordinate-marker::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: white;
  opacity: .9;
}
.coordinate-readout {
  margin-top: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 11px;
  color: #405671;
  background: white;
}
.coordinate-readout strong { color: #18365f; font-size: 12px; }
.coordinate-readout span { color: var(--muted); font-size: 10px; text-align: right; }
.danger-link {
  border: 0;
  padding: 9px 0;
  color: #bc3f3f;
  background: transparent;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.admin-event-row > .danger-link { margin: 0 14px 12px; }
.danger-button {
  min-height: 46px;
  border: 1px solid #e2bcbc;
  border-radius: 12px;
  color: #b33434;
  background: #fff5f5;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.admin-save-bar {
  position: sticky;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
  margin-top: 26px;
  padding: 10px;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(16,35,63,.14);
}
.admin-save-button { min-height: 46px; }

@media (max-width: 760px) {
  .header-inner { grid-template-columns: 44px 1fr 74px; }
  .admin-hero { flex-direction: column; }
  .admin-status { width: 100%; flex-basis: auto; }
  .admin-toolbar { grid-template-columns: 1fr; }
  .admin-selector-grid { grid-template-columns: 1fr 1fr; }
  .admin-create-grid { grid-template-columns: 1fr 1fr; }
  .admin-registration-grid { grid-template-columns: 1fr; }
  .admin-registration-fields { grid-template-columns: 1fr 1fr; }
  .event-form-grid { grid-template-columns: 1fr 1fr; }
  .admin-coordinate-field { grid-column: 1 / -1; }
}

@media (max-width: 480px) {
  .admin-card { padding: 14px; }
  .admin-selector-grid,
  .admin-form-grid,
  .event-form-grid { grid-template-columns: 1fr; }
  .admin-field.wide { grid-column: auto; }
  .admin-save-bar { grid-template-columns: 1fr; }
  .admin-video-box > div:first-child { align-items: flex-start; flex-direction: column; }
  .admin-coordinate-field { padding: 11px; }
  .coordinate-picker-header { align-items: stretch; flex-direction: column; }
  .coordinate-center-button { width: 100%; }
  .coordinate-readout { align-items: flex-start; flex-direction: column; }
  .coordinate-readout span { text-align: left; }
}

/* 영상 탭: 왼쪽 투구 카드 + 오른쪽 스트라이크존 */
.video-analysis-layout {
  padding: 12px 2px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 205px;
  gap: 10px;
  align-items: stretch;
  border-top: 1px solid var(--line);
  background: white;
}
.video-event-panel,
.video-zone-panel {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.video-event-panel { padding: 0; }
.video-zone-panel {
  padding: 0 2px 0 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid var(--line);
  overflow: visible;
}
.video-event-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  max-height: none;
  overflow: visible;
}
.video-event-list .event-button {
  width: 100%;
  min-height: 76px;
  padding: 12px 48px 10px 12px;
  border-radius: 14px;
  background: white;
}
.video-event-list .event-button.active {
  border-color: #111820;
  box-shadow: 0 0 0 1px #111820;
  background: #fff;
}
.video-zone-panel .zone-wrap {
  width: 100%;
  max-width: 190px;
  margin: 0 auto;
  padding: 22px 18px 25px;
}
.video-zone-panel .zone-legend {
  margin-top: -5px;
  gap: 4px 7px;
  font-size: 7px;
  white-space: nowrap;
}
.video-zone-panel .zone-legend span { gap: 3px; }
.video-zone-panel .legend-dot { width: 6px; height: 6px; }
.pitch-point.video-active {
  z-index: 8;
  outline: 3px solid rgba(16,35,63,.88);
  outline-offset: 3px;
  transform: translate(-50%, -50%) scale(1.16);
  box-shadow: 0 5px 16px rgba(16,35,63,.42);
}

@media (max-width: 760px) {
  .video-analysis-layout {
    grid-template-columns: minmax(0, 1fr) 175px;
    gap: 7px;
  }
  .video-event-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .video-event-list .event-button {
    min-height: 72px;
    padding: 10px 38px 9px 10px;
  }
  .video-event-list .event-button strong { font-size: 12px; }
  .video-event-list .event-button span {
    margin-top: 3px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 8px;
  }
  .video-event-list .event-button em { top: 8px; right: 6px; font-size: 8px; }
  .video-zone-panel { padding-left: 7px; }
  .video-zone-panel .zone-wrap { max-width: 165px; padding: 20px 14px 23px; }
  .video-zone-panel .pitch-point {
    width: 27px;
    height: 27px;
    border-width: 2px;
    font-size: 10px;
  }
  .video-zone-panel .pitch-point.confidence-mid::after { inset: -7px; }
}

@media (max-width: 430px) {
  .video-analysis-layout {
    padding-left: 0;
    padding-right: 0;
    grid-template-columns: minmax(0, 1fr) 145px;
    gap: 5px;
  }
  .video-event-list { grid-template-columns: 1fr; gap: 6px; }
  .video-event-list .event-button {
    min-height: 64px;
    padding: 9px 8px 8px;
  }
  .video-event-list .event-button em { position: static; margin-top: 3px; }
  .video-zone-panel { padding-left: 4px; }
  .video-zone-panel .zone-wrap { max-width: 138px; padding: 18px 8px 21px; }
  .video-zone-panel .zone-label.left { left: -2px; }
  .video-zone-panel .zone-label.right { right: -2px; }
  .video-zone-panel .zone-legend {
    white-space: normal;
    gap: 3px 5px;
    font-size: 6px;
  }
}


/* 소속·등번호 이력 */
.affiliation-card .admin-section-help { margin-top: 10px; }
.affiliation-history-list {
  display: grid;
  gap: 9px;
  margin: 2px 0 18px;
}
.affiliation-history-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.affiliation-history-row.current {
  border-color: #79a5d6;
  background: #eef6ff;
  box-shadow: 0 0 0 2px rgba(46,115,210,.07);
}
.affiliation-history-badge {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #48617e;
  background: #e6edf5;
  font-size: 10px;
  font-weight: 900;
}
.affiliation-history-row.current .affiliation-history-badge {
  color: white;
  background: var(--blue);
}
.affiliation-history-copy { min-width: 0; }
.affiliation-history-copy strong,
.affiliation-history-copy span,
.affiliation-history-copy small { display: block; }
.affiliation-history-copy strong { font-size: 14px; }
.affiliation-history-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.affiliation-history-copy small { margin-top: 4px; color: #586b82; font-size: 10px; line-height: 1.4; }
.affiliation-change-form {
  padding: 15px;
  border: 1px dashed #aebfd2;
  border-radius: 16px;
  background: #f7f9fc;
}
.affiliation-change-form .section-title-row { margin-bottom: 13px; }
.affiliation-change-form .section-title-row h2 { font-size: 15px; }
.affiliation-apply-button { margin-top: 13px; }

@media (max-width: 480px) {
  .affiliation-history-row { grid-template-columns: 38px minmax(0, 1fr); padding: 10px; }
  .affiliation-change-form { padding: 12px; }
}

/* 경기별 구분 및 선택 */
.game-selector-card {
  margin: 12px 0 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 6px 20px rgba(16,35,63,.045);
}
.game-selector-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}
.game-selector-heading small,
.game-selector-heading strong { display: block; }
.game-selector-heading small { color: var(--muted); font-size: 10px; }
.game-selector-heading strong { margin-top: 3px; font-size: 15px; }
.player-game-select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #b9c9dc;
  border-radius: 12px;
  padding: 9px 12px;
  color: var(--text);
  background: #f9fbfd;
  font-weight: 800;
  outline: none;
}
.player-game-select:focus {
  border-color: #5b8fca;
  box-shadow: 0 0 0 3px rgba(46,115,210,.1);
}
.game-meta-grid {
  margin-top: 11px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 7px;
}
.game-meta-grid > div {
  min-width: 0;
  padding: 9px 8px;
  border-radius: 12px;
  background: #f3f6fa;
}
.game-meta-grid span,
.game-meta-grid strong { display: block; }
.game-meta-grid span { color: var(--muted); font-size: 9px; }
.game-meta-grid strong {
  margin-top: 3px;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.game-source-link {
  margin-top: 10px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #c7d4e4;
  border-radius: 11px;
  color: #275b94;
  background: #edf4fc;
  text-decoration: none;
  font-size: 11px;
  font-weight: 850;
}
.game-label-preview {
  padding: 12px;
  border: 1px solid #d3deea;
  border-radius: 13px;
  background: #f7f9fc;
}
.game-label-preview span,
.game-label-preview strong,
.game-label-preview small { display: block; }
.game-label-preview span { color: #53667e; font-size: 11px; font-weight: 850; }
.game-label-preview strong { margin-top: 5px; font-size: 15px; }
.game-label-preview small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }

@media (max-width: 760px) {
  .game-meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .game-meta-grid > div:last-child { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .game-selector-card { padding: 13px; }
  .game-meta-grid { grid-template-columns: 1fr 1fr; }
  .game-meta-grid strong { white-space: normal; }
}

/* Cloudflare 공용 서버 / 관리자 로그인 */
.auth-page {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
}
.auth-card {
  width: min(100%, 440px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: var(--shadow);
}
.auth-icon { font-size: 40px; margin-bottom: 10px; }
.auth-card h1 { margin: 7px 0 8px; font-size: 30px; }
.auth-card > p { margin: 0 0 18px; color: var(--muted); line-height: 1.6; font-size: 13px; }
.auth-card > small { display: block; margin-top: 14px; color: var(--muted); line-height: 1.5; font-size: 10px; }
.auth-form { display: grid; gap: 13px; }
.auth-form label { display: grid; gap: 6px; }
.auth-form label span { color: #53667e; font-size: 11px; font-weight: 850; }
.auth-form input {
  min-height: 48px;
  border: 1px solid #cfd9e6;
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
.auth-form input:focus { border-color: #5b8fca; box-shadow: 0 0 0 3px rgba(46,115,210,.1); }
.auth-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #efc3c3;
  border-radius: 11px;
  color: #a82f2f;
  background: #fff5f5;
  font-size: 12px;
}
.cloud-loading-card {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
}
.cloud-loading-card span { color: var(--muted); font-size: 12px; }
.cloud-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #dbe6f2;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: cloudSpin .8s linear infinite;
}
@keyframes cloudSpin { to { transform: rotate(360deg); } }
.cloud-admin-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cloud-video-box .admin-field { width: 100%; }

@media (max-width: 760px) {
  .cloud-admin-toolbar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 440px) {
  .auth-card { padding: 22px 18px; }
  .cloud-admin-toolbar { grid-template-columns: 1fr; }
}
