:root {
  --bg: #f7f6f2;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #58cc02;
  --accent-dark: #46a302;
  --accent-text: #ffffff;
  --danger: #ea2b2b;
  --danger-bg: #fff5f5;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --tap-min: 56px;
  --font: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}

h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: 0.02em;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.subtle {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 20px;
}

.store-header {
  margin-bottom: 20px;
}

.store-header .store-name {
  font-size: 1.5rem;
  font-weight: 800;
}

.store-header .table-label {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 4px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap-min);
  padding: 14px 20px;
  font-size: 1.15rem;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--card-shadow);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--card-shadow);
  margin-top: 12px;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-dark);
  box-shadow: none;
  min-height: 44px;
  font-size: 1rem;
  margin-top: 8px;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.scan-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 280px;
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0;
  box-shadow: var(--card-shadow);
}

.scan-area video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-overlay {
  position: absolute;
  inset: 20%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 12px;
  pointer-events: none;
}

.url-panel {
  margin-top: 16px;
}

.url-panel input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 12px 16px;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid #ddd;
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.url-panel input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.category-card:active {
  transform: scale(0.98);
}

.category-card .thumbs {
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 8px;
}

.category-card .name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.nav-back {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: #fff;
  border-radius: 12px;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 12px;
}

.category-tab {
  flex: 0 0 auto;
  scroll-snap-align: start;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  font-family: inherit;
}

.category-tab.active {
  border-color: var(--accent);
  background: #eefbe5;
}

.dish-swipe {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  margin: 0 -16px;
  padding: 0 16px;
}

.dish-panel {
  flex: 0 0 100%;
  scroll-snap-align: center;
  padding-right: 8px;
}

.dish-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dish-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px;
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.dish-card .emoji {
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.dish-card .dish-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.dish-card .dish-price {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.dish-card .dish-note {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 2px;
}

.dish-detail-hero {
  text-align: center;
  margin-bottom: 20px;
}

.dish-detail-hero .emoji {
  font-size: 4.5rem;
  line-height: 1;
}

.dish-detail-hero .dish-name {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 12px 0 4px;
}

.dish-detail-hero .dish-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-dark);
}

.option-block {
  margin-bottom: 20px;
}

.option-block .step-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.option-block.done .step-title::after {
  content: " ✓";
  color: var(--accent-dark);
}

.choice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: var(--tap-min);
  padding: 12px 16px;
  background: #fff;
  border: 2px solid #e8e8e8;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1.1rem;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--card-shadow);
}

.choice-btn.selected {
  border-color: var(--accent);
  background: #eefbe5;
}

.choice-btn .emoji {
  font-size: 2rem;
}

.choice-btn .meta {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.proxy-section {
  margin-top: 24px;
  padding-top: 8px;
}

.status-ok {
  text-align: center;
  padding: 20px;
  background: #eefbe5;
  border-radius: var(--radius);
  margin-top: 16px;
}

.status-ok h3 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  color: var(--accent-dark);
}

.status-fail {
  margin-top: 16px;
}

.status-fail h3 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  color: var(--danger);
}

.fail-coach {
  position: relative;
  padding: 16px;
  background: var(--danger-bg);
  border-radius: var(--radius);
}

.fail-frame {
  border: 4px solid var(--danger);
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.fail-frame .mock-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 12px 24px;
  background: #333;
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
