
:root{
  --blue:#1976d2;
  --blue-dark:#0d5fae;
  --blue-light:#e8f3ff;
  --green:#2e9d5b;
  --yellow:#ffd447;
  --orange:#ff8a34;
  --red:#e45252;
  --ink:#263238;
  --muted:#66737a;
  --bg:#f3f6f8;
  --card:#fff;
  --line:#dce3e8;
  --shadow:0 8px 20px rgba(30,55,75,.10);
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{
  margin:0;background:var(--bg);color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP","Yu Gothic",Meiryo,sans-serif;
  min-height:100vh
}
button{font:inherit;color:inherit;cursor:pointer}
#app{max-width:500px;margin:auto;min-height:100vh;padding:14px 14px 100px}
.top{display:flex;align-items:center;justify-content:space-between;padding:4px 2px 14px}
.logo{display:flex;align-items:center;gap:10px}
.logo-bike{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--yellow);font-size:23px}
.top small,.subhead small{display:block;color:var(--muted);font-size:11px;font-weight:700}
h1{font-size:21px;line-height:1.2;margin:2px 0 0;font-weight:800}
.round{width:42px;height:42px;border:1px solid var(--line);background:#fff;border-radius:13px;font-size:22px}
.page{display:none}.page.active{display:block}

.hello-card{
  min-height:170px;border-radius:22px;background:linear-gradient(135deg,#d9efff,#f3fbff);
  border:2px solid #c5e4fa;padding:22px;display:flex;justify-content:space-between;
  overflow:hidden;position:relative
}
.today-label{display:inline-block;background:#fff;color:var(--blue-dark);border-radius:99px;padding:5px 10px;font-size:11px;font-weight:800}
.hello-card h2{font-size:25px;line-height:1.35;margin:14px 0 6px;font-weight:800}
.hello-card p{font-size:13px;color:var(--muted);margin:0}
.hello-art{width:110px;position:relative;flex:none}
.hello-art span{position:absolute;right:5px;top:0;font-size:38px}
.hello-art b{position:absolute;right:5px;bottom:3px;font-size:60px;transform:rotate(-4deg)}

.start{
  width:100%;margin-top:12px;border:0;border-radius:20px;background:var(--blue);
  color:#fff;padding:18px 20px;display:flex;align-items:center;gap:16px;
  box-shadow:0 7px 0 var(--blue-dark);text-align:left
}
.start:active{transform:translateY(4px);box-shadow:0 3px 0 var(--blue-dark)}
.start-icon{display:grid;place-items:center;width:48px;height:48px;background:#fff;color:var(--blue);border-radius:50%;font-size:20px}
.start-copy{display:flex;flex-direction:column}
.start-copy b{font-size:23px}.start-copy small{font-size:12px;color:#e5f2ff;margin-top:2px}

.block{margin-top:24px}
.heading,.subhead{display:flex;align-items:end;justify-content:space-between;margin:0 2px 10px}
.heading h3,.settings h3{font-size:18px;margin:0;font-weight:800}
.heading button,.subhead button{border:0;background:none;color:var(--blue);font-size:12px;font-weight:700}
.chip{display:inline-block;padding:5px 9px;border-radius:99px;background:var(--yellow);font-size:11px!important;color:#5f4a00!important;font-weight:800}

.hint-card{
  background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px;
  display:flex;gap:13px;align-items:flex-start;box-shadow:var(--shadow)
}
.hint-mark{width:38px;height:38px;flex:none;border-radius:12px;background:var(--yellow);display:grid;place-items:center;font-weight:900;font-size:20px}
.hint-card b{font-size:15px}.hint-card p{font-size:12px;line-height:1.65;color:var(--muted);margin:5px 0 0}

.memory-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.memory{
  min-height:170px;background:#fff;border:1px solid var(--line);border-radius:18px;
  padding:14px;position:relative;box-shadow:0 4px 10px rgba(32,55,75,.06)
}
.memory.locked{background:#edf1f4;color:#778188;box-shadow:none}
.memory .emoji{width:52px;height:52px;border-radius:16px;background:var(--blue-light);display:grid;place-items:center;font-size:29px;margin-bottom:12px}
.memory:nth-child(3n+2) .emoji{background:#fff4c7}
.memory:nth-child(3n+3) .emoji{background:#e4f5e9}
.memory h4{font-size:14px;margin:0 0 6px;font-weight:800}
.memory p{font-size:11px;line-height:1.55;color:var(--muted);margin:0}
.memory time{position:absolute;right:12px;bottom:10px;color:#909ba1;font-size:9px}
.memory .hint{margin-top:9px;padding-top:8px;border-top:1px dashed #d3dce1;font-size:11px;line-height:1.5;color:#657178}
.memory .hint::before{content:"ヒント：";font-weight:800;color:var(--orange)}

.mini-guide{background:#fff;border:1px solid var(--line);border-radius:18px;padding:16px}
.mini-guide h3{font-size:15px;margin:0 0 12px}
.guide-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:11px}
.guide-row span{width:24px;height:24px;border-radius:50%;background:var(--blue);color:#fff;display:grid;place-items:center;font-weight:800}
.guide-row b{font-size:11px}.guide-row i{font-style:normal;color:#9aa4aa}

.ride-head{display:flex;align-items:center;gap:12px;margin:3px 0 12px}
.ride-head h2,.subhead h2{font-size:21px;margin:2px 0 0;font-weight:800}
.ride-head small{color:var(--muted);font-size:11px}
.back{width:42px;height:42px;border-radius:13px;border:1px solid var(--line);background:#fff;font-size:20px}
.ride-map,.big-map{position:relative;border-radius:20px;background:#fff;border:1px solid var(--line);overflow:hidden;padding:7px}
.leaflet-map{width:100%;height:100%;min-height:330px;background:#dce8e4;border-radius:15px}
.history-map{min-height:510px}
.ride-map .leaflet-map{min-height:390px}
.gps-badge{position:absolute;top:17px;left:17px;padding:8px 11px;border-radius:10px;background:#fff;font-size:11px;font-weight:800;box-shadow:var(--shadow);z-index:500}
.gps-badge.good{color:var(--green)}.gps-badge.bad{color:var(--red)}
.map-fallback{position:absolute;inset:7px;display:grid;place-items:center;padding:25px;text-align:center;background:#e8eef1;border-radius:15px;color:var(--muted);font-size:13px;z-index:400}

.soft-stats{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:11px 0}
.soft-stats div{background:#fff;border:1px solid var(--line);border-radius:16px;padding:14px}
.soft-stats span{display:block;color:var(--muted);font-size:11px;font-weight:700}
.soft-stats b{display:block;margin-top:5px;font-size:15px}

.ride-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.ride-actions button,.settings button,.full{border:0;border-radius:15px;padding:15px;font-weight:800}
.ride-actions .primary:first-child{grid-column:1/3}
.primary{background:var(--blue);color:#fff}
.secondary{background:#e2e8ec}
.danger{background:var(--red);color:#fff}
.safety,.settings p,.big-map p{font-size:11px;line-height:1.65;color:var(--muted)}
.dev{margin-top:15px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:11px}
.dev summary{font-size:11px;color:var(--muted)}.dev pre{white-space:pre-wrap;font-size:10px;line-height:1.6}

.big-map p{margin:9px 6px 3px}
.ride-list{margin-top:12px}
.ride-item,.journal-item{background:#fff;border:1px solid var(--line);border-radius:16px;padding:15px;margin-bottom:9px}
.ride-item b,.journal-item b{font-size:14px}
.ride-item p,.journal-item p{font-size:11px;color:var(--muted);line-height:1.6;margin:6px 0 0}

.settings{margin-top:22px;border-top:1px solid var(--line);padding-top:18px}
.settings button{width:100%;margin-top:8px;background:#e2e8ec}
.outline-danger{background:#fff!important;border:1px solid #e19494!important;color:#b53636}

.modal{display:none;position:fixed;inset:0;background:rgba(23,35,43,.48);align-items:flex-end;justify-content:center;z-index:1000}
.modal.show{display:flex}
.modal-card{width:min(500px,100%);background:#fff;border-radius:25px 25px 0 0;padding:22px 18px 30px;text-align:center;animation:up .25s ease}
.handle{width:40px;height:5px;border-radius:99px;background:#cfd6da;margin:-7px auto 18px}
.result-icon{font-size:58px}.result-title{font-size:24px;font-weight:900}
.result-list{display:grid;gap:8px;margin:16px 0}
.found{padding:13px;border-radius:14px;background:var(--blue-light);text-align:left}
.found b{font-size:14px}.found p{font-size:11px;color:var(--muted);margin:4px 0}
.full{width:100%}
.toast{position:fixed;left:50%;bottom:91px;transform:translate(-50%,15px);background:#263238;color:#fff;padding:10px 15px;border-radius:12px;opacity:0;pointer-events:none;transition:.2s;z-index:1500;font-size:12px;white-space:nowrap}
.toast.show{opacity:1;transform:translate(-50%,0)}

nav{
  position:fixed;z-index:900;bottom:8px;left:50%;transform:translateX(-50%);
  width:min(480px,calc(100% - 16px));height:72px;background:#fff;border:1px solid var(--line);
  border-radius:20px;display:grid;grid-template-columns:repeat(4,1fr);box-shadow:0 8px 26px rgba(25,45,60,.16)
}
nav button{border:0;background:none;color:#738087;font-size:10px;font-weight:700;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}
nav button.active{color:var(--blue)}
nav i{font-style:normal;font-size:21px;filter:grayscale(1);opacity:.7}
nav button.active i{filter:none;opacity:1}
.leaflet-control-attribution{font-size:9px!important}
.leaflet-container{font-family:inherit}
@keyframes up{from{transform:translateY(100%)}to{transform:none}}
@media(min-width:700px){body{padding:16px 0}}

/* v3.1 built-in tile map (Leaflet dependency removed) */
.simple-map{position:relative;width:100%;height:100%;min-height:330px;overflow:hidden;border-radius:15px;background:#dce8e4;touch-action:none}
.simple-map .tile-pane,.simple-map .route-pane{position:absolute;inset:0;overflow:hidden}
.simple-map .tile-pane img{position:absolute;width:256px;height:256px;user-select:none;-webkit-user-drag:none}
.simple-map .route-pane{pointer-events:none;width:100%;height:100%}
.simple-map .map-controls{position:absolute;right:10px;top:10px;z-index:20;display:grid;gap:5px}
.simple-map .map-controls button{width:38px;height:38px;border:1px solid #cfd9df;border-radius:10px;background:#fff;font-size:21px;font-weight:800;box-shadow:0 3px 10px rgba(20,40,55,.12)}
.simple-map .map-attrib{position:absolute;right:4px;bottom:3px;z-index:20;background:rgba(255,255,255,.85);padding:2px 5px;font-size:9px;color:#53626a}
.simple-map .map-attrib a{color:#315f88}
.simple-map .map-loading{position:absolute;left:10px;bottom:10px;z-index:19;background:rgba(255,255,255,.92);padding:6px 9px;border-radius:8px;font-size:10px;color:#5d6b72}

/* v3.2: hidden fallback must stay hidden */
[hidden]{display:none!important}
