:root {
  color-scheme: light;
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  color: #182b28;
  background: #f3f6f3;
  --muted: #526763;
  --line: #d9e3de;
  --accent: #12634e;
  --accent-dark: #0b4839;
  --accent-soft: #e6f2eb;
  --error: #962c34;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; line-height: 1.55; }
h1, h2, h3, p, dl, dd, fieldset { margin: 0; }
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); letter-spacing: -.045em; line-height: 1.2; }
h2 { font-size: 1.22rem; letter-spacing: -.025em; line-height: 1.35; }
h3 { font-size: 1.07rem; }
a { color: inherit; }
section, #records { scroll-margin-top: 1rem; }
:focus-visible { outline: 2px solid #218362; outline-offset: 3px; }
.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: #142c27; color: #fff; }
.header-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 750; text-decoration: none; }
.brand-icon, .coach-icon { display: grid; place-items: center; flex: none; border-radius: 9px; font-size: 1.25rem; }
.brand-icon { width: 33px; height: 33px; color: #143d31; background: #b4eacb; }
nav { display: flex; flex-wrap: wrap; gap: .35rem 1.15rem; }
nav a { color: #d9ebe3; font-size: .875rem; font-weight: 650; text-decoration: none; }
nav a:hover { text-decoration: underline; }

main { padding-block: 30px 48px; }
.page-heading { margin-bottom: 20px; }
.page-heading p { color: var(--muted); margin-top: 7px; }
.entry-grid, .metrics-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; gap: 16px; }
.metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; margin-bottom: 16px; }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 4px 13px #16332907; }
.section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; }
.group-title { margin: 24px 0 12px; font-size: 1.45rem; }
.caption, .coach-note { color: var(--muted); font-size: .875rem; }
.bottom-grid { margin-top: 16px; }

form { display: grid; gap: 12px; margin-top: 14px; }
label { display: grid; min-width: 0; gap: 5px; font-size: .875rem; font-weight: 650; }
input, select, button { font: inherit; }
input, select { width: 100%; min-width: 0; height: 42px; padding: 7px 10px; background: #fff; color: inherit; border: 1px solid #c8d6cf; border-radius: 8px; font-size: 1rem; font-weight: 400; }
input::placeholder { color: #667972; opacity: 1; }
select { appearance: none; padding-right: 27px; background-image: linear-gradient(45deg, transparent 50%, #496761 50%), linear-gradient(135deg, #496761 50%, transparent 50%); background-position: right 15px center, right 11px center; background-size: 4px 4px; background-repeat: no-repeat; }
input[type=date] { min-inline-size: 0; }
.date-field { width: min(100%, 200px); }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-actions, .record-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-actions .primary { margin-inline-start: auto; }
.button { min-height: 40px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; font-size: .875rem; font-weight: 700; }
.button.small { min-height: 36px; padding: 5px 9px; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: var(--accent-soft); color: #164c3e; border-color: #d8e9df; }
.secondary:hover, .quiet:hover { background: #d8ebe0; }
.quiet { background: #fff; color: #405b53; border-color: var(--line); }
.button:disabled { opacity: .55; cursor: default; }
.status:not(:empty) { margin-top: 9px; color: var(--accent-dark); font-size: .875rem; overflow-wrap: anywhere; }
.status.error { color: var(--error); }
.status + .caption { margin-top: 7px; }
input[aria-invalid="true"] { border-color: var(--error); }

#exercise-list { display: grid; gap: 12px; }
.exercise-card { position: relative; min-inline-size: 0; padding: 10px 13px 13px; border: 1px solid var(--line); border-radius: 11px; background: #f7faf7; }
.exercise-card legend { padding: 0 5px; font-size: .875rem; font-weight: 750; }
.strength-fields, .cardio-fields { margin-top: 10px; }
.set-list { display: grid; gap: 6px; }
.set-row { display: grid; grid-template-columns: 3.4rem repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); }
.set-row:has(.set-count:not([hidden])) { grid-template-columns: 3.4rem repeat(3, minmax(0, 1fr)) auto; }
.set-label { align-self: center; font-size: .8rem; font-weight: 700; color: var(--muted); }
.set-row .button { height: 42px; }
.add-set, .remove-exercise { margin-top: 6px; }

.coach-card { background: #fafffc; border-color: #cde4d8; }
.coach-heading { display: flex; align-items: center; gap: 9px; }
.coach-icon { width: 36px; height: 36px; color: #154e3d; background: #ceeedb; }
.coach-note { margin-top: 9px; }
.result { margin-top: 13px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f6f9f7; overflow-wrap: anywhere; }
.result p { white-space: pre-wrap; font-size: .9375rem; color: var(--muted); }
.result h3 { margin-bottom: 4px; }
.result.error { border-color: #ebc3c7; background: #fff6f6; }
.result.error p { color: var(--error); }

.level-card { background: #183c33; color: #fff; border-color: #183c33; }
.level-card .caption, .xp-heading, #total-xp { color: #d0e6da; font-size: .875rem; }
.level-number { margin-block: 7px; font-size: 1.15rem; }
.level-number strong { font-size: 2rem; line-height: 1; }
progress { display: block; width: 100%; height: 9px; margin: 8px 0; border: 0; border-radius: 999px; background: #426157; appearance: none; overflow: hidden; }
progress::-webkit-progress-bar { background: #426157; }
progress::-webkit-progress-value { background: #a6e8c1; border-radius: 999px; }
progress::-moz-progress-bar { background: #a6e8c1; border-radius: 999px; }
.weekly dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.weekly dl div + div { padding-left: 10px; border-left: 1px solid var(--line); }
.weekly dt { color: var(--muted); font-size: .875rem; }
.weekly dd { font-size: .875rem; overflow-wrap: anywhere; }
.weekly strong { font-size: 1.6rem; }
.trend-select { width: min(100%, 17rem); }
.trend .caption { margin-top: 3px; }
.chart-frame { margin-top: 8px; }
canvas { display: block; width: 100%; height: 210px; }
.chart-details { color: var(--muted); font-size: .875rem; }
.chart-details ul { margin-bottom: 0; }

#record-list { list-style: none; padding: 0; margin: 10px 0 0; }
.record-item { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.record-item:last-child { padding-bottom: 0; }
.record-item time { font-weight: 750; }
.record-item ul { margin: 0; padding-inline-start: 1.25rem; color: var(--muted); font-size: .875rem; }
.record-actions .delete { color: var(--error); }
dialog { width: min(420px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: inherit; }
dialog::backdrop { background: #142c2766; }
dialog .caption { margin-top: 7px; overflow-wrap: anywhere; }
dialog .record-actions { justify-content: flex-end; }
.danger { color: #fff; background: var(--error); }
.danger:hover { background: #752329; }

@media (max-width: 800px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { flex-direction: column; align-items: flex-start; justify-content: center; gap: .65rem; padding-block: 12px; }
  .entry-grid, .metrics-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 16px; }
  main { padding-block: 22px 32px; }
}

@media (max-width: 460px) {
  .shell { width: calc(100% - 24px); }
  .field-pair { grid-template-columns: minmax(0, 1fr); }
  .set-row, .set-row:has(.set-count:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-label { grid-column: 1 / -1; }
  .set-row .remove-set { justify-self: start; height: auto; }
  .form-actions .primary { flex: 1 0 100%; }
  .weekly strong { font-size: 1.3rem; }
}
