/* Reset & Global Base */
*, *:before, *:after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f9fafb;
}

/* Common Toast Component */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  text-align: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -40%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

/* ==========================================================================
   HOMEPAGE (GameStore) STYLES
   ========================================================================== */
.gamestore-root {
  background: #f9fafb;
  min-height: 100vh;
  min-height: 100dvh;
}

.wrap {
  background: #f9fafb;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, sans-serif;
  color: #292524;
  line-height: 1.5;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 0 40px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.03);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px 20px;
  background: rgba(249, 250, 251, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.topbar .logo {
  font-size: 17px;
  font-weight: 700;
  color: #292524;
}

.topbar .count {
  font-size: 12px;
  color: #a8a29e;
}

.hero {
  margin: 12px 16px 20px;
  border-radius: 16px;
  overflow: hidden;
  height: 190px;
  display: flex;
  align-items: flex-end;
  padding: 20px 24px;
  position: relative;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.15);
}

.hero .h-bg {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero:before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2) 50%);
  z-index: 1;
}

.hero:after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.6), rgba(0, 0, 0, 0.2));
  z-index: 1;
}

.h-inner {
  position: relative;
  z-index: 2;
  color: #fff;
}

.h-tag {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.25);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-weight: 500;
  backdrop-filter: blur(4px);
}

.h-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.3px;
}

.h-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 12px;
}

.h-btn {
  display: inline-block;
  padding: 7px 22px;
  background: #fff;
  color: #0f766e;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.h-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.tabs {
  padding: 0 16px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: 6px 16px;
  border-radius: 10px;
  font-size: 12px;
  white-space: nowrap;
  background: #fff;
  color: #78716c;
  border: 1px solid #e7e5e4;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.tab.on {
  background: #292524;
  color: #fff;
  border-color: #292524;
  font-weight: 600;
}

.sec {
  padding: 4px 20px 12px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #1c1917;
}

.sec .sub {
  font-size: 11px;
  font-weight: 400;
  color: #a8a29e;
}

.list {
  padding: 0 16px;
}

.card {
  background: #fff;
  border-radius: 14px;
  margin-bottom: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #f3f4f6;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.card:hover {
  border-color: #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.card:active {
  border-color: #d6d3d1;
  transform: scale(0.99);
}

.c-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  background: #f3f4f6;
}

.c-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
}

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

.c-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #1c1917;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.c-meta {
  font-size: 11px;
  color: #a8a29e;
  display: flex;
  align-items: center;
  gap: 6px;
}

.c-meta .badge {
  font-size: 9px;
  background: #ecfdf5;
  color: #065f46;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.c-meta .stars {
  color: #d97706;
}

.c-btn {
  flex-shrink: 0;
  padding: 7px 16px;
  background: #0d9488;
  color: #fff;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.c-btn:hover {
  background: #0f766e;
}

.c-btn:active {
  opacity: 0.9;
}

.footer {
  text-align: center;
  font-size: 11px;
  color: #d6d3d1;
  padding: 30px 0;
}

/* ==========================================================================
   TASK PAGE (SupermarketTask) STYLES
   ========================================================================== */
.v5-root {
  background: #faf6ef;
  min-height: 100vh;
  min-height: 100dvh;
}

.v5-wrap {
  font-family: -apple-system, PingFang SC, Noto Sans SC, sans-serif;
  color: #2d2a24;
  max-width: 600px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  -webkit-font-smoothing: antialiased;
}

.hero-wrap {
  padding: 36px 24px 12px;
  text-align: center;
}

.hero-wrap h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  color: #2d2a24;
  letter-spacing: -0.5px;
  margin: 0;
}

.hero-wrap h1 .accent {
  color: #f76707;
}

.hero-wrap .desc {
  font-size: 14px;
  color: #888;
  line-height: 1.7;
  margin-top: 10px;
  padding: 0 6px;
}

.visitor-line {
  text-align: center;
  font-size: 12px;
  color: #bbb;
  margin-bottom: 12px;
}

.steps-wrap {
  padding: 0 16px 24px;
}

.task-card {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid #f0ebe2;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #444;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f76707, #f97316);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.comment-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.quote-cell {
  flex: 1;
  min-width: 0;
  background: #f7f1e9;
  border-radius: 10px;
  padding: 13px 15px;
  font-size: 14px;
  line-height: 1.6;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-copy {
  flex-shrink: 0;
  align-self: stretch;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  background: #f76707;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  min-width: 64px;
  user-select: none;
}

.btn-copy:active {
  opacity: 0.85;
  transform: scale(0.97);
}

.btn-copy.done {
  background: #4ade80 !important;
  color: #fff !important;
}

.tip {
  font-size: 13px;
  color: #aaa;
  text-align: center;
  line-height: 1.6;
  margin-top: 12px;
}

.tip .red {
  color: #f03e3e;
  font-weight: 700;
}

.demo-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 12px 16px;
  background: #fef5ed;
  border: 1px solid #fde0c2;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease;
}

.demo-toggle:active {
  background: #fde8d0;
}

.demo-toggle-text {
  font-size: 13px;
  color: #e8590c;
  font-weight: 500;
}

.demo-toggle-arrow {
  font-size: 12px;
  color: #e8590c;
  transition: transform 0.25s ease;
}

.demo-toggle.active .demo-toggle-arrow {
  transform: rotate(180deg);
}

/* Smooth Accordion Demo Content (Prevents Layout Jumps) */
.demo-content {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-top 0.3s ease;
  margin-top: 0;
}

.demo-content.open {
  max-height: 1200px;
  opacity: 1;
  margin-top: 12px;
}

.demo-img-wrap {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f0;
  min-height: 200px;
}

.demo-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.upload-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-upload {
  height: 46px;
  padding: 0 28px;
  border: none;
  border-radius: 10px;
  background: #f76707;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  box-shadow: 0 4px 12px rgba(247, 103, 7, 0.25);
}

.btn-upload:active {
  opacity: 0.85;
  transform: scale(0.98);
}

.warning {
  width: 100%;
  font-size: 13px;
  color: #b8860b;
  line-height: 1.5;
  padding: 10px 14px;
  background: #fef4e0;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.promo-section {
  width: 100%;
  margin-top: 10px;
}

.promo-label {
  font-size: 13px;
  color: #888;
  text-align: center;
  margin-bottom: 8px;
}

.promo-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid #f0ebe2;
}

.promo-card .promo-img {
  width: 100%;
  display: block;
  border-radius: 14px;
}

/* ==========================================================================
   CUSTOMER SERVICE CHAT PANEL MODAL STYLES (Flicker-Free)
   ========================================================================== */
.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1999;
  animation: fadeInBackdrop 0.25s ease-out;
}

@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  height: 60vh;
  max-height: 650px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.15);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

@keyframes slideUp {
  0% { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: #fff;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  font-size: 28px;
  line-height: 1;
}

.chat-agent-name {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}

.chat-agent-status {
  font-size: 12px;
  color: #52c41a;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-agent-status:before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #52c41a;
}

.chat-close {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f5f5f5;
  font-size: 16px;
  color: #999;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.chat-close:active {
  background: #e8e8e8;
}

.chat-warning {
  background: #fff3cd;
  padding: 8px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: #856404;
  flex-shrink: 0;
  border-bottom: 1px solid #ffeeba;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fc;
}

.chat-body::-webkit-scrollbar {
  width: 4px;
}
.chat-body::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.msg {
  display: flex;
  margin-bottom: 14px;
  animation: msgFadeIn 0.2s ease-out;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.bot {
  justify-content: flex-start;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-all;
}

.msg.bot .bubble {
  background: #fff;
  color: #333;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border-bottom-left-radius: 4px;
}

.msg.user .bubble {
  background: linear-gradient(135deg, #ff8a3d, #ff6b35);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(255, 107, 53, 0.25);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-img-preview {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.4);
}

.bot-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
}

.bot-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  animation: typing 1.4s infinite both;
}

.bot-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.bot-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1.1);
  }
}

.chat-footer {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
  background: #fff;
}

.upload-btn-full {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff8a3d, #ff6b35);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.15s, transform 0.15s;
  user-select: none;
}

.upload-btn-full:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #ccc;
}

.upload-btn-full:not(:disabled):active {
  opacity: 0.85;
  transform: scale(0.99);
}

.upload-btn-full svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   SUCCESS PAGE STYLES
   ========================================================================== */
.success-root {
  min-height: 100vh;
  min-height: 100dvh;
  background: #f2f2f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

@keyframes successFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.success-card {
  background: #fff;
  max-width: 480px;
  width: 100%;
  border-radius: 20px;
  padding: 36px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  animation: successFadeIn 0.2s ease-out;
}

.success-icon {
  font-size: 56px;
  margin-bottom: 16px;
  line-height: 1;
}

.success-title {
  font-size: 22px;
  font-weight: 700;
  color: #1c1917;
  margin-bottom: 8px;
}

.success-desc {
  font-size: 14px;
  color: #78716c;
  line-height: 1.6;
  margin-bottom: 28px;
}

.resource-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ff8a3d, #f2722a);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 14px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(242, 114, 42, 0.3);
  transition: all 0.15s ease;
  user-select: none;
}

.resource-btn:hover {
  opacity: 0.95;
  box-shadow: 0 6px 18px rgba(242, 114, 42, 0.4);
}

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

.back-home-btn {
  margin-top: 16px;
  display: inline-block;
  font-size: 13px;
  color: #a8a29e;
  text-decoration: none;
  padding: 8px 16px;
  cursor: pointer;
}

.back-home-btn:hover {
  color: #78716c;
}
