:root {
  --bg: #0d0f14;
  --bg-2: #151923;
  --card: #1b202c;
  --card-2: #232a39;
  --line: #2c3446;
  --text: #eef1f7;
  --muted: #97a1b5;
  --gold: #e2b33c;
  --gold-2: #f5cf6a;
  --gold-dim: #8a6a1e;
  --ok: #3ecf8e;
  --warn: #ffb84d;
  --err: #ff6b6b;
  --radius: 14px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(900px 420px at 50% -8%, rgba(226, 179, 60, 0.16), transparent 70%),
    radial-gradient(600px 320px at 100% 100%, rgba(226, 179, 60, 0.06), transparent 70%);
  background-repeat: no-repeat;
  min-height: 100dvh;
}

a { color: var(--gold-2); }

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px calc(120px + env(safe-area-inset-bottom));
}

.top {
  padding: calc(18px + env(safe-area-inset-top)) 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; flex-direction: column; }
.brand .mark {
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--gold);
  opacity: 0.85;
}
.brand .name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

select, input, textarea {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus, input:focus, textarea:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(226, 179, 60, 0.15);
}
input::placeholder, textarea::placeholder { color: #6b7688; }
textarea { resize: vertical; min-height: 72px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  color: #171207;
  box-shadow: 0 8px 24px -12px rgba(226, 179, 60, 0.9);
}
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
.btn.danger { color: var(--err); border-color: rgba(255, 107, 107, 0.35); }

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

.label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.label b { color: var(--gold-2); font-size: 18px; font-weight: 800; }

.row { display: grid; gap: 12px; }
.row.two { grid-template-columns: 1fr 1fr; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.chip.on {
  border-color: var(--gold-dim);
  background: rgba(226, 179, 60, 0.14);
  color: var(--gold-2);
  font-weight: 600;
}

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input { text-align: center; font-size: 20px; font-weight: 700; padding: 10px; }
.stepper .btn { width: 48px; height: 48px; padding: 0; font-size: 22px; flex: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hide { display: none !important; }

/* 菜品分组 */
.group { margin-bottom: 14px; }
.group h3 {
  font-size: 14px;
  color: var(--gold);
  margin: 18px 0 8px;
  letter-spacing: 2px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.group h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 0.12s;
}
.item + .item { border-top: 1px solid rgba(44, 52, 70, 0.6); border-radius: 0; }
.item .ico {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  background: rgba(226, 179, 60, 0.12);
  color: var(--gold);
  border: 1px solid rgba(226, 179, 60, 0.18);
}
.item .mid { flex: 1; min-width: 0; }
.item .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 12px; color: var(--muted); }
.item .pr { font-weight: 700; color: var(--gold-2); white-space: nowrap; }

.qty { display: flex; align-items: center; gap: 6px; }
.qty button {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.qty span { min-width: 20px; text-align: center; font-weight: 700; font-size: 14px; }

/* 底部操作栏 */
.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(13, 15, 20, 0.4), var(--bg) 40%);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 20;
}
.bar-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.bar .sum { flex: 1; min-width: 0; }
.bar .sum .t1 { font-size: 12px; color: var(--muted); }
.bar .sum .t2 { font-size: 22px; font-weight: 800; color: var(--gold-2); line-height: 1.2; }
.bar .sum .t2 small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  background: rgba(35, 42, 57, 0.98);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: rgba(255, 107, 107, 0.5); }

/* 模态 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: end center;
  z-index: 40;
  padding: 0;
}
.modal .sheet {
  width: 100%;
  max-width: 520px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 88dvh;
  overflow: auto;
  animation: up 0.22s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } }

@media (min-width: 640px) {
  .modal { place-items: center; }
  .modal .sheet { border-radius: 18px; }
}

.skeleton {
  height: 64px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: sk 1.2s infinite linear;
  margin-bottom: 10px;
}
@keyframes sk { to { background-position: -200% 0; } }

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body { background-image: none !important; }
  body > *:not(.modal) { display: none !important; }
  .modal {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
  }
  .modal .sheet {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: #fff !important;
    padding: 0 !important;
    overflow: visible !important;
    animation: none !important;
    color: #000 !important;
  }
  .modal .sheet * { color: #000 !important; border-color: #999 !important; }
  #ticket-print { padding: 8mm; }
  .no-print { display: none !important; }
}

@page { margin: 10mm; }
