/* ============ SOLUNA 相場チャート — Apple-inspired design ============ */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --blue-tint: rgba(0, 113, 227, 0.1);
  --green: #34c759;
  --green-tint: rgba(52, 199, 89, 0.12);
  --red: #ff3b30;
  --red-tint: rgba(255, 59, 48, 0.1);
  --gold: #b8860b;
  --nav-bg: rgba(251, 251, 253, 0.8);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius: 18px;
  --radius-sm: 12px;
  /* ロゴに合わせたゴールドアクセント */
  --gold: #a87b1e;
  --gold-2: #8a6410;
  --gold-tint: rgba(168, 123, 30, 0.12);
  --gold-grad: linear-gradient(135deg, #d8ac45, #a87b1e);
  --on-gold: #171207;
}
:root[data-theme="dark"] {
  --bg: #0a0a10;
  --surface: #14141c;
  --surface-2: #101017;
  --text: #f5f0e6;
  --text-2: #a8a49a;
  --text-3: #857f72;
  --line: rgba(240, 199, 94, 0.10);
  --blue: #2997ff;
  --blue-tint: rgba(41, 151, 255, 0.15);
  --green: #30d158;
  --green-tint: rgba(48, 209, 88, 0.16);
  --red: #ff453a;
  --red-tint: rgba(255, 69, 58, 0.15);
  --nav-bg: rgba(10, 10, 16, 0.82);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.55);
  --gold: #f0c75e;
  --gold-2: #c1922c;
  --gold-tint: rgba(240, 199, 94, 0.14);
  --gold-grad: linear-gradient(135deg, #f6d97e, #c1922c);
  --on-gold: #171207;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ページ全体の横スクロールを禁止（モバイルで横にスライドしてしまう問題の対策。
   ナビ等の横スクロールは各要素内のoverflow-x:autoで個別に許可） */
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; } /* clipはstickyヘッダーを壊さない */

/* ============ Navbar ============ */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  /* iPhoneのノッチ（カメラ）と重ならないようセーフエリア分を確保（PWA/ホーム画面起動時） */
  padding-top: env(safe-area-inset-top);
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 22px;
  height: 52px; display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, #0071e3, #40a9ff);
  color: #fff; display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.brand-mark-img {
  width: 30px; height: 30px; border-radius: 8px; display: block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.brand-sub { font-weight: 500; color: var(--text-2); font-size: 13px; margin-left: 2px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  padding: 6px 14px; border-radius: 999px; font-size: 13.5px;
  color: var(--text-2); transition: all 0.2s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { background: var(--gold-grad); color: var(--on-gold); font-weight: 700; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 15px; cursor: pointer;
  transition: transform 0.2s ease;
}
.icon-btn:hover { transform: scale(1.08); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-menu-btn { display: none; }

/* モバイル用ページメニュー（☰で開くポップアップ） */
.nav-popup {
  position: absolute; top: calc(100% + 6px); right: 12px; left: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  padding: 6px; z-index: 200;
  animation: popIn 0.16s ease;
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.nav-popup a {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 10px;
  font-size: 15px; color: var(--text-2);
}
.nav-popup a + a { margin-top: 2px; }
.nav-popup a.active { background: var(--gold-grad); color: var(--on-gold); font-weight: 700; }

/* ============ Layout ============ */
#app { max-width: 1080px; margin: 0 auto; padding: 32px 22px 64px; min-height: 70vh; }
.hero { padding: 28px 0 8px; }
.hero h1 {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Times New Roman", serif;
  font-size: clamp(28px, 4.5vw, 44px);
  font-weight: 700; letter-spacing: 0.01em; line-height: 1.2;
}
.hero p.lead { color: var(--text-2); font-size: 17px; margin-top: 8px; }
.section-title {
  font-size: 21px; font-weight: 700; letter-spacing: -0.02em;
  margin: 36px 0 14px; display: flex; align-items: center; gap: 8px;
}
.section-title .chip { font-size: 11px; font-weight: 600; }

/* ============ Cards / surfaces ============ */
.panel {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
  border: 1px solid var(--line);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 800px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-links {
    overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    /* 右端をフェードさせて「横にスライドできる」ことを示す */
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 10px; font-size: 12.5px; flex-shrink: 0; white-space: nowrap; }
  .nav-inner { gap: 10px; }
  .brand-sub { display: none; }
  .nav-menu-btn { display: block; }
}

/* ============ Stat tiles ============ */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
@media (max-width: 700px) { .stat-row { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface); border-radius: var(--radius-sm);
  border: 1px solid var(--line); padding: 16px 18px;
}
.stat .label { font-size: 12px; color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .delta { font-size: 13px; font-weight: 600; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.chip.up { background: var(--green-tint); color: var(--green); }
.chip.down { background: var(--red-tint); color: var(--red); }
.chip.flat { background: var(--gold-tint); color: var(--gold); }
.chip.neutral { background: var(--line); color: var(--text-2); }

/* ============ Genre chips ============ */
.genre-row {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.genre-row::-webkit-scrollbar { display: none; }
.genre-chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.genre-chip:hover { color: var(--text); }
.genre-chip.active { background: var(--gold-grad); color: var(--on-gold); border-color: transparent; font-weight: 700; }
.genre-more { flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 7px 30px 7px 14px; }
/* 指数ブランド表記（SOLUNA 100）— ロゴに合わせた明朝体＋ゴールド */
.serif-brand {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Times New Roman", "Noto Serif JP", serif;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.gold-text {
  background: linear-gradient(180deg, #d8ac45 0%, #b78a2e 55%, #8a6410 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #a87b1e;
}
:root[data-theme="dark"] .gold-text {
  background: linear-gradient(180deg, #fdf6d8 0%, #f0c75e 50%, #c1922c 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #f0c75e;
}
.filter-label {
  flex-shrink: 0; align-self: center; font-size: 11.5px; font-weight: 700;
  color: var(--text-3); letter-spacing: 0.03em; min-width: 52px;
}
.genre-more.active { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }

/* ============ Filter panel ============ */
.filter-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.filter-toggle:hover { border-color: var(--gold); }
.filter-toggle.has-active { border-color: var(--gold); color: var(--gold); }
.filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--gold-grad); color: var(--on-gold); font-size: 11px; font-weight: 700;
}
.filter-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin: 0 0 16px;
  animation: fadeIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.filter-group + .filter-group { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.filter-group-label {
  font-size: 11.5px; font-weight: 700; color: var(--text-3);
  letter-spacing: 0.03em; margin-bottom: 8px;
}
.chip-wrap { display: flex; gap: 6px; flex-wrap: wrap; }
.genre-chip.sm { padding: 5px 12px; font-size: 12px; }
.mini-input {
  width: 110px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 13px; outline: none;
}
.mini-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }

/* ============ Ranking list ============ */
.rank-list { display: flex; flex-direction: column; }
.rank-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 6px; border-bottom: 1px solid var(--line);
  border-radius: 10px; transition: background 0.15s ease;
  cursor: pointer;
}
.rank-item:last-child { border-bottom: none; }
.rank-item:hover { background: var(--surface-2); }
.rank-num {
  width: 26px; text-align: center; font-weight: 800; font-size: 15px;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}
.rank-item:nth-child(1) .rank-num { color: var(--gold); }
/* 取引ランキング TOP3 のメダル装飾 */
.rank-item.medal {
  border: 1px solid var(--gold); background: var(--gold-tint);
  border-radius: 12px; margin: 4px 0; padding-left: 10px; padding-right: 8px;
}
.rank-item.medal .rank-num { font-size: 24px; width: 34px; }
.rank-item.medal .rank-name { font-size: 15px; }
.card-thumb {
  width: 42px; height: 58px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(150deg, #d8dce4, #aeb6c2);
  display: grid; place-items: center; font-size: 20px;
  overflow: hidden;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta { font-size: 12px; color: var(--text-3); }
.rank-price { text-align: right; }
.rank-price .p { font-weight: 700; font-variant-numeric: tabular-nums; }
.spark { width: 80px; height: 30px; flex-shrink: 0; }
@media (max-width: 600px) { .spark { display: none; } }

/* ============ Card grid ============ */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin: 18px 0 22px;
}
.search-box {
  flex: 1; min-width: 220px; position: relative;
}
.search-box input {
  width: 100%; padding: 10px 16px 10px 38px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: 14px; outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.search-box input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.search-box::before {
  content: "🔍"; position: absolute; left: 13px; top: 50%;
  transform: translateY(-50%); font-size: 13px; opacity: 0.5;
}
select.filter, .seg {
  padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-size: 13.5px;
  cursor: pointer; outline: none; appearance: none;
  -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2386868b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.pcard {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--line); padding: 16px;
  cursor: pointer; transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}
.pcard:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.pcard-top { display: flex; gap: 12px; align-items: flex-start; }
.pcard .card-thumb { width: 52px; height: 72px; font-size: 26px; }
.pcard-name { font-weight: 700; font-size: 14.5px; line-height: 1.35; }
.pcard-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.pcard-price-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-top: 12px;
}
.pcard-price { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pcard .spark { width: 100%; height: 38px; margin-top: 8px; }

/* ============ Detail page ============ */
.back-link {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--gold); font-size: 14px; font-weight: 600;
  margin-bottom: 18px; cursor: pointer;
}
.detail-head { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.detail-thumb {
  width: 148px; height: 205px; border-radius: 12px; flex-shrink: 0;
  cursor: zoom-in;
  background: linear-gradient(150deg, #d8dce4, #aeb6c2);
  display: grid; place-items: center; font-size: 52px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.detail-tags { display: flex; gap: 8px; margin: 10px 0 14px; flex-wrap: wrap; }
.detail-price { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.detail-delta { font-size: 15px; font-weight: 600; margin-left: 10px; }

.range-seg {
  display: inline-flex; background: var(--line); border-radius: 10px; padding: 3px; gap: 2px;
}
.range-seg button {
  border: none; background: transparent; color: var(--text-2);
  padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
}
.range-seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.grade-seg { margin-left: auto; }
.detail-segs {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  margin-top: 8px; width: 100%; max-width: 480px;
}
.detail-segs .range-seg { display: flex; width: 100%; }
.detail-segs .range-seg button { flex: 1; text-align: center; }
.detail-segs .grade-seg { margin-left: 0; }
.tag-break { flex-basis: 100%; height: 0; }
.detail-tags { align-items: center; }

.chart-wrap { margin-top: 20px; position: relative; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); white-space: nowrap;
  transform: translate(-50%, -110%); opacity: 0; transition: opacity 0.12s ease;
}
.chart-tooltip .tt-date { color: var(--text-3); font-size: 11px; }
.chart-tooltip .tt-price { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

.hist-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13.5px; }
.hist-table th {
  text-align: left; color: var(--text-3); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.hist-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hist-table tr:last-child td { border-bottom: none; }
.label-mini { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.02em; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }

/* ============ Admin ============ */
.admin-note {
  background: var(--blue-tint); border-radius: var(--radius-sm);
  padding: 14px 18px; font-size: 13.5px; color: var(--text);
  margin-bottom: 22px; border: 1px solid rgba(0,113,227,0.15);
}
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-2);
  margin-bottom: 5px;
}
.field input, .field select {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font-size: 14px; outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.field input:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-tint); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 22px; border-radius: 999px; border: none;
  background: var(--gold-grad); color: var(--on-gold); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s ease, opacity 0.2s ease;
}
.btn:hover { opacity: 0.9; transform: scale(1.02); }
.btn.secondary { background: var(--line); color: var(--text); }
.btn.danger-ghost { background: transparent; color: var(--red); border: 1px solid var(--red-tint); }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.set-list { display: flex; flex-direction: column; gap: 10px; }
.set-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.set-item .s-name { font-weight: 700; font-size: 14.5px; }
.set-item .s-meta { font-size: 12px; color: var(--text-3); }
.set-item .s-count { margin-left: auto; font-size: 12.5px; color: var(--text-2); font-weight: 600; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 22px;
  border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 200; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.empty {
  text-align: center; color: var(--text-3); padding: 48px 0; font-size: 14px;
}

/* ============ FAQ ============ */
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  padding: 15px 4px; font-size: 14.5px; font-weight: 600;
  cursor: pointer; list-style: none; position: relative; padding-right: 28px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "＋"; position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%); color: var(--text-3); font-weight: 400;
  transition: transform 0.2s ease;
}
.faq-item[open] summary::after { content: "－"; }
.faq-item p {
  padding: 0 4px 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.75;
}

/* ============ Footer ============ */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 22px calc(44px + env(safe-area-inset-bottom)); /* ホームバーと重ならないように */
  text-align: center; color: var(--text-3); font-size: 12.5px;
}
.footer-note { margin-top: 4px; font-size: 11.5px; }

/* fade-in */
.fade-in { animation: fadeIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }


/* ============ モバイル最適化（利用者の大半がスマホ想定） ============ */
@media (max-width: 640px) {
  #app { padding: 14px 12px 48px; }
  .hero { padding: 12px 0 4px; }
  .hero h1 { font-size: 24px; }
  .hero p.lead { font-size: 14px; margin-top: 5px; }
  .section-title { font-size: 16px; margin: 18px 0 10px; }
  .panel { padding: 14px; border-radius: 14px; }

  /* カード詳細：1画面に価格・チャート・履歴が収まる密度に */
  .detail-head { gap: 12px; flex-wrap: nowrap; }
  .detail-info { flex: 1; min-width: 0; }
  .detail-segs { gap: 5px; max-width: none; }
  .detail-segs .range-seg { padding: 2px; }
  .detail-segs .range-seg button { padding: 6px 4px; font-size: 12px; }
  .detail-tags { gap: 4px; }
  .detail-tags .chip { font-size: 10px; padding: 2px 7px; }
  .detail-thumb { width: 96px; height: 133px; font-size: 30px; border-radius: 10px; }
  .detail-info h1 { font-size: 19px; }
  .detail-tags { margin: 6px 0 8px; gap: 5px; }
  .detail-tags .chip { font-size: 10.5px; padding: 2px 8px; }
  .back-link { margin-bottom: 10px; font-size: 13px; }
  .range-seg { padding: 2px; }
  .range-seg button { padding: 5px 10px; font-size: 12px; }
  .detail-price { font-size: clamp(22px, 6.5vw, 30px) !important; }
  .detail-delta { font-size: 12.5px; }
  .chip { font-size: 11px; padding: 2px 8px; }
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
  .stat { padding: 8px 10px; border-radius: 10px; }
  .stat .label { font-size: 10px; }
  .stat .value { font-size: 15px !important; }
  .hist-table { font-size: 12px; }
  .hist-table td { padding: 6px 4px; }
  .hist-table th { padding: 5px 4px; font-size: 10px; }

  /* ランキング行のコンパクト化 */
  .rank-item { gap: 9px; padding: 9px 4px; }
  .card-thumb { width: 36px; height: 50px; }
  .rank-name { font-size: 13px; }
  .rank-meta { font-size: 10.5px; }
  .rank-price .p { font-size: 13.5px; }
  .rank-num { width: 20px; font-size: 13px; }

  /* フィルタ・チップ類 */
  .genre-chip { padding: 5px 11px; font-size: 11.5px; }
  .filter-toggle { padding: 7px 14px; font-size: 12px; }
  .filter-panel { padding: 12px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .pcard { padding: 12px; }
  .toolbar { gap: 8px; margin: 12px 0 14px; }
}


/* カード画像の拡大表示（ライトボックス） */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(5, 5, 10, 0.88);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: grid; place-items: center; cursor: zoom-out;
  animation: fadeIn 0.18s ease;
}
.lightbox img {
  max-width: min(92vw, 480px); max-height: 86vh;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* タップでグラフ切替できる状態ブロック */
.cb-tap { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.cb-tap:active { transform: scale(0.97); }
.cb-go {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  margin-left: auto; float: right; opacity: 0.85;
}

/* スニダンの背景透過画像はカードの周囲に透明余白（左右約28%・上下約8%）があるため、
   拡大して枠いっぱいにカードを表示する */
.card-thumb img[src*="snkrdunk"],
.detail-thumb img[src*="snkrdunk"] {
  transform: scale(1.2);
}
.detail-thumb { overflow: hidden; }
.lightbox img[src*="snkrdunk"] {
  transform: scale(1.5); /* 透明余白の分だけ拡大してカードを大きく見せる */
  box-shadow: none; /* 余白ごと拡大するため影は不自然になる */
}


/* ============ 比較モードの状態別ブロック ============ */
.cond-blocks {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 14px;
}
.cond-block {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); padding: 12px 14px;
}
.cond-block.cb-psa { border-color: color-mix(in srgb, var(--blue) 40%, transparent); }
.cond-block.cb-a { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.cb-label { font-size: 11.5px; font-weight: 700; }
.cb-price { font-size: clamp(19px, 4.5vw, 26px); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.cb-meta { font-size: 11px; color: var(--text-3); line-height: 1.6; }
@media (max-width: 640px) {
  .cond-blocks { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cond-block.cb-diff { grid-column: 1 / -1; }
  .cond-block.cb-diff .cb-price { display: inline; margin-right: 8px; white-space: nowrap; }
  .cond-block.cb-diff .cb-label { display: inline; margin-right: 10px; }
  .cond-block.cb-diff .cb-meta { display: inline; }
  .cond-block { padding: 10px 12px; }
}

/* ============ 起動スプラッシュ：アプリアイコンが組み上がる → ズームして吸い込まれる ============ */
#splash {
  position: fixed; inset: 0; z-index: 500;
  background: #0a0a10;
  display: grid; place-items: center;
  overflow: hidden;
  transition: opacity 0.8s ease;
}
#splash.hide { opacity: 0; pointer-events: none; }
.sp-icon {
  position: relative;
  width: min(80vw, 380px); height: min(80vw, 380px);
  transform-origin: 50% 50%;
}
/* ⓪ 真っ暗な画面から、枠のオーラがじわじわ浮かび上がる */
.sp-aura {
  position: absolute; inset: 0;
  border-radius: 18.75%; /* アイコンの角丸（96/512）と一致 */
  box-shadow:
    0 0 90px 20px rgba(240, 199, 94, 0.45),
    0 0 30px 4px rgba(246, 217, 126, 0.35),
    inset 0 0 80px 16px rgba(240, 199, 94, 0.25);
  opacity: 0;
  animation: spAura 0.9s cubic-bezier(0.45, 0.05, 0.35, 1) 0.05s forwards, spAuraPulse 3.0s ease-in-out 1.1s infinite alternate;
}
@keyframes spAura { to { opacity: 1; } }
@keyframes spAuraPulse {
  from { box-shadow: 0 0 90px 20px rgba(240, 199, 94, 0.45), 0 0 30px 4px rgba(246, 217, 126, 0.35), inset 0 0 80px 16px rgba(240, 199, 94, 0.25); }
  to   { box-shadow: 0 0 130px 30px rgba(240, 199, 94, 0.62), 0 0 44px 8px rgba(246, 217, 126, 0.5), inset 0 0 100px 22px rgba(240, 199, 94, 0.34); }
}
.sp-icon svg {
  width: 100%; height: 100%; display: block;
  position: relative; z-index: 1;
  opacity: 0;
  animation: spIconIn 0.9s cubic-bezier(0.45, 0.05, 0.25, 1) 0.5s both,
             spFlash 0.55s ease-in-out 3.9s;
}
@keyframes spFlash { 0%, 100% { filter: brightness(1); } 35% { filter: brightness(1.4); } }
@keyframes spIconIn { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
/* 最後：ズームアップして画面に吸い込まれる */
#splash.hide .sp-icon {
  transform: scale(13);
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.6, 0.05, 0.85, 0.3), opacity 0.6s ease 0.25s;
}
/* ① SOLUNA：クリップ矩形が左→右に広がって「書かれていく」 */
.sp-write-rect { animation: spWrite 1.3s cubic-bezier(0.45, 0.05, 0.25, 1) 0.9s forwards; }
@keyframes spWrite { to { width: 458px; } }
/* ② 100：浮かび上がる */
.a-100 {
  opacity: 0;
  transform-box: fill-box; transform-origin: center;
  animation: spPop 0.9s cubic-bezier(0.22, 0.8, 0.3, 1) 2.0s forwards;
}
@keyframes spPop { from { opacity: 0; transform: translateY(14px) scale(0.93); } to { opacity: 1; transform: none; } }
/* ③ チャート：左→右に描画（本来の透過度 0.38 へ） */
.a-line {
  opacity: 0.38;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: spDraw 1.3s cubic-bezier(0.45, 0.05, 0.25, 1) 2.6s forwards;
}
.a-area { opacity: 0; animation: spFade 0.8s ease-in-out 3.2s forwards; }
.a-grid { opacity: 0; animation: spGridIn 1.0s ease-in-out 2.6s forwards; }
@keyframes spDraw { to { stroke-dashoffset: 0; } }
@keyframes spFade { to { opacity: 1; } }
@keyframes spGridIn { to { opacity: 0.10; } }
/* ④ 金の枠：一周描かれてアイコン完成
   （完成した瞬間に破線設定を解除して、始点と終点の継ぎ目を完全に消す） */
.a-frame1, .a-frame2, .a-frame3 {
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: spDrawFrame 3.5s cubic-bezier(0.5, 0.05, 0.45, 1) 0.4s forwards;
}
.a-frame2 { animation-delay: 0.55s; }
.a-frame3 { animation-delay: 0.65s; }
@keyframes spDrawFrame {
  0%    { stroke-dashoffset: 100; stroke-dasharray: 100; }
  99.9% { stroke-dashoffset: 0;   stroke-dasharray: 100; }
  100%  { stroke-dashoffset: 0;   stroke-dasharray: none; }
}
/* ⑤ 枠がつながった瞬間：白金の光が高速で一周＋アイコン全体が一瞬きらめく */
.a-glint {
  stroke-dasharray: 12 88; stroke-dashoffset: 100;
  opacity: 0;
  filter: drop-shadow(0 0 10px rgba(255, 244, 204, 0.95)) drop-shadow(0 0 22px rgba(240, 199, 94, 0.6));
  animation: spGlint 0.6s cubic-bezier(0.3, 0, 0.35, 1) 3.9s forwards;
}
@keyframes spGlint {
  0%   { opacity: 0; stroke-dashoffset: 100; }
  15%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; stroke-dashoffset: -24; }
}

/* ホームのカード検索サジェスト */
.home-search { margin-top: 4px; }
.home-search .search-box input { width: 100%; }
.suggest-panel {
  position: absolute; left: 0; right: 0; top: 6px; z-index: 150;
  padding: 8px; box-shadow: var(--shadow-lg);
}
.suggest-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
}
.suggest-item:hover { background: var(--gold-tint); }

/* iOSの自動ズーム防止：入力欄は16px以上に（16px未満だとフォーカス時に画面が拡大される） */
input[type="search"], input[type="text"], input[type="number"], select {
  font-size: 16px;
}

/* ============ 独自アイコン ============ */
.ic {
  width: 1.05em; height: 1.05em;
  display: inline-block; vertical-align: -0.16em;
  color: var(--gold);
}
.ic.muted { color: var(--text-3); width: 1.4em; height: 1.4em; }
/* メダルバッジ（🥇🥈🥉の代替） */
.medal-b {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; font-weight: 800; color: #171207;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.medal-b.m1 { background: linear-gradient(135deg, #f8e9a0, #d4a437 60%, #b8860b); }
.medal-b.m2 { background: linear-gradient(135deg, #f2f2f5, #b9bfc9 60%, #8e97a3); color: #23262b; }
.medal-b.m3 { background: linear-gradient(135deg, #e8b98a, #b87333 60%, #8c5323); color: #241305; }

/* 免責事項（フッター最下部に控えめに折りたたみ表示） */
.legal-note { margin-top: 14px; }
.legal-note summary {
  font-size: 10.5px; color: var(--text-3); opacity: 0.55;
  cursor: pointer; list-style: none; display: inline-block;
}
.legal-note summary::-webkit-details-marker { display: none; }
.legal-note[open] summary { opacity: 0.8; }
.legal-note p {
  font-size: 10.5px; color: var(--text-3); opacity: 0.7;
  max-width: 640px; margin: 6px auto 0; line-height: 1.7;
}

/* ============ メンバーシップゲート（スモーク＋ポップアップ） ============ */
.gate-wrap {
  position: relative;
  max-height: 620px; overflow: hidden;
  border-radius: var(--radius);
}
/* スモークの下端をフェードアウトさせて「まだ続きがある」感を出す */
.gate-wrap::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(180deg, transparent, var(--bg));
  pointer-events: none; z-index: 4;
}
.gate-blur {
  filter: blur(14px) saturate(0.8);
  pointer-events: none; user-select: none;
  opacity: 0.75;
}
.gate-pop {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center;
  padding: 20px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(240, 199, 94, 0.12);
  padding: 26px 26px 22px;
  max-width: 360px; width: 100%;
  text-align: center;
  animation: gateIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes gateIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }
.gate-card .ic { width: 2em; height: 2em; }
.gate-title {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 18px; font-weight: 700; margin: 10px 0 6px;
}
.gate-copy { font-size: 12.5px; color: var(--text-2); line-height: 1.7; }
.gate-btn {
  display: block; width: 100%; margin-top: 14px;
  padding: 13px 20px; border: none; border-radius: 999px;
  background: var(--gold-grad); color: var(--on-gold);
  font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none;
}
.gate-sub {
  display: block; margin-top: 10px; font-size: 12px;
  color: var(--text-3); text-decoration: underline; cursor: pointer;
}

/* 高騰・下落：変動率順・絞り込み・状態A/PSA10 の3点横並び */
.updown-controls {
  display: flex; gap: 8px; align-items: stretch;
  margin: 10px 0 4px;
}
.updown-controls > * { flex: 1; min-width: 0; }
.updown-controls .filter.compact {
  font-size: 13px; padding: 9px 8px; height: auto;
}
.updown-controls .filter-toggle.compact {
  font-size: 13px; padding: 9px 8px; margin: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
.updown-controls .range-seg.compact { display: flex; }
.updown-controls .range-seg.compact button {
  flex: 1; font-size: 12.5px; padding: 8px 6px; white-space: nowrap;
}

/* 「すべてのセット」セレクトの右はみ出し修正 */
.toolbar { max-width: 100%; }
.toolbar .search-box, .toolbar .search-box input { max-width: 100%; }
.toolbar select.filter {
  max-width: 100%; width: 100%;
  min-width: 0; box-sizing: border-box;
  text-overflow: ellipsis;
}

/* モバイル幅いっぱいのセグメント（期間・状態切替） */
.seg-stack { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 14px; }
.range-seg.seg-full { display: flex; width: 100%; }
.range-seg.seg-full button {
  flex: 1; min-width: 0;
  font-size: 13.5px; padding: 11px 4px;
  white-space: nowrap;
}
@media (max-width: 420px) {
  .range-seg.seg-full button { font-size: 12px; padding: 11px 2px; letter-spacing: -0.02em; }
}
