:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --primary: #0f6fff;
  --primary-dark: #0a57cc;
  --text: #1a2230;
  --text-sub: #6b7683;
  --border: #e3e8ef;
  --danger: #e5484d;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(20, 40, 80, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px
           calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.view.is-hidden { display: none; }
.is-hidden { display: none !important; }

/* ===== ヘッダー ===== */
.app-header {
  text-align: center;
  padding: 20px 0 16px;
}
.app-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.app-subtitle {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-sub);
}

/* ===== ルート一覧 ===== */
.route-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.card:active { transform: scale(0.98); }

.route-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.route-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.route-card-info {
  flex: 1;
  min-width: 0;
}
.route-card-name {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 4px;
}
.route-card-path {
  font-size: 14px;
  color: var(--text-sub);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-card-edit {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.route-card-edit:active { background: var(--bg); }

/* 検索ボタン（カード下段・大きめ） */
.route-card-search {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.12s ease;
}
.route-card-search:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}
.route-card-search .search-icon { font-size: 18px; line-height: 1; }

/* 未登録状態の検索ボタン */
.route-card-search.is-empty {
  background: #f0f6ff;
  color: var(--primary);
  border: 1px dashed var(--primary);
  font-size: 15px;
}
.route-card-search.is-empty:active { background: #e3eeff; }

/* ===== 追加ボタン ===== */
.card-add {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-style: dashed;
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f6ff;
  font-size: 17px;
  font-weight: 700;
}
.card-add-icon { font-size: 22px; line-height: 1; }

.hint {
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 20px;
}

/* ===== フォーム ===== */
.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.field-input {
  width: 100%;
  padding: 15px 14px;
  font-size: 17px; /* iOSで自動ズームさせないため16px以上 */
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
}
.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.15);
}

.form-error {
  margin: -6px 0 0;
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.btn {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:active { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger);
}
