/* =====================
   Reset & Base
===================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
  background: #020617;
  color: #e5e7eb;
}

/* =====================
   Header
===================== */

.top {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 16px 12px;
  background:#020617;
}

.top h1 {
    margin: 6px 0 0;
    font-size: 24px;
    text-align: center;
}

.sub {
  margin-top: 4px;
  font-size: 13px;
  opacity: 0.6;
}

/* =====================
   Back Link
===================== */

.back-link {
  display: inline-block;
  font-size: 14px;
  color: #9ca3af;
  text-decoration: none;
}

.back-link:hover {
  color: #ffffff;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: #020617;
  z-index: 1000;
}

/* ヘッダー内レイアウト */
.header-inner {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* ===== Logo ===== */
.logo {
  font-size: 26px;
  font-weight: 600;
  text-decoration: none;
  color: #fff;
}

/* ===== Hamburger ===== */
.hamburger {
  position: relative;
  width: 26px;
  height: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

/* 中央基準にする */
.hamburger span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #ffffff;
  transition: all 0.3s ease;
}

/* 3本線の位置 */
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 8px; }
.hamburger span:nth-child(3) { bottom: 0; }

/* × 変形 */
.hamburger.active span:nth-child(1) {
  top: 8px;
  transform: rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  top: 8px;
  transform: rotate(-45deg);
}

/* ===== Mobile Menu ===== */
.mobile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #0b1220;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: 
    max-height 0.35s ease,
    padding 0.3s ease,
    opacity 0.2s ease;

  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* 開いた状態 */
.mobile-menu.active {
  max-height: 300px;
  padding: 20px;
  opacity: 1;
  width: 200px;
}

/* メニューリンク */
.mobile-menu a,
.mobile-menu a:visited,
.mobile-menu a:hover,
.mobile-menu a:active {
  color: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.hamburger {
  -webkit-tap-highlight-color: transparent; /* モバイルの青消す */
}

.logo {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: #fff;
}

.logo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.logo-text {
  font-size: 22px;
  font-weight: 600;
}

.cg-zero {
  font-size: 0.65em;
  vertical-align: baseline;
  position: relative;
  top: 0.25em;
  opacity: 0.8;
}

/* =========================
   Footer
========================= */

.site-footer {
  padding: 24px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 13px;
  opacity: 0.9;
  background:#020617;
  max-width: 420px;
  margin:0 auto;
}

.footer-links {
  margin-bottom: 12px;
  line-height:2;
}

.footer-links a {
  color: #9fb3ff;
  text-decoration: none;
  margin: 0 10px;
  font-weight: 500;
}

.footer-links a:hover {
  text-decoration: underline;
  opacity: 1;
}

.footer-disclaimer {
  font-size: 12px;
  opacity: 0.6;
  margin-bottom: 8px;
}

.footer-copy {
  font-size: 11px;
  opacity: 0.5;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-bottom: 20px !important;
  width: 280px;
  margin:0 auto;
}

.footer-grid a {
  color: #9ca3af;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}

.footer-grid a:hover {
  color: #ffffff;
}

.zero-count {
  font-size: 0.65em;
  position: relative;
  bottom: 0;
  opacity: 0.7;
}

.up {
  color: #22c55e; /* 緑 */
  font-weight: 600;
}

.down {
  color: #ef4444; /* 赤 */
  font-weight: 600;
}

.flat {
  color: #94a3b8;
}