/* =============================================
   RailBuddy Japan — メインスタイル
   ============================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --accent: #e53935;
  --accent-soft: #ffebee;
  --gold: #f9a825;
  --bg: #f5f6fa;
  --white: #ffffff;
  --text: #1a1a2e;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 20px rgba(26, 35, 126, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
               Arial, 'Noto Sans KR', 'Noto Sans TC', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* =============================================
   画面切り替え
   ============================================= */

.screen {
  display: none;
  min-height: 100vh;
  flex-direction: column;
  animation: fadeIn 0.25s ease;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   トップページ（言語選択）
   ============================================= */

#screen-lang {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-light) 60%, #5c6bc0 100%);
  align-items: center;
  justify-content: center;
  padding: 40px 24px 60px;
}

/* ヒーローエリア */
.hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-icon {
  font-size: 64px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.app-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.app-subtitle {
  font-size: 15px;
  color: rgba(255,255,255,0.8);
  font-weight: 400;
}

.free-badge {
  display: inline-block;
  margin-top: 12px;
  background: linear-gradient(135deg, #f9a825, #ff6f00);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.access-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 10px 24px;
}

.counter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.counter-label {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.counter-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
}

.counter-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.3);
}

/* 言語セクション */
.lang-section {
  width: 100%;
  max-width: 360px;
}

.lang-label {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* 言語ボタングリッド */
.lang-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.lang-btn {
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: var(--radius);
  padding: 20px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lang-btn:hover,
.lang-btn:active {
  background: rgba(255,255,255,0.28);
  border-color: rgba(255,255,255,0.6);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.lang-flag {
  font-size: 32px;
}

.lang-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
}

.lang-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
}

/* 日本語リンク */
.lang-other {
  text-align: center;
}

.lang-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.2s;
}

.lang-link:hover {
  color: var(--white);
  background: rgba(255,255,255,0.1);
}

/* =============================================
   共通：トップバー
   ============================================= */

.top-bar {
  display: flex;
  align-items: center;
  background: var(--primary);
  padding: 16px 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(26,35,126,0.2);
}

.back-btn,
.lang-switch-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: var(--white);
  font-size: 14px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.lang-switch-btn {
  width: 40px;
  font-size: 18px;
}

.back-btn {
  padding: 0 14px;
  gap: 4px;
  font-weight: 600;
}

.back-label {
  font-size: 13px;
  letter-spacing: 0.02em;
}

.back-btn:hover,
.lang-switch-btn:hover {
  background: rgba(255,255,255,0.25);
}

.screen-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  text-align: center;
}

/* =============================================
   共通：コンテンツエリア
   ============================================= */

.content {
  flex: 1;
  padding: 24px 20px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.section-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

/* =============================================
   空港ボタン
   ============================================= */

.airport-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.airport-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.airport-btn:hover,
.airport-btn:active {
  border-color: var(--primary-light);
  box-shadow: 0 6px 24px rgba(26,35,126,0.16);
  transform: translateY(-2px);
}

.airport-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.airport-info {
  flex: 1;
}

.airport-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.airport-code {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
  font-family: monospace;
  letter-spacing: 0.5px;
}

.airport-lines {
  font-size: 12px;
  color: var(--primary-light);
  font-weight: 600;
}

.arrow {
  font-size: 24px;
  color: var(--text-sub);
  flex-shrink: 0;
}

/* =============================================
   Tipsボックス
   ============================================= */

.tips-box {
  background: #fff8e1;
  border: 1.5px solid #ffe082;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tips-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.tips-text {
  font-size: 13px;
  color: #5d4037;
  line-height: 1.55;
}

/* =============================================
   交通手段ボタン
   ============================================= */

.transport-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.transport-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.transport-btn:hover,
.transport-btn:active {
  border-color: var(--primary-light);
  box-shadow: 0 6px 24px rgba(26,35,126,0.16);
  transform: translateY(-2px);
}

.transport-icon {
  font-size: 40px;
  flex-shrink: 0;
}

.transport-info {
  flex: 1;
}

.transport-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
}

.transport-sub {
  font-size: 13px;
  color: var(--text-sub);
}

/* 比較ボタン */
.compare-btn {
  width: 100%;
  background: var(--accent-soft);
  border: 1.5px solid #ef9a9a;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s;
}

.compare-btn:hover {
  background: #ffcdd2;
  border-color: var(--accent);
}

/* =============================================
   比較モーダル
   ============================================= */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-overlay.open {
  display: flex;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 24px 40px;
  width: 100%;
  max-width: 480px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--border);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 20px;
}

.compare-table th {
  background: var(--primary);
  color: var(--white);
  padding: 10px 8px;
  font-weight: 700;
  text-align: center;
}

.compare-table th:first-child {
  border-radius: 8px 0 0 0;
}

.compare-table th:last-child {
  border-radius: 0 8px 0 0;
}

.compare-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  color: var(--text-sub);
}

.compare-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text);
}

.compare-table td.good {
  color: #2e7d32;
  font-weight: 700;
}

.compare-rec {
  background: #f3f4ff;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compare-rec p {
  font-size: 13px;
  color: var(--text);
}

/* =============================================
   レスポンシブ（タブレット以上）
   ============================================= */

@media (min-width: 600px) {
  #screen-lang {
    padding: 60px 40px 80px;
  }

  .lang-grid {
    gap: 16px;
  }

  .lang-btn {
    padding: 24px 12px;
  }

  .modal {
    border-radius: var(--radius);
    margin-bottom: 40px;
  }

  .modal-overlay {
    align-items: center;
  }
}

/* =============================================
   目的地選択画面
   ============================================= */

.dest-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dest-btn {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.dest-btn:hover,
.dest-btn:active {
  border-color: var(--primary-light);
  box-shadow: 0 6px 24px rgba(26,35,126,0.16);
  transform: translateY(-2px);
}

.dest-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.dest-info { flex: 1; }

.dest-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}

.dest-sub {
  font-size: 12px;
  color: var(--text-sub);
}

/* =============================================
   経路詳細画面
   ============================================= */

.route-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  color: var(--white);
}

.route-from-to {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.route-from, .route-to {
  font-size: 16px;
  font-weight: 700;
}

.route-arrow {
  font-size: 18px;
  opacity: 0.8;
}

.route-line-name {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 16px;
  line-height: 1.4;
}

/* 情報カード */
.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.info-card {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  backdrop-filter: blur(4px);
}

.info-card-icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.info-card-label {
  font-size: 10px;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-card-value {
  font-size: 14px;
  font-weight: 700;
  margin-top: 2px;
}

/* 号車Tip */
.car-tip {
  grid-column: 1 / -1;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

/* =============================================
   ステップガイド
   ============================================= */

.steps-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}

.step {
  display: flex;
  gap: 14px;
  margin-bottom: 4px;
}

.step-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-num {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.step-line {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, var(--primary-light), var(--border));
  margin: 6px 0;
  min-height: 24px;
}

.step-body {
  flex: 1;
  padding-bottom: 24px;
}

.step-loc {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 5px;
}

.step-action {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 8px;
}

.step-badge {
  display: inline-block;
  background: var(--primary);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

/* 更新日 */
.last-updated {
  font-size: 11px;
  color: var(--text-sub);
  text-align: center;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* =============================================
   任意の駅入力
   ============================================= */

.custom-dest-box {
  margin-top: 20px;
  background: var(--white);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.custom-dest-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.custom-dest-row {
  display: flex;
  gap: 10px;
}

.custom-dest-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.custom-dest-input:focus {
  border-color: var(--primary-light);
}

.custom-dest-btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  width: 48px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.custom-dest-btn:hover {
  background: var(--primary-light);
}

/* 準備中メッセージ */
.coming-soon-box {
  background: #fff8e1;
  border: 1.5px solid #ffe082;
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin: 20px 0;
}

.coming-soon-icon { font-size: 40px; margin-bottom: 12px; }
.coming-soon-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.coming-soon-msg { font-size: 14px; color: var(--text-sub); line-height: 1.6; }

/* =============================================
   ミッション画面
   ============================================= */

#screen-mission {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-light) 60%, #5c6bc0 100%);
  align-items: center;
  justify-content: center;
  padding: 40px 24px 60px;
}

.mission-wrap {
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.mission-icon {
  font-size: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

.mission-catch {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.mission-sub {
  font-size: 16px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 28px;
  line-height: 1.5;
}

.mission-points {
  list-style: none;
  margin-bottom: 36px;
  text-align: left;
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.mission-points li {
  font-size: 14px;
  color: rgba(255,255,255,0.92);
  line-height: 1.6;
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
}

.mission-points li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-weight: 700;
}

.mission-start-btn {
  display: block;
  width: 100%;
  padding: 18px;
  background: #fff;
  color: var(--primary);
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 14px;
  letter-spacing: 0.3px;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.mission-start-btn:active { transform: scale(0.98); }

.mission-feedback-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.mission-feedback-btn:active { background: rgba(255,255,255,0.1); }

/* =============================================
   コピーボタン
   ============================================= */

.copy-route-btn {
  display: block;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-align: center;
}

.copy-route-btn:active { transform: scale(0.98); }

.copy-route-btn.copied {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #2e7d32;
}

/* =============================================
   フィードバックモーダル
   ============================================= */

.feedback-modal {
  padding: 28px 24px;
}

.fb-input,
.fb-textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.fb-input:focus,
.fb-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
}

.fb-textarea { resize: vertical; min-height: 100px; }

.fb-send-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.fb-send-btn:disabled { background: #9e9e9e; cursor: not-allowed; }

.fb-status {
  margin-top: 12px;
  font-size: 13px;
  color: #2e7d32;
  text-align: center;
  line-height: 1.5;
}

/* =============================================
   ダークモード
   ============================================= */

[data-theme="dark"] {
  --primary: #1a237e;
  --primary-light: #5c6bc0;
  --accent: #ef5350;
  --accent-soft: #3d1010;
  --bg: #0f1117;
  --white: #1a2033;
  --text: #e2e8f5;
  --text-sub: #9ca3b8;
  --border: #2a3050;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] .tips-box {
  background: #1c1500;
  border-color: #3d2e00;
}

[data-theme="dark"] .tips-text {
  color: #d4a84b;
}

[data-theme="dark"] .compare-rec {
  background: #1a1d35;
}

[data-theme="dark"] .compare-rec p {
  color: var(--text);
}

[data-theme="dark"] .coming-soon-box {
  background: #1c1500;
  border-color: #3d2e00;
}

[data-theme="dark"] .compare-table td.good {
  color: #66bb6a;
}

[data-theme="dark"] .compare-table td {
  border-bottom-color: var(--border);
  color: var(--text-sub);
}

[data-theme="dark"] .compare-table td:first-child {
  color: var(--text);
}

[data-theme="dark"] .copy-route-btn.copied {
  background: #1a2e1a;
  color: #66bb6a;
  border-color: #66bb6a;
}

[data-theme="dark"] .fb-input,
[data-theme="dark"] .fb-textarea {
  background: var(--white);
  color: var(--text);
}

[data-theme="dark"] .fb-status {
  color: #66bb6a;
}

[data-theme="dark"] .fb-send-btn:disabled {
  background: #444;
}

[data-theme="dark"] .custom-dest-input {
  background: var(--white);
  color: var(--text);
}

[data-theme="dark"] .modal {
  background: var(--white);
}

[data-theme="dark"] .modal-close {
  background: var(--border);
  color: var(--text);
}

[data-theme="dark"] .modal-title {
  color: var(--text);
}

[data-theme="dark"] .review-place-select {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}

/* ダークモード切替ボタン */
.dark-toggle-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  transition: background 0.2s;
}

.dark-toggle-btn:hover {
  background: rgba(255,255,255,0.25);
}
