/* 🤖 public/css/main.css
 * Supermarket Tracker — 方案 B：粗獷歡樂 Brutalist Joy
 * 設計規範：[CLAUDE.md §3.3](../../CLAUDE.md) 程式碼風格
 * Mobile-First + 響應式（375px ~ 1920px）
 */

/* ==========================================================================
   CSS 變數（B 風格配色）
   ========================================================================== */
:root {
  /* 核心配色 */
  --yellow: #ffd93d; /* 主品牌色：亮黃 */
  --coral: #ff6b6b; /* 強調色：珊瑚紅 */
  --mint: #4ecdc4; /* 次要：薄荷綠 */
  --lavender: #a78bfa; /* 第三：薰衣草 */
  --black: #1a1a1a; /* 邊框與文字 */
  --white: #ffffff; /* 卡片底 */

  /* 字型 */
  --font-display: "Fredoka", "Noto Sans TC", sans-serif;
  --font-body: "Fredoka", "Noto Sans TC", sans-serif;

  /* 粗黑邊框 */
  --border-thick: 4px solid var(--black);
  --border-thin: 3px solid var(--black);

  /* 硬陰影（撞擊感）*/
  --shadow-sm: 4px 4px 0 var(--black);
  --shadow-md: 6px 6px 0 var(--black);
  --shadow-lg: 8px 8px 0 var(--black);

  /* 過渡 */
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --transition-base: 200ms var(--bounce);
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px; /* 避免 iOS Safari 自動縮放 */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.4;
  color: var(--black);
  background-color: var(--yellow);
  background-image:
    radial-gradient(circle at 15% 10%, var(--coral) 0%, transparent 8%),
    radial-gradient(circle at 85% 20%, var(--mint) 0%, transparent 10%),
    radial-gradient(circle at 50% 80%, var(--lavender) 0%, transparent 12%),
    radial-gradient(var(--black) 1.5px, transparent 1.5px);
  background-size:
    auto,
    auto,
    auto,
    24px 24px;
  background-attachment: fixed;
  min-height: 100vh;
  padding: calc(20px + var(--safe-top)) 16px calc(110px + var(--safe-bottom)) 16px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.1;
}

p {
  line-height: 1.5;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ==========================================================================
   無障礙 Focus 樣式（B 風格：粗黑邊框）
   ========================================================================== */
:focus-visible {
  outline: 4px solid var(--coral);
  outline-offset: 2px;
}

/* ==========================================================================
   卡片（B 風格：粗黑邊框 + 硬陰影 + 隨機旋轉）
   ========================================================================== */
.card {
  background: var(--white);
  border: var(--border-thick);
  box-shadow: var(--shadow-md);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  transition: transform var(--transition-base);
}

.card:hover {
  transform: translateY(-4px) rotate(0deg);
  box-shadow: var(--shadow-lg);
}

.card:nth-of-type(odd) {
  transform: rotate(-0.5deg);
}
.card:nth-of-type(even) {
  transform: rotate(0.5deg);
}
.card:nth-of-type(odd):hover {
  transform: translateY(-4px) rotate(-0.3deg);
}
.card:nth-of-type(even):hover {
  transform: translateY(-4px) rotate(0.3deg);
}

.card-title {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.card-description {
  font-size: 14px;
  color: rgba(26, 26, 26, 0.7);
  margin-bottom: 16px;
  font-weight: 500;
}

/* ==========================================================================
   Header（B 風格：粗黑邊框 + 硬陰影 + 隨機旋轉）
   ========================================================================== */
.app-header {
  background: var(--white);
  border: var(--border-thick);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  padding: 12px 12px 12px;
  margin: 0 auto 12px;
  max-width: 1200px;
  transform: rotate(-1deg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-title {
  font-size: 17.6px;
  font-weight: 700;
  line-height: 1;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.app-title span:first-child {
  font-size: 24px;
  line-height: 1;
}

.app-subtitle {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.75);
  margin: 0 0 8px;
}

/* 狀態指示器（B 風格 badge）*/
.app-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  background: var(--mint);
  border: var(--border-thin);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0;
}

/* 瀏覽計數器 */
.visit-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--lavender);
  color: var(--white);
  border: var(--border-thin);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  margin-top: 0;
  margin-left: 0;
}

/* 狀態列同行容器（flex-wrap 讓手機版同行、桌面版自動換行）*/
.app-header .status-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.app-status.offline {
  background: var(--coral);
}

.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--black);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 1.5s ease-in-out infinite;
}

.app-status.offline .status-indicator {
  background: var(--white);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

/* ==========================================================================
   Main 容器
   ========================================================================== */
.app-main {
  width: 100%;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* ==========================================================================
   進度條（F-02 模型載入 · B 風格）
   ========================================================================== */
.progress-container {
  margin: 16px 0;
  padding: 12px;
  background: var(--yellow);
  border: var(--border-thin);
  border-radius: 12px;
}

.progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--black);
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 16px;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--coral);
  border-right: 2px solid var(--black);
  transition: width 300ms ease-out;
}

.progress-fill--complete {
  background: var(--mint);
}

.progress-fill--error {
  background: var(--coral);
  background-image: repeating-linear-gradient(
    45deg,
    var(--black),
    var(--black) 4px,
    var(--coral) 4px,
    var(--coral) 8px
  );
}

/* ==========================================================================
   Placeholder 區（B 風格：彩色 emoji + 粗邊框）
   ========================================================================== */
.capture-placeholder,
.cart-placeholder,
.exchange-placeholder {
  background: var(--yellow);
  border: 3px dashed var(--black);
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  margin-top: 12px;
}

.cart-placeholder {
  background: var(--mint);
}
.exchange-placeholder {
  background: var(--lavender);
}

.placeholder-icon {
  display: block;
  font-size: 64px;
  line-height: 1;
  margin-bottom: 8px;
  filter: drop-shadow(2px 2px 0 var(--black));
}

.placeholder-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--black);
  margin: 0;
}

/* ==========================================================================
   拍照按鈕（B 風格大按鈕）
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 16px 24px;
  background: var(--coral);
  color: var(--white);
  border: var(--border-thick);
  box-shadow: var(--shadow-md);
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-base);
  transform: rotate(-1deg);
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-4px) rotate(-1deg);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(2px) translateX(2px) rotate(-1deg);
  box-shadow: 2px 2px 0 var(--black);
}

.btn-primary .btn-icon {
  font-size: 28px;
}

.btn-mint {
  background: var(--mint);
  transform: rotate(0.5deg);
}
.btn-mint:hover {
  transform: translateY(-4px) rotate(0.5deg);
}
.btn-mint:active {
  transform: translateY(2px) translateX(2px) rotate(0.5deg);
}

.btn-lavender {
  background: var(--lavender);
  transform: rotate(-0.5deg);
}
.btn-lavender:hover {
  transform: translateY(-4px) rotate(-0.5deg);
}
.btn-lavender:active {
  transform: translateY(2px) translateX(2px) rotate(-0.5deg);
}

/* ==========================================================================
   F-06 購物車 UI 樣式
   ========================================================================== */
.item-list-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-cart-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--white);
  color: var(--black);
  border: 3px solid var(--black);
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms var(--bounce);
}
.btn-cart-action:hover {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 4px 4px 0 var(--black);
}
.btn-cart-action:active {
  transform: translateY(1px) translateX(1px) rotate(-1deg);
  box-shadow: 1px 1px 0 var(--black);
}
.btn-cart-danger {
  background: var(--coral);
  color: var(--white);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.item-list-loading,
.item-list-empty,
.item-list-error {
  text-align: center;
  padding: 24px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.7;
}
.item-list-error {
  color: var(--coral);
  opacity: 1;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--mint);
  border: 3px solid var(--black);
  border-radius: 12px;
  min-height: 64px;
  transition: transform 150ms var(--bounce);
}
.cart-item:nth-child(even) {
  background: var(--lavender);
  transform: rotate(-0.5deg);
}
.cart-item:nth-child(odd) {
  transform: rotate(0.5deg);
}
.cart-item:hover {
  transform: translateY(-2px) rotate(0deg);
}

.cart-item-emoji {
  width: 48px;
  height: 48px;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.cart-item-info {
  flex: 1;
  min-width: 0;
}
.cart-item-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-item-meta {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}
.cart-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.cart-item-qty-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-item-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-item-qty {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}
.btn-qty-plus,
.btn-qty-minus {
  width: 28px;
  height: 28px;
  background: var(--yellow);
  color: var(--black);
  border: 2px solid var(--black);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.btn-qty-plus:hover,
.btn-qty-minus:hover {
  background: var(--coral);
  color: var(--white);
}
.cart-item-price {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.btn-item-delete {
  width: 32px;
  height: 32px;
  background: var(--coral);
  color: var(--white);
  border: 2px solid var(--black);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}
.btn-item-delete:hover {
  transform: rotate(90deg);
}

.cart-summary {
  margin-top: 12px;
  padding: 12px;
  background: var(--yellow);
  border: var(--border-thick);
  border-radius: 12px;
}
.cart-summary h4 {
  font-size: 16px;
  margin-bottom: 8px;
}
.summary-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-row {
  display: grid;
  grid-template-columns: 1fr auto 80px;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
}
.summary-amount {
  text-align: right;
}

/* ==========================================================================
   F-04 拍照 UI 樣式
   ========================================================================== */
.capture-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.capture-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-capture-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 12px 20px;
  background: var(--mint);
  color: var(--black);
  border: var(--border-thick);
  box-shadow: var(--shadow-sm);
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms var(--bounce);
}
.btn-capture-action:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 var(--black);
}
.btn-capture-action:active {
  transform: translateY(2px) translateX(2px);
  box-shadow: 2px 2px 0 var(--black);
}
.btn-capture-action .btn-icon {
  font-size: 24px;
}
.btn-capture-alt {
  background: var(--lavender);
}

.btn-capture-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 14px 24px;
  background: #81d8d0;
  color: var(--white);
  border: var(--border-thick);
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms var(--bounce);
}
.btn-capture-primary:hover {
  background: #6bc9c0;
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 8px 8px 0 var(--black);
}
.btn-capture-primary:active {
  background: #5ab8af;
  transform: translateY(2px) translateX(2px) rotate(-1deg);
  box-shadow: 2px 2px 0 var(--black);
}

.capture-shoot-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.btn-shoot {
  width: 88px;
  height: 88px;
  background: var(--coral);
  color: var(--white);
  border: var(--border-thick);
  box-shadow: var(--shadow-md);
  border-radius: 50%;
  font-size: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms var(--bounce);
}
.btn-shoot:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 8px 8px 0 var(--black);
}
.btn-shoot:active {
  transform: scale(0.95);
  box-shadow: 2px 2px 0 var(--black);
}
.shoot-hint {
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
}

.capture-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.preview-img {
  max-width: 100%;
  max-height: 300px;
  border: var(--border-thick);
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  object-fit: contain;
  background: var(--gray-light);
}
.preview-info {
  font-size: 12px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  opacity: 0.7;
}
.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.capture-progress {
  width: 100%;
  padding: 12px;
  background: var(--yellow);
  border: var(--border-thin);
  border-radius: 12px;
}
.progress-text {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}
.progress-bar-track {
  height: 12px;
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--coral);
  transition: width 200ms ease-out;
}

.capture-result {
  width: 100%;
}
.result-card {
  padding: 16px;
  border: var(--border-thick);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}
.result-success {
  background: var(--mint);
}
.result-error {
  background: var(--coral);
  color: var(--white);
}
.result-card h4 {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 800;
}
.result-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.result-label {
  font-weight: 700;
  opacity: 0.7;
}
.result-value {
  font-weight: 600;
}
.result-action-hint {
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0;
}
.result-error-code {
  font-size: 12px;
  opacity: 0.8;
}

/* ==========================================================================
   Sticky Bottom CTA（B 風格：粗黑邊框 + 硬陰影）
   ========================================================================== */
.sticky-cta {
  position: fixed;
  bottom: calc(88px + var(--safe-bottom));
  left: 16px;
  right: 16px;
  z-index: 40;
  max-width: 448px;
  margin: 0 auto;
}

.sticky-cta .btn-primary {
  font-size: 20px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  text-align: center;
  padding: 16px;
  margin-top: 24px;
}

.footer-text {
  font-size: 11px;
  font-weight: 600;
  color: rgba(26, 26, 26, 0.7);
  margin: 0;
}

.version-badge,
.tech-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--black);
  color: var(--yellow);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  margin: 0 2px;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   底部 Tab Bar（B 風格：粗黑邊框 + FAB 凸起）
   ========================================================================== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(88px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--white);
  border-top: var(--border-thick);
  display: flex;
  z-index: 30;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--black);
  text-decoration: none;
  min-height: 48px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 700;
  transition: background var(--transition-base);
}

.tab-item.active {
  background: var(--yellow);
}

.tab-item.active .tab-icon {
  transform: scale(1.1);
}

.tab-icon {
  font-size: 24px;
  transition: transform var(--transition-base);
}

/* 中央 FAB Tab */
.tab-fab {
  flex: 0 0 72px;
  position: relative;
}

.tab-fab .tab-circle {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  background: var(--coral);
  color: var(--white);
  border: var(--border-thick);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.tab-fab:active .tab-circle {
  transform: translateX(-50%) translateY(2px) translateX(2px);
  box-shadow: 2px 2px 0 var(--black);
}

/* ==========================================================================
   響應式：平板與桌面（雙欄佈局）
   ========================================================================== */
@media (min-width: 768px) {
  body {
    padding: 24px 24px 120px;
  }

  /* 桌面版 Header 覆蓋 */
  .app-header {
    padding: 24px 20px;
    margin: 0 auto 24px;
  }

  .app-title {
    font-size: 36px;
    gap: 12px;
    margin: 0 0 8px;
  }

  .app-title span:first-child {
    font-size: 40px;
  }

  .app-subtitle {
    font-size: 16px;
    margin: 0 0 16px;
  }

  .app-status {
    padding: 6px 14px;
    font-size: 12px;
  }

  .visit-counter {
    padding: 6px 14px;
    font-size: 13px;
  }

  .card {
    padding: 24px;
  }
  .card-title {
    font-size: 24px;
  }

  .placeholder-icon {
    font-size: 80px;
  }

  /* 桌面版：雙欄佈局
     左欄：總計 + 拍照辨識
     右欄：購物車 + 即時匯率 */
  .app-main .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
  }

  .cart-summary {
    grid-column: 1;
    grid-row: 1;
  }
  .capture-section {
    grid-column: 1;
    grid-row: 2;
  }
  .cart-section {
    grid-column: 2;
    grid-row: 1;
  }
  .exchange-section {
    grid-column: 2;
    grid-row: 2;
  }

  /* 桌面版：放開外層容器寬度限制（覆蓋 style.css 的 max-width: 600px）
     對應 Tailwind: md:max-w-5xl */
  .app-main {
    max-width: 1200px;
    margin: 0 auto;
  }
  .app-main .container {
    max-width: 100%;
  }

  /* 桌面版：Tab Bar 變為置中浮動 Dock（覆蓋原本的 fixed bottom full-width）
     對應 Tailwind: md:max-w-3xl mx-auto md:bottom-6 md:rounded-2xl md:border md:shadow-lg */
  .tab-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 768px;
    min-width: 480px;
    height: auto;
    padding: 12px 16px;
    background: var(--white);
    border: var(--border-thick);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    z-index: 30;
    display: flex;
    gap: 4px;
  }

  /* 桌面版：調整每個 Tab 項目大小 */
  .tab-bar .tab-item {
    flex: 1;
    min-width: 64px;
    padding: 8px 6px;
    font-size: 12px;
  }

  .tab-bar .tab-icon {
    font-size: 26px;
  }

  /* 桌面版：FAB 融入 Dock，不突出 */
  .tab-bar .tab-fab {
    flex: 0 0 64px;
  }

  .tab-bar .tab-fab .tab-circle {
    position: static;
    transform: none;
    width: 56px;
    height: 56px;
    font-size: 26px;
    box-shadow: var(--shadow-md);
  }

  .tab-bar .tab-fab:active .tab-circle {
    transform: translateY(2px) translateX(2px);
    box-shadow: 2px 2px 0 var(--black);
  }

  /* 桌面版：結帳按鈕改為與 Tab Dock 浮動在同一水平線上
     對應 Tailwind: w-full max-w-md md:max-w-5xl mx-auto */
  .sticky-cta {
    position: fixed;
    bottom: calc(24px + 76px + 12px);
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 768px;
    min-width: 480px;
    padding: 0 16px;
    z-index: 40;
  }
  .sticky-cta .btn-primary {
    width: 100%;
    font-size: 20px;
    border-radius: 20px;
  }
}

@media (min-width: 1024px) {
  body {
    padding: 32px 32px 120px;
  }

  .app-title {
    font-size: 32px;
  }

  .app-main .container {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

/* ==========================================================================
   使用者偏好：減少動畫
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .card,
  .btn-primary,
  .tab-circle,
  .tab-icon {
    transform: none !important;
  }
}

/* ============================================================================
   結帳對話框
   ============================================================================ */
.checkout-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.checkout-dialog {
  background: var(--card-bg, #16213e);
  border: 3px solid var(--black, #000);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 4px 4px 0 var(--black, #000);
}

.checkout-dialog h2 {
  font-family: var(--font-display, sans-serif);
  font-size: 1.4rem;
  margin-bottom: 16px;
  text-align: center;
  color: var(--yellow, #FFD93D);
}

.checkout-items {
  background: var(--dark, #0a0a1a);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: break-word;
  margin-bottom: 8px;
  max-height: 150px;
  overflow-y: auto;
  color: #e2e8f0;
}

.checkout-summary {
  background: var(--dark, #0a0a1a);
  padding: 12px;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 12px;
}

.checkout-total {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--coral, #ff6b6b);
}

.checkout-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-checkout-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border: var(--border-thick, 3px solid #000);
  border-radius: 12px;
  font-family: var(--font-display, sans-serif);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms var(--bounce, ease);
  width: 100%;
}

.btn-checkout-action:active {
  transform: translateY(2px) translateX(2px);
  box-shadow: 2px 2px 0 var(--black, #000);
}

.btn-checkout-action.btn-share {
  background: var(--coral, #ff6b6b);
  color: var(--white, #fff);
  box-shadow: var(--shadow-md, 4px 4px 0 #000);
  transform: rotate(-1deg);
}

.btn-checkout-action.btn-share:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 6px 6px 0 var(--black, #000);
}

.btn-checkout-action.btn-confirm {
  background: var(--yellow, #FFD93D);
  color: var(--black, #000);
  box-shadow: var(--shadow-md, 4px 4px 0 #000);
  transform: rotate(-1deg);
}

.btn-checkout-action.btn-confirm:hover {
  transform: translateY(-3px) rotate(-1deg);
  box-shadow: 6px 6px 0 var(--black, #000);
}

.btn-checkout-action.btn-cancel {
  background: var(--white, #fff);
  color: var(--text-muted, #94a3b8);
  border-color: var(--black, #000);
}

.btn-checkout-action.btn-cancel:hover {
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 4px 4px 0 var(--black, #000);
  color: var(--black, #000);
}
