:root {
  --ink: #173b34;
  --ink-soft: #41625c;
  --paper: #f6f2e9;
  --surface: #fffdf8;
  --line: #d8ddd3;
  --accent: #ee704f;
  --accent-deep: #d65538;
  --lime: #c6df70;
  --blue: #99cbd0;
  --lavender: #b7add4;
  --gold: #e8bc62;
  --shadow: 0 18px 50px rgba(23, 59, 52, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(198, 223, 112, 0.24), transparent 25rem),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  font-feature-settings: "palt";
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
}

.header-actions,
.backup-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cloud-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.cloud-dot {
  width: 8px;
  height: 8px;
  background: #9aaaa5;
  border-radius: 50%;
}

.cloud-button[data-status="connected"] .cloud-dot {
  background: #5f9e4a;
  box-shadow: 0 0 0 4px rgba(95, 158, 74, 0.13);
}

.cloud-button[data-status="syncing"] .cloud-dot {
  background: var(--gold);
  animation: pulse 1s ease-in-out infinite alternate;
}

.cloud-button[data-status="error"] .cloud-dot {
  background: var(--accent);
}

@keyframes pulse {
  to { transform: scale(1.45); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 28px;
  height: 28px;
  border: 7px solid var(--ink);
  border-top-color: var(--accent);
  border-radius: 50%;
  transform: rotate(-24deg);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 21px;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button--dark {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(23, 59, 52, 0.16);
}

.button--accent {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(238, 112, 79, 0.2);
}

.button--accent:hover {
  background: var(--accent-deep);
}

.button--wide {
  width: 100%;
  min-height: 54px;
  border-radius: 14px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: 72px;
  align-items: end;
  min-height: 490px;
  padding: 76px 76px 66px;
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  right: -120px;
  width: 500px;
  height: 500px;
  border: 80px solid rgba(198, 223, 112, 0.12);
  border-radius: 50%;
}

.hero::after {
  content: "";
  position: absolute;
  right: 33%;
  bottom: -90px;
  width: 170px;
  height: 170px;
  background: var(--accent);
  border-radius: 42% 58% 60% 40%;
  opacity: 0.86;
  transform: rotate(18deg);
}

.hero-copy,
.week-score {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.hero .eyebrow {
  color: var(--lime);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 28px;
  font-size: clamp(3rem, 6.3vw, 5.6rem);
  line-height: 1.03;
  letter-spacing: -0.07em;
}

h1 em {
  color: var(--lime);
  font-style: normal;
}

.hero-lead {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.9;
}

.week-score {
  padding: 29px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  backdrop-filter: blur(12px);
}

.week-score__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 700;
}

.sample-badge {
  padding: 5px 9px;
  color: var(--ink);
  background: var(--lime);
  border-radius: 99px;
  font-size: 0.66rem;
}

.sample-badge[hidden] {
  display: none;
}

.week-score strong {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 4.2rem;
  letter-spacing: -0.06em;
}

.week-score small {
  font-size: 0.9rem;
  letter-spacing: 0;
  opacity: 0.65;
}

.week-score__bar {
  height: 8px;
  margin: 17px 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.week-score__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lime);
  border-radius: inherit;
  transition: width 400ms ease;
}

.week-score p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  line-height: 1.6;
}

.weekly-section,
.history-section {
  padding: 74px 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  letter-spacing: -0.05em;
}

.section-heading--week {
  align-items: center;
}

.date-range {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.week-nav {
  display: flex;
  align-items: center;
  padding: 4px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.week-nav button {
  min-width: 42px;
  height: 38px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  border-radius: 99px;
  font-weight: 800;
  cursor: pointer;
}

.week-nav button:hover {
  background: #fff;
}

.activity-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.activity-card {
  min-width: 0;
  padding: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(216, 221, 211, 0.88);
  border-radius: var(--radius-md);
}

.activity-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 34px;
}

.activity-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  background: var(--card-color, var(--lime));
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 950;
}

.done-badge {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.done-badge.is-done {
  color: var(--ink);
}

.activity-card h3 {
  min-height: 2.7em;
  margin: 0 0 7px;
  font-size: 1rem;
  line-height: 1.35;
}

.activity-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.activity-card strong {
  display: block;
  margin-top: 18px;
  font-size: 1.3rem;
}

.week-note {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 16px;
  padding: 20px 24px;
  background: rgba(198, 223, 112, 0.34);
  border-radius: 15px;
}

.week-note__icon {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-weight: 900;
}

.week-note p,
.week-note span {
  margin: 0;
}

.week-note strong {
  margin-right: 5px;
}

.week-note p {
  font-size: 0.84rem;
  line-height: 1.7;
}

.week-note p span {
  color: var(--ink-soft);
}

.lower-section {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: stretch;
}

.weight-panel,
.entry-panel {
  padding: clamp(28px, 4vw, 46px);
  background: var(--surface);
  border: 1px solid rgba(216, 221, 211, 0.86);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.weight-panel {
  min-height: 580px;
}

.weight-current {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  text-align: right;
}

.weight-current strong {
  font-size: 2.3rem;
  letter-spacing: -0.06em;
}

.weight-current > span {
  margin-left: 5px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.weight-current small {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.chart-wrap {
  min-height: 390px;
}

.chart-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  text-align: center;
  line-height: 1.7;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 390px;
  overflow: visible;
}

.chart-grid {
  stroke: #dfe3dc;
  stroke-width: 1;
}

.chart-area {
  fill: url(#areaGradient);
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-point {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 3;
}

.chart-label {
  fill: var(--ink-soft);
  font-family: inherit;
  font-size: 11px;
}

.chart-value {
  fill: var(--ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
}

.type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 25px;
}

.type-picker label {
  cursor: pointer;
}

.type-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-picker span {
  display: block;
  padding: 9px 12px;
  color: var(--ink-soft);
  background: #f2f1eb;
  border: 1px solid transparent;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 800;
  transition: 150ms ease;
}

.type-picker input:checked + span {
  color: #fff;
  background: var(--ink);
}

.type-picker input:focus-visible + span {
  outline: 3px solid rgba(238, 112, 79, 0.3);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.field {
  display: block;
}

.field[hidden] {
  display: none;
}

.field > span {
  display: block;
  margin: 0 0 7px 3px;
  font-size: 0.72rem;
  font-weight: 850;
}

.field small {
  color: var(--ink-soft);
  font-size: 0.65rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #f4f3ed;
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
}

.field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #f4f3ed;
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
}

.field select:focus {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 59, 52, 0.08);
}

.field--photo {
  grid-column: 1 / -1;
}

.field--photo input[type="file"] {
  height: auto;
  min-height: 52px;
  padding: 12px;
}

.button:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.field input:focus {
  background: #fff;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(23, 59, 52, 0.08);
}

.field--note {
  margin: 15px 0 20px;
}

.save-message {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  text-align: center;
}

.history-list {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.photo-section {
  padding: 74px 0 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.photo-empty {
  display: grid;
  grid-column: 1 / -1;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 9px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  text-align: center;
}

.photo-empty > span {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  border-radius: 50%;
  font-size: 1.35rem;
}

.photo-empty strong {
  margin-top: 5px;
}

.photo-empty small {
  max-width: 360px;
  line-height: 1.7;
}

.photo-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(23, 59, 52, 0.06);
}

.photo-card__media {
  display: grid;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  place-items: center;
  color: var(--ink);
  background: #e8e9df;
  text-decoration: none;
}

.photo-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  background: var(--lime);
  border-radius: 22px;
  font-size: 1.1rem;
  font-weight: 950;
}

.photo-card__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 16px 8px;
}

.photo-card__caption strong {
  font-size: 0.82rem;
}

.photo-card__caption time {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.photo-card > p {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.6;
}

.history-detail a {
  color: inherit;
}

.history-row {
  display: grid;
  grid-template-columns: 90px 48px minmax(170px, 1fr) minmax(120px, 1.5fr) 40px;
  gap: 17px;
  align-items: center;
  min-height: 76px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-date {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.history-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  background: var(--row-color, var(--lime));
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 950;
}

.history-name {
  font-size: 0.88rem;
  font-weight: 850;
}

.history-detail {
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.history-detail span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-button {
  width: 34px;
  height: 34px;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.delete-button:hover {
  color: var(--accent-deep);
  background: rgba(238, 112, 79, 0.1);
}

.empty-row {
  padding: 42px 20px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.7;
}

.text-button {
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font-size: 0.75rem;
  font-weight: 750;
  cursor: pointer;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 44px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

footer p {
  margin: 0;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 48px;
    min-height: auto;
    padding: 60px 48px 48px;
  }

  .week-score {
    max-width: 430px;
  }

  .activity-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lower-section {
    grid-template-columns: 1fr;
  }

  .weight-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    min-height: 76px;
  }

  .brand {
    font-size: 0.7rem;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    border-width: 6px;
  }

  .site-header .button {
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.76rem;
  }

  .header-actions {
    gap: 7px;
  }

  .cloud-button {
    min-width: 40px;
    padding: 0 11px;
  }

  .cloud-button #cloud-label {
    display: none;
  }

  .hero {
    gap: 40px;
    padding: 48px 24px 28px;
    border-radius: 22px;
  }

  h1 {
    font-size: clamp(2.7rem, 14vw, 4.2rem);
  }

  .hero-lead br {
    display: none;
  }

  .week-score {
    padding: 22px;
  }

  .weekly-section,
  .history-section {
    padding: 54px 0;
  }

  .section-heading--week {
    align-items: flex-end;
  }

  .week-nav button {
    min-width: 36px;
    padding: 0 8px;
  }

  .week-nav #today-week {
    display: none;
  }

  .activity-list {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }

  .photo-section {
    padding-top: 54px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .photo-empty {
    min-height: 230px;
    padding: 24px;
  }

  .backup-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 9px;
  }

  .activity-card {
    padding: 17px;
  }

  .activity-card__head {
    margin-bottom: 24px;
  }

  .activity-card h3 {
    font-size: 0.88rem;
  }

  .week-note {
    align-items: flex-start;
  }

  .weight-panel,
  .entry-panel {
    padding: 26px 20px;
    border-radius: 22px;
  }

  .chart-wrap,
  .chart-svg,
  .chart-empty {
    min-height: 300px;
    height: 300px;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .history-row {
    grid-template-columns: 62px 38px minmax(0, 1fr) 32px;
    gap: 10px;
    padding: 12px 13px;
  }

  .history-icon {
    width: 36px;
    height: 36px;
  }

  .history-detail {
    grid-column: 3 / 4;
    margin-top: -8px;
  }

  .delete-button {
    grid-column: 4;
    grid-row: 1 / 3;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
