:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #17181A;
  --ink-2: #55564F;
  --ink-3: #9A9A93;
  --line: #E7E6E1;
  --actual: #2563A8;
  --actual-bg: #EAF1F9;
  --base-c: #9A9A93;
  --target-c: #1D9E75;
  --target-bg: #E5F4EE;
  --slow-c: #D0453E;
  --slow-bg: #FBEBEA;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--bg); color: var(--ink);
  line-height: 1.6;
  padding-bottom: 76px;
}
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }

header.app {
  padding: 14px 16px 10px;
  display: flex; align-items: baseline; justify-content: space-between;
}
header.app h1 { font-size: 19px; font-weight: 700; letter-spacing: 0.02em; }
header.app h1 .dash { color: var(--actual); }
header.app .sub { font-size: 11px; color: var(--ink-3); }

main { padding: 0 14px; max-width: 560px; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h2 { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
input, select, textarea, button {
  font: inherit; color: inherit;
}
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--actual); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 120px; font-size: 13px; }

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 13px; cursor: pointer; color: var(--ink-2);
  min-height: 36px;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.add { border-style: dashed; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; font-weight: 500; cursor: pointer;
  min-height: 44px;
}
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.accent { background: var(--actual); color: #fff; border-color: var(--actual); }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: 13px; }
.btn.danger { color: var(--slow-c); border-color: var(--slow-c); }
.btn:active { transform: scale(0.98); }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs button {
  flex: 1; padding: 12px 0 10px; background: none; border: none;
  font-size: 12px; color: var(--ink-3); cursor: pointer;
}
nav.tabs button.on { color: var(--ink); font-weight: 600; }
nav.tabs button .ic { display: block; font-size: 18px; margin-bottom: 1px; }

.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.seg button { flex: 1; padding: 9px 0; background: var(--surface); border: none; font-size: 13px; color: var(--ink-3); cursor: pointer; min-height: 40px; }
.seg button.on { background: var(--ink); color: #fff; }

.time-setting { display: flex; gap: 8px; margin-bottom: 12px; }
.time-setting .ts {
  flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px; cursor: pointer;
}
.time-setting .ts .lbl { font-size: 11px; color: var(--ink-3); }
.time-setting .ts .val { font-size: 18px; font-weight: 600; }
.time-setting .ts.base .val { color: var(--ink-2); }
.time-setting .ts.target .val { color: var(--target-c); }

.split-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.split-row .pt { width: 74px; font-size: 13px; color: var(--ink-2); text-align: right; }
.split-row input { flex: 1; }
.split-row .cum { width: 66px; font-size: 12px; color: var(--ink-3); }

.chart-legend { display: flex; gap: 14px; justify-content: center; font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.chart-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

.best-header { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.best-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px; cursor: pointer;
}
.best-row .medal { font-size: 16px; }
.best-row .t { font-size: 17px; font-weight: 700; }
.best-row .meta { margin-left: auto; font-size: 11px; color: var(--ink-3); text-align: right; }

.day-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.day-item .t { font-size: 16px; font-weight: 600; }
.day-item .b3 { font-size: 13px; }
.day-item .meta { margin-left: auto; font-size: 11px; color: var(--ink-3); }
.day-item .del { background: none; border: none; color: var(--ink-3); font-size: 16px; padding: 6px; cursor: pointer; }

.nav-date { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0; }
.nav-date button { background: none; border: 1px solid var(--line); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; }
.nav-date .cur { font-size: 14px; font-weight: 600; min-width: 110px; text-align: center; }

.dialog-bg { position: fixed; inset: 0; background: rgba(20,20,20,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.dialog { background: var(--surface); border-radius: 14px; padding: 18px; width: 100%; max-width: 340px; }
.dialog h3 { font-size: 15px; margin-bottom: 12px; }
.dialog .actions { display: flex; gap: 8px; margin-top: 14px; }
.dialog .actions .btn { flex: 1; }

.notice { font-size: 12px; color: var(--ink-3); }
.warn { background: var(--slow-bg); color: var(--slow-c); border-radius: 8px; padding: 8px 10px; font-size: 12px; margin: 8px 0; }
.ok-msg { background: var(--target-bg); color: var(--target-c); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin: 8px 0; }
.empty { text-align: center; color: var(--ink-3); font-size: 13px; padding: 28px 10px; }
.pb-badge { background: var(--target-c); color: #fff; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.hidden { display: none !important; }
a.btn { text-decoration: none; color: inherit; }
a.btn.accent { color: #fff; }
