:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --text: #1b1c1e;
  --muted: #74777d;
  --line: #dedfdc;
  --accent: #126a72;
  --accent-strong: #0d5258;
  --danger: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 650;
}

button:active {
  transform: translateY(1px);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 12px;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: 100%;
  max-width: 300px;
}

.login-panel h1 {
  font-size: 42px;
  margin: 0 0 26px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack label {
  display: grid;
  gap: 6px;
}

.ghost {
  margin-top: 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
  width: 100%;
}

.notice {
  min-height: 22px;
  color: var(--muted);
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 58px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: rgba(247, 247, 244, 0.96);
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 24px;
}

.text-button {
  background: transparent;
  color: var(--accent);
  padding: 0 8px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.unread-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #d11f1f;
  box-shadow: 0 0 0 3px rgba(209, 31, 31, 0.14);
}

.drawer {
  position: fixed;
  z-index: 8;
  top: 58px;
  left: 0;
  width: min(78vw, 310px);
  bottom: 0;
  background: white;
  border-right: 1px solid var(--line);
  padding: 10px;
  box-shadow: 12px 0 24px rgba(0, 0, 0, 0.08);
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 8px;
  margin-bottom: 4px;
}

.nav-item.active {
  background: #e9f1f1;
}

.nav-toggle {
  display: flex;
}

.nav-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d11f1f;
  box-shadow: 0 0 0 3px rgba(209, 31, 31, 0.11);
}

.toggle-pill {
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  text-align: center;
}

.nav-toggle.is-on .toggle-pill {
  border-color: rgba(18, 106, 114, 0.35);
  background: #e3f0ef;
  color: var(--accent-strong);
}

.hello-link.unread {
  background: linear-gradient(90deg, #e03131, #f08c00, #2f9e44, #1971c2, #9c36b5);
  color: white;
}

.view {
  padding: 18px;
  max-width: 760px;
  margin: 0 auto;
}

#helloView {
  min-height: calc(100vh - 58px);
  display: flex;
  flex-direction: column;
  padding-bottom: 150px;
}

.view h2 {
  margin: 0 0 14px;
  font-size: 24px;
}

.conversation-shell {
  flex: 1;
  min-height: 0;
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 16px;
  padding: 22px 0 12px;
}

.hello-articles,
.sport-rubrics {
  display: grid;
  gap: 12px;
  width: 100%;
}

.hello-article {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  min-height: 84px;
  cursor: pointer;
}

.article-toolbar {
  display: flex;
  justify-content: flex-end;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-top: 10px;
}

.article-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
  justify-content: flex-end;
}

.article-actions .symbol-button {
  width: 28px;
  min-height: 28px;
  font-size: 14px;
}

.article-editor {
  display: grid;
  gap: 8px;
}

.article-link {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  text-decoration: none;
}

.article-url {
  display: block;
  min-width: 0;
  color: var(--accent);
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.25;
}

.article-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 41, 51, 0.26);
}

.article-window {
  position: relative;
  width: min(520px, 100%);
  max-height: min(76vh, 680px);
  overflow-y: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.18);
}

.article-window h2 {
  margin: 0 38px 12px 0;
  font-size: 22px;
}

.article-full-text {
  white-space: pre-wrap;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
}

.inline-link {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.symbol-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 19px;
  line-height: 1;
}

.danger-symbol {
  color: var(--danger);
}

.hello-article h2 {
  margin: 4px 0 8px;
  font-size: 20px;
}

.hello-article p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.article-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hello-article.latest {
  border-color: rgba(18, 106, 114, 0.4);
}

.peek-zone {
  position: fixed;
  right: 18px;
  bottom: 190px;
  z-index: 6;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: #1f2933;
  user-select: none;
  touch-action: none;
  box-shadow: none;
}

.peek-zone::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  border: 1px solid #1f2933;
}

.lock-target {
  position: fixed;
  right: 28px;
  bottom: 288px;
  z-index: 8;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 22px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.trash-target {
  position: fixed;
  right: 28px;
  bottom: 104px;
  z-index: 8;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 2px solid var(--danger);
  color: var(--danger);
  font-size: 21px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.history-target {
  position: fixed;
  right: 88px;
  bottom: 192px;
  z-index: 8;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  border: 2px solid #4b5563;
  color: #4b5563;
  font-size: 20px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.lock-target.ready {
  background: var(--accent);
  color: white;
}

.trash-target.ready {
  background: var(--danger);
  color: white;
}

.history-target.ready {
  background: #4b5563;
  color: white;
}

.pin-panel {
  position: fixed;
  right: 18px;
  bottom: 252px;
  z-index: 10;
  width: 150px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
}

.pin-panel input {
  text-align: center;
  letter-spacing: 3px;
}

.message-reveal {
  position: fixed;
  left: 50%;
  bottom: 285px;
  z-index: 7;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 350px);
  transform: translateX(-50%);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}

.message-reveal.locked {
  outline: 2px solid rgba(18, 106, 114, 0.35);
  outline-offset: 4px;
}

.bubble {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.bubble.empty {
  border-style: dashed;
  color: var(--muted);
  text-align: center;
  font-weight: 650;
}

.bubble.mine {
  border-color: #b4d3d5;
}

.meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 5;
  width: min(724px, calc(100vw - 36px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0 18px;
  background: var(--bg);
}

.composer textarea {
  background: #f0f1ed;
  border-color: #d2d5cf;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.035);
}

.list,
.media-list {
  display: grid;
  gap: 10px;
}

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.card-title {
  font-weight: 700;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.card-actions button {
  min-height: 36px;
}

.compact-form {
  margin-bottom: 16px;
}

.media-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.media-card > span:last-child,
.media-card .meta,
.media-card .card-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-thumb {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #e9ecef;
  color: var(--accent-strong);
  font-weight: 800;
}

.media-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.media-comment-form input {
  min-height: 36px;
  padding: 8px 10px;
}

.media-comment-form.reply {
  margin-top: 6px;
  margin-left: 8px;
}

.media-comment-form .symbol-button {
  width: 34px;
  min-height: 34px;
}

.media-comments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-width: 0;
}

.media-comment {
  border-left: 2px solid var(--line);
  padding-left: 8px;
  min-width: 0;
}

.media-comment-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: baseline;
  font-size: 14px;
  min-width: 0;
}

.media-comment-body span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.media-comment-body strong {
  color: var(--accent-strong);
}

.media-comment-body em {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.media-replies {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-left: 8px;
  min-width: 0;
}

.media-comment-toggle {
  width: 30px;
  min-height: 30px;
  margin-top: 8px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.weight-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.weight-panel {
  margin: 0 0 18px;
}

.weight-summary.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.weight-current {
  min-height: 0;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.weight-current:focus-visible {
  outline: 2px solid rgba(18, 106, 114, 0.35);
  outline-offset: 2px;
}

.mini-stat strong {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4f4;
  color: var(--accent);
}

.mini-stat em {
  color: var(--muted);
  font-style: normal;
}

.weight-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weight-form {
  display: grid;
  grid-template-columns: minmax(126px, 1fr) minmax(92px, 0.7fr) minmax(104px, 0.9fr) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.weight-form input {
  min-width: 0;
}

.weight-detail {
  display: grid;
  gap: 10px;
}

.weight-chart {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--accent-strong);
}

.weight-chart svg {
  width: 100%;
  height: auto;
  display: block;
}

.weight-chart text {
  fill: currentColor;
  font-size: 10px;
}

.weight-chart .axis-label {
  opacity: 0.72;
}

.weight-chart circle {
  fill: white;
  stroke: currentColor;
  stroke-width: 2;
}

.weight-chart-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.food-panel {
  margin: 0 0 18px;
}

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

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.small-text-button {
  min-height: 34px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 12px;
}

.section-line h3 {
  margin: 0;
  font-size: 15px;
}

.food-form {
  display: grid;
  grid-template-columns: minmax(118px, 0.95fr) 82px minmax(110px, 1fr) minmax(90px, 0.75fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.food-list {
  display: grid;
  gap: 8px;
}

.food-meal-group {
  display: grid;
  gap: 6px;
}

.food-meal-group h4 {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.food-entry {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.food-entry strong {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4f4;
  color: var(--accent);
}

.food-entry em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.food-edit-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(116px, 0.9fr) 80px minmax(110px, 1fr) minmax(90px, 0.8fr) auto;
  gap: 8px;
  cursor: default;
}

.food-edit-form input {
  min-width: 0;
  padding: 8px;
}

.hungry-suggestion {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 0 0 10px;
  font-size: 13px;
}

.hungry-suggestion ul {
  margin: 8px 0;
  padding-left: 18px;
}

.hungry-suggestion span {
  color: var(--muted);
  font-size: 12px;
}

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.stat strong {
  display: block;
  font-size: 24px;
}

.admin-block {
  margin: 22px 0;
}

.admin-block h3 {
  margin: 0 0 10px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.danger {
  background: var(--danger);
}

@media (max-width: 520px) {
  .composer {
    grid-template-columns: 1fr;
  }

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

  .weight-form {
    grid-template-columns: minmax(0, 1fr) 82px minmax(88px, 0.8fr) auto;
    gap: 6px;
  }

  .weight-form input {
    padding: 10px 8px;
    font-size: 14px;
  }

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

  .food-entry {
    grid-template-columns: auto 1fr auto;
  }

  .food-entry .danger-symbol {
    grid-column: 3;
  }

  .food-edit-form {
    grid-template-columns: 1fr 82px;
  }

  .food-edit-form [data-food-name],
  .food-edit-form [data-food-quantity] {
    grid-column: 1 / -1;
  }

  .text-button {
    font-size: 13px;
  }
}
