* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  background: #f5f6f8;
  color: #1a1a1a;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

/* 登入畫面 */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-width: 360px;
  width: 100%;
}

.login-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-card p {
  color: #666;
  margin-bottom: 32px;
}

.google-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #4285f4;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.google-btn:hover {
  background: #357ae8;
}

/* 主畫面 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ddd;
}

.logout-btn {
  border: 1px solid #ddd;
  background: white;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.main-content {
  padding: 24px 16px;
}

.placeholder {
  text-align: center;
  color: #666;
  margin-top: 40px;
}

/* 新增按鈕 */
.add-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #1a73e8;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
}

/* 券卡片列表 */
.voucher-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voucher-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.voucher-card.used {
  opacity: 0.5;
}

.voucher-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  flex-shrink: 0;
  background: #eee;
}

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

.voucher-merchant {
  font-weight: 600;
  font-size: 15px;
}

.voucher-item {
  font-size: 13px;
  color: #555;
}

.voucher-expiry {
  font-size: 12px;
  color: #999;
}

.action-btn {
  border: 1px solid #1a73e8;
  background: white;
  color: #1a73e8;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.action-btn:disabled {
  border-color: #ccc;
  color: #999;
  cursor: default;
}

/* Modal 共用樣式 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  z-index: 100;
}

.modal-content {
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.close-btn {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

/* 上傳表單欄位 */
#step-pick-image,
#step-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#step-confirm label {
  font-size: 13px;
  color: #555;
  margin-top: 6px;
}

#step-confirm input,
#step-confirm select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
}

.image-preview {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
  background: #f0f0f0;
}

.primary-btn {
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #1a73e8;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.primary-btn:disabled {
  background: #a0bcec;
}

.status-text {
  text-align: center;
  font-size: 13px;
  color: #666;
}

.raw-text-details {
  margin-top: 8px;
}

.raw-text-details summary {
  font-size: 13px;
  color: #1a73e8;
  cursor: pointer;
}

#raw-text {
  width: 100%;
  height: 80px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 12px;
  color: #666;
  resize: vertical;
}

/* 原圖檢視 */
.image-viewer-content {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-content img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
}

.image-viewer-content .close-btn {
  position: absolute;
  top: -40px;
  right: 8px;
  color: white;
  font-size: 24px;
}

#image-viewer {
  align-items: center;
  justify-content: center;
}
