:root {
  color-scheme: light;
  --paper: #fff3dc;
  --ink: #17181d;
  --muted: #514943;
  --yellow: #ffde47;
  --green: #b6eaa5;
  --peach: #ffb391;
  --lilac: #c9b8ff;
  --blue: #96dff4;
  --mono: ui-monospace, Consolas, monospace;
  font-family: system-ui, sans-serif;
  background: #e3d9f7;
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #5333a7; outline-offset: 3px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 490px;
  margin: auto;
  background: var(--paper);
  padding-top: env(safe-area-inset-top);
}
.appbar, main { padding-inline: clamp(14px, 5vw, 23px); }
.appbar {
  min-height: 58px;
  margin: 0 clamp(14px, 5vw, 23px);
  padding-inline: 0;
  border-bottom: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.brand, .appbar-actions { display: flex; align-items: center; gap: 9px; }
.brand { font-weight: 900; font-size: 13px; text-decoration: none; }
.stamp, .avatar {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 2px solid var(--ink);
  border-radius: 3px;
}
.stamp { background: var(--yellow); box-shadow: 2px 2px var(--ink); }
.stamp .icon { width: 19px; height: 19px; }
.avatar { background: var(--lilac); font-weight: 800; }
.install { min-height: 44px; background: transparent; border: 0; font-weight: 800; font-size: 13px; text-decoration: underline; }
main { min-height: 0; overflow: auto; flex: 1; padding-top: 16px; padding-bottom: 22px; }
main:focus { outline: none; }
.connection { padding: 7px 16px; font-size: 12px; text-align: center; background: var(--lilac); }

.lead { margin-bottom: 15px; }
.eyebrow { font: 750 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h1 { font: 900 clamp(28px, 8vw, 37px)/1.02 Arial, sans-serif; letter-spacing: -.055em; margin: 6px 0; overflow-wrap: anywhere; }
h2 { font: 850 22px/1.13 Arial, sans-serif; letter-spacing: -.04em; }
.lead p { color: var(--muted); font-size: 14px; }
.lead-bottom { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.text-button { min-height: 44px; background: none; border: 0; padding: 0 1px; font-weight: 750; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.lead-bottom .text-button { flex: none; }
.metrics { display: grid; grid-template-columns: 1.35fr 1fr; gap: 9px; margin-right: 4px; }
.block {
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 3px 3px var(--ink);
  background: var(--tone, #fff9e9);
}
.score {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 159px;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 6px;
  --tone: var(--yellow);
}
.score::after {
  content: "";
  position: absolute;
  inset: 8px 8px 8px 51%;
  z-index: -1;
  opacity: .14;
  background: conic-gradient(var(--ink) 25%, transparent 0 50%, var(--ink) 0 75%, transparent 0) 0 0 / 22px 22px;
  mask-image: linear-gradient(90deg, transparent, #000);
}
.metric-label { font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.score-value { font: 850 clamp(41px, 12vw, 58px)/.94 var(--mono); letter-spacing: -.095em; }
.score-value small { display: inline-block; font: 700 11px var(--mono); letter-spacing: 0; margin-left: 4px; white-space: nowrap; }
.score p { font-size: 12px; }
.metric-side { display: grid; grid-template-rows: 1fr 1fr; gap: 9px; }
.metric-side .block { display: grid; align-content: center; gap: 6px; padding: 8px 10px; }
.metric-side .block:first-child { --tone: var(--lilac); }
.metric-side .block:last-child { --tone: var(--peach); }
.metric-number, .card-value { font: 750 clamp(13px, 3.7vw, 16px)/1.2 var(--mono); letter-spacing: -.04em; overflow-wrap: anywhere; }
.activities { margin-top: 21px; }
.activity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 10px 4px 0 0; }
[data-section="bike"] { --tone: var(--green); }
[data-section="mush"] { --tone: var(--peach); }
[data-section="med"] { --tone: var(--lilac); }
[data-section="xbox"] { --tone: var(--blue); }
.activity-card {
  min-height: 83px;
  padding: 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-content: start;
  gap: 6px;
  text-align: left;
  text-decoration: none;
}
.activity-card strong { justify-self: end; font-size: 13px; overflow-wrap: anywhere; }
.activity-card .card-value { grid-column: 1 / -1; font-size: 12px; }
.activity-card:hover, .button:hover { box-shadow: 1px 1px var(--ink); }

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 5px 7px max(6px, env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink);
}
.tab { min-height: 52px; display: grid; place-content: center; justify-items: center; gap: 4px; text-decoration: none; font-size: 11px; font-weight: 750; }
.tab-symbol { width: 35px; height: 25px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 2px; }
.tab-symbol .icon { width: 18px; height: 18px; }
.tab[aria-current="page"] .tab-symbol { background: var(--yellow); border-color: var(--ink); box-shadow: 2px 2px var(--ink); }
.tab:hover .tab-symbol { background: var(--yellow); }

.section-head { margin-bottom: 17px; }
.section-head p, .empty { font-size: 14px; color: var(--muted); }
.detail-card { position: relative; isolation: isolate; overflow: hidden; padding: 16px; min-height: 136px; margin-right: 4px; }
.detail-card .figure { position: absolute; z-index: -1; right: 5px; bottom: 0; width: 134px; height: 134px; opacity: .21; transform: rotate(-9deg); stroke-width: 1.1; }
.detail-card .detail-value { font: 850 clamp(33px, 10vw, 46px)/1.1 var(--mono); letter-spacing: -.085em; margin: 8px 0 0; }
.detail-card .detail-note { margin-top: 5px; font-size: 13px; }
.button {
  min-height: 46px;
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 3px 3px var(--ink);
  font-weight: 800;
  padding: 7px 12px;
  font-size: 14px;
}
.primary { background: var(--yellow); }
.secondary { background: #fff9e9; }
.section-actions, .timer-actions { display: flex; gap: 9px; margin: 14px 4px 0 0; }
.section-actions .button, .timer-actions .primary { flex: 1; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets button { min-height: 44px; padding: 6px 11px; border: 2px solid var(--ink); border-radius: 3px; background: transparent; font-weight: 750; }
.presets button[aria-pressed="true"] { background: var(--lilac); box-shadow: 2px 2px var(--ink); }
.journal { margin-top: 23px; }
.empty { padding: 12px 0; }
.entries { list-style: none; margin: 9px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.entry { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; min-height: 53px; border-bottom: 1px solid var(--ink); }
.entry-info { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.entry-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.entry-value { flex: none; font-weight: 750; font: 750 13px var(--mono); }
.entry-edit { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border: 0; background: none; padding: 0; }
.entry-edit .icon { width: 18px; height: 18px; }
.entry-edit:hover { background: var(--lilac); }
.feedback { margin: 0; background: var(--yellow); border-block: 1px solid var(--ink); padding: 7px 14px; font-size: 13px; }

dialog {
  width: min(calc(100% - 24px), 435px);
  max-height: calc(100dvh - 24px);
  padding: 17px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 5px 5px var(--ink);
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: #17181d88; }
.fields { display: grid; gap: 10px; margin-top: 13px; }
.fields label { display: grid; gap: 5px; font-size: 13px; font-weight: 750; }
.fields input { width: 100%; min-height: 44px; border: 2px solid var(--ink); border-radius: 3px; padding: 6px 8px; background: #fffaf1; font-size: 16px; }
.fields-help, .field-error { font-size: 13px; }
.field-error, .delete { color: #81271a; }
.field-error, .delete { margin-top: 10px; }
.editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (min-width: 560px) {
  .app { min-height: min(700px, 100dvh); height: min(860px, calc(100dvh - 30px)); margin-block: 15px; border: 2px solid var(--ink); box-shadow: 6px 6px var(--ink); }
}
@media (max-width: 355px) {
  .score-value small { display: block; margin: 5px 0 0; }
  .lead-bottom .text-button { font-size: 12px; }
}
