@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/outfit-400.woff2") format("woff2");
}

@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/outfit-600.woff2") format("woff2");
}

@font-face {
  font-family: Outfit;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/outfit-700.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --fog: #e7edf3;
  --paper: #ffffff;
  --ink: #16324f;
  --mist: #4e6478;
  --line: #e3eaf1;
  --water: #1c8cff;
  --water-deep: #0b6fe0;
  --track: #d6e9ff;
  --soft: #f6f9fc;
  --danger: #b42318;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--fog);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 280px at 50% -40px, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0) 70%),
    var(--fog);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body.sheet-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--water);
  outline-offset: 2px;
}

.noscript {
  padding: 24px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
}

.hero {
  margin-bottom: 16px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.who {
  display: flex;
  gap: 12px;
  min-width: 0;
  flex: 1 1 200px;
}

.who-text {
  min-width: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e5f6ea;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  flex: none;
}

.brand {
  margin: 0 0 2px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--water-deep);
}

.name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.nickname {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.date {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--mist);
  white-space: nowrap;
}

@media (max-width: 340px) {
  .who {
    flex-basis: 100%;
  }

  .card-btn {
    margin-left: auto;
  }
}

.edit-btn,
.card-btn,
.text-btn {
  appearance: none;
}

.edit-btn {
  border: 1px solid #b9d9fb;
  background: #fff;
  color: var(--water-deep);
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  min-height: 32px;
  line-height: 1.2;
}

.card-btn {
  flex: 0 0 auto;
  align-self: flex-start;
  border: 1px solid #d5e4f2;
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.name-form {
  margin-top: 12px;
  background: var(--paper);
  border: 1px solid #e4edf5;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(22, 50, 79, 0.05);
}

.name-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.text-btn {
  border: 0;
  background: #f3f6f9;
  color: var(--ink);
  border-radius: 999px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--paper);
  border: 1px solid #e4edf5;
  border-radius: 24px;
  padding: 18px 16px 16px;
  box-shadow: 0 12px 32px rgba(22, 50, 79, 0.06);
}

.card.water {
  border-top: 4px solid var(--water);
}

.card.sport {
  border-top: 4px solid var(--sport, var(--line));
}

.card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.ring-wrap {
  position: relative;
  width: min(214px, 100%);
  aspect-ratio: 1;
  margin: 8px auto 0;
}

.ring-svg {
  display: block;
  width: 100%;
  height: 100%;
  shape-rendering: geometricPrecision;
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 16;
}

.ring-track {
  stroke: var(--track);
}

.ring-value {
  stroke: var(--water);
  stroke-linecap: round;
}

.ring-center {
  position: absolute;
  inset: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-kicker,
.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.ring-kicker {
  margin-bottom: 2px;
}

.ring-total {
  margin: 0;
  font-size: clamp(40px, 12vw, 48px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-unit {
  margin: 2px 0 0;
  color: var(--mist);
  font-size: 13px;
  font-weight: 600;
}

.done-label {
  text-align: center;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--water-deep);
}

.done-pct {
  text-align: center;
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--water);
  font-variant-numeric: tabular-nums;
}

.remain-line {
  text-align: center;
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.goal-line {
  text-align: center;
  margin: 2px 0 14px;
  color: var(--mist);
  font-size: 13px;
}

.sip,
.record {
  appearance: none;
  width: 100%;
  border: 0;
  border-radius: 16px;
  font-weight: 700;
}

.sip {
  min-height: 52px;
  background: var(--water);
  color: #fff;
  font-size: 17px;
  box-shadow: 0 8px 18px rgba(28, 140, 255, 0.28);
}

.sip.small {
  width: auto;
  min-width: 96px;
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
  box-shadow: none;
}

.sip:active,
.record:active {
  transform: scale(0.98);
}

.sip:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}

.record {
  margin-top: 10px;
  min-height: 50px;
  font-size: 16px;
}

.tabs {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  padding: 4px;
  background: #f3f6f9;
  border-radius: 16px;
}

.tab {
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--mist);
  font-size: 13px;
  font-weight: 700;
  border-radius: 12px;
  min-height: 48px;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.tab[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(22, 50, 79, 0.1);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.tab[aria-selected="true"] .dot {
  width: 8px;
  height: 8px;
}

.sum,
.empty {
  margin-top: 14px;
  border-radius: 16px;
  background: var(--soft);
}

.sum {
  padding: 12px 14px;
  border-left: 4px solid var(--sport, var(--line));
}

.sum-line {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.sum-line span,
.pace strong,
.log-time,
.ring-total,
.done-pct {
  font-variant-numeric: tabular-nums;
}

.sep {
  color: #9aadbe;
  font-weight: 600;
  padding: 0 4px;
}

.pace {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.pace strong {
  font-size: 16px;
}

.empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--mist);
  font-size: 15px;
  font-weight: 600;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.fields.single {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field span {
  font-size: 13px;
  font-weight: 700;
  color: var(--mist);
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f8fbfd;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.field input::placeholder {
  color: #9aadbe;
  font-weight: 500;
}

.form-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.form-error:empty {
  display: none;
}

.logs-title {
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--mist);
}

.logs {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 10px 12px;
  background: var(--soft);
  border-radius: 14px;
}

.log-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
}

.log-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--mist);
}

.log-detail {
  font-size: 15px;
  font-weight: 600;
}

.x {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #7e93a7;
  font-size: 22px;
  line-height: 1;
  flex: none;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(22, 50, 79, 0.48);
}

.sheet[hidden] {
  display: none;
}

.sheet-panel {
  width: min(430px, 100%);
  max-height: min(92dvh, 920px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 24px 24px 18px 18px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 20px 50px rgba(22, 50, 79, 0.2);
  outline: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.sheet-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.sheet-scroll {
  overflow: auto;
  min-height: 0;
}

.preview {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  background: var(--fog);
  -webkit-touch-callout: default;
  user-select: auto;
}

.hint {
  margin: 10px 0 0;
  color: var(--mist);
  font-size: 13px;
  line-height: 1.5;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.status {
  margin: 0;
  color: var(--water-deep);
  font-size: 13px;
  font-weight: 600;
}

.status:empty {
  display: none;
}

.pulse {
  animation: rise 420ms ease;
}

@keyframes rise {
  from {
    transform: translateY(6px);
    opacity: 0.35;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@media (hover: hover) {
  .sip:hover:not(:disabled) {
    background: #0a7ae6;
  }

  .record:hover {
    filter: brightness(0.96);
  }

  .x:hover {
    background: #eef3f8;
    color: var(--ink);
  }

  .card-btn:hover,
  .edit-btn:hover,
  .text-btn:hover {
    background: #f5f9fc;
  }
}

@media (max-height: 680px) {
  .ring-wrap {
    width: min(176px, 100%);
  }
}

@media (min-width: 720px) {
  .sheet {
    align-items: center;
  }

  .sheet-panel {
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse {
    animation: none;
  }

  .sip:active,
  .record:active {
    transform: none;
  }
}
