/* 運動部 — manabu-letter.com
   藍（伝統色）と日光の金茶。見出しは明朝、UIは角ゴシック。
   CSPで inline style を許していないので、装飾はすべてここに置く。 */

:root {
  --ground:      #f4f6f8;
  --surface:     #ffffff;
  --surface-alt: #eceff3;
  --ink:         #171d29;
  --ink-soft:    #4a5464;
  --muted:       #7c8695;
  --line:        #d8dee6;
  --line-soft:   #e6eaf0;
  --ai:          #2d4a6b;
  --ai-ink:      #ffffff;
  --sun:         #b8862f;
  --ok:          #3f7a5a;
  --err:         #a4423a;

  --mincho: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, serif;
  --gothic: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", system-ui, sans-serif;
  --mono:   ui-monospace, "SF Mono", Menlo, monospace;

  --t-xs: 0.6875rem;
  --t-s:  0.8125rem;
  --t-m:  0.9375rem;
  --t-l:  1.0625rem;
  --t-xl: 1.375rem;
  --r: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:      #10141b;
    --surface:     #171d26;
    --surface-alt: #1f2732;
    --ink:         #e6eaf1;
    --ink-soft:    #aab4c2;
    --muted:       #78828f;
    --line:        #2a333f;
    --line-soft:   #212934;
    --ai:          #8fb0d4;
    --ai-ink:      #10141b;
    --sun:         #d9ab5c;
    --ok:          #6aa886;
    --err:         #d98f86;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--gothic);
  font-size: var(--t-m);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 20px calc(48px + env(safe-area-inset-bottom));
}

.loading { color: var(--muted); text-align: center; padding: 48px 0; }

/* ── ヘッダー ─────────────────────────── */
.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 22px;
}
.head-title {
  font-family: var(--mincho);
  font-size: var(--t-xl);
  letter-spacing: 0.12em;
  line-height: 1;
}
.head-meta {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  line-height: 1.7;
}

/* ── テキスト ─────────────────────────── */
.lead { color: var(--ink-soft); font-size: var(--t-s); margin: 0 0 16px; }
.lead-strong { color: var(--ink); }

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 30px 0 12px;
}
.section-label .count { color: var(--ink); font-variant-numeric: tabular-nums; }

.lock-note {
  text-align: center;
  color: var(--muted);
  font-size: var(--t-s);
  padding: 24px 8px 8px;
  line-height: 1.9;
}
.lock-rule {
  display: block;
  width: 28px;
  height: 1px;
  background: var(--line);
  margin: 0 auto 16px;
}

.msg { font-size: var(--t-s); padding: 10px 0; }
.msg-err { color: var(--err); }
.msg-ok  { color: var(--ok); }

/* ── 種目タイル ───────────────────────── */
.tile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 98px;
  padding: 16px 14px;
  background: var(--surface-alt);
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: var(--t-m);
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.tile:hover { border-color: var(--line); }
.tile[aria-pressed="true"] {
  background: var(--ai);
  border-color: var(--ai);
  color: var(--ai-ink);
}
.tile:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }
.tile-label { font-weight: 600; letter-spacing: 0.04em; display: block; }
.tile-sub { font-size: var(--t-xs); opacity: .7; font-family: var(--mono); display: block; }

.tile-other {
  width: 100%;
  margin-top: 10px;
  min-height: 0;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  padding: 14px;
}
.tile-other .tile-sub { margin-left: auto; }

/* ── 入力 ─────────────────────────────── */
.field {
  width: 100%;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--t-m);
  line-height: 1.6;
  color: var(--ink);
  resize: none;
}
.field::placeholder { color: var(--muted); }
.field:focus-visible { outline: 2px solid var(--sun); outline-offset: 1px; border-color: var(--ai); }
.field-other { margin-top: 8px; border-color: var(--ai); }
.field-note { margin-top: 12px; background: transparent; font-size: var(--t-s); }

.form-row { display: flex; flex-direction: column; gap: 6px; padding-bottom: 16px; }
.form-label {
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}
.form-hint { font-size: var(--t-xs); color: var(--muted); line-height: 1.7; }

.btn {
  width: 100%;
  padding: 15px;
  margin-top: 14px;
  background: var(--ai);
  color: var(--ai-ink);
  border: none;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--t-m);
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { background: var(--surface-alt); color: var(--muted); cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }

.btn-quiet {
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  background: transparent;
  color: var(--ai);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--t-s);
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.btn-quiet:hover { border-color: var(--ai); }
.btn-quiet:focus-visible { outline: 2px solid var(--sun); outline-offset: 2px; }

.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin-top: 26px;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--ink-soft); }

/* ── ログ表示 ─────────────────────────── */
.done-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: var(--r);
  font-size: var(--t-s);
  color: var(--ok);
}

/* 今週の回数。記録した後だけ出る自分用の数字。 */
.week-note {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 12px 14px 0;
}
.week-count { color: var(--ink-soft); }
.week-count strong { color: var(--sun); font-size: var(--t-l); letter-spacing: 0; }

.log { display: flex; flex-direction: column; }

.log-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
}
.log-row:first-child { border-top: none; }
.log-row-mine {
  border-left: 2px solid var(--sun);
  padding-left: 12px;
  margin-left: -14px;
}

/* アイコン列は幅を固定して、名前の開始位置を全行で揃える */
.acts {
  display: flex;
  gap: 5px;
  align-items: center;
  padding-top: 3px;
  color: var(--ai);
  width: 76px;
  flex: 0 0 76px;
}
.log-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.who { font-size: var(--t-s); font-weight: 600; letter-spacing: 0.03em; }
.who-owner { color: var(--sun); }
.log-time { font-family: var(--mono); font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-note { font-size: var(--t-s); color: var(--ink-soft); line-height: 1.7; }

.other-tag {
  display: inline-block;
  font-size: var(--t-xs);
  padding: 1px 8px;
  border: 1px solid var(--sun);
  color: var(--sun);
  border-radius: 2px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.6;
}

.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

.tally {
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--muted);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  padding-top: 20px;
  text-align: center;
}
.tally strong { color: var(--sun); font-weight: 600; }

.foot {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: var(--t-xs);
  color: var(--muted);
  line-height: 1.9;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
