/* ── GPX Viewer styles ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:    #22c55e;
  --accent2:   #16a34a;
  --accent-bg: rgba(34,197,94,.1);
  --surface:   #0f172a;
  --card:      #111827;
  --card2:     #1e293b;
  --border:    #1e293b;
  --border2:   #334155;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --radius:    14px;
}

body { background: var(--surface); color: var(--text); font-family: system-ui, sans-serif; line-height: 1.6; }

/* ── header ── */
.site-header { position: sticky; top: 0; z-index: 200; background: rgba(15,23,42,.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon { width: 32px; height: 32px; }
.logo-text { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: var(--text2); text-decoration: none; font-size: .875rem; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
@media(max-width:640px) { .nav-links { display: none; } }

/* ── hero ── */
.hero { padding: 52px 24px 36px; text-align: center; max-width: 660px; margin: 0 auto; }
.hero-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; background: var(--accent-bg); border: 1px solid rgba(34,197,94,.25); border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--accent); margin-bottom: 18px; }
.hero h1 { font-size: clamp(1.6rem,4vw,2.4rem); font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.hero h1 span { background: linear-gradient(135deg,#22c55e,#4ade80); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero p { color: var(--text2); font-size: 1rem; }

/* ── tool wrap ── */
.tool-wrap { max-width: 960px; margin: 0 auto; padding: 0 20px 80px; }

/* ── drop zone ── */
.drop-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--card);
  position: relative;
}
.drop-zone.dragging,
.drop-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-icon { width: 52px; height: 52px; background: var(--accent-bg); border: 1px solid rgba(34,197,94,.3); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.drop-icon svg { width: 24px; height: 24px; color: var(--accent); }
.drop-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.drop-sub   { font-size: .875rem; color: var(--text2); }
.drop-btn   { display: inline-block; margin-top: 20px; padding: 10px 24px; background: linear-gradient(135deg,var(--accent),#4ade80); border-radius: 999px; color: #fff; font-size: .875rem; font-weight: 600; }
.error-box  { margin-top: 16px; padding: 12px 16px; background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); border-radius: 10px; color: #f87171; font-size: .875rem; text-align: left; }

/* ── loaded header bar ── */
.loaded-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.loaded-name { font-size: 1.1rem; font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 8px; }
.loaded-name svg { width: 18px; height: 18px; color: var(--accent); }
.loaded-file { font-size: .78rem; color: var(--text3); font-family: monospace; }
.btn-reset { padding: 7px 16px; background: var(--card2); border: 1px solid var(--border2); border-radius: 999px; color: var(--text2); font-size: .8rem; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.btn-reset:hover { background: rgba(248,113,113,.15); border-color: #f87171; color: #f87171; }
.btn-reset svg { width: 14px; height: 14px; }

/* ── track selector ── */
.track-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.track-tab { padding: 6px 16px; background: var(--card); border: 1px solid var(--border2); border-radius: 999px; color: var(--text2); font-size: .8rem; font-weight: 500; cursor: pointer; transition: all .15s; }
.track-tab:hover { border-color: var(--accent); color: var(--accent); }
.track-tab.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* ── stats grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
@media(max-width:720px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:380px) { .stats-grid { grid-template-columns: 1fr 1fr; } }

.stat-card { background: var(--card); border: 1px solid var(--border2); border-radius: 12px; padding: 16px; }
.stat-label { font-size: .72rem; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.stat-label svg { width: 13px; height: 13px; }
.stat-value { font-size: 1.15rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-value.accent { color: var(--accent); }

/* ── map ── */
.map-card { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.map-card-header { padding: 12px 16px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border2); font-size: .85rem; font-weight: 600; color: var(--text2); }
.map-card-header svg { width: 15px; height: 15px; color: var(--accent); }
.map-legend { display: flex; gap: 16px; margin-left: auto; font-size: .73rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: middle; }

#gpx-map { height: 460px; width: 100%; }
@media(max-width:600px) { #gpx-map { height: 280px; } }

/* ── elevation chart ── */
.elev-card { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.elev-card h3 { font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.elev-card h3 svg { width: 15px; height: 15px; color: var(--accent); }
.elev-chart-wrap { height: 180px; position: relative; }

/* ── waypoints table ── */
.wpt-card { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.wpt-card h3 { font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.wpt-card h3 svg { width: 15px; height: 15px; color: #f59e0b; }
.wpt-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.wpt-table th { text-align: left; padding: 8px 12px; color: var(--text3); font-weight: 600; font-size: .73rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border2); }
.wpt-table td { padding: 9px 12px; color: var(--text2); border-bottom: 1px solid var(--border); font-family: monospace; }
.wpt-table tr:last-child td { border-bottom: none; }
.wpt-table tr:hover td { background: var(--card2); }
.wpt-name { color: var(--text) !important; font-weight: 600; font-family: system-ui, sans-serif !important; }

/* ── info sections ── */
.tis-section { margin-top: 56px; }
.tis-section-title { font-size: 1.2rem; font-weight: 800; color: var(--text); margin-bottom: 22px; }
.tis-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
@media(max-width:720px)  { .tis-grid { grid-template-columns: 1fr; } }
@media(min-width:720px) and (max-width:960px) { .tis-grid { grid-template-columns: 1fr 1fr; } }
.tis-card { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 22px; }
.tis-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.tis-icon svg { width: 20px; height: 20px; }
.tis-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 8px; }
.tis-card p, .tis-card li { font-size: .845rem; color: var(--text2); line-height: 1.7; }
.tis-card ol, .tis-card ul { padding-left: 18px; }
.tis-card li { margin-bottom: 5px; }

/* ── FAQ ── */
.faq-section { margin-top: 56px; }
.faq-section h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 18px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 15px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-size: .9rem; font-weight: 700; color: var(--text); cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq-q svg { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; transition: transform .2s; }
.faq-q.open svg { transform: rotate(180deg); }
.faq-a { font-size: .855rem; color: var(--text2); line-height: 1.7; margin-top: 10px; }

[x-cloak] { display: none !important; }

/* ── Related tools & blog ── */
.related-section { padding: clamp(24px,4vw,40px) 0; border-top: 1px solid var(--border); }
.related-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.related-title { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.btn-view-all { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; border-radius: 999px; font-size: .83rem; font-weight: 600; border: 1px solid var(--border2); color: var(--text2); transition: border-color .15s, color .15s; text-decoration: none; }
.btn-view-all:hover { border-color: var(--accent); color: var(--accent); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 14px; }
.related-tool-card { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; transition: border-color .18s, transform .18s, box-shadow .18s; }
.related-tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.related-tool-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.related-tool-icon svg { width: 20px; height: 20px; color: #fff; }
.related-tool-name { font-size: .92rem; font-weight: 700; color: var(--text); }
.related-tool-desc { font-size: .8rem; color: var(--text2); line-height: 1.5; flex: 1; }
.related-tool-link { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; color: var(--accent); margin-top: 4px; }
.related-tool-link svg { width: 13px; height: 13px; }
.blog-cards-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); gap: 14px; }
.blog-card-sm { background: var(--card); border: 1px solid var(--border2); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; transition: border-color .18s, transform .18s, box-shadow .18s; }
.blog-card-sm:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.blog-cat-badge { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; width: fit-content; }
.blog-card-title { font-size: .92rem; font-weight: 700; line-height: 1.4; color: var(--text); }
.blog-card-excerpt { font-size: .8rem; color: var(--text2); line-height: 1.6; flex: 1; }
.blog-card-meta { font-size: .73rem; color: var(--text3); }
.blog-read-link { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--accent); margin-top: 4px; }
.blog-read-link svg { width: 12px; height: 12px; }
