:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --ink: #23231f;
  --muted: #8a8a80;
  --line: #e6e5dd;
  --brand: #c0581f;
  --brand-ink: #ffffff;
  --error: #c0392b;
  --ok: #2e7d32;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(35, 35, 31, 0.07);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px 12px 48px;
  min-height: 100vh;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
.muted { color: var(--muted); font-size: 13px; margin: 6px 0; }
.error { color: var(--error); font-size: 13px; margin: 6px 0; word-break: break-all; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
}
.brand { font-weight: 700; font-size: 17px; }
.link-btn {
  background: none;
  border: none;
  color: var(--brand);
  font-size: 14px;
  padding: 6px 2px;
  min-height: 36px;
  cursor: pointer;
}

.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}
.tab.active { border-color: var(--brand); color: var(--brand); font-weight: 600; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

input[type="password"], input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  background: #fcfcfa;
  color: var(--ink);
  resize: vertical;
}
textarea { min-height: 44px; }
input:focus, textarea:focus { outline: 2px solid rgba(192, 88, 31, 0.35); border-color: transparent; }

.dish-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.dish-row { display: flex; gap: 8px; align-items: center; }
.dish-row input { flex: 1; }
.dish-row button {
  flex: none;
  border: none;
  background: none;
  color: var(--error);
  font-size: 18px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tag {
  border: 1px solid var(--line);
  background: #fbfbf9;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  min-height: 34px;
  user-select: none;
}
.tag.selected { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

button.primary, button.primary.big {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:disabled { background: #d8a28a; cursor: default; }
button.primary.small { width: auto; min-height: 44px; padding: 0 16px; font-size: 14px; }

.login-card { margin-top: 18vh; }
#login-form { display: flex; flex-direction: column; gap: 12px; }
#login-form button { width: 100%; min-height: 52px; border: none; border-radius: 12px; background: var(--brand); color: var(--brand-ink); font-size: 16px; font-weight: 600; cursor: pointer; }

.results { display: flex; flex-direction: column; gap: 14px; }
.review-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-no { font-weight: 700; font-size: 14px; }
.review-len { color: var(--muted); font-size: 12px; }
.review-card textarea { min-height: 90px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.review-actions button {
  flex: 1 1 auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfbf9;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.review-actions button:disabled { opacity: 0.55; cursor: default; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(35, 35, 31, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.toast.show { opacity: 1; }

.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.history-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fcfcf9;
}
.history-item h3 { margin: 0 0 4px; font-size: 14px; }
.history-item .meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.history-item .snippet { font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 80px; overflow: hidden; }
.history-item .ops { display: flex; gap: 8px; margin-top: 8px; }
.history-item .ops button {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  cursor: pointer;
}
.history-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 20px 0; }

@media (min-width: 700px) {
  #app { padding: 24px; }
  .card { padding: 22px; }
}
