:root {
  --cream: #fff6e9;
  --card: #fffdf9;
  --orange: #c85a0a;
  --orange-soft: #ffe3c2;
  --orange-ink: #8f4105;
  --ink: #4a3424;
  --muted: #7d6653;
  --red: #b83a25;
  --tabs-height: calc(58px + env(safe-area-inset-bottom));
  color-scheme: light;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  background: var(--cream);
}

body {
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:active {
  opacity: 0.75;
}

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabs-height) + 90px);
}

.state {
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

.btn {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.btn.soft {
  background: var(--orange-soft);
  color: var(--orange-ink);
}

.btn.danger {
  background: #fbe4df;
  color: var(--red);
}

.btn.wide {
  display: block;
  width: 100%;
  margin-top: 14px;
}

.link {
  min-height: 36px;
  padding: 4px 0 4px 16px;
  background: none;
  color: var(--muted);
  font-size: 14px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.card {
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 4px 14px rgba(160, 100, 40, 0.08);
}

h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

/* 登录 */
.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8vh;
  text-align: center;
}

.login img {
  width: 150px;
  height: 150px;
  border-radius: 50%;
}

.login h1 {
  margin: 16px 0 2px;
  font-size: 24px;
}

.login form {
  width: min(100%, 300px);
  margin-top: 22px;
}

.field {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #f0dcc2;
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
}

/* 菜单 */
.hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.hero img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

.hero h1 {
  margin: 0;
  font-size: 21px;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 0 16px 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: var(--card);
  color: var(--muted);
}

.chip.on {
  background: var(--orange);
  color: #fff;
  font-weight: 600;
}

.dish {
  display: flex;
  width: 100%;
  gap: 12px;
  padding: 10px;
  text-align: left;
  outline-offset: 0;
}

.dish.on {
  box-shadow: inset 0 0 0 2px var(--orange);
}

.photo {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--orange-soft);
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}

.dish-body {
  flex: 1;
  min-width: 0;
}

.dish-name {
  font-size: 16px;
  font-weight: 600;
}

.dish-foot {
  display: flex;
  justify-content: flex-end;
}

.pick {
  padding: 3px 14px;
  border-radius: 14px;
  background: var(--orange-soft);
  color: var(--orange-ink);
  font-size: 13px;
  font-weight: 600;
}

.on .pick {
  background: var(--orange);
  color: #fff;
}

/* 底部 */
#bar:not(:empty) {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabs-height) + 10px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 24px), 536px);
  padding: 7px 8px 7px 20px;
  border-radius: 30px;
  background: var(--ink);
  color: #fff;
  transform: translateX(-50%);
}

#tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  height: var(--tabs-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  box-shadow: 0 -2px 10px rgba(160, 100, 40, 0.08);
}

#tabs[hidden] {
  display: none;
}

#tabs button {
  flex: 1;
  max-width: 187px;
  background: none;
  color: var(--muted);
}

#tabs button.on {
  color: var(--orange);
  font-weight: 700;
}

/* 底部面板 */
.mask {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(60, 35, 15, 0.42);
}

.panel {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--card);
  animation: rise 0.2s ease-out;
}

@keyframes rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel {
    animation: none;
  }
}

.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
}

.row {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.row .chip {
  background: var(--cream);
}

.row .chip.on {
  background: var(--orange);
}

label.form {
  display: block;
  margin-top: 12px;
  font-weight: 600;
}

label.form .field {
  margin-top: 5px;
  font-weight: 400;
}

.check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 8px;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--orange);
}

.edit-photo {
  display: block;
  cursor: pointer;
  text-align: center;
}

.edit-photo img,
.edit-photo .placeholder {
  width: 100%;
  height: 160px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--orange-soft);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* 记录 */
.shopping {
  background: var(--orange-soft);
}

.past {
  opacity: 0.65;
}

.note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--cream);
}

.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.head-row h2 {
  margin: 0;
}

.manage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
}

#toast {
  position: fixed;
  left: 50%;
  top: 40%;
  z-index: 20;
  max-width: 80%;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(50, 35, 25, 0.9);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 0.2s;
}

#toast.show {
  opacity: 1;
}
