:root {
  color-scheme: light;
  --bg: #eef5f0;
  --bg-2: #f8fbf7;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --surface-tint: #edf8f2;
  --text: #15231e;
  --muted: #62766d;
  --soft: #8aa097;
  --line: rgba(34, 72, 58, 0.13);
  --brand: #08735f;
  --brand-2: #11a68a;
  --brand-3: #bff3df;
  --ink: #0d3f35;
  --amber: #f6a93b;
  --rose: #df5c6d;
  --danger: #b93942;
  --shadow: 0 18px 48px rgba(14, 61, 49, 0.12);
  --shadow-soft: 0 8px 22px rgba(20, 50, 42, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --nav-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 10% 0%, rgba(17, 166, 138, 0.18), transparent 34rem),
    radial-gradient(circle at 92% 8%, rgba(246, 169, 59, 0.16), transparent 26rem),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
}

.ambient {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

.ambient::before {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0));
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  content: "";
  height: 260px;
  position: absolute;
  right: -80px;
  top: 120px;
  transform: rotate(-18deg);
  width: 260px;
}

a {
  color: var(--brand);
  text-decoration: none;
}

button,
.button {
  appearance: none;
  border: 0;
  border-radius: 16px;
  background: #eef5f1;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 760;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover,
.button:hover {
  box-shadow: inset 0 0 0 1px rgba(8, 115, 95, 0.2), var(--shadow-soft);
  transform: translateY(-1px);
}

button.primary,
.button.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 14px 32px rgba(8, 115, 95, 0.26);
}

.button.small {
  min-height: 38px;
  padding: 0 14px;
}

button.danger {
  background: linear-gradient(135deg, var(--danger), var(--rose));
  color: #fff;
}

.ghost-button {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  min-height: 38px;
}

.icon {
  height: 20px;
  width: 20px;
}

.topbar {
  align-items: center;
  background: rgba(248, 251, 247, 0.78);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(34, 72, 58, 0.09);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 42px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 10px;
  font-weight: 850;
  letter-spacing: 0;
}

.brand b {
  color: var(--brand);
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--brand), #54d0af);
  border-radius: 13px;
  color: #fff;
  display: inline-flex;
  height: 40px;
  justify-content: center;
  letter-spacing: -0.02em;
  width: 40px;
  box-shadow: 0 10px 26px rgba(8, 115, 95, 0.22);
}

.desktop-nav {
  align-items: center;
  display: flex;
  gap: 8px;
}

.nav-item {
  align-items: center;
  border-radius: 14px;
  color: var(--muted);
  display: inline-flex;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 720;
}

.nav-item.active {
  background: #e4f4ee;
  color: var(--brand);
}

.shell {
  margin: 0 auto;
  max-width: 1160px;
  padding: clamp(18px, 3vw, 34px) 18px 56px;
}

.hero {
  background:
    radial-gradient(circle at 78% 28%, rgba(191, 243, 223, 0.8), transparent 16rem),
    linear-gradient(135deg, #ffffff 0%, #edf8f2 54%, #d9f2e7 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  box-shadow: var(--shadow);
  display: grid;
  min-height: 420px;
  overflow: hidden;
  padding: clamp(28px, 8vw, 72px);
  position: relative;
}

.hero::after {
  background:
    linear-gradient(135deg, rgba(8, 115, 95, 0.92), rgba(17, 166, 138, 0.86)),
    repeating-linear-gradient(0deg, transparent 0 18px, rgba(255, 255, 255, 0.12) 18px 19px);
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(8, 115, 95, 0.28);
  content: "Mood 8/10\a Calm · Hopeful\a\a Write one kind next step";
  color: #fff;
  font-weight: 760;
  line-height: 1.9;
  padding: 26px;
  position: absolute;
  right: clamp(22px, 7vw, 80px);
  top: 72px;
  white-space: pre;
  width: min(280px, 32vw);
}

.hero > div {
  max-width: 520px;
  position: relative;
  z-index: 1;
}

.hero h1,
.page-title h1 {
  font-size: clamp(2.25rem, 7vw, 5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 16px;
}

.hero p,
.page-title p,
.muted {
  color: var(--muted);
}

.hero p {
  font-size: 1.08rem;
  max-width: 44rem;
}

.page-title {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 0 20px;
}

.page-title p {
  margin: 0;
  max-width: 520px;
}

.grid {
  display: grid;
  gap: 16px;
  margin: 18px 0;
}

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

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

.panel,
.grid article,
.stat-card,
.entry-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.panel,
.grid article {
  backdrop-filter: blur(18px);
}

.panel.link {
  color: var(--text);
  font-weight: 800;
  min-height: 116px;
}

.panel h2,
.grid h2 {
  margin-top: 0;
}

.section-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0 0 3px;
}

.section-head p {
  margin: 0;
}

.sparkline {
  align-items: end;
  background: linear-gradient(180deg, rgba(232, 245, 239, 0.74), rgba(255, 255, 255, 0.56));
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  gap: 8px;
  height: 150px;
  padding: 18px;
}

.sparkline span {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(8, 115, 95, 0.18);
  flex: 1;
  min-height: 16px;
}

.stat-card {
  min-height: 138px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  background: var(--brand-3);
  border-radius: 999px;
  content: "";
  height: 76px;
  opacity: 0.45;
  position: absolute;
  right: -18px;
  top: -18px;
  width: 76px;
}

.stat-card strong,
.grid article strong {
  display: block;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.stat-card span,
.grid article span {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-top: 8px;
}

.form {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1.3fr);
}

.mood-card {
  align-items: center;
  background: linear-gradient(135deg, #effaf5, #ffffff);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(120px, 0.9fr) minmax(180px, 1.4fr) auto;
  padding: 16px;
}

.mood-card strong,
.mood-card small {
  display: block;
}

.mood-card small {
  color: var(--muted);
  font-weight: 680;
}

label,
fieldset {
  color: var(--ink);
  display: grid;
  font-size: 0.92rem;
  font-weight: 760;
  gap: 8px;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
}

legend {
  padding: 0 6px;
}

input,
textarea,
select {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  font: inherit;
  font-weight: 560;
  min-height: 48px;
  outline: none;
  padding: 12px 14px;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(8, 115, 95, 0.48);
  box-shadow: 0 0 0 4px rgba(17, 166, 138, 0.14);
}

textarea {
  min-height: 260px;
  resize: vertical;
}

.field-counter {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 700;
  justify-self: end;
}

input[type="range"] {
  accent-color: var(--brand);
  min-height: 34px;
  padding: 0;
}

[data-mood-value] {
  align-items: center;
  background: var(--ink);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 0.86rem;
  height: 32px;
  justify-content: center;
  width: 44px;
}

.check,
.chips label {
  align-items: center;
  background: #edf7f2;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  padding: 9px 12px;
}

.check {
  border-radius: 16px;
}

.check input,
.chips input {
  min-height: auto;
  width: auto;
}

.chips label:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chips label.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar,
.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
}

.toolbar {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  padding: 10px;
}

.toolbar form {
  display: flex;
  flex: 1;
  gap: 10px;
  min-width: min(100%, 360px);
}

.inline {
  display: inline-flex;
  margin: 0;
}

.row,
.entry-card {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.row {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

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

.row p,
.entry-card p {
  color: var(--muted);
  margin: 5px 0 0;
}

.entry-card {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(239, 249, 244, 0.9));
  margin-bottom: 12px;
}

.entry-score {
  align-items: center;
  background: var(--ink);
  border-radius: 18px;
  color: #fff;
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: column;
  font-weight: 850;
  height: 64px;
  justify-content: center;
  line-height: 1;
  width: 64px;
}

.entry-score small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.67rem;
  margin-top: 5px;
}

.entry-score.large {
  height: 88px;
  width: 88px;
  font-size: 1.65rem;
}

.detail-hero {
  align-items: center;
  background:
    radial-gradient(circle at 82% 22%, rgba(191, 243, 223, 0.9), transparent 15rem),
    linear-gradient(135deg, #ffffff, #eaf8f2);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  padding: clamp(20px, 5vw, 34px);
}

.detail-hero h1 {
  font-size: clamp(2rem, 7vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 8px;
}

.detail-hero p {
  color: var(--muted);
  margin: 0 0 10px;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.mini-tags span {
  background: #e8f5ef;
  border-radius: 999px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 760;
  padding: 4px 9px;
}

.entry .content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.28));
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 1.04rem;
  margin: 18px 0;
  padding: 18px;
}

.entry-image {
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  display: block;
  margin: 16px 0;
  max-height: 520px;
  max-width: 100%;
}

.analysis {
  background: #f8fbf7;
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-top: 12px;
  padding: 16px;
}

.analysis strong {
  color: var(--brand);
  letter-spacing: 0.04em;
}

.flash {
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
  padding: 13px 16px;
  font-weight: 720;
}

.flash.success {
  background: #dbf6e9;
  color: #145437;
}

.flash.error {
  background: #ffe4e5;
  color: #872b2b;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chart {
  align-items: end;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(241, 249, 245, 0.92));
  display: flex;
  gap: 10px;
  height: 320px;
  padding: 24px;
}

.chart div {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 12px 12px 5px 5px;
  box-shadow: 0 12px 24px rgba(8, 115, 95, 0.18);
  flex: 1;
  min-width: 10px;
}

.bottom-nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 26px 26px 0 0;
  bottom: 0;
  box-shadow: 0 -14px 38px rgba(19, 48, 40, 0.12);
  display: none;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  justify-content: space-around;
  left: 0;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  z-index: 30;
}

.bottom-nav .nav-item {
  flex: 1;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  min-height: 58px;
  padding: 0 4px;
}

.bottom-nav .nav-item span {
  font-size: 0.7rem;
}

.bottom-nav .nav-item .icon {
  height: 22px;
  width: 22px;
}

@media (max-width: 920px) {
  .desktop-nav .nav-item span {
    display: none;
  }

  .hero::after {
    opacity: 0.82;
    right: -56px;
    top: 52px;
    width: 230px;
  }
}

@media (max-width: 780px) {
  .topbar {
    min-height: 64px;
    padding: 0 16px;
  }

  .desktop-nav {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  .shell {
    padding: 18px 14px 40px;
  }

  .hero {
    min-height: 520px;
    padding: 28px;
  }

  .hero::after {
    bottom: 26px;
    left: 24px;
    right: 24px;
    top: auto;
    width: auto;
  }

  .page-title {
    align-items: start;
    display: block;
  }

  .page-title h1 {
    font-size: clamp(2.1rem, 13vw, 3.3rem);
  }

  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }

  .row,
  .entry-card {
    align-items: flex-start;
  }

  .entry-card {
    display: grid;
    grid-template-columns: 64px 1fr;
  }

  .detail-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .entry-card > a {
    grid-column: 1 / -1;
    width: 100%;
  }

  .toolbar,
  .toolbar form {
    align-items: stretch;
    flex-direction: column;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .toolbar .button,
  .toolbar button,
  .actions .button,
  .actions button {
    width: 100%;
  }

  textarea {
    min-height: 220px;
  }
}

@media (min-width: 781px) {
  body {
    padding-bottom: 0;
  }
}
