@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* =========================================
   Variables & Reset (Slightly Brighter Deep Navy)
   ========================================= */
:root {
  /* 背景を少し明るいネイビーグレーに変更して視認性アップ */
  --bg: #15151E;
  --card: #1D1D2B;
  --card-alt: #252535;
  --border: #2C2C3D;
  --border-strong: #3F3F5A;
  
  --accent: #E8FF57;
  --blue: #4A9EFF;
  --red: #FF6B6B;
  
  /* テキストのコントラストを調整 */
  --text: #F8F8FA;
  --text-muted: #A0A0B5;
  --text-faint: #6B6B80;
  
  --font-sans: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Syne', "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); overflow-x: hidden; }
body {
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#app { display: flex; flex-direction: column; min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* =========================================
   NAV (Topbar)
   ========================================= */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  gap: 16px; flex-wrap: wrap; position: sticky; top: 0;
  background: rgba(21, 21, 30, 0.85); backdrop-filter: blur(8px);
  z-index: 100;
}
.topbar-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.topbar-title { font-family: var(--font-mono); font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.topbar-sub { font-size: 11px; color: var(--text-muted); }

.nav-links { display: flex; gap: 20px; }
.nav-links a { font-size: 13px; color: var(--text-muted); font-weight: 500; transition: color 0.2s; }
.nav-links a.active, .nav-links a:hover { color: var(--text); }

.lang-switcher { display: flex; gap: 4px; }
.lang-btn {
  background: none; border: 1px solid var(--border-strong);
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.lang-btn.active { background: var(--card-alt); border-color: var(--accent); color: var(--accent); }

/* =========================================
   Calculator Layout (index.html)
   ========================================= */
.layout {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  padding: 40px 24px; gap: 48px; max-width: 1200px; margin: 0 auto; width: 100%;
}
.panel-input { flex: 1 1 500px; display: flex; flex-direction: column; gap: 48px; }
.panel-dash {
  flex: 0 1 340px; position: sticky; top: 88px; height: fit-content;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 32px 24px;
  box-shadow: 0 16px 32px rgba(0,0,0,0.25);
}

/* ── Input Sections ── */
.section-header { margin-bottom: 8px; }
.section-title {
  font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700;
  display: flex; align-items: center; gap: 12px; color: var(--text);
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.section-hint { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ── Form Elements ── */
.field-group { margin-bottom: 16px; width: 100%; }
.field-label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px;
}
.field-input {
  width: 100%; padding: 12px 16px;
  /* 入力欄の背景を少し暗くしてメリハリをつける */
  
  background: rgba(0, 0, 0, 0.25); 
  border: 1px solid var(--border-strong);
  border-radius: 8px; color: var(--text); 
  font-size: 15px; transition: all 0.2s;
}
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px rgba(232,255,87,0.3); }

/* select要素（ドロップダウン）専用の調整 */
select.field-input { appearance: auto; cursor: pointer; }

/* ── 動的追加行（サブスク・耐久財）のレイアウト修正 ── */
.sub-row, .asset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: nowrap; /* PCでは横一列を維持 */
}

/* 行の中の各フィールドが均等・または適切な幅になるように調整 */
.sub-row .field-input, .asset-row .field-input { margin-bottom: 0; }

/* サブスク行：各要素に明示的な幅を割り当てて被りを防ぐ */
.sub-row > *:nth-child(1) { flex: 2; min-width: 0; }      /* サービス名 */
.sub-row > *:nth-child(2) { flex: 1.5; min-width: 0; max-width: 120px }    /* 金額 */
.sub-row > *:nth-child(3) { width: 60px; flex: none; }    /* 数字（1） */
.sub-row > *:nth-child(4) { width: 80px; flex: none; }    /* 年/月 ドロップダウン */

.asset-row > *:nth-child(1) { flex: 2; min-width: 0; }      
.asset-row > *:nth-child(2) { flex: 1.5; min-width: 0; }    
.asset-row > *:nth-child(3) { width: 70px; flex: none; }   


.sub-row > .row-monthly-calc,
.asset-row > .row-monthly-calc {
  width: 90px;
  flex: none;
  text-align: right;
  font-size: 0.8rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 削除ボタン：固定サイズで右端に配置 */
.sub-row > .remove-btn,
.asset-row > .remove-btn { flex: none; }

.remove-btn {
  background: transparent; border: none; color: var(--text-faint);
  font-size: 20px; cursor: pointer; padding: 4px 8px; transition: color 0.2s;
  line-height: 1;
}
.remove-btn:hover { color: var(--red); }

/* ── 追加ボタン ── */
.add-btn {
  width: 100%; padding: 14px; margin-top: 8px;
  background: transparent; border: 1px dashed var(--border-strong);
  color: var(--text-muted); border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 700; transition: all 0.2s;
}
.add-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(232,255,87,0.05); }

/* ── Dashboard (Right Panel) ── */
.hero-card { margin-bottom: 32px; }
.hero-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 12px; line-height: 1.4;
}

/* 数字の潰れを解消するため、フォント指定とサイズを見直し */
.hero-amount {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
  font-size: 3rem; /* clampを外して固定化 */
  font-weight: 800;
  color: var(--accent); line-height: 1.1; margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.hero-currency { font-size: 1.4rem; vertical-align: top; margin-right: 4px; color: var(--text-muted); }
.hero-sub { font-size: 12px; color: var(--text-faint); }

.empty-hint {
  text-align: center; color: var(--text-faint); padding: 40px 0;
  font-size: 13px; border: 1px dashed var(--border-strong);
  border-radius: 8px; margin-top: 24px;
}

.chart-container { display: flex; justify-content: center; padding: 24px 0; }
.donut-chart {
  width: 180px; height: 180px; border-radius: 50%;
  -webkit-mask: radial-gradient(transparent 58%, #000 59%);
  mask: radial-gradient(transparent 58%, #000 59%);
  background: var(--border-strong); transition: background 0.5s ease-out;
}

.share-btn {
  display: block; width: 100%; padding: 16px; margin-top: 32px;
  background: var(--accent); color: #0A0A0F; border: none;
  border-radius: 8px; font-weight: 800; font-size: 14px;
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.02em;
}
.share-btn:hover { background: #f0ff80; transform: translateY(-2px); }

/* =========================================
   Concept Page Layout (concept.html)
   ========================================= */
.page { max-width: 760px; margin: 0 auto; padding: 0 24px; }
section { padding: 56px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.eyebrow { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--blue); margin-bottom: 14px; }
h1, h2 { font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); line-height: 1.35; margin-bottom: 20px; }
h2 { font-size: clamp(1.3rem, 4.5vw, 1.7rem); line-height: 1.5; margin-bottom: 18px; }
p { color: var(--text); margin-bottom: 16px; }
p.lead { font-size: 17px; color: #C8C8D8; }

.formula {
  background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px;
  padding: 24px 20px; margin: 28px 0; font-family: var(--font-mono); font-size: clamp(14px, 4vw, 17px);
  line-height: 2.1; overflow-x: auto; white-space: nowrap;
}
.formula .op { color: var(--text-faint); padding: 0 4px; }
.formula .term { color: var(--text); }
.formula .term-accent { color: var(--accent); font-weight: 700; }
.formula .result { display: block; margin-bottom: 4px; font-weight: 800; font-size: 1.15em; color: var(--accent); }

.gap-chart { background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 24px 16px 16px; margin: 24px 0; }
.gap-chart-row { margin-bottom: 18px; }
.gap-chart-row:last-of-type { margin-bottom: 10px; }
.gap-chart-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; }
.gap-chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.gap-bar { flex: 1; border-radius: 4px 4px 0 0; position: relative; min-height: 4px; }
.gap-bar-spike { background: var(--red); }
.gap-bar-flat  { background: var(--border-strong); }
.gap-bar-const { background: var(--accent); }
.gap-bar[data-value]::before {
  content: attr(data-value); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px;
  color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.gap-bar-spike[data-value]::before { color: var(--red); font-weight: 700; }
.gap-bar-const[data-value]::before { color: var(--accent); font-weight: 700; }
.gap-chart-months { display: flex; gap: 6px; margin-top: 8px; }
.gap-chart-months span { flex: 1; text-align: center; font-size: 10px; color: var(--text-faint); font-family: var(--font-mono); }
.gap-chart-caption { font-size: 12px; color: var(--text-faint); margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
.compare-card { background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; }
.compare-card.is-real { border-color: var(--accent); }
.compare-title { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.compare-card.is-real .compare-title { color: var(--accent); }
.compare-card:not(.is-real) .compare-title { color: var(--text-muted); }
.compare-row { margin-bottom: 14px; }
.compare-row:last-child { margin-bottom: 0; }
.compare-row dt { font-size: 11px; color: var(--text-faint); margin-bottom: 4px; letter-spacing: 0.04em; }
.compare-row dd { font-size: 14px; line-height: 1.6; }
.compare-card.is-real .compare-row dd { color: var(--text); }
.compare-card:not(.is-real) .compare-row dd { color: #aaaab8; }
.compare-row .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.calc-grid { display: grid; gap: 12px; margin: 24px 0; }
.calc-card { background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; }
.calc-name { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.calc-lines { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); line-height: 2; font-variant-numeric: tabular-nums; }
.calc-lines .op { color: var(--text-faint); }
.calc-lines .val { color: var(--text); }
.calc-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.calc-result-label { font-size: 12px; color: var(--text-muted); }
.calc-result-val { font-family: var(--font-mono); font-size: 22px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.calc-note { margin-top: 16px; font-size: 13px; color: var(--text-muted); }
.calc-note .num { font-family: var(--font-mono); color: var(--accent); font-weight: 700; }

.stance-card {
  background: linear-gradient(135deg, #1D1D2B 0%, #15151E 100%);
  border: 1px solid var(--border-strong); border-radius: 16px; padding: 32px 24px; text-align: center; position: relative; overflow: hidden;
}
.stance-card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(232,255,87,0.06) 0%, transparent 70%); pointer-events: none; }
.stance-statement { font-size: clamp(1.1rem, 4.5vw, 1.45rem); font-weight: 800; line-height: 1.6; color: var(--accent); margin-bottom: 18px; position: relative; }
.stance-body { font-size: 14px; color: var(--text-muted); position: relative; }
.stance-body p:last-child { margin-bottom: 0; }

.cta { text-align: center; padding-top: 48px; padding-bottom: 64px; }
.cta h2 { margin-bottom: 12px; }
.cta p { color: var(--text-muted); margin-bottom: 28px; }
.cta-btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #0A0A0F; text-decoration: none;
  font-weight: 800; font-size: 15px; letter-spacing: 0.02em; padding: 16px 32px; border-radius: 10px; min-height: 48px; transition: all 0.15s;
}
.cta-btn:hover { background: #f0ff80; transform: translateY(-1px); }

footer { text-align: center; padding: 28px 20px 40px; font-size: 11px; color: var(--text-faint); }

/* =========================================
   Why Page Specific Styles (/why)
   ========================================= */
.inline-link {
  color: var(--blue); text-decoration: underline; text-decoration-color: rgba(74,158,255,0.35);
  text-underline-offset: 3px; font-weight: 500;
}
.inline-link:hover { text-decoration-color: var(--blue); }

.advice-list { display: flex; flex-direction: column; gap: 10px; margin: 24px 0; }
.advice-item {
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 14px 16px; font-size: 14px;
  display: flex; align-items: baseline; gap: 12px; color: var(--text-muted);
}
.advice-item .advice-no { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.advice-verdict {
  margin-top: 18px; padding: 14px 16px; border-radius: 10px;
  background: rgba(232,255,87,0.06); border: 1px solid rgba(232,255,87,0.18);
  font-size: 14px; color: var(--text);
}
.advice-verdict strong { color: var(--accent); }

.see-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
@media (max-width: 560px) { .see-grid { grid-template-columns: 1fr; } }
.see-col { background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; }
.see-col.is-blind { border-color: rgba(255,107,107,0.3); }
.see-title { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border-strong); }
.see-col:not(.is-blind) .see-title { color: var(--blue); }
.see-col.is-blind .see-title { color: var(--red); }
.see-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.see-list li { font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; align-items: flex-start; }
.see-mark { flex-shrink: 0; font-family: var(--font-mono); font-weight: 800; font-size: 14px; }
.see-col:not(.is-blind) .see-mark { color: var(--blue); }
.see-col.is-blind .see-mark { color: var(--red); }

.deficit-card { background: var(--card); border: 1px solid var(--border-strong); border-radius: 14px; padding: 18px; margin: 24px 0; }
.deficit-lines { font-family: var(--font-mono); font-size: 14px; color: var(--text-muted); line-height: 2.2; font-variant-numeric: tabular-nums; }
.deficit-lines .val { color: var(--text); }
.deficit-lines .op { color: var(--text-faint); }
.deficit-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-strong); display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.deficit-result-label { font-size: 12px; color: var(--text-muted); }
.deficit-result-val { font-family: var(--font-mono); font-size: 22px; font-weight: 800; color: var(--red); font-variant-numeric: tabular-nums; }

.choice-list { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 24px; }
.choice-item { background: var(--card-alt); border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px 16px; font-size: 14px; display: flex; gap: 12px; align-items: baseline; }
.choice-no { font-family: var(--font-mono); font-size: 12px; font-weight: 800; color: var(--accent); flex-shrink: 0; }

.cta-secondary { display: block; margin-top: 16px; font-size: 13px; color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.cta-secondary:hover { color: var(--blue); text-decoration-color: var(--blue); }


/* =========================================
   Responsive
   ========================================= */
@media (max-width: 768px) {
  .layout { padding: 24px 16px; gap: 32px; }
  .panel-dash { position: static; margin-top: 16px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
  .compare-grid { grid-template-columns: 1fr; }
  
  /* スマホ時は動的行を縦並びに切り替え */
  .sub-row, .asset-row { flex-wrap: wrap; }
  .sub-row > *:nth-child(1) { flex: 1 1 100%; margin-bottom: 8px; }
  .sub-row > *:nth-child(2) { flex: 1 1 calc(50% - 10px); }
  .sub-row > *:nth-child(3) { flex: 1 1 50px; }
  .sub-row > *:nth-child(4) { flex: 1 1 auto; }

  /* スマホ時の月額換算表示と削除ボタン */
  .sub-row > .row-monthly-calc,
  .asset-row > .row-monthly-calc {
    flex: 1 1 auto;
    width: auto;
    text-align: left;
  }
}