:root {
  --ink: #1f2430;
  --sub: #6b7280;
  --line: #e6e8ee;
  --bg: #f1f3f8;
  --card: #ffffff;
  --accent: #2f6fde;
  --you: #f2a516;
  --accent-soft: #e8effc;
  --radius: 20px;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
}
.sex-b { --accent: #2f6fde; --you: #f2a516; --accent-soft: #e8effc; }
.sex-g { --accent: #e0564a; --you: #2f9c8f; --accent-soft: #fdecea; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.6; -webkit-text-size-adjust: 100%; }
main { max-width: 560px; margin: 0 auto; padding: 0 16px 24px; }
h1, h2, p { margin: 0; }
b { font-weight: 800; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 12px 16px; background: var(--bg); }
.brand { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; }
.brand small, h1 small { font-size: .6em; color: var(--sub); }
.switch { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 3px; font-size: 13px; font-weight: 800; }
.switch > * { padding: 3px 12px; border-radius: 99px; text-decoration: none; }
.switch .on { background: var(--accent); color: #fff; }
.switch a { color: var(--sub); }
.switch a:hover { color: var(--ink); background: var(--bg); }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin-top: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card h2 { font-size: 17px; font-weight: 800; color: var(--accent); }
.card .lead { font-size: 13px; color: var(--sub); margin-top: 2px; }
.note { font-size: 12px; color: var(--sub); margin-top: 10px; }

/* 入力 */
.form { margin-top: 4px; }
.form h1 { font-size: 22px; line-height: 1.4; margin-bottom: 8px; }
.field { display: block; margin-top: 16px; }
.field > span { display: block; font-size: 14px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
select, .num input { width: 100%; font: inherit; font-size: 20px; font-weight: 700; color: var(--ink);
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; background: #fff; }
select:focus, .num input:focus { outline: none; border-color: var(--accent); }
.num { position: relative; }
.num input { padding-right: 52px; }   /* 上下ボタンが単位と重ならないよう、単位の分を空ける */
.num i { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--sub); font-weight: 700; }
input[type=range] { width: 100%; margin-top: 10px; accent-color: var(--accent); }
button { font: inherit; font-weight: 800; font-size: 16px; border: 2px solid var(--accent); color: var(--accent); background: #fff;
  border-radius: 99px; padding: 12px 20px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; }
.form button { width: 100%; margin-top: 20px; font-size: 18px; padding: 14px; }

/* 結果 */
.res-head { margin-top: 24px; font-weight: 800; font-size: 15px; text-align: center; color: var(--sub); }
.map-wrap { margin-top: 12px; }
#map { display: block; }

.measures { display: grid; gap: 18px; margin-top: 12px; }
.meter + .meter { border-top: 1px dashed var(--line); padding-top: 16px; }
.m-title { font-size: 14px; color: var(--sub); font-weight: 700; }
.m-title em { font-style: normal; color: var(--ink); }
.m-value { font-size: 18px; font-weight: 700; }
.m-value b { font-size: 36px; color: var(--accent); margin: 0 2px; }
.m-diff { font-size: 13px; color: var(--sub); margin-top: 4px; }
.m-diff b { color: var(--ink); }
.m-na { color: var(--sub); }
.track { position: relative; height: 12px; border-radius: 99px; margin-top: 6px;
  background: repeating-linear-gradient(90deg, var(--accent-soft) 0 calc(10% - 2px), #fff calc(10% - 2px) 10%); }
.mark { position: absolute; top: 50%; width: 22px; height: 22px; border-radius: 50%; background: var(--you);
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.12); transform: translate(-50%, -50%); }
.track-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--sub); margin-top: 2px; }

.rarity { text-align: center; margin-top: 8px; }
.r-label { font-size: 40px; font-weight: 800; color: var(--accent); line-height: 1.3; }
.r-stars { font-size: 26px; color: var(--you); letter-spacing: 2px; }
.r-stars span { color: var(--line); }
.r-freq { margin-top: 8px; font-size: 15px; }
.r-share { font-size: 14px; color: var(--sub); }
.r-share b { color: var(--ink); }

.era { margin-top: 10px; }
.era-main { background: var(--accent-soft); border-radius: 16px; padding: 16px; text-align: center; }
.era-sub { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 14px; }
.e-lead { font-size: 13px; color: var(--sub); font-weight: 700; }
.e-year { font-size: 18px; font-weight: 700; }
.e-year b { font-size: 44px; color: var(--accent); }
.e-year small, .e-pair small { font-size: 14px; color: var(--sub); }
.e-pair { font-size: 18px; font-weight: 700; }
.e-pair b { font-size: 26px; color: var(--accent); }
.e-sub { font-size: 13px; color: var(--sub); }
.e-line { font-size: 16px; }
.e-line b { color: var(--accent); }

.share { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.share .primary { grid-column: 1 / -1; font-size: 18px; padding: 14px; }
.share button[hidden] { display: none; }
.share button[hidden] + button { grid-column: 1 / -1; }

.foot a { color: inherit; }
.foot { max-width: 560px; margin: 0 auto; padding: 8px 16px 32px; font-size: 12px; color: var(--sub); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* トップ */
.home main { padding-top: 10vh; }
.hero { text-align: center; padding: 32px 20px; }
.hero h1 { font-size: 30px; }
.hero p { margin-top: 12px; color: var(--sub); }
.entries { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.entry { display: block; padding: 22px 0; border-radius: 18px; color: #fff; background: var(--accent);
  font-size: 22px; font-weight: 800; text-decoration: none; }
.m-badge { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 800; color: #fff; background: var(--you); padding: 1px 10px; border-radius: 99px; }
.zone { margin-top: 12px; padding: 12px 14px; background: var(--accent-soft); border-radius: 14px; font-size: 14px; }
.z-range { font-weight: 700; }
.z-range b { font-size: 16px; }
.z-icon { display: inline-block; width: 12px; height: 12px; border: 2.5px solid var(--ink); margin-right: 6px; vertical-align: -1px; }
.z-share { color: var(--sub); font-size: 13px; }
.z-you { margin-top: 4px; }
.z-you b { color: var(--accent); }
.hist { display: block; margin-top: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; font-weight: 700; color: var(--sub);
  background: #f7f8fb; border-radius: 12px; padding: 10px 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span:first-child { color: var(--ink); }
.legend p { flex-basis: 100%; font-size: 12px; font-weight: 500; }
.retry { display: block; margin-top: 14px; text-align: center; font-weight: 800; color: var(--accent); text-decoration: none; padding: 10px; }
.retry::after { content: " →"; }
