:root {
  --bg: #fff8e8;
  --surface: #fffdf7;
  --surface-strong: #fff3c7;
  --text: #3d2f24;
  --muted: #8a7662;
  --line: #eadcc5;
  --brand: #ffc83d;
  --brand-strong: #f6a900;
  --tomato: #f36b4f;
  --matcha: #8dbb62;
  --shadow: 0 10px 28px rgba(92, 65, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 200, 61, 0.22), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 88px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 248, 232, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(234, 220, 197, 0.72);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: inset 0 -2px 0 rgba(246, 169, 0, 0.22);
  font-size: 22px;
}

.brand-text {
  display: grid;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 19px;
  letter-spacing: 0;
}

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

.page {
  width: min(100%, 1040px);
  margin: 0 auto;
  padding: 14px 14px 24px;
}

.hero-action {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #fffdf7, #fff1bc);
  box-shadow: var(--shadow);
}

.hero-action h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.hero-action p {
  margin: 0;
  color: var(--muted);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--text);
  background: var(--brand);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 rgba(154, 105, 0, 0.18);
}

.button.secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.ghost {
  padding: 9px 12px;
  background: transparent;
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.danger {
  background: #ffd4c9;
  color: #802b1b;
}

.button.compact {
  padding: 9px 12px;
  justify-self: start;
}

.search-panel,
.form-card,
.auth-card,
.stat-card,
.friend-card,
.detail-card {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.94);
  border-radius: 18px;
  box-shadow: 0 8px 20px rgba(92, 65, 32, 0.08);
}

.search-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.field-row {
  display: grid;
  gap: 8px;
}

.field-row label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  background: #fffefa;
  color: var(--text);
  outline: none;
}

.textarea {
  min-height: 86px;
  resize: vertical;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.filter-grid.collapsed {
  display: none;
}

.feed-grid {
  display: grid;
  gap: 14px;
}

.meal-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(92, 65, 32, 0.08);
}

.meal-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffedb1, #fff9df);
  font-size: 64px;
  overflow: hidden;
}

.emoji-card {
  align-content: center;
  gap: 10px;
}

.emoji-main {
  display: block;
  font-size: 72px;
  line-height: 1;
}

.emoji-caption {
  max-width: calc(100% - 28px);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  color: #6c563c;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.meal-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.meal-body {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.meal-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: #fff1bc;
  color: #67460f;
  font-size: 12px;
  font-weight: 700;
}

.tag.green {
  background: #e7f2d8;
  color: #486d24;
}

.tag.red {
  background: #ffe0d8;
  color: #8a301f;
}

.form-card,
.auth-card,
.detail-card,
.stat-card,
.friend-card {
  padding: 14px;
}

.auth-card {
  display: grid;
  gap: 14px;
  max-width: 460px;
  margin: 28px auto 0;
}

.auth-card h1 {
  margin: 0;
  font-size: 24px;
}

.notice {
  padding: 10px 12px;
  border: 1px solid rgba(246, 169, 0, 0.5);
  border-radius: 13px;
  background: #fff4c9;
  color: #6d4b0f;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 13px;
}

.form-section {
  display: grid;
  gap: 13px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffefa;
}

.required-section {
  border-color: rgba(246, 169, 0, 0.5);
  background: linear-gradient(180deg, #fffdf7, #fff8df);
}

.optional-section {
  background: #fffdf7;
}

.private-section {
  background: #fff9f1;
}

.section-kicker {
  width: max-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #72510d;
  font-size: 12px;
  font-weight: 900;
}

.helper-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segmented {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.segment {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 11px;
  background: #fffefa;
  color: var(--text);
}

.segment.active {
  border-color: var(--brand-strong);
  background: var(--brand);
  font-weight: 800;
}

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fffefa;
}

.preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(calc(100% - 24px), 520px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.nav-btn {
  border: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 9px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.nav-btn.active {
  color: var(--text);
  background: #fff1bc;
  font-weight: 800;
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 18;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: var(--shadow);
  font-size: 27px;
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-number {
  font-size: 30px;
  font-weight: 900;
}

.stat-summary {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(246, 169, 0, 0.42);
  border-radius: 18px;
  background: linear-gradient(135deg, #fffdf7, #fff0bd);
  box-shadow: 0 8px 20px rgba(92, 65, 32, 0.08);
}

.stat-summary strong {
  font-size: 19px;
}

.stat-summary span {
  color: var(--muted);
  line-height: 1.45;
}

.rank-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 13px;
  background: #fff8e4;
}

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

.friend-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffefa;
}

.section-title {
  margin: 18px 0 10px;
  font-size: 18px;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

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

.comment {
  padding: 10px;
  border-radius: 13px;
  background: #fff8e4;
}

.comment strong {
  display: block;
}

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

@media (min-width: 760px) {
  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .form-card,
  .detail-card {
    padding: 20px;
  }
}
