* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #fafafa;
  color: #333;
  min-height: 100vh;
}

/* Nav bar */
.nav-bar {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 600;
  color: #222;
  text-decoration: none;
}

.nav-logo:hover {
  color: #000;
}

.nav-github {
  color: #666;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.nav-github:hover {
  color: #333;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 48px;
}

.site-title {
  font-size: 40px;
  font-weight: 700;
  color: #222;
  margin-bottom: 8px;
}

.site-subtitle {
  font-size: 16px;
  color: #888;
}

/* Builder */
.builder {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.input-group {
  margin-bottom: 20px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #555;
  margin-bottom: 6px;
}

.input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.input-row input {
  flex: 1;
  padding: 10px 16px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: #4285F4;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: #4285F4;
  color: #fff;
}

.btn-primary:hover {
  background: #3367d6;
}

/* User tags */
.user-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 36px;
}

.user-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f0f4ff;
  border: 1px solid #c5d5f7;
  border-radius: 20px;
  font-size: 14px;
  color: #333;
}

.user-tag .color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.user-tag .remove {
  cursor: pointer;
  color: #999;
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
}

.user-tag .remove:hover {
  color: #e34234;
}

.self-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 20px;
  font-size: 14px;
  color: #333;
  margin-bottom: 4px;
}

.self-tag .remove {
  cursor: pointer;
  color: #999;
  font-size: 16px;
  line-height: 1;
  margin-left: 2px;
}

.self-tag .remove:hover {
  color: #e34234;
}

/* Presets */
.presets {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.presets-label,
.range-label {
  font-size: 13px;
  color: #888;
}

.btn-preset {
  padding: 5px 12px;
  font-size: 13px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #555;
}

.btn-preset:hover {
  background: #eee;
  border-color: #ccc;
}

/* Range selector */
.range-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-range {
  padding: 5px 14px;
  font-size: 13px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #555;
}

.btn-range:hover {
  background: #eee;
}

.btn-reset {
  padding: 5px 14px;
  font-size: 13px;
  background: #fff;
  border: 1px solid #e34234;
  color: #e34234;
  margin-left: auto;
}

.btn-reset:hover {
  background: #e34234;
  color: #fff;
}

.btn-range.active,
.btn-theme.active {
  background: #4285F4;
  color: #fff;
  border-color: #4285F4;
}

.btn-theme {
  padding: 5px 14px;
  font-size: 13px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  color: #555;
}

/* Chart */
.chart-container {
  position: relative;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-placeholder {
  text-align: center;
  color: #aaa;
  font-size: 15px;
  padding: 60px 0;
}

.chart-img {
  width: 100%;
  height: auto;
  display: block;
}

.chart-loading {
  text-align: center;
  color: #888;
  padding: 60px 0;
}

/* Spinner overlay — shown top-right of chart container while loading */
.chart-spinner {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #4285F4;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

/* Embed section */
.embed-section {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.embed-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #333;
}

.embed-code-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
  background: #f6f8fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.embed-code {
  flex: 1;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12px;
  color: #555;
  word-break: break-all;
  line-height: 1.5;
  overflow-x: auto;
}

.btn-copy {
  padding: 8px 16px;
  background: #2EAD6D;
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  align-self: center;
}

.btn-copy:hover {
  background: #259a5e;
}

.btn-copy.copied {
  background: #666;
}

.btn-share {
  margin-top: 12px;
  padding: 10px 20px;
  background: #000;
  color: #fff;
  font-size: 14px;
}

.btn-share:hover {
  background: #333;
}

.embed-hint {
  font-size: 13px;
  color: #888;
}

.embed-hint a {
  color: #4285F4;
  text-decoration: none;
}

.embed-hint a:hover {
  text-decoration: underline;
}

/* Guide */
.guide {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}

.guide-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.guide-steps {
  padding-left: 20px;
  line-height: 2;
  font-size: 15px;
  color: #444;
}

.guide-steps a {
  color: #4285F4;
}

/* Data source */
.data-source {
  font-size: 12px;
  color: #999;
  text-align: center;
  margin-bottom: 32px;
}

/* Footer */
footer {
  text-align: center;
  padding-top: 32px;
  border-top: 1px solid #eee;
  font-size: 13px;
  color: #aaa;
}

footer a {
  color: #888;
  text-decoration: none;
}

footer a:hover {
  color: #555;
}

/* Responsive */
@media (max-width: 600px) {
  .site-title { font-size: 32px; }
  .input-row { flex-direction: column; }
  .range-selector { flex-wrap: wrap; }
  .embed-code-box { flex-direction: column; }
}
