/* ============================================================================
   티샷로그 (TheShotLog) — Electric Course Dark 공유 스타일
   디자인 가이드: _docs/style_guide/electric_course_dark_guide.md
   ============================================================================ */

/* ── 폰트 ────────────────────────────────────────────────────── */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ── 티샷로그 로고 + 워드마크 (공통) ───────────────────────── */
.tshotlog-svg { display: block; width: 100%; height: 100%; }
.tshotlog-logomark {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-overlay, #1a2138);
  border: 2px solid var(--lime-300, #d4ff3a);
  color: var(--lime-300, #d4ff3a);
  box-shadow: 0 0 24px rgba(212, 255, 58, 0.35);
}
.tshotlog-logomark.sm { width: 32px; height: 32px; border-radius: 8px; border-width: 1.5px; }
.tshotlog-logomark.md { width: 56px; height: 56px; border-radius: 13px; }
.tshotlog-logomark.lg { width: 80px; height: 80px; border-radius: 18px; }
.tshotlog-logomark.xl { width: 110px; height: 110px; border-radius: 24px; }
.tshotlog-logomark .tshotlog-svg { width: 75%; height: 75%; }
.tshotlog-wordmark {
  font-weight: 800; letter-spacing: -1px; line-height: 1.1;
  font-family: 'Pretendard', sans-serif;
}
.tshotlog-wordmark .accent { color: var(--lime-300, #d4ff3a); }

:root {
  /* ── 4-Layer Ink 배경 ────────────────────────────────────── */
  --bg-base: #050810;
  --bg-surface: #0a0e1a;
  --bg-elevated: #131929;
  --bg-overlay: #1a2138;
  --bg-highlight: #232b45;

  /* ── Lime (Primary Accent) ──────────────────────────────── */
  --lime-200: #e0ff70;
  --lime-300: #d4ff3a;   /* MAIN */
  --lime-400: #c0ed1e;
  --lime-500: #a3e635;
  --lime-800: #4d7c0f;
  --lime-900: #2d4a0a;

  /* ── 호환용 alias (기존 페이지 var(--bg) / var(--accent) 등) ── */
  --bg: var(--bg-base);
  --frame: var(--bg-surface);
  --surface: var(--bg-elevated);
  --surface-2: var(--bg-overlay);
  --surface-3: var(--bg-highlight);
  --border: var(--border-default);
  --accent: var(--lime-300);
  --accent-ink: var(--text-on-lime);
  --accent-2: var(--info);
  --gold: var(--eagle);
  --bad: var(--danger);
  --warn: var(--warning);
  --text: var(--text-primary);
  --text-dim: var(--text-tertiary);
  --text-mute: var(--text-quaternary);

  /* ── Text Hierarchy ──────────────────────────────────────── */
  --text-primary: #f5f7fa;
  --text-secondary: #c8cfe0;
  --text-tertiary: #9ba3c0;
  --text-quaternary: #6e7491;
  --text-on-lime: #050810;

  /* ── Borders ─────────────────────────────────────────────── */
  --border-subtle: rgba(155, 163, 192, 0.08);
  --border-default: rgba(155, 163, 192, 0.14);
  --border-strong: rgba(155, 163, 192, 0.22);
  --border-lime: rgba(212, 255, 58, 0.4);
  --border-lime-strong: rgba(212, 255, 58, 0.8);

  /* ── Semantic ────────────────────────────────────────────── */
  --good: #d4ff3a;
  --info: #38bdf8;
  --warning: #fb923c;
  --danger: #fb7185;
  --eagle: #fde047;

  /* ── Tee Box ─────────────────────────────────────────────── */
  --tee-black: #0a0e1a;
  --tee-blue: #38bdf8;
  --tee-white: #f5f7fa;
  --tee-gold: #fde047;
  --tee-red: #fb7185;

  /* ── Typography (Pretendard 단일 폰트 — TSHOTLOG_TYPOGRAPHY_GUIDE.md) ── */
  --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', '맑은 고딕', sans-serif;
  /* Mono 폰트도 Pretendard 사용 (변수명만 유지 — 한글 fallback 깨짐 방지) */
  --font-mono: 'Pretendard', monospace;

  /* ── Spacing 8px grid ────────────────────────────────────── */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px;

  /* ── Radius ──────────────────────────────────────────────── */
  --radius-sm: 8px;  --radius-md: 12px; --radius-lg: 16px;
  --radius-xl: 20px; --radius-2xl: 24px; --radius-full: 9999px;

  /* ── Touch Targets ───────────────────────────────────────── */
  --touch-min: 48px; --touch-comfy: 56px; --touch-large: 64px; --touch-xl: 72px;

  /* ── Shadows ─────────────────────────────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

  /* ── Lime Glow (signature) ───────────────────────────────── */
  --glow-lime-sm: 0 0 12px rgba(212, 255, 58, 0.2);
  --glow-lime-md: 0 0 24px rgba(212, 255, 58, 0.35);
  --glow-lime-lg: 0 0 48px rgba(212, 255, 58, 0.4);
  --glow-lime-text: 0 0 20px rgba(212, 255, 58, 0.5);

  /* ── Selection State Hierarchy (TSHOTLOG_BUTTON_GUIDE.md §2) ── */
  /* L0 Default — 미선택 */
  --state-default-bg: var(--bg-overlay);
  --state-default-border: var(--border-default);
  --state-default-text: var(--text-primary);
  /* L1 Soft — 일반 선택 (가장 많이 사용, 글로우 X) */
  --state-soft-bg: var(--lime-900);
  --state-soft-border: var(--lime-800);
  --state-soft-text: var(--lime-300);
  /* L2 Medium — 활성·의도 (보조 강조) */
  --state-medium-bg: rgba(212, 255, 58, 0.15);
  --state-medium-border: var(--lime-400);
  --state-medium-text: var(--lime-300);
  /* L3 Strong — CTA·핵심 (화면당 1-2개, 글로우 ON) */
  --state-strong-bg: var(--lime-300);
  --state-strong-border: var(--lime-300);
  --state-strong-text: var(--bg-base);
  --state-strong-glow: var(--glow-lime-md);
  /* L4 Disabled */
  --state-disabled-opacity: 0.5;
}

/* ── Base Reset ───────────────────────────────────────────── */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'tnum';   /* 숫자 자릿수 정렬 */
  font-size: 14px; line-height: 1.5;
  min-height: 100vh; display: flex; justify-content: center;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(212,255,58,.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(56,189,248,.02) 0%, transparent 50%);
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.num, [data-num] { font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums; }

/* ── 모바일 프레임 ─────────────────────────────────────────── */
.frame {
  max-width: 480px; width: 100%;
  background: var(--bg-base); min-height: 100vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.scroll { flex: 1; overflow-y: auto; padding-bottom: 80px; }
.scroll.no-bottomnav { padding-bottom: 0; }

/* ── 페이지 헤더 (단색, 입체감 그라데이션 X) ────────────── */
.page-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4);
  display: flex; align-items: center; justify-content: space-between;
}
.page-header h1 {
  margin: 0; font-size: 17px; font-weight: 700; flex: 1; text-align: center;
  color: var(--text-primary);
}
.page-header .icon-btn { width: var(--touch-comfy); height: var(--touch-comfy); }
.page-header.with-sub { padding-bottom: var(--space-2); }
.page-header .sub {
  width: 100%; color: var(--text-tertiary); font-size: 12px;
  margin-top: 4px; text-align: center; font-family: var(--font-mono);
}

.icon-btn {
  width: var(--touch-comfy); height: var(--touch-comfy); border-radius: var(--radius-md);
  background: transparent; border: 0;
  color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 17px; cursor: pointer;
  transition: all .15s;
}
@media (hover: hover) and (pointer: fine) {
.icon-btn:hover { background: var(--bg-overlay); color: var(--text-primary); }
}
.icon-btn.ghost { background: transparent; border: 0; }

/* ── 카드 ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  margin: var(--space-3) var(--space-4);
}
.card-elevated {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.card-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-mono);
  margin: 0 0 var(--space-3);
}
.card-title .more {
  float: right; color: var(--lime-300); font-weight: 600; font-size: 11px;
  text-transform: none; letter-spacing: 0;
  font-family: var(--font-mono);
}

/* ── 리스트 항목 ─────────────────────────────────────────── */
.list-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .body .title { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.list-item .body .meta { color: var(--text-tertiary); font-size: 12px; margin-top: 2px; }
.list-item .right { color: var(--text-tertiary); font-size: 13px; text-align: right; flex-shrink: 0; }
@media (hover: hover) and (pointer: fine) {
.list-item:hover { background: var(--bg-overlay); }
}

/* ── 칩 / 배지 ───────────────────────────────────────────── */
.chip {
  display: inline-block; padding: 2px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600;
  background: var(--bg-overlay); color: var(--text-tertiary);
  font-family: var(--font-mono); letter-spacing: 0;
}
.chip.good { background: rgba(212,255,58,.12); color: var(--lime-300); }
.chip.bad  { background: rgba(251,113,133,.18); color: var(--danger); }
.chip.warn { background: rgba(251,146,60,.18); color: var(--warning); }
.chip.gold { background: rgba(253,224,71,.18); color: var(--eagle); }
.chip.cyan { background: rgba(56,189,248,.18); color: var(--info); }

/* ── 버튼 (TSHOTLOG_BUTTON_GUIDE §4) ───────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  padding: 0 var(--space-5); height: var(--touch-comfy);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--bg-overlay); color: var(--text-primary);
  font-size: 14px; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: all .15s;
  font-family: var(--font-sans);
}
@media (hover: hover) and (pointer: fine) {
.btn:hover { background: var(--bg-highlight); border-color: var(--border-lime); }
}
.btn:active { transform: scale(0.97); }
/* Primary = L3 Strong (화면당 1-2개) */
.btn.primary {
  background: var(--state-strong-bg); color: var(--state-strong-text);
  border-color: var(--state-strong-border); font-weight: 800;
  box-shadow: var(--state-strong-glow);
}
@media (hover: hover) and (pointer: fine) {
.btn.primary:hover { background: var(--lime-400); box-shadow: var(--glow-lime-lg); }
}
.btn.primary:disabled { opacity: var(--state-disabled-opacity); cursor: not-allowed; box-shadow: none; }
/* 의미색 버튼 */
.btn.success { background: var(--good); color: var(--text-on-lime); border-color: var(--good); font-weight: 800; }
.btn.danger  { background: var(--danger); color: var(--text-on-lime); border-color: var(--danger); font-weight: 800; }
.btn.ghost   { background: transparent; border: 1px solid var(--border-default); color: var(--lime-300); }
@media (hover: hover) and (pointer: fine) {
.btn.ghost:hover { background: rgba(212, 255, 58, 0.1); border-color: var(--border-lime); }
}
.btn.lg { height: var(--touch-large); padding: 0 var(--space-6); font-size: 15px; }
.btn.xl { height: var(--touch-xl); padding: 0 var(--space-8); font-size: 16px; border-radius: var(--radius-lg); }
.btn.block { width: 100%; }

/* ── 선택 상태 위계 유틸리티 (TSHOTLOG_BUTTON_GUIDE §8) ───── */
.state-default {
  background: var(--state-default-bg);
  border: 1.5px solid var(--state-default-border);
  color: var(--state-default-text);
}
.state-soft {
  background: var(--state-soft-bg);
  border: 1.5px solid var(--state-soft-border);
  color: var(--state-soft-text);
  box-shadow: none;
}
.state-medium {
  background: var(--state-medium-bg);
  border: 1.5px solid var(--state-medium-border);
  color: var(--state-medium-text);
  box-shadow: none;
}
.state-strong {
  background: var(--state-strong-bg);
  border: 1.5px solid var(--state-strong-border);
  color: var(--state-strong-text);
  box-shadow: var(--state-strong-glow);
}
.state-disabled {
  opacity: var(--state-disabled-opacity);
  cursor: not-allowed;
  pointer-events: none;
}

/* ── pill / tile 일반 선택 = L1 Soft (글로우 X) ─────────── */
.pill, .tile {
  background: var(--bg-overlay);
  border: 1.5px solid var(--border-default);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  cursor: pointer; transition: all .15s;
  font-weight: 700;
}
/* :hover 는 실제 마우스/포인터 환경에만 — 터치 디바이스 sticky-hover 잔상 방지 */
@media (hover: hover) and (pointer: fine) {
  .pill:hover, .tile:hover { background: var(--bg-highlight); border-color: var(--border-lime); }
}
.pill:active, .tile:active { transform: scale(0.96); }
.pill.active, .tile.selected, .tile.active {
  background: var(--state-soft-bg);
  border-color: var(--state-soft-border);
  color: var(--state-soft-text);
  box-shadow: none;
}
/* CTA 위계가 필요한 곳 — 명시적으로 .emphasis 추가 */
.pill.active.emphasis, .tile.selected.emphasis {
  background: var(--state-strong-bg);
  border-color: var(--state-strong-border);
  color: var(--state-strong-text);
  box-shadow: var(--state-strong-glow);
}

/* ── 폼 ───────────────────────────────────────────────────── */
.field { margin-bottom: var(--space-4); }
.field-label {
  font-size: 11px; color: var(--text-tertiary); font-weight: 600;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono); letter-spacing: 0;
}
.input {
  width: 100%; padding: var(--space-3) var(--space-3);
  background: var(--bg-overlay); border: 1px solid var(--border-default);
  color: var(--text-primary); border-radius: var(--radius-md);
  font-size: 14px; font-family: var(--font-sans);
  transition: all .15s;
}
.input:focus {
  outline: none; border-color: var(--border-lime);
  box-shadow: var(--glow-lime-sm);
}
.input::placeholder { color: var(--text-quaternary); }

.toggle-tabs {
  display: flex; background: var(--bg-elevated); border-radius: var(--radius-md);
  padding: 4px; margin: 0 var(--space-4) var(--space-3);
  border: 1px solid var(--border-subtle);
}
.toggle-tabs .tab {
  flex: 1; padding: var(--space-2); text-align: center;
  color: var(--text-tertiary);
  font-size: 13px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-mono);
}
.toggle-tabs .tab.active {
  background: var(--state-soft-bg);
  color: var(--state-soft-text);
}

/* ── 바텀 네비 ─────────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  max-width: 480px; width: 100%;
  background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
  display: grid; grid-template-columns: repeat(5, 1fr);
  z-index: 20; padding: var(--space-1) var(--space-1) var(--space-2);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: var(--space-2);
  color: var(--text-tertiary); font-size: 11px; font-weight: 600;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--lime-300); }
.nav-item.fab {
  position: relative; top: -16px;
  background: var(--lime-300); color: var(--text-on-lime);
  width: 56px; height: 56px; border-radius: var(--radius-full);
  align-self: center; justify-self: center;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-lime-md);
  font-weight: 800;
}
.nav-item.fab i { font-size: 24px; }
.nav-item.fab span { display: none; }

/* ── 하단 액션바 (페이지 하단 고정 액션 버튼) ────────────── */
.action-bar {
  position: sticky; bottom: 0;
  background: var(--bg-surface); border-top: 1px solid var(--border-subtle);
  padding: var(--space-3) var(--space-4) var(--space-4); display: flex; gap: var(--space-2);
}
.action-bar .btn { flex: 1; }

/* ── 통계 미니 카드 ────────────────────────────────────────── */
.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2); margin: var(--space-3) var(--space-4);
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  transition: border-color .15s;
}
@media (hover: hover) and (pointer: fine) {
.stat-card:hover { border-color: var(--border-lime); }
}
.stat-card .label {
  font-size: 11px; color: var(--text-tertiary); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  font-family: var(--font-mono);
}
.stat-card .value {
  font-size: 28px; font-weight: 800; color: var(--lime-300);
  margin-top: var(--space-1); line-height: 1; letter-spacing: -1px;
  font-feature-settings: 'tnum';
  text-shadow: var(--glow-lime-text);
}
.stat-card .delta {
  font-size: 11px; color: var(--text-tertiary); font-weight: 600;
  margin-top: var(--space-1); font-family: var(--font-mono);
}
.stat-card .delta.bad { color: var(--danger); }
.stat-card .value-dim { color: var(--text-quaternary); text-shadow: none; }

/* ── 스코어카드 테이블 ─────────────────────────────────────── */
.scorecard {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: var(--bg-elevated); border-radius: var(--radius-md);
  overflow: hidden; margin: var(--space-3) var(--space-4);
  width: calc(100% - 2rem);
  font-feature-settings: 'tnum';
}
.scorecard th, .scorecard td {
  padding: var(--space-2); text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}
.scorecard th {
  background: var(--bg-overlay); color: var(--text-tertiary);
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
  font-family: var(--font-mono);
}
.scorecard td { color: var(--text-primary); }
.scorecard td.par { color: var(--text-tertiary); font-size: 12px; font-family: var(--font-mono); }
.scorecard td.score { font-weight: 800; }
.scorecard td.eagle  { background: rgba(253,224,71,.15);  color: var(--eagle); }
.scorecard td.birdie { background: rgba(212,255,58,.12);  color: var(--lime-300); }
.scorecard td.par-good { color: var(--text-primary); }
.scorecard td.bogey  { background: rgba(251,146,60,.15);  color: var(--warning); }
.scorecard td.dbogey { background: rgba(251,113,133,.15); color: var(--danger); }

/* ── 작은 헬퍼 ─────────────────────────────────────────────── */
.muted { color: var(--text-tertiary); }
.dim   { color: var(--text-quaternary); }
.center { text-align: center; }
.gap { padding: var(--space-4) 0; }
.divider { height: 1px; background: var(--border-subtle); margin: var(--space-2) var(--space-4); }
.empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--text-tertiary); }
.empty i { font-size: 36px; opacity: .4; display: block; margin-bottom: var(--space-2); color: var(--text-quaternary); }

/* ── 사이트맵용 ─────────────────────────────────────────────── */
.sitemap { padding: var(--space-8); max-width: 1200px; margin: 0 auto; }
.sitemap h1 { color: var(--text-primary); margin-bottom: var(--space-6); }
.sitemap .grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}
.sitemap .item {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4); transition: all .15s;
  display: block; color: var(--text-primary);
}
@media (hover: hover) and (pointer: fine) {
.sitemap .item:hover { border-color: var(--border-lime); transform: translateY(-2px); }
}
.sitemap .item .num {
  color: var(--lime-300); font-weight: 800; font-size: 12px;
  font-family: var(--font-mono);
}
.sitemap .item h3 { margin: var(--space-1) 0; font-size: 16px; }
.sitemap .item p { margin: 0; font-size: 13px; color: var(--text-tertiary); line-height: 1.4; }
