:root {
  --ink: #2c2723;
  --muted: #81766b;
  --faint: #a99c90;
  --paper: #fffaf3;
  --card: #fffdf9;
  --line: #eadfd3;
  --line-strong: #decbbb;
  --brand: #c54b32;
  --brand-deep: #8f2f20;
  --brand-soft: #f6ded4;
  --green: #3f7655;
  --green-soft: #e6f0e5;
  --yellow: #f5bf53;
  --shadow: 0 18px 50px rgba(92, 57, 34, 0.11);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #eee4d8;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 14%, rgba(245, 191, 83, 0.2), transparent 24rem),
    radial-gradient(circle at 85% 82%, rgba(197, 75, 50, 0.12), transparent 25rem),
    #eee4d8;
  -webkit-font-smoothing: antialiased;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(197, 75, 50, 0.25);
  outline-offset: 2px;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.backdrop-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.18;
}

.dot-one {
  top: 12vh;
  left: calc(50% - 440px);
}

.dot-two {
  right: calc(50% - 490px);
  bottom: 22vh;
  width: 46px;
  height: 46px;
  background: var(--yellow);
  opacity: 0.34;
}

.backdrop-line {
  position: absolute;
  top: 22vh;
  right: calc(50% - 460px);
  width: 90px;
  height: 140px;
  border: 2px solid rgba(143, 47, 32, 0.12);
  border-radius: 52% 48% 40% 60%;
  transform: rotate(18deg);
}

.app-shell {
  position: relative;
  width: min(100%, 540px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 243, 0.3), rgba(255, 250, 243, 0.95)),
    var(--paper);
  box-shadow: 0 0 70px rgba(74, 48, 28, 0.14);
}

.boot-screen {
  display: grid;
  min-height: 100dvh;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted);
}

.boot-mark {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  border-radius: 28px;
  font-size: 36px;
  background: var(--brand-soft);
  animation: gentle-bob 1.8s ease-in-out infinite;
}

.boot-screen p {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.08em;
}

@keyframes gentle-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-7px) rotate(2deg);
  }
}

.onboarding {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  padding: max(30px, env(safe-area-inset-top)) 26px max(28px, env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(197, 75, 50, 0.12);
  border-radius: 14px;
  font-size: 21px;
  background: #fff;
  box-shadow: 0 7px 18px rgba(111, 59, 30, 0.08);
}

.brand-word {
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-tag {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.onboarding-hero {
  position: relative;
  margin: auto 0 30px;
  padding: 16px 0 4px;
}

.onboarding-hero::before {
  position: absolute;
  top: -58px;
  right: -20px;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: #f5cf85;
  content: "";
  opacity: 0.45;
  filter: blur(1px);
}

.onboarding-kicker {
  position: relative;
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.onboarding h1,
.login-heading {
  position: relative;
  max-width: 390px;
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(40px, 11vw, 59px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.onboarding h1 em {
  color: var(--brand);
  font-style: normal;
}

.onboarding-copy {
  position: relative;
  max-width: 340px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.setup-card,
.login-card {
  position: relative;
  padding: 22px;
  border: 1px solid rgba(222, 203, 187, 0.72);
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.form-field {
  display: grid;
  gap: 8px;
  margin-bottom: 15px;
}

.form-field:last-of-type {
  margin-bottom: 0;
}

.form-field label,
.field-label {
  color: #65594f;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fffdf9;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.textarea-input {
  min-height: 82px;
  padding-top: 12px;
  padding-bottom: 12px;
  resize: vertical;
}

.text-input::placeholder,
.textarea-input::placeholder {
  color: #b4a79b;
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  border-color: rgba(197, 75, 50, 0.52);
  box-shadow: 0 0 0 4px rgba(197, 75, 50, 0.07);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}

.field-help {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-height: 52px;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding: 0 20px;
  border-radius: 16px;
  color: #fff9f3;
  font-size: 15px;
  font-weight: 700;
  background: var(--brand);
  box-shadow: 0 12px 22px rgba(160, 57, 36, 0.2);
  transition: transform 140ms ease, background 140ms ease;
}

.primary-button:hover {
  background: #b6422c;
}

.primary-button:active {
  transform: scale(0.985);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  box-shadow: none;
}

.primary-button.compact {
  min-height: 44px;
  width: auto;
  margin: 0;
  padding: 0 18px;
  border-radius: 14px;
  font-size: 13px;
}

.secondary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  background: #fffdf9;
}

.text-button {
  padding: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 650;
  background: transparent;
}

.login-card {
  margin-top: 12px;
}

.login-heading {
  margin-bottom: 8px;
  font-size: 38px;
}

.login-copy {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.member-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.member-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  text-align: left;
  background: #fffdf9;
  cursor: pointer;
}

.member-choice.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.member-choice-avatar,
.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 13px;
  font-size: 19px;
  background: #f8eadf;
}

.member-choice strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-choice small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.onboarding-footer {
  margin-top: 20px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
}

.main-page {
  min-height: 100dvh;
  padding-bottom: calc(104px + var(--safe-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(18px, env(safe-area-inset-top)) 20px 12px;
}

.topbar-family {
  min-width: 0;
}

.topbar-family small {
  display: block;
  margin-bottom: 1px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.topbar-family strong {
  display: block;
  overflow: hidden;
  font-family: "Songti SC", "STSong", serif;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(234, 223, 211, 0.86);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 253, 249, 0.86);
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.topbar-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  font-size: 18px;
  background: var(--brand-soft);
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 7px 20px 22px;
  padding: 24px 23px 22px;
  border-radius: var(--radius-xl);
  color: #fffaf4;
  background:
    radial-gradient(circle at 90% 0%, rgba(245, 191, 83, 0.55), transparent 36%),
    linear-gradient(135deg, #c54b32, #9c3526);
  box-shadow: 0 18px 30px rgba(133, 47, 30, 0.2);
}

.hero::after {
  position: absolute;
  right: -34px;
  bottom: -58px;
  width: 174px;
  height: 174px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  content: "";
}

.hero-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: rgba(255, 250, 244, 0.73);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.hero-date span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f9d48f;
}

.hero h1 {
  position: relative;
  z-index: 1;
  max-width: 320px;
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(31px, 8vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 19px;
}

.hero-copy {
  margin: 0;
  color: rgba(255, 250, 244, 0.76);
  font-size: 12px;
  line-height: 1.65;
}

.hero-count {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 12px;
  color: rgba(255, 250, 244, 0.86);
  font-size: 10px;
  background: rgba(83, 25, 17, 0.19);
  backdrop-filter: blur(5px);
}

.hero-count strong {
  color: #fff;
  font-size: 16px;
}

.pair-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 20px 21px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 253, 249, 0.74);
}

.pair-avatars {
  display: flex;
  flex: 0 0 auto;
}

.pair-avatars span {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  font-size: 14px;
  background: #f7e8dc;
}

.pair-avatars span + span {
  margin-left: -8px;
}

.pair-status strong {
  color: var(--ink);
  font-weight: 650;
}

.pair-status .status-dot {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: #c5ad9b;
}

.pair-status .status-dot.done {
  background: #62a475;
  box-shadow: 0 0 0 4px rgba(98, 164, 117, 0.12);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 20px 13px;
}

.section-heading h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.section-heading .text-button {
  margin: -6px -8px -6px 0;
}

.category-strip {
  display: flex;
  gap: 8px;
  margin: 0 -20px 16px;
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  background: transparent;
  cursor: pointer;
}

.category-chip.active {
  border-color: var(--ink);
  color: var(--paper);
  font-weight: 650;
  background: var(--ink);
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px;
}

.dish-card {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 238px;
  flex-direction: column;
  padding: 9px;
  border: 1px solid rgba(234, 223, 211, 0.8);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 7px 18px rgba(90, 61, 40, 0.055);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.dish-card.selected {
  border-color: rgba(197, 75, 50, 0.38);
  box-shadow: 0 8px 24px rgba(197, 75, 50, 0.09);
}

.dish-visual {
  position: relative;
  display: grid;
  min-height: 97px;
  place-items: center;
  border-radius: 16px;
  font-size: 43px;
  background:
    radial-gradient(circle at 72% 25%, rgba(255, 255, 255, 0.8), transparent 28%),
    var(--dish-bg, #f3e6d7);
}

.dish-visual::after {
  position: absolute;
  right: 13px;
  bottom: 10px;
  width: 29px;
  height: 10px;
  border: 1px solid rgba(88, 57, 35, 0.08);
  border-radius: 50%;
  content: "";
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(-16deg);
}

.partner-mark {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 8px;
  color: #355c41;
  font-size: 9px;
  font-weight: 700;
  background: rgba(241, 249, 239, 0.92);
  box-shadow: 0 2px 7px rgba(50, 80, 52, 0.08);
}

.dish-content {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  padding: 10px 2px 1px;
}

.dish-name {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-description {
  display: -webkit-box;
  margin: 5px 0 10px;
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

.category-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-dish-button {
  display: inline-flex;
  height: 29px;
  min-width: 29px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 750;
  background: #fff;
  cursor: pointer;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stepper button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 9px;
  color: var(--brand);
  font-size: 18px;
  line-height: 1;
  background: var(--brand-soft);
  cursor: pointer;
}

.stepper button.plus {
  color: #fff;
  background: var(--brand);
}

.stepper span {
  min-width: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 249, 0.55);
}

.empty-state span {
  display: block;
  margin-bottom: 10px;
  font-size: 36px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
}

.selection-bar {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: calc(80px + var(--safe-bottom));
  left: 16px;
  display: flex;
  width: min(calc(100% - 32px), 508px);
  min-height: 56px;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  padding: 8px 8px 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 19px;
  color: #fff8f2;
  background: rgba(44, 39, 35, 0.95);
  box-shadow: 0 13px 28px rgba(53, 35, 22, 0.22);
  backdrop-filter: blur(12px);
  transform: translateY(130%);
  opacity: 0;
  transition: transform 220ms ease, opacity 180ms ease;
}

.selection-bar.show {
  transform: translateY(0);
  opacity: 1;
}

.selection-summary {
  min-width: 0;
  flex: 1;
}

.selection-summary strong {
  display: block;
  font-size: 12px;
}

.selection-summary small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: rgba(255, 248, 242, 0.58);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-bar button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 13px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  background: #fff8f1;
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  z-index: 18;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  width: min(100%, 540px);
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 0 auto;
  padding: 10px 24px var(--safe-bottom);
  border-top: 1px solid rgba(234, 223, 211, 0.75);
  background: rgba(255, 250, 243, 0.92);
  backdrop-filter: blur(18px);
}

.nav-button {
  display: flex;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 14px;
  color: #9c8f83;
  font-size: 9px;
  font-weight: 650;
  background: transparent;
  cursor: pointer;
}

.nav-button svg {
  width: 20px;
  height: 20px;
}

.nav-button.active {
  color: var(--brand);
  background: rgba(246, 222, 212, 0.48);
}

.subpage {
  min-height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 20px calc(105px + var(--safe-bottom));
}

.subpage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.subpage-heading small {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.subpage-heading h1 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 34px;
  letter-spacing: -0.035em;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.history-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-card-head strong {
  font-size: 15px;
}

.history-card-head span {
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
  background: var(--green-soft);
}

.history-card-head span.waiting {
  color: #8d7143;
  background: #f8eedb;
}

.history-dishes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 13px;
}

.history-dish {
  padding: 7px 9px;
  border-radius: 9px;
  color: #6f6257;
  font-size: 10px;
  background: #f8f2ea;
}

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

.history-empty span {
  display: block;
  margin-bottom: 16px;
  font-size: 48px;
}

.history-empty p {
  margin: 0 auto;
  max-width: 250px;
  font-size: 13px;
  line-height: 1.8;
}

.settings-profile {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 23px;
  border-radius: var(--radius-xl);
  color: #fffaf4;
  background:
    radial-gradient(circle at 90% 0%, rgba(245, 191, 83, 0.47), transparent 40%),
    #2d2925;
}

.settings-profile > small {
  color: rgba(255, 250, 244, 0.56);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.settings-profile h2 {
  margin: 8px 0 17px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 29px;
}

.settings-members {
  display: flex;
  gap: 8px;
}

.settings-member {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  color: rgba(255, 250, 244, 0.75);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.07);
}

.settings-panel {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.settings-panel h3 {
  margin: 0 0 15px;
  font-size: 15px;
}

.settings-action {
  display: flex;
  width: 100%;
  min-height: 48px;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.settings-action + .settings-action {
  border-top: 1px solid #f1e8de;
}

.settings-action-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: #f7eee5;
}

.settings-action-text {
  min-width: 0;
  flex: 1;
}

.settings-action-text strong {
  display: block;
  font-size: 13px;
}

.settings-action-text small {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
}

.settings-action-arrow {
  color: #b4a59a;
  font-size: 17px;
}

.settings-note {
  padding: 15px 17px;
  border-radius: 15px;
  color: #867769;
  font-size: 10px;
  line-height: 1.75;
  background: #f5ede4;
}

.settings-note strong {
  color: var(--ink);
}

.modal-layer,
.sheet-layer {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(39, 30, 23, 0.44);
  backdrop-filter: blur(4px);
  animation: fade-in 160ms ease;
}

.modal-card,
.bottom-sheet {
  width: min(100%, 540px);
  max-height: min(88dvh, 780px);
  overflow-y: auto;
  border-radius: 27px 27px 0 0;
  background: var(--paper);
  box-shadow: 0 -18px 50px rgba(53, 35, 22, 0.19);
  animation: sheet-in 220ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.modal-card {
  width: min(calc(100% - 34px), 480px);
  margin: auto;
  border-radius: 27px;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: #d8cbbf;
}

.sheet-content,
.modal-content {
  padding: 21px 22px calc(24px + env(safe-area-inset-bottom));
}

.sheet-header,
.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 19px;
}

.sheet-header h2,
.modal-header h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", serif;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.sheet-header p,
.modal-header p {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.close-button {
  display: grid;
  width: 33px;
  height: 33px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  background: #fffdf9;
  cursor: pointer;
}

.summary-section + .summary-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #eee3d8;
}

.summary-person {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 11px;
}

.summary-person .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
}

.summary-person strong {
  font-size: 13px;
}

.summary-person small {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
}

.summary-list {
  display: grid;
  gap: 7px;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 8px 11px;
  border-radius: 12px;
  background: #f8f1e9;
}

.summary-row span:first-child {
  font-size: 20px;
}

.summary-row strong {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-row .summary-note {
  max-width: 105px;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-row b {
  color: var(--brand);
  font-size: 11px;
}

.summary-empty {
  padding: 15px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.overlap-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 17px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--green);
  font-size: 11px;
  background: var(--green-soft);
}

.sheet-actions {
  display: flex;
  gap: 9px;
  margin-top: 20px;
}

.sheet-actions > * {
  flex: 1;
}

.dish-detail-visual {
  display: grid;
  min-height: 150px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 21px;
  font-size: 68px;
  background:
    radial-gradient(circle at 72% 25%, rgba(255, 255, 255, 0.85), transparent 26%),
    var(--dish-bg, #f3e6d7);
}

.detail-quantity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 15px;
  background: #f8f1e9;
}

.detail-quantity strong {
  font-size: 13px;
}

.detail-quantity .stepper button {
  width: 34px;
  height: 34px;
}

.detail-quantity .stepper span {
  min-width: 23px;
  font-size: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 13px;
  background: #f1e8df;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  background: transparent;
  cursor: pointer;
}

.segmented button.active {
  color: var(--ink);
  background: #fffdf9;
  box-shadow: 0 3px 8px rgba(77, 54, 35, 0.08);
}

.manage-list {
  display: grid;
  gap: 7px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 13px;
  background: #f8f1e9;
}

.manage-row-emoji {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  font-size: 18px;
  background: #fffaf4;
}

.manage-row-text {
  min-width: 0;
  flex: 1;
}

.manage-row-text strong {
  display: block;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-row-text small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
}

.manage-row button {
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--brand);
  font-size: 9px;
  background: var(--brand-soft);
  cursor: pointer;
}

.manage-add-form {
  margin-top: 19px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.manage-add-form h3 {
  margin: 0 0 14px;
  font-size: 14px;
}

.emoji-category-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 16px;
  bottom: calc(146px + var(--safe-bottom));
  left: 16px;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  max-width: min(400px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 12px;
  color: #fffaf4;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  background: rgba(44, 39, 35, 0.94);
  box-shadow: 0 10px 24px rgba(53, 35, 22, 0.18);
  animation: toast-in 180ms ease;
}

.form-error {
  margin: 10px 0 0;
  color: var(--brand);
  font-size: 11px;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@media (min-width: 720px) {
  .app-shell {
    min-height: calc(100vh - 32px);
    margin-top: 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 34px;
  }

  .bottom-nav {
    bottom: 16px;
    border-radius: 0 0 34px 34px;
  }

  .selection-bar {
    bottom: calc(96px + var(--safe-bottom));
  }

  .main-page {
    min-height: calc(100vh - 32px);
  }

  .subpage {
    min-height: calc(100vh - 32px);
  }
}

@media (max-width: 360px) {
  .onboarding {
    padding-right: 18px;
    padding-left: 18px;
  }

  .topbar,
  .subpage {
    padding-right: 16px;
    padding-left: 16px;
  }

  .hero {
    margin-right: 16px;
    margin-left: 16px;
  }

  .pair-status,
  .section-heading {
    margin-right: 16px;
    margin-left: 16px;
  }

  .category-strip {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .dish-grid {
    gap: 9px;
    padding: 0 16px;
  }

  .dish-card {
    min-height: 225px;
  }

  .dish-name {
    font-size: 14px;
  }

  .setup-card {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
