/* =========================================
   Qoo10 Design System Tokens
   Source: eBay-JapanPM/qoo10-design-system-assets
   ========================================= */
:root {
  /* Brand */
  --c-brand: #FD4752;
  --c-brand-dark: #E03040;
  --c-brand-surface: #FFEFED;
  --c-gradient-strong: linear-gradient(90deg, #fd4752 0%, #ff60cd 100%);
  --c-gradient-vivid: linear-gradient(123deg, #75a8ff 0%, #ff60cd 100%);

  /* Backgrounds */
  --c-bg: #F7F7FA;
  --c-surface: #FFFFFF;
  --c-surface-disabled: #F9F9FB;

  /* Text */
  --c-text: #19191A;
  --c-text-2: #7E8189;
  --c-text-3: #989CA5;
  --c-text-disabled: #C1C4CC;
  --c-text-on-surface: #FFFFFF;
  --c-text-link: #3360FF;
  --c-success: #4CAA00;
  --c-warning: #FF9900;
  --c-danger: #FD4752;

  /* Borders */
  --c-border: #E8E9ED;
  --c-border-strong: #C1C4CC;
  --c-border-focused: #19191A;
  --c-border-disabled: #DCDDE2;

  /* Status surfaces */
  --c-success-surface: #EDFAF2;
  --c-warning-surface: #FFF7ED;
  --c-danger-surface: #FFEFED;

  /* Spacing (Qoo10 spacing scale) */
  --s-xxs: 2px;
  --s-xs:  4px;
  --s-s:   8px;
  --s-m:  12px;
  --s-l:  16px;
  --s-xl: 20px;
  --s-2xl:24px;
  --s-3xl:32px;

  /* Border Radius */
  --r-xs:  4px;
  --r-s:   6px;
  --r-m:   8px;
  --r-l:  12px;
  --r-xl: 16px;
  --r-2xl:20px;
  --r-pill:1000px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(25,25,26,0.08), 0 0 0 1px rgba(25,25,26,0.04);
  --shadow-md: 0 4px 12px rgba(25,25,26,0.12);
}

/* =========================================
   Reset & Base
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px; /* body-large */
  -webkit-font-smoothing: antialiased;
}

/* =========================================
   Header
   ========================================= */
header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 var(--s-l);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 18px; /* title-large */
  font-weight: 800;
  background: var(--c-gradient-strong);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo em {
  font-style: normal;
  -webkit-text-fill-color: var(--c-text);
}
.header-badge {
  font-size: 11px; /* caption-medium */
  color: var(--c-text-3);
  background: var(--c-bg);
  padding: var(--s-xs) var(--s-s);
  border-radius: var(--r-pill);
  border: 1px solid var(--c-border);
}

/* =========================================
   Container & Hero
   ========================================= */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--s-2xl) var(--s-l) 80px;
}

.hero {
  text-align: center;
  padding: var(--s-3xl) 0 var(--s-2xl);
}
.hero-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--c-gradient-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--s-l);
  font-size: 28px;
}
.hero h1 {
  font-size: 24px; /* display-small */
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.3;
  margin-bottom: var(--s-s);
  color: var(--c-text);
}
.hero h1 span {
  background: var(--c-gradient-strong);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 13px; /* body-medium */
  color: var(--c-text-2);
  line-height: 1.7;
}
.feature-chips {
  display: flex;
  justify-content: center;
  gap: var(--s-s);
  margin-top: var(--s-m);
  flex-wrap: wrap;
}
.feature-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-xs);
  padding: var(--s-xs) var(--s-m);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-pill);
  font-size: 12px; /* body-small */
  color: var(--c-text-2);
  font-weight: 600;
}

/* =========================================
   Cards
   ========================================= */
.card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  padding: var(--s-xl);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s-m);
}
.card-title {
  font-size: 16px; /* title-medium */
  font-weight: 700;
  margin-bottom: var(--s-l);
  display: flex;
  align-items: center;
  gap: var(--s-s);
  color: var(--c-text);
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-brand);
  color: var(--c-text-on-surface);
  font-size: 11px; /* caption-medium */
  font-weight: 800;
  flex-shrink: 0;
}

/* =========================================
   Form Elements
   ========================================= */
.form-group { margin-bottom: var(--s-m); }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px; /* body-small */
  font-weight: 700;
  color: var(--c-text-2);
  margin-bottom: var(--s-xs);
  letter-spacing: 0.2px;
}
label .opt {
  font-weight: 400;
  color: var(--c-text-3);
}

input[type="text"],
input[type="date"] {
  width: 100%;
  padding: var(--s-s) var(--s-m);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-m);
  font-size: 14px; /* body-large */
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: var(--c-surface);
  color: var(--c-text);
  height: 44px;
}
input:focus { border-color: var(--c-border-focused); box-shadow: 0 0 0 3px rgba(25,25,26,0.08); }
input::placeholder { color: var(--c-text-3); }

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-s);
}

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-s) var(--s-m);
  border: 1px solid var(--c-border);
  border-radius: var(--r-m);
  cursor: pointer;
  user-select: none;
}
.toggle-label { font-size: 13px; color: var(--c-text-2); font-weight: 500; }
.toggle-switch {
  width: 38px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--c-border-strong);
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-surface);
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on { background: var(--c-brand); }
.toggle-switch.on::after { transform: translateX(16px); }

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-xs);
  padding: 0 var(--s-2xl);
  border-radius: var(--r-m);
  font-size: 14px; /* body-large */
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  height: 48px;
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-gradient-strong);
  color: var(--c-text-on-surface);
  width: 100%;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--c-brand);
  color: var(--c-brand);
  width: 100%;
}
.btn-outline:hover { background: var(--c-brand-surface); }
.btn-secondary {
  background: var(--c-bg);
  color: var(--c-text-2);
  width: 100%;
  border: 1px solid var(--c-border-strong);
}
.btn-secondary:hover { background: var(--c-border); }
.btn-sm {
  height: 34px;
  padding: 0 var(--s-m);
  font-size: 12px; /* body-small */
  border-radius: var(--r-s);
  width: auto;
}
.btn-xs {
  height: 28px;
  padding: 0 var(--s-s);
  font-size: 11px; /* caption-medium */
  border-radius: var(--r-xs);
  width: auto;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* =========================================
   Date Grid
   ========================================= */
.date-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--s-s);
}
.date-item {
  padding: var(--s-s) var(--s-xs);
  border-radius: var(--r-m);
  border: 1px solid var(--c-border);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  user-select: none;
  line-height: 1.3;
  background: var(--c-surface);
}
.date-item:hover { border-color: var(--c-brand); background: var(--c-brand-surface); }
.date-item .d-num {
  font-size: 18px; /* display-xsmall but smaller */
  font-weight: 800;
  color: var(--c-text);
  display: block;
}
.date-item .d-info {
  font-size: 11px; /* caption-medium */
  color: var(--c-text-3);
  margin-top: 2px;
}
.date-item.weekend .d-num { color: var(--c-danger); }
.date-item.sat .d-num { color: #3360FF; }
.date-item.selected {
  border-color: var(--c-success);
  background: var(--c-success-surface);
}
.date-item.selected .d-num { color: #2D8A00; }
.date-item.selected .d-info { color: #4CAA00; }

/* =========================================
   Station Autocomplete
   ========================================= */
.ac-wrapper { position: relative; }
.ac-list {
  position: absolute;
  top: calc(100% + var(--s-xs));
  left: 0;
  right: 0;
  background: var(--c-surface);
  border: 1.5px solid var(--c-text);
  border-radius: var(--r-l);
  max-height: 220px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: var(--shadow-md);
}
.ac-list:empty { display: none; }
.ac-item {
  padding: var(--s-s) var(--s-m);
  cursor: pointer;
  font-size: 13px; /* body-medium */
  display: flex;
  align-items: center;
  gap: var(--s-s);
  border-bottom: 1px solid var(--c-border);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: var(--c-bg); }
.ac-item-name { font-weight: 600; color: var(--c-text); }
.line-tags { display: flex; gap: 3px; flex-wrap: wrap; }

/* Line badges */
.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: var(--r-xs);
  font-size: 10px; /* caption-small */
  font-weight: 800;
  color: white;
}

.station-selected {
  margin-top: var(--s-xs);
  padding: var(--s-s) var(--s-m);
  background: var(--c-bg);
  border-radius: var(--r-s);
  font-size: 13px;
  color: var(--c-text);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--c-border);
}
.station-selected .clear-btn {
  background: none;
  border: none;
  color: var(--c-text-3);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

/* =========================================
   Results — Date Ranking
   ========================================= */
.rank-card {
  display: flex;
  align-items: center;
  gap: var(--s-m);
  padding: var(--s-m);
  border-radius: var(--r-l);
  border: 1px solid var(--c-border);
  margin-bottom: var(--s-s);
  background: var(--c-surface);
  transition: border-color 0.15s;
}
.rank-1 { border-color: #FFBD00; background: #FFFBEB; }
.rank-2 { border-color: #B0B0B0; background: #FAFAFA; }
.rank-3 { border-color: #CD7C2F; background: #FFF7ED; }

.rank-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px; /* body-medium */
  color: white;
  flex-shrink: 0;
}
.rank-1 .rank-num { background: #FFBD00; }
.rank-2 .rank-num { background: #B0B0B0; }
.rank-3 .rank-num { background: #CD7C2F; }
.rank-num-other {
  width: 34px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text-3);
  flex-shrink: 0;
}

.rank-info { flex: 1; min-width: 0; }
.rank-date { font-size: 15px; font-weight: 700; color: var(--c-text); }
.rank-people { font-size: 12px; color: var(--c-text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rank-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-brand);
  text-align: right;
  flex-shrink: 0;
}
.rank-count small { font-size: 11px; font-weight: 400; color: var(--c-text-3); display: block; }

/* Progress bar */
.progress {
  height: 3px;
  background: var(--c-border);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: var(--s-xs);
}
.progress-fill {
  height: 100%;
  background: var(--c-gradient-strong);
  border-radius: var(--r-pill);
  transition: width 0.5s ease;
}

/* =========================================
   Results — Station
   ========================================= */
.station-card {
  display: flex;
  align-items: center;
  gap: var(--s-m);
  padding: var(--s-m);
  border-radius: var(--r-l);
  border: 1px solid var(--c-border);
  margin-bottom: var(--s-s);
  background: var(--c-surface);
  cursor: default;
}
.station-rank {
  font-size: 22px;
  font-weight: 800;
  min-width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.station-rank.s1 { color: var(--c-brand); }
.station-rank.s2 { color: var(--c-text-3); }
.station-rank.s3 { color: var(--c-text-3); }
.station-info { flex: 1; }
.station-name { font-size: 16px; /* title-medium */ font-weight: 700; }
.station-lines { margin-top: var(--s-xs); display: flex; gap: 3px; flex-wrap: wrap; }

/* =========================================
   Share Box
   ========================================= */
.share-box {
  display: flex;
  gap: var(--s-s);
  align-items: center;
  padding: var(--s-s) var(--s-m);
  background: var(--c-bg);
  border-radius: var(--r-m);
  border: 1px solid var(--c-border);
}
.share-url {
  flex: 1;
  font-size: 12px; /* body-small */
  color: var(--c-text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-btn {
  padding: var(--s-xs) var(--s-m);
  border-radius: var(--r-s);
  background: var(--c-brand);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.copy-btn:active { opacity: 0.8; }
.copy-btn.copied { background: var(--c-success); }

/* =========================================
   Alerts
   ========================================= */
.alert {
  padding: var(--s-s) var(--s-m);
  border-radius: var(--r-m);
  font-size: 13px; /* body-medium */
  margin-bottom: var(--s-m);
}
.alert-info {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.alert-success {
  background: var(--c-success-surface);
  color: #2D8A00;
  border: 1px solid #BBEED4;
}
.alert-warning {
  background: var(--c-warning-surface);
  color: #92400E;
  border: 1px solid #FDE68A;
}
.alert-brand {
  background: var(--c-brand-surface);
  color: var(--c-brand-dark);
  border: 1px solid #FFCDD0;
}

/* =========================================
   Loading / Empty / Success
   ========================================= */
.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--c-text-3);
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto var(--s-m);
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: var(--s-3xl) var(--s-xl);
  color: var(--c-text-3);
  font-size: 13px;
}

.success-screen {
  text-align: center;
  padding: var(--s-3xl) var(--s-xl);
}
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-xl);
  background: var(--c-success-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--s-l);
  font-size: 30px;
}
.success-screen h2 { font-size: 20px; font-weight: 800; margin-bottom: var(--s-xs); }
.success-screen p { font-size: 13px; color: var(--c-text-2); margin-bottom: var(--s-xl); }

/* =========================================
   Misc
   ========================================= */
.section-label {
  font-size: 11px; /* caption-medium */
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--c-text-3);
  margin-bottom: var(--s-s);
}
.divider {
  height: 1px;
  background: var(--c-border);
  margin: var(--s-m) 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--s-s);
  border-radius: var(--r-pill);
  font-size: 11px; /* caption-medium */
  font-weight: 600;
  background: var(--c-bg);
  color: var(--c-text-2);
  border: 1px solid var(--c-border);
  margin: 2px;
}
.participant-chips { display: flex; flex-wrap: wrap; gap: var(--s-xs); }
.participant-chip {
  padding: var(--s-xs) var(--s-s);
  border-radius: var(--r-pill);
  background: var(--c-bg);
  font-size: 12px; /* body-small */
  border: 1px solid var(--c-border);
  color: var(--c-text-2);
}

/* =========================================
   Responsive — Mobile first (≤1024px)
   ========================================= */
@media (max-width: 480px) {
  .date-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
  .hero h1 { font-size: 22px; }
  .row-2 { grid-template-columns: 1fr; }
  .rank-card { flex-wrap: nowrap; }
}

/* PC grid는 모바일(≤1024px)에서 단일 컬럼 */
.pc-grid { display: block; }
.pc-index-grid { display: block; }

/* =========================================
   PC Layout (>1024px) — 2-column
   ========================================= */
@media (min-width: 1025px) {
  /* 헤더 PC 정렬 — 컨테이너와 동일 너비 */
  .header-inner {
    max-width: 1100px;
    padding: 0 var(--s-3xl);
    height: 60px;
  }
  .logo { font-size: 22px; }

  /* 전체 폰트 사이즈 스케일업 */
  body { font-size: 16px; }
  input[type="text"], input[type="date"] { font-size: 16px; height: 48px; }
  label { font-size: 13px; }
  .card-title { font-size: 18px; }
  .btn { font-size: 16px; height: 52px; }
  .btn-sm { font-size: 13px; height: 36px; }
  .alert { font-size: 14px; }
  .rank-date { font-size: 16px; }
  .rank-count { font-size: 24px; }
  .station-name { font-size: 18px; }

  .container {
    max-width: 1100px;
    padding: var(--s-3xl) var(--s-3xl) 80px;
  }

  /* PC two-column grid wrapper */
  .pc-grid {
    display: grid;
    gap: var(--s-xl);
    align-items: start;
  }
  .pc-grid-2 { grid-template-columns: 1fr 1fr; }
  .pc-grid-3-2 { grid-template-columns: 3fr 2fr; }
  .pc-grid-2-3 { grid-template-columns: 2fr 3fr; }

  /* index.html: hero left, form right */
  .pc-index-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-3xl);
    align-items: stretch;
  }
  .pc-hero-col {
    position: sticky;
    top: 80px;
  }
  .hero { text-align: left; padding: var(--s-3xl) 0 0; }
  .hero-icon { margin-left: 0; }
  .pc-form-col { display: flex; flex-direction: column; justify-content: flex-end; }
  .hero h1 { font-size: 32px; }
  .hero p  { font-size: 15px; }
  .feature-chips { justify-content: flex-start; }
  .how-to-section { margin-top: 0; }

  /* vote.html: left=name+station, right=date grid */
  .pc-vote-left  { display: flex; flex-direction: column; gap: 0; }
  .pc-vote-right { display: flex; flex-direction: column; gap: 0; }

  /* result.html: equal-height columns */
  .pc-equal-height { align-items: stretch; }
  .result-panel { display: flex; flex-direction: column; height: 100%; }

  /* Larger date grid on PC */
  .date-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .date-item .d-num { font-size: 20px; }
  .date-item .d-info { font-size: 12px; }

  /* success-screen PC 전체 너비 */
  .success-screen { padding: var(--s-3xl) 20%; }
  .success-screen h2 { font-size: 28px; }
  .success-screen p { font-size: 16px; }
}

/* =========================================
   Sticky CTA Bar (vote.html)
   ========================================= */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--c-border);
  padding: var(--s-m) var(--s-l);
  padding-bottom: calc(var(--s-m) + env(safe-area-inset-bottom));
}
.sticky-cta-inner {
  max-width: 600px;
  margin: 0 auto;
}
@media (min-width: 1025px) {
  .sticky-cta {
    position: static;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
    padding: 0 var(--s-3xl) var(--s-3xl);
  }
  .sticky-cta-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
  }
}

/* 페이지 하단에 sticky 바 높이만큼 여백 추가 (모바일만) */
.container { padding-bottom: 120px; }
@media (min-width: 1025px) {
  .container { padding-bottom: 0; }
}

/* =========================================
   How-to 사용 안내 토글 (모바일 툴팁)
   ========================================= */
.how-to-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--s-xs);
  padding: var(--s-xs) var(--s-m);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-2);
  background: var(--c-surface);
  cursor: pointer;
  font-family: inherit;
  margin-bottom: var(--s-s);
  transition: border-color 0.15s, color 0.15s;
}
.how-to-trigger:hover { border-color: var(--c-brand); color: var(--c-brand); }
.how-to-chevron { transition: transform 0.2s; }
.how-to-trigger[aria-expanded="true"] .how-to-chevron { transform: rotate(180deg); }
.how-to-label { display: none; }
.how-to-card { display: none; }
.how-to-card.open { display: block; }

@media (min-width: 1025px) {
  .how-to-trigger { display: none; }
  .how-to-label { display: block; }
  .how-to-card { display: block; }
}

/* Scroll to top fix */
html { scroll-behavior: smooth; }
