:root {
  --bg: #f2f4f6;
  --card: #ffffff;
  --text: #191f28;
  --muted: #6b7684;
  --line: #e5e8eb;
  --blue: #3182f6;
  --blue-weak: #e8f1ff;
  --green: #00c73c;
  --red: #f04452;
  --yellow: #ffc342;
  --radius: 20px;
  --shadow: 0 4px 16px rgba(0, 21, 73, 0.04);
  --t-caption: 13px;
  --t-body: 15px;
  --t-title: 17px;
  --t-num: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
code { font-size: 12px; color: var(--muted); }

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(242, 244, 246, 0.92);
  backdrop-filter: blur(12px);
}
.brand { font-weight: 800; font-size: var(--t-title); color: var(--text); letter-spacing: -0.04em; }
.top-nav { display: flex; gap: 16px; flex: 1; }
.top-nav a { color: var(--muted); font-weight: 700; }
.top-nav a.on { color: var(--text); }
.top button {
  background: transparent;
  color: var(--muted);
  border: 0;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.tabbar { display: none; }

main {
  padding: 8px 20px 40px;
  max-width: 1080px;
  margin: 0 auto;
}

h1, h2 { margin: 0; font-size: var(--t-title); letter-spacing: -0.03em; line-height: 1.35; font-weight: 800; }
.page-head, .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-head { margin: 4px 0 16px; }
.card-head { margin-bottom: 16px; }
.card-head h2 a { color: var(--text); }
.card-head > strong { font-size: var(--t-title); font-weight: 800; }
.card-link {
  color: var(--muted);
  font-size: var(--t-caption);
  font-weight: 600;
}
.metric { margin-bottom: 20px; }
.metric strong { display: block; font-size: var(--t-num); letter-spacing: -0.04em; font-weight: 800; line-height: 1.2; }
.metric p, .caption {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--t-caption);
  line-height: 1.45;
}
.caption { margin: -8px 0 16px; }
.help-btn {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e5e8eb;
  color: #8b95a1;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
}
.help-btn:active { background: #d1d6db; }
.help-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.help-layer[hidden] { display: none; }
.help-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 19, 43, 0.4);
  cursor: pointer;
}
.help-sheet {
  position: relative;
  width: min(480px, 100%);
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 32px rgba(0, 21, 73, 0.08);
}
.help-sheet h3 { margin: 0 0 10px; font-size: 20px; letter-spacing: -0.03em; }
.help-sheet p { margin: 0 0 24px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.help-ok {
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
@media (min-width: 641px) {
  .help-layer { align-items: center; }
  .help-sheet { border-radius: 24px; padding: 28px 24px; }
}
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.kpis article, .panel, .login-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpis article { padding: 16px; }
.kpis span { color: var(--muted); font-size: var(--t-caption); font-weight: 600; }
.kpis strong { display: block; font-size: var(--t-title); margin: 8px 0 0; letter-spacing: -0.03em; font-weight: 800; }
.up { color: var(--red) !important; }
.down { color: var(--blue) !important; }
.mute { color: var(--muted) !important; font-weight: 600; }

.panel { padding: 20px; margin-bottom: 12px; }
.month-nav { display: flex; gap: 8px; }
.month-nav a {
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: var(--t-caption); font-weight: 600; padding: 8px 4px; }
td { padding: 12px 4px; border-top: 1px solid var(--line); font-size: var(--t-body); }

.cal-wrap { overflow: hidden; padding: 12px; }
.cal-head, .cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head span { color: var(--muted); font-size: 12px; padding: 8px 4px; text-align: center; font-weight: 600; }
.cal-day {
  min-height: 72px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text);
  border-radius: 12px;
}
.cal-day em { font-style: normal; color: var(--muted); font-size: 12px; font-weight: 600; }
.cal-day b { font-size: 12px; }
.cal-day.dim { opacity: 0.28; }
.cal-day.off { background: #f9fafb; }
.cal-day.win { background: #fff1f1; }
.cal-day.lose { background: #eef4ff; }
.cal-day.wait { background: var(--blue-weak); }

.news { list-style: none; padding: 0; margin: 0; }
.news li { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.news a { flex: 1; word-break: break-word; color: var(--text); font-weight: 600; }
.news .empty { color: var(--muted); }
.tag {
  flex-shrink: 0;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-weak);
  color: var(--blue);
  font-weight: 700;
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(400px, 100%); padding: 36px 24px 32px; }
.login-card h1 { margin-bottom: 8px; font-size: 32px; }
.login-card label { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin: 24px 0 12px; }
.pw-field { position: relative; display: block; margin-top: 8px; }
.login-card input {
  width: 100%;
  padding: 16px 48px 16px 14px;
  border-radius: 14px;
  border: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #8b95a1;
  cursor: pointer;
}
.pw-toggle svg { width: 22px; height: 22px; fill: currentColor; display: block; margin: 0 auto; }
.pw-toggle .eye-off { display: none; }
.pw-toggle.is-on .eye-on { display: none; }
.pw-toggle.is-on .eye-off { display: block; }
.login-card button[type="submit"] {
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}
.err { color: var(--red); font-weight: 600; }

.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-list li { border-top: 1px solid var(--line); }
.pick-list a {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  color: var(--text);
}
.pick-list em {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.pick-list b { font-size: var(--t-body); }
.pick-list small { display: block; color: var(--muted); margin-top: 4px; font-size: var(--t-caption); }
.pick-list a > strong { font-size: var(--t-body); font-weight: 700; }
.wait { color: var(--blue) !important; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
}
.pair.four { grid-template-columns: repeat(4, 1fr); }
.pair > div { background: var(--bg); border-radius: 14px; padding: 12px; }
.pair dt { color: var(--muted); font-size: var(--t-caption); font-weight: 600; }
.pair dd { margin: 6px 0 0; font-weight: 800; font-size: var(--t-body); }
.chart-box { position: relative; min-height: 168px; background: var(--bg); border-radius: 16px; padding: 8px; }
.chart-box.tall { min-height: 208px; }
.chart-box canvas { width: 100% !important; height: 160px !important; display: block; }
.chart-box.tall canvas { height: 200px !important; }
.empty-chart {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0;
  text-align: center;
  padding: 16px;
}
.empty-chart.hide { display: none; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 12px; }
.panel.empty { color: var(--muted); }
.guide p, .guide li, .guide dd {
  margin: 0;
  color: var(--text);
  font-size: var(--t-body);
  line-height: 1.65;
}
.guide ul { margin: 0; padding-left: 18px; }
.guide li + li, .guide .guide-steps > div + div { margin-top: 12px; }
.guide-steps { margin: 0; }
.guide-steps dt { color: var(--blue); font-size: var(--t-caption); font-weight: 800; margin-bottom: 4px; }
.guide-steps dd { margin: 0; }

@media (max-width: 900px) {
  .kpis, .split, .pair.four { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
  main { padding: 8px 16px 96px; }
  .top-nav { display: none; }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 8;
  }
  .tabbar a {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    color: var(--muted);
    font-weight: 800;
    border-radius: 12px;
  }
  .tabbar a.on { color: var(--blue); background: var(--blue-weak); }
}

@media (max-width: 640px) {
  .metric strong { font-size: 24px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 54px; padding: 6px 3px; }
  .cal-day b { font-size: 10px; }
}
