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

:root {
  --cream: #FAF8F4;
  --ink: #1C1C1A;
  --ink-muted: #4E4B46;
  --ink-faint: #858280;
  --accent: #2E5D3B;
  --accent-light: #EAF1EB;
  --border: rgba(28,28,26,0.1);
  --shadow-sm: 0 2px 12px rgba(28,28,26,0.08);
  --shadow-md: 0 8px 40px rgba(28,28,26,0.12);
  --sans: 'Instrument Sans', sans-serif;
  --serif: 'Cormorant Garamond', serif;
}

html, body {
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── HEADER ── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  background: var(--cream);
  position: relative;
  z-index: 10;
  animation: fadeDown 0.5s ease both;
  gap: 12px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.site-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 6px;
}

.site-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* ── SOCIAL LINKS ── */
.social-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  text-decoration: none;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}
.social-link:hover {
  color: var(--ink);
  border-color: var(--ink-faint);
  background: rgba(128,128,120,0.06);
}
.social-link svg { flex-shrink: 0; }

/* ── INTRO STRIP ── */
.intro {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 11px 60px 11px 24px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  animation: fadeDown 0.5s 0.1s ease both;
}

.intro-text {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--ink-muted);
  text-align: center;
}

.intro-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
}

.intro-tip {
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ── HELP BUTTON (in intro strip) ── */
.help-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px 6px 8px;
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}
.help-btn:hover {
  color: var(--ink);
  border-color: rgba(46,93,59,0.4);
  background: var(--accent-light);
}
.help-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.help-btn.active svg { stroke: #fff; }
.help-label { line-height: 1; }

/* ── GRAPH WRAPPER ── */
.graph-section {
  flex: 1;
  position: relative;
  display: flex;
}

.graph-section iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: none;
  display: block;
  touch-action: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── GUIDE PANEL ── */
.guide-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  pointer-events: none;
}

.guide-panel {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 300px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.25s cubic-bezier(.4,0,.2,1);
}
.guide-panel.visible {
  pointer-events: all;
  transform: translateY(0) scale(1);
  opacity: 1;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.guide-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}

.guide-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px;
  transition: color 0.15s;
}
.guide-close:hover { color: var(--ink); }

.guide-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.guide-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.guide-item-text strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}
.guide-item-text span {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.guide-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── FOOTER ── */
footer {
  padding: 14px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: fadeUp 0.5s 0.3s ease both;
}

.footer-left {
  font-size: 12px;
  color: var(--ink-faint);
}

.footer-right {
  font-size: 12px;
  color: var(--ink-faint);
}
.footer-right a {
  color: var(--ink-muted);
  text-decoration: none;
}
.footer-right a:hover { color: var(--ink); }

/* ── ANIMATIONS ── */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE: TABLET (≤768px) ── */
@media (max-width: 768px) {
  header {
    padding: 0 20px;
    height: 56px;
  }
  .site-title { font-size: 18px; }
  .site-subtitle { font-size: 11px; }
  .intro {
    padding: 10px 52px 10px 20px;
    gap: 6px;
  }
  .intro-dot { display: none; }
  .intro-tip { display: none; }
  .graph-section iframe {
    min-height: 420px;
  }
  .guide-panel {
    width: 280px;
  }
  footer {
    padding: 12px 20px;
  }
}

/* ── RESPONSIVE: MOBILE (≤480px) ── */
@media (max-width: 480px) {
  header {
    padding: 0 16px;
    height: 52px;
    gap: 8px;
  }
  .site-logo { width: 24px; height: 24px; }
  .site-title { font-size: 17px; }
  .site-subtitle { font-size: 10px; }
  .intro {
    padding: 9px 48px 9px 16px;
  }
  .intro-text { font-size: 13px; }
  .help-btn {
    right: 12px;
    padding: 6px 8px;
  }
  .help-label { display: none; }
  .graph-section iframe {
    min-height: 360px;
    padding-bottom: 56px;
  }
  .guide-overlay {
    padding: 12px;
    align-items: flex-end;
    justify-content: stretch;
  }
  .guide-panel {
    width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 20px 18px;
  }
  footer {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}