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

body {
  background: #0a0a0f;
  color: #d0d0d0;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  font-size: 14px;
}

.header {
  padding: 10px 20px;
  background: #111118;
  border-bottom: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 100;
}

.header h1 {
  font-size: 24px;
  color: #e0e0e0;
  font-weight: 700;
  letter-spacing: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
}

#pairSelect {
  background: #1a1a24;
  color: #e0e0e0;
  border: 1px solid #333;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  min-width: 120px;
}

#pairSelect:hover {
  border-color: #555;
}

#pairSelect optgroup {
  background: #1a1a24;
  color: #888;
  font-style: normal;
  font-size: 12px;
}

#pairSelect option {
  background: #1a1a24;
  color: #e0e0e0;
  padding: 2px 8px;
}

.status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333;
}

.status-dot.ok { background: #4caf50; }
.status-dot.warn { background: #ff9800; }
.status-dot.error { background: #f44336; }

/* サマリーバー */
.summary-bar {
  padding: 8px 16px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a24;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-item .label {
  color: #888;
}

.summary-item .value {
  color: #e0e0e0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.value.positive { color: #4caf50; }
.value.negative { color: #f44336; }
.value.neutral  { color: #ff9800; }

/* 建値ゾーン */
.entry-zone {
  padding: 6px 16px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a24;
  display: flex;
  gap: 16px;
  font-size: 13px;
  flex-wrap: wrap;
}

.entry-zone .zone-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zone-long { color: #26a69a; }
.zone-short { color: #ef5350; }

/* 指標パネル群 */
.panels-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.panel {
  border-bottom: 1px solid #1a1a24;
  padding: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #0e0e16;
  border-bottom: 1px solid #1a1a24;
  user-select: none;
}

.panel-header:hover {
  background: #12121c;
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-value {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* チャート領域 - position:relativeはクロスヘア同期用 */
.panel-chart {
  height: 120px;
  width: 100%;
  position: relative;
}

.panel-chart.tall {
  height: 200px;
}

.panel-chart.indicator-chart2 {
  height: 140px;
  border-top: 1px solid #1a1a24;
}

/* クロスヘア同期線 */
.sync-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
  display: none;
  z-index: 10;
}

/* 指標セレクタ */
.indicator-selector-header {
  padding: 8px 12px;
}

#indicatorSelect {
  background: #1a1a24;
  color: #e0e0e0;
  border: 1px solid #333;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  max-width: 70%;
}

#indicatorSelect:hover {
  border-color: #555;
}

/* チャート凡例 */
.chart-legend {
  display: flex;
  gap: 12px;
  padding: 4px 12px 6px;
  background: #0e0e16;
  font-size: 11px;
  color: #888;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-color {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 1px;
}

.legend-color.dashed {
  border-top: 2px dashed;
  background: none !important;
  height: 0;
}

/* 空データ表示 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: #555;
  gap: 12px;
}

.empty-state h2 {
  font-size: 20px;
  color: #777;
}

.empty-state p {
  font-size: 14px;
  max-width: 500px;
  text-align: center;
  line-height: 1.6;
}

/* ========================================
   レスポンシブ（スマホ対応）
   ======================================== */

@media (max-width: 768px) {
  .header {
    padding: 8px 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .header h1 {
    font-size: 20px;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  #pairSelect {
    font-size: 14px;
    padding: 6px 8px;
    flex: 1;
    max-width: 45%;
  }

  #lastUpdate {
    display: none;
  }

  .summary-bar {
    padding: 6px 12px;
    gap: 10px;
    font-size: 12px;
  }

  .entry-zone {
    padding: 6px 12px;
    gap: 10px;
    font-size: 12px;
  }

  /* 価格チャート: スマホでも大きめに */
  #priceChart {
    height: 300px !important;
  }

  /* 指標チャート */
  .panel-chart.tall {
    height: 180px;
  }

  .panel-chart.indicator-chart2 {
    height: 120px;
  }

  .indicator-selector-header {
    padding: 6px 8px;
  }

  #indicatorSelect {
    font-size: 12px;
    max-width: 65%;
  }

  .chart-legend {
    gap: 8px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .panel-value {
    font-size: 11px;
  }
}

@media (max-width: 400px) {
  .header h1 {
    font-size: 18px;
  }

  .summary-bar {
    gap: 8px;
    font-size: 11px;
  }

  .entry-zone {
    flex-direction: column;
    gap: 4px;
  }

  #priceChart {
    height: 250px !important;
  }

  .panel-chart.tall {
    height: 150px;
  }

  .panel-chart.indicator-chart2 {
    height: 100px;
  }
}
/* ========================================
   ブローカー比率ページ レイアウト
   ======================================== */

.broker-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-areas:
    "main side"
    "main sidead";
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.broker-main { grid-area: main; min-width: 0; }
.broker-side { grid-area: side; }
.broker-side-ad { grid-area: sidead; }

/* 表示トグル（凡例兼用） */
.toggle-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 4px 12px;
}

.toggle-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: #12121c;
  border: 1px solid #1f1f2c;
  border-radius: 6px;
  font-size: 12px;
  color: #cfcfcf;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
}

.toggle-item:hover { border-color: #3a3a4a; }

.toggle-item--avg {
  background: #181820;
  border-color: #3a3a44;
}

.toggle-item input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: #00e5ff;
  cursor: pointer;
  margin: 0;
}

.toggle-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 1px;
}

.toggle-swatch--avg { height: 4px; }

.toggle-label { font-weight: 600; color: #e0e0e0; }

.toggle-val {
  color: #9aa;
  font-variant-numeric: tabular-nums;
}

.toggle-note {
  font-size: 10px;
  color: #c98;
  border: 1px solid #4a3a2a;
  border-radius: 3px;
  padding: 0 4px;
}

/* 価格チャート「データなし」 */
.price-empty {
  padding: 10px 12px;
  color: #666;
  font-size: 12px;
}

/* ========================================
   現在値一覧（サイド）
   ======================================== */

.side-panel {
  background: #0e0e16;
  border: 1px solid #1a1a24;
  border-radius: 8px;
  overflow: hidden;
}

.side-panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 12px;
  background: #111118;
  border-bottom: 1px solid #1a1a24;
}

.side-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.side-panel-sub {
  font-size: 11px;
  color: #666;
  font-variant-numeric: tabular-nums;
}

.current-list {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cur-row { display: flex; flex-direction: column; gap: 4px; }

.cur-row--avg {
  padding: 6px 8px;
  margin: -2px -4px 2px;
  background: #15151f;
  border: 1px solid #2c2c38;
  border-radius: 6px;
}

.cur-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.cur-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cur-name {
  color: #e0e0e0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cur-row--avg .cur-name { color: #fff; }

.cur-note {
  font-size: 9px;
  color: #c98;
  margin-left: 5px;
  vertical-align: middle;
}

.cur-val {
  margin-left: auto;
  color: #9aa;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cur-bar {
  display: flex;
  height: 8px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: #1a1a24;
}

.cur-bar-long { background: #26a69a; height: 100%; }
.cur-bar-short { background: #ef5350; height: 100%; }

/* ========================================
   広告枠（チャートに被せない）
   ======================================== */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0d14;
  border: 1px dashed #2a2a36;
  border-radius: 8px;
  color: #555;
}

.ad-banner {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 14px auto 0;
}

.ad-rectangle {
  width: 300px;
  height: 250px;
  max-width: 100%;
  margin: 0 auto;
}

.ad-placeholder {
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* スマホ固定フッター広告 */
.ad-footer-mobile {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50px;
  align-items: center;
  justify-content: center;
  background: #0d0d14;
  border-top: 1px solid #2a2a36;
  z-index: 200;
}

.ad-footer-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #222230;
  color: #aaa;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

/* ブローカーページ レスポンシブ */
@media (max-width: 900px) {
  .broker-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "side"
      "main"
      "sidead";
    padding: 10px;
    gap: 10px;
  }

  #brokerChart { height: 340px !important; }

  .ad-footer-mobile { display: flex; }

  /* フッター広告に被らないよう下部に余白 */
  body { padding-bottom: 58px; }
}

/* ========================================
   トップ（説明）ページ
   ======================================== */

.home-body { padding-bottom: 0; }

.home-tag {
  color: #666;
  font-size: 13px;
  letter-spacing: 1px;
}

.home-nav-link {
  color: #00e5ff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
}
.home-nav-link:hover { text-decoration: underline; }

.home-hero {
  padding: 64px 20px 56px;
  background:
    radial-gradient(900px 360px at 78% -8%, rgba(0,229,255,0.10), transparent 70%),
    radial-gradient(700px 320px at 10% 4%, rgba(126,87,194,0.10), transparent 70%),
    #0a0a0f;
  border-bottom: 1px solid #1a1a24;
}

.home-hero-inner { max-width: 920px; margin: 0 auto; }

.home-kicker {
  font-size: 12px;
  letter-spacing: 3px;
  color: #00bcd4;
  font-weight: 700;
  margin-bottom: 16px;
}

.home-hero-title {
  font-size: 40px;
  line-height: 1.25;
  font-weight: 800;
  color: #f0f0f0;
  letter-spacing: 0.5px;
}

.home-accent { color: #00e5ff; }

.home-hero-sub {
  margin-top: 22px;
  max-width: 640px;
  color: #9a9aa5;
  font-size: 15px;
  line-height: 1.8;
}

.home-cta-row {
  margin-top: 30px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.home-cta-row--center { justify-content: center; margin-top: 24px; }

.home-cta {
  display: inline-block;
  background: #00e5ff;
  color: #06121a;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 8px;
  text-decoration: none;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 28px rgba(0,229,255,0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.home-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 32px rgba(0,229,255,0.28); }

.home-cta-note { color: #777; font-size: 13px; }

.home-section {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 20px;
  border-bottom: 1px solid #14141c;
}

.home-section--quiet { padding: 28px 20px 36px; }

.home-section-title {
  font-size: 22px;
  font-weight: 800;
  color: #e8e8e8;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.home-section-sub {
  color: #888;
  font-size: 14px;
  margin-bottom: 22px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.home-card {
  background: #0e0e16;
  border: 1px solid #1c1c28;
  border-radius: 12px;
  padding: 22px 20px;
}

.home-card-icon {
  font-size: 26px;
  color: #00e5ff;
  margin-bottom: 12px;
  line-height: 1;
}

.home-card h4 {
  font-size: 16px;
  color: #e8e8e8;
  margin-bottom: 8px;
  font-weight: 700;
}

.home-card p {
  font-size: 13.5px;
  color: #9a9aa5;
  line-height: 1.75;
}

.home-broker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.home-broker-item {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #0e0e16;
  border: 1px solid #1c1c28;
  border-radius: 8px;
  padding: 11px 13px;
  font-size: 14px;
}

.home-broker-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-broker-name { color: #e0e0e0; font-weight: 600; }

.home-broker-note {
  margin-left: auto;
  font-size: 11px;
  color: #777;
  text-align: right;
}

.home-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.home-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  color: #b8b8c0;
  font-size: 14px;
  line-height: 1.7;
}

.home-steps strong { color: #e8e8e8; }

.home-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #15151f;
  border: 1px solid #2c2c38;
  color: #00e5ff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.home-disclaimer {
  max-width: 920px;
  margin: 0 auto;
  color: #6f6f78;
  font-size: 12.5px;
  line-height: 1.9;
}

.home-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 20px 40px;
  color: #555;
  font-size: 13px;
  letter-spacing: 1px;
}

.home-footer-dot { color: #333; }

@media (max-width: 768px) {
  .home-hero { padding: 44px 16px 40px; }
  .home-hero-title { font-size: 28px; }
  .home-hero-sub { font-size: 14px; }
  .home-section { padding: 36px 16px; }
  .home-feature-grid { grid-template-columns: 1fr; }
  .home-broker-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 460px) {
  .home-broker-grid { grid-template-columns: 1fr; }
  .home-hero-title { font-size: 24px; }
}
