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

:root {
  --bg: #0f0f23;
  --bg-card: #1a1a3e;
  --bg-card2: #16213e;
  --accent: #4f8ef7;
  --accent2: #7c5cbf;
  --text: #e8eaf6;
  --text-muted: #8899aa;
  --danger: #e74c3c;
  --success: #2ecc71;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 24px;
}
.screen.active {
  display: flex;
}

/* ヘッダー */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 8px;
  border-radius: 50%;
  transition: background 0.2s;
  line-height: 1;
}
.icon-btn:active {
  background: rgba(255,255,255,0.1);
}

/* 時刻表示 */
#time-display {
  text-align: center;
  padding: 20px;
  font-size: 3rem;
  font-weight: 200;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ルートカード */
#routes-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 16px;
}

.route-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-card2));
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,0.07);
}

.route-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.route-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.route-stations {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.station-name {
  font-size: 1.4rem;
  font-weight: 700;
}

.route-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.route-main-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: transform 0.1s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.4);
}

.route-main-btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* 設定画面のルートリスト */
#routes-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-route-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(255,255,255,0.07);
}

.settings-route-info {
  flex: 1;
}

.settings-route-name {
  font-weight: 700;
  margin-bottom: 4px;
}

.settings-route-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.settings-route-actions {
  display: flex;
  gap: 8px;
}

.btn-edit, .btn-delete {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-edit { color: var(--accent); }
.btn-delete { color: var(--danger); }
.btn-edit:active, .btn-delete:active {
  background: rgba(255,255,255,0.1);
}

/* 空状態 */
#empty-state, #empty-settings {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
#empty-state p, #empty-settings p {
  margin-bottom: 20px;
  font-size: 1rem;
  line-height: 1.6;
}
.hidden { display: none !important; }

/* ボタン */
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  color: var(--accent);
  font-size: 1rem;
  padding: 12px 24px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:active { background: rgba(79,142,247,0.15); }

/* モーダル */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}
.modal.hidden { display: none; }

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 28px 20px 40px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-content h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-weight: 700;
}

.modal-content label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.modal-content input {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.modal-content input:focus {
  border-color: var(--accent);
}
.modal-content input::placeholder {
  color: var(--text-muted);
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-cancel {
  flex: 1;
  padding: 14px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-cancel:active { background: rgba(255,255,255,0.07); }

.btn-save {
  flex: 2;
  padding: 14px;
  background: var(--accent);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-save:active { opacity: 0.85; }

.btn-danger {
  flex: 2;
  padding: 14px;
  background: var(--danger);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

#delete-route-name {
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 1rem;
}

/* レスポンシブ */
@media (max-width: 360px) {
  .station-name { font-size: 1.2rem; }
  #time-display { font-size: 2.5rem; }
}
