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

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --card: #0f3460;
  --primary: #e94560;
  --primary-hover: #c73650;
  --text: #eee;
  --text-muted: #999;
  --border: #2a2a4a;
  --danger: #e94560;
  --success: #2ecc71;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* Auth */
.auth-card {
  max-width: 380px;
  margin: 0 auto;
  padding: 60px 24px 24px;
  text-align: center;
}
.auth-card h1 { font-size: 2rem; margin-bottom: 4px; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; }

.tabs { display: flex; gap: 0; margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; position: relative; z-index: 1; }
.tab {
  flex: 1; padding: 10px; border: none; background: var(--surface);
  color: var(--text-muted); cursor: pointer; font-size: 0.95rem; transition: all 0.2s;
}
.tab.active { background: var(--card); color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 0; }

input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[readonly] { opacity: 0.6; cursor: default; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
textarea { resize: vertical; }

.btn {
  padding: 10px 18px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 0.9rem; transition: all 0.15s;
}
.btn:hover { background: var(--card); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 0.8rem; }

.error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }

.warning-banner {
  background: rgba(233, 69, 96, 0.15); border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 12px; text-align: left;
  font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); margin-bottom: 16px;
}
.warning-banner strong { color: var(--danger); display: block; margin-bottom: 4px; }
.warning-banner ul { margin: 0; padding-left: 18px; }
.warning-banner li { margin-bottom: 4px; }
.warning-banner a { color: var(--primary); }
.warning-banner p { margin: 0; }

/* Header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.3rem; }
.header-right { display: flex; align-items: center; gap: 10px; }
.nickname { color: var(--text-muted); font-size: 0.9rem; }

/* Filters */
.filters {
  display: flex; align-items: center; gap: 10px; padding: 12px 24px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.filters select { width: auto; min-width: 130px; }
.spacer { flex: 1; }

/* Climb List */
.climb-list { max-width: 900px; margin: 0 auto; padding: 8px 24px; }

.climb-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s;
}
.climb-row:hover { background: var(--surface); border-radius: var(--radius); }

.climb-row .route-name { font-weight: 600; min-width: 0; }
.climb-row .grade {
  background: var(--card); padding: 2px 8px; border-radius: 4px;
  font-size: 0.8rem; white-space: nowrap;
}
.climb-row .meta { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }
.climb-row .date { margin-left: auto; color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

.app-error {
  display: flex; align-items: center; gap: 10px; padding: 10px 24px;
  background: rgba(233, 69, 96, 0.15); color: var(--danger); font-size: 0.85rem;
}
.empty { text-align: center; color: var(--text-muted); padding: 60px 24px; }
.route-count { text-align: center; color: var(--text-muted); font-size: 0.85rem; padding: 16px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-content {
  position: relative; background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; width: 90%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
}
.modal-content.small { max-width: 360px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 1.2rem; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
legend { padding: 0 8px; color: var(--text-muted); font-size: 0.85rem; }
fieldset > input,
fieldset > .toggle-row,
fieldset > label,
fieldset > textarea { margin-bottom: 10px; }
fieldset > *:last-child { margin-bottom: 0; }

label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }
label > select,
label > input { margin-top: 4px; }

.toggle-row { margin-bottom: 12px; }
.toggle-row label { display: inline-flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.toggle-row input[type="checkbox"] { width: auto; }

#route-picker { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); }
#route-picker option { padding: 6px 8px; }

.route-info {
  margin-top: 10px; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; line-height: 1.6; cursor: pointer;
}
.route-info:hover { border-color: var(--primary); }
.route-info .label { color: var(--text-muted); font-size: 0.8rem; }

.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }

/* Responsive */
@media (max-width: 600px) {
  .filters { padding: 10px 12px; }
  .filters select { min-width: 100px; font-size: 0.8rem; }
  .climb-list { padding: 8px 12px; }
  header { padding: 12px; }
  .header-right { gap: 6px; }
  .modal-content { padding: 16px; width: 95%; }
}
