/* DX経営ゲーム 共通CSS */
:root {
  --primary:   #1a56db;
  --accent:    #e94560;
  --bg:        #f5f7fa;
  --surface:   #ffffff;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --success:   #16a34a;
  --warning:   #d97706;
  --danger:    #e94560;
  --radius:    10px;
  --font:      'Noto Sans JP', 'Helvetica Neue', sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

/* ヘッダー */
.header {
  background: var(--primary);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1rem; font-weight: 700; color: #fff; }
.badge {
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
}

/* カード */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px;
}
.card-title {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* フォーム */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: var(--text);
  font-size: 1rem;
  -webkit-appearance: none;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}
.field .range-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* スライダー */
.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.slider-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #d1d5db;
  border-radius: 3px;
  outline: none;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1a56db;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.slider-row input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1a56db;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.slider-row .val { min-width: 48px; text-align: right; font-weight: 700; font-size: 1.1rem; color: #1a56db; }

/* ボタン */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--primary); color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 数値表示 */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px;
}
.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
}
.kpi .label { font-size: 0.75rem; color: var(--muted); margin-bottom: 4px; }
.kpi .value { font-size: 1.4rem; font-weight: 700; }
.kpi.positive .value { color: var(--success); }
.kpi.negative .value { color: var(--danger); }

/* バー（競争力可視化）*/
.bar-row { margin-bottom: 8px; }
.bar-row .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 3px;
}
.bar-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s;
}

/* トースト */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ページ切り替え */
.page { display: none; }
.page.active { display: block; }

/* ナビゲーション */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  display: flex;
  border-top: 1px solid #333;
  z-index: 100;
}
.nav-item {
  flex: 1;
  padding: 10px 0 12px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: manipulation;
}
.nav-item.active { color: var(--accent); }
.nav-item .icon { font-size: 1.4rem; display: block; margin-bottom: 2px; pointer-events: none; }

/* セーフエリア（iPhone）*/
body { padding-bottom: env(safe-area-inset-bottom); }
.header { padding-top: max(12px, env(safe-area-inset-top)); }
