/* ── Reset & Base ────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'PingFang TC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft JhengHei', sans-serif;
  background-color: #FAF8F5;
  overflow-x: hidden;
}

/* ── Screen visibility ───────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  background-color: #FAF8F5;
}
.screen.active {
  display: flex;
}

/* ── Site header ─────────────────────────────── */
.site-header {
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}
.header-inner {
  max-width: 480px;
  margin: 0 auto;
}
.header-logo {
  height: 36px;
  width: auto;
}

/* ── Button ──────────────────────────────────── */
.btn-primary {
  display: block;
  width: calc(100% - 48px);
  max-width: 360px;
  margin: 24px auto;
  padding: 16px 0;
  background: #F5821F;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 0.05em;
  position: relative;
  z-index: 1;
}
.btn-primary:active {
  background: #d9700f;
}

/* ── Polaroid frame ──────────────────────────── */
.polaroid-frame {
  background: #fff;
  padding: 12px 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-radius: 2px;
}
.polaroid-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1px;
}

/* ── Cover screen ────────────────────────────── */
.cover-main {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 48px;
  position: relative;
  overflow: hidden;
}

.bg-icons {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 0;
}
.icon {
  position: absolute;
  width: 80px;
  height: auto;
  opacity: 0.85;
}
.icon-luggage  { top: 8%;  left: 4%;  width: 80px; transform: rotate(-12deg); }
.icon-camera   { top: 12%; right: 6%; width: 80px; transform: rotate(10deg); }
.icon-passport { top: 35%; left: 2%;  width: 80px; transform: rotate(-8deg); }
.icon-map      { top: 30%; right: 4%; width: 80px; transform: rotate(6deg); }
.icon-plane    { bottom: 20%; left: 6%; width: 80px; transform: rotate(-15deg); }
.icon-eiffel   { bottom: 12%; right: 3%; width: 80px; }
.icon-flipflops{ bottom: 28%; right: 8%; width: 80px; transform: rotate(5deg); }

.cover-title-img {
  width: 88%;
  max-width: 380px;
  height: auto;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.cover-subtitle-img {
  width: 90%;
  max-width: 360px;
  height: auto;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.cover-subtitle-text {
  font-size: 16px;
  color: #555;
  text-align: center;
  margin-top: 8px;
  position: relative;
  z-index: 1;
}
.cover-polaroid {
  width: 82%;
  max-width: 340px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

/* ── Rules screen ────────────────────────────── */
.rules-main {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 48px;
  position: relative;
  overflow: hidden;
}


.rules-title {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}
.rules-text {
  font-size: 15px;
  color: #555;
  text-align: center;
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

/* Demo card animation */
.rules-demo {
  width: 82%;
  max-width: 340px;
  position: relative;
  z-index: 1;
}
.demo-card {
  position: relative;
  animation: demo-swipe 2.4s ease-in-out infinite;
}
@keyframes demo-swipe {
  0%   { transform: translateX(0) rotate(0deg); }
  20%  { transform: translateX(-40px) rotate(-8deg); }
  40%  { transform: translateX(0) rotate(0deg); }
  60%  { transform: translateX(40px) rotate(8deg); }
  80%  { transform: translateX(0) rotate(0deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

.demo-overlay {
  position: absolute;
  top: 8px;
  font-size: 28px;
  font-weight: 900;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
  pointer-events: none;
}
.demo-overlay--like    { right: 8px; color: #4CAF50; animation: demo-like-fade 2.4s ease-in-out infinite; }
.demo-overlay--dislike { left: 8px;  color: #F44336; animation: demo-dislike-fade 2.4s ease-in-out infinite; }

@keyframes demo-like-fade {
  0%,39%,61%,100% { opacity: 0; }
  50%,55% { opacity: 1; }
}
@keyframes demo-dislike-fade {
  0%,19%,41%,100% { opacity: 0; }
  25%,30% { opacity: 1; }
}

.demo-polaroid { pointer-events: none; }

.demo-buttons {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  margin-top: 12px;
}
.demo-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid;
  font-size: 20px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.demo-btn--dislike { border-color: #F44336; color: #F44336; }
.demo-btn--like    { border-color: #4CAF50; color: #4CAF50; }

/* ── Game screen ─────────────────────────────── */
.game-main {
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 48px;
  position: relative;
  overflow: hidden;
}

.game-header {
  font-size: 22px;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.game-statement {
  font-size: 17px;
  font-weight: 700;
  color: #222;
  text-align: center;
  margin: 12px 4px 4px;
  line-height: 1.4;
}

.game-card-area {
  width: 86%;
  max-width: 360px;
  position: relative;
  margin-bottom: 36px;
  z-index: 1;
}

/* Draggable card */
.card {
  position: relative;
  touch-action: none;
  user-select: none;
  will-change: transform;
  cursor: grab;
  -webkit-user-drag: none;
}
.card:active { cursor: grabbing; }

/* Like / dislike overlays */
.card-overlay {
  position: absolute;
  top: 12px;
  font-size: 32px;
  font-weight: 900;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 2;
  pointer-events: none;
}
.card-overlay--like    { right: 16px; color: #4CAF50; }
.card-overlay--dislike { left: 16px;  color: #F44336; }

/* Fly-off classes */
.card--fly-right {
  transition: transform 350ms ease-in;
  transform: translateX(120vw) rotate(30deg) !important;
}
.card--fly-left {
  transition: transform 350ms ease-in;
  transform: translateX(-120vw) rotate(-30deg) !important;
}
/* Snap back */
.card--snap {
  transition: transform 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Game buttons */
.game-buttons {
  display: flex;
  gap: 48px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.game-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid;
  font-size: 24px;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.game-btn--dislike { border-color: #F44336; color: #F44336; }
.game-btn--like    { border-color: #4CAF50; color: #4CAF50; }
.game-btn:active   { transform: scale(0.92); }

/* ── Result screen ───────────────────────────── */
#screen-result {
  position: relative;
}
#screen-result > .bg-icons {
  height: 100vh;
  overflow: hidden;
}
.result-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 0;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.result-title {
  font-size: 20px;
  font-weight: 700;
  color: #222;
  text-align: center;
  margin-bottom: 4px;
  position: relative;
  z-index: 1;
}
.result-subtitle {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.result-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.trait-badge {
  background: #F5821F;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 50px;
}

.result-analogy {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
  z-index: 1;
}
.result-analogy p {
  font-size: 14px;
  color: #444;
  line-height: 1.6;
  margin-bottom: 8px;
}
.result-analogy p:last-child { margin-bottom: 0; }

.result-bet {
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.bet-badge {
  background: #1a3d6b;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 24px;
  border-radius: 50px;
}

.result-race-section { width: 100%; margin-bottom: 8px; position: relative; z-index: 1; }
.result-race-label {
  font-size: 14px;
  color: #444;
  text-align: center;
  margin-bottom: 12px;
  line-height: 1.5;
}

.result-horses {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.horse-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: calc(33% - 8px);
  min-width: 80px;
}
.horse-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.horse-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  text-align: center;
}

/* ── Footer (matches hkjc-cny) ───────────────── */
.footer-outer {
  width: 100%;
  box-sizing: border-box;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* White section - logo and disclaimer */
.footer-section-white {
  background-color: #fff;
  padding: 32px 48px;
}

.footer-white-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* Row 1: Logo aligned right */
.footer-row-logo {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-logo-item {
  flex-shrink: 0;
}

.footer-logo-img {
  display: block;
  max-width: 200px;
  height: auto;
  border: 0;
}

.footer-company-name { display: none; }
.footer-years { display: none; }

/* Row 2: Disclaimer left, bubble right */
.footer-row-disclaimer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.footer-disclaimer-content {
  flex: 1;
  min-width: 0;
}

.footer-bubble {
  flex-shrink: 0;
}

.footer-bubble-link {
  display: block;
  text-decoration: none;
}

.footer-bubble-img {
  display: block;
  max-width: 100px;
  height: auto;
}

/* Disclaimer section */
.footer-disclaimer {
  display: block;
}

.footer-disclaimer-heading {
  display: block;
  font-size: 18px;
  font-weight: bold;
  color: #003b7c;
  margin-bottom: 16px;
  text-decoration: none;
}

.footer-disclaimer-heading:hover {
  text-decoration: underline;
}

.footer-legal-text {
  font-size: 14px;
  line-height: 1.8;
  color: #000;
}

/* Gray section - customer care */
.footer-section-gray {
  background-color: #e8e4df;
  padding: 32px 48px;
}

.footer-gray-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.customer-care-content {
  text-align: right;
}

.footer-text {
  font-size: 13px;
  line-height: 1.8;
  color: #333;
  margin: 0;
}

.footer-text span {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.footer-text a {
  color: #003b7c;
  text-decoration: underline;
}

.footer-text a:hover {
  text-decoration: none;
}

.footer-copyright {
  margin-top: 16px;
}

/* Background icons – mobile */
@media (max-width: 768px) {
  .icon          { width: 56px; }
  .icon-luggage  { width: 56px; }
  .icon-camera   { width: 56px; }
  .icon-passport { width: 56px; }
  .icon-map      { width: 56px; }
  .icon-plane    { width: 56px; }
  .icon-eiffel   { width: 56px; }
  .icon-flipflops{ width: 56px; }
}

/* Tablet: 769px – 1024px */
@media (max-width: 1024px) {
  .footer-section-white { padding: 28px 32px; }
  .footer-section-gray  { padding: 24px 32px; }
  .footer-logo-img      { max-width: 160px; }
  .footer-bubble-img    { width: 100px; }
  .footer-disclaimer-heading { font-size: 16px; margin-bottom: 12px; }
  .footer-legal-text    { font-size: 13px; }
  .footer-text          { font-size: 12px; }
}

/* Mobile: up to 768px */
@media (max-width: 768px) {
  .footer-section-white { padding: 24px 20px; }
  .footer-section-gray  { padding: 20px; }
  .footer-logo-img      { max-width: 140px; }
  .footer-bubble-img    { width: 80px; }
  .footer-disclaimer-heading { font-size: 15px; margin-bottom: 10px; }
  .footer-legal-text    { font-size: 12px; line-height: 1.7; }
  .customer-care-content { text-align: right; }
  .footer-text          { font-size: 11px; line-height: 1.7; }
}

/* Small mobile: up to 480px */
@media (max-width: 480px) {
  .footer-section-white { padding: 20px 16px; }
  .footer-section-gray  { padding: 16px; }
  .footer-logo-img      { max-width: 120px; }
  .footer-row-disclaimer { flex-direction: column; }
  .footer-bubble        { order: -1; align-self: flex-end; }
  .footer-bubble-img    { width: 70px; }
  .footer-disclaimer-heading { font-size: 14px; margin-bottom: 8px; }
  .footer-legal-text    { font-size: 11px; }
  .footer-text          { font-size: 10px; }
  .footer-text a        { word-break: break-all; }
}
