* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  line-height: 1.6;
}

.topbar {
  padding: 24px 16px 16px;
  text-align: center;
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border-bottom: 1px solid #30363d;
}

.topbar h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.topbar .sub { margin: 4px 0 0; font-size: 0.85rem; color: #8b949e; }

main { max-width: 880px; margin: 0 auto; padding: 16px; }

.input-section, .panel, .about {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.hint {
  font-size: 0.82rem;
  color: #8b949e;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.hint code {
  font-family: ui-monospace, monospace;
  background: #21262d;
  padding: 2px 6px;
  border-radius: 3px;
  color: #c9d1d9;
}
.hint button {
  background: #1f6feb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  margin-left: auto;
}
.hint button:hover { background: #388bfd; }

#log {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  border-radius: 6px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  resize: vertical;
}

.status { font-size: 0.82rem; color: #8b949e; margin-top: 8px; min-height: 1.2em; }
.status.error { color: #ff7b72; }

.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.card .value {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
  color: #ffd33d;
}
.card .label { font-size: 0.78rem; color: #8b949e; }

.panel h2 { margin-top: 0; font-size: 1.05rem; }
.dim { color: #8b949e; font-size: 0.82rem; }

.punchcard-wrap { overflow-x: auto; }
#punchcard { display: block; }
#punchcard .cell { stroke: #0d1117; stroke-width: 2; }
#punchcard .label { fill: #8b949e; font-size: 11px; font-family: ui-monospace, monospace; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.two-col .panel { margin-bottom: 0; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

#hours .bar { fill: #1f6feb; }
#hours .bar:hover { fill: #58a6ff; }
#hours .axis-label { fill: #6e7681; font-size: 9px; font-family: ui-monospace, monospace; }

.author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.author-row .name { width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author-row .track { flex: 1; background: #0d1117; border-radius: 3px; height: 16px; overflow: hidden; }
.author-row .fill { height: 100%; background: linear-gradient(90deg, #1f6feb, #58a6ff); }
.author-row .count { width: 36px; text-align: right; font-family: ui-monospace, monospace; color: #8b949e; }

#months .bar { fill: #3fb950; }
#months .bar:hover { fill: #56d364; }
#months .axis-label { fill: #6e7681; font-size: 9px; font-family: ui-monospace, monospace; }

.about h2 { margin-top: 0; font-size: 1.05rem; }
.about p { font-size: 0.9rem; }
.about code { font-family: ui-monospace, monospace; background: #21262d; padding: 1px 5px; border-radius: 3px; }
.about a { color: #58a6ff; }

footer {
  border-top: 1px solid #30363d;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: #8b949e;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 880px;
  margin: 24px auto 0;
}
footer a { color: #58a6ff; }
