*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: light;
  --ink: #514d55;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  min-width: 280px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: #f5dbb0 url("img/bg.png") center top / 100% auto repeat-y;
  font-family: Arial, Helvetica, "Segoe UI", sans-serif;
  line-height: 1.55;
}

/* ===== Decorative background icons ===== */
.background-decorations {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-ic {
  position: absolute;
  z-index: 0;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* Match the reference's edge decorations, including each asset's transparent margins. */
.bg-ic-arrows-top-left     { width: 13%;   max-width: 270px; left: -3%;   top: 6%; }
.bg-ic-nails-top           { width: 12%;   max-width: 240px; left: 32.5%; top: -6%; transform: rotate(20deg); }
.bg-ic-hammer-top          { width: 10.8%; max-width: 220px; left: 67%;   top: -5.5%; }
.bg-ic-hammer-left         { width: 10.8%; max-width: 220px; left: .8%;   top: 47.5%; transform: scaleX(-1); }
.bg-ic-toolbox-right       { width: 12%;   max-width: 245px; right: -4.3%; top: 21.5%; }
.bg-ic-nails-right         { width: 9%;    max-width: 185px; right: -1.8%; top: 59.5%; }
.bg-ic-toolbox-bottom-left { width: 12%;   max-width: 245px; left: 4%;    bottom: -5%; }
.bg-ic-hammer-bottom       { width: 10.8%; max-width: 220px; left: 40.2%; bottom: -4%; }
.bg-ic-nails-bottom        { width: 12%;   max-width: 240px; left: 65%;   bottom: -3.5%; transform: rotate(-65deg); }

/* ===== Page layout ===== */
.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 1.8vw, 44px);
  width: 87.5%;
  max-width: 1920px;
  margin: 0 auto;
  padding: clamp(20px, 1.5vw, 36px) clamp(28px, 3vw, 70px) clamp(80px, 6vw, 140px) 0;
}

.col-left,
.col-right { min-width: 0; }

/* ===== Left column — Game Poster ===== */
.ad-wrap {
  position: relative;
  width: 100%;
  transform: rotate(-2deg);
  transform-origin: center center;
}
.img-ad { display: block; width: 100%; height: auto; }

.btn-wrap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 7.5%;
  width: 68%;
  border-radius: 50px;
  transition: transform .18s ease, filter .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-img { display: block; width: 100%; height: auto; }
.btn-wrap:active { transform: translateX(-50%) scale(.98); }
.btn-wrap:focus-visible { outline: 3px solid #c47a1a; outline-offset: 4px; }

/* ===== Right column ===== */
.col-right {
  display: flex;
  flex-direction: column;
  padding-top: clamp(20px, 1.8vw, 44px);
}

/* ===== Card base ===== */
.card {
  position: relative;
  width: 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* ===== Contact Support Card (bg_mian_01.png: 949 × 632) ===== */
.card-contact {
  container-type: inline-size;
  aspect-ratio: 949 / 632;
  background-image: url("img/bg_mian_01.png");
}

.card-header {
  display: flex;
  align-items: center;
  gap: 3%;
}
.contact-header {
  /* Position content inside the frame, accounting for transparent artwork margins. */
  position: absolute;
  top: 25%;
  left: 10%;
  right: 16%;
  align-items: flex-start;
  gap: 1cqw;
}
.contact-header .card-icon {
  width: 17.28cqw;
  max-width: none;
  flex: 0 0 17.28cqw;
}
.card-icon {
  display: block;
  width: 14%;
  max-width: 84px;
  height: auto;
  flex: 0 0 14%;
}
.contact-heading {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 4cqw;
}
.card-title {
  font-size: clamp(18px, 1.65vw, 36px);
  font-weight: 800;
  line-height: 1.2;
}
.card-contact .contact-title {
  color: #126b16;
  font-size: clamp(14px, 5.4cqw, 51.25px);
  font-weight: 900;
  white-space: nowrap;
}

.contact-swoosh {
  display: block;
  width: 48.5cqw;
  height: auto;
  margin-top: 1.2cqw;
}
.contact-email {
  position: absolute;
  top: 51.8%;
  left: 10%;
  right: 11%;
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #454545;
  font-size: clamp(12px, 3.4cqw, 32px);
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.contact-email:focus-visible {
  outline: 2px solid #126b16;
  outline-offset: 4px;
  border-radius: 2px;
}
.divider-line {
  position: absolute;
  top: 60.4%;
  left: 25.3%;
  display: block;
  width: 48.5%;
  height: auto;
}
.contact-sub {
  position: absolute;
  top: 67.5%;
  left: 10%;
  right: 11%;
  color: #454545;
  font-size: clamp(10px, 2.63cqw, 25px);
  line-height: 1.45;
  text-align: center;
}

/* ===== Privacy Policy Card (bg_mian_02.png: 936 × 647) ===== */
.card-privacy {
  /* Compensate for the two frame images' different transparent side margins. */
  width: 100.5%;
  margin-left: 3.9%;
  margin-top: -4%;
  background-image: url("img/bg_mian_02.png");
}

/* Intrinsic aspect ratio via ::before — 647 / 936 = 69.12% */
.card-privacy::before {
  content: "";
  display: block;
  padding-top: 69.12%;
}

.privacy-header {
  position: absolute;
  top: 11%;
  left: 10%;
  right: 10%;
  display: flex;
  align-items: center;
  gap: 3%;
}
.privacy-title { color: #7b2fc0; }

.privacy-swoosh {
  position: absolute;
  top: 25%;
  left: 10%;
  width: 50%;
  height: auto;
}

.text-wrapper {
  position: absolute;
  top: 32%;
  left: 10%;
  right: 12%;
  bottom: 11%;
  min-height: 0;
}

.privacy-body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: #a87ac5 transparent;
  color: #55505a;
  font-size: clamp(14px, 1.1vw, 23px);
  line-height: 1.65;
  overflow-wrap: break-word;
}
.privacy-body:focus-visible {
  outline: 2px solid #7b2fc0;
  outline-offset: 5px;
  border-radius: 3px;
}
.privacy-body::-webkit-scrollbar        { width: 6px; }
.privacy-body::-webkit-scrollbar-track  { background: transparent; }
.privacy-body::-webkit-scrollbar-thumb  { border-radius: 999px; background: #a87ac5; }
.privacy-body p           { margin-bottom: .6em; }
.privacy-body strong      { color: #3f3a43; }
.privacy-body ul          { margin: .2em 0 .7em 1.2em; }
.privacy-body li          { margin-bottom: .2em; }
.privacy-body a           { color: #7b2fc0; }
.pp-title {
  margin: .9em 0 .3em;
  color: #7b2fc0;
  font-size: 1.05em;
  font-weight: 700;
}

.ic-bonus {
  position: absolute;
  z-index: 2;
  right: -20%;
  bottom: -24%;
  width: 36%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

/* ===== Hover states ===== */
@media (hover: hover) and (pointer: fine) {
  .btn-wrap:hover {
    transform: translateX(-50%) translateY(-3px) scale(1.015);
    filter: brightness(1.06);
  }
  .contact-email:hover { color: #1e7a2e; text-decoration: underline; }
  .privacy-body a:hover { text-decoration: underline; }
}

/* =========================================================
   DESKTOP — single-screen, no page scroll (≥1001px)
   ========================================================= */
@media (min-width: 1001px) {
  html, body {
    height: 100%;
    overflow: hidden;
  }

  body {
    --pad-t: clamp(10px, 1.5vh, 20px);
    --pad-b: clamp(40px, 5vh, 64px);
    --pad-x: clamp(80px, 7vw, 136px);
    --gap:   clamp(24px, 2.6vw, 52px);
    /* Fit poster + both cards in one viewport.
       Divisor 1.42 = poster-aspect(0.6713) + right-col-ratio(0.75) ≈ 1.421 */
    --fit-h: min(
      calc(100vh  - var(--pad-t) - var(--pad-b)),
      calc((100vw - var(--pad-x) - var(--gap) - 16px) / 1.42)
    );
    --fit-h: min(
      calc(100dvh - var(--pad-t) - var(--pad-b)),
      calc((100vw - var(--pad-x) - var(--gap) - 16px) / 1.42)
    );
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
  }

  .page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    gap: var(--gap);
    padding: var(--pad-t) calc(var(--pad-x) / 2) var(--pad-b);
    overflow: hidden;
  }

  /* ad.png: 766 × 1141 → aspect = 0.6713 */
  .col-left {
    flex: 0 0 auto;
    width: calc(var(--fit-h) * 0.6713);
    height: var(--fit-h);
  }
  .ad-wrap,
  .img-ad { width: 100%; height: 100%; }
  .img-ad { object-fit: contain; }

  .col-right {
    flex: 0 0 auto;
    width: calc(var(--fit-h) * 0.75);
    height: auto;
    min-height: 0;
    padding-top: 0;
  }

  /* Scale font sizes relative to viewport on wide screens */
  .card-title    { font-size: clamp(14px, 1.5vw, 32px); }
  .card-icon     { max-width: 72px; }

  .privacy-body {
    font-size: clamp(12px, 0.95vw, 21px);
    line-height: 1.5;
  }

  .ic-bonus {
    right:  -13%;
    bottom: -20%;
    width:   30%;
  }
}

/* =========================================================
   MOBILE — stacked single column (≤1000px)
   ========================================================= */
@media (max-width: 1000px) {
  body { background-size: auto 1000px; }

  .page {
    grid-template-columns: minmax(0, 1fr);
    width: calc(100% - 40px);
    max-width: 640px;
    gap: 8px;
    padding: 24px 0 100px;
  }

  .col-left  { width: 100%; max-width: 560px; margin: 0 auto; }
  .col-right { padding-top: 0; }

  /* Dim decorations on narrow screens */
  .bg-ic { opacity: .5; }
  .bg-ic-arrows-top-left     { width: 110px; left: -40px; top: 90px; }
  .bg-ic-nails-top           { width: 110px; left: 44%; top: -40px; }
  .bg-ic-hammer-top          { width: 100px; left: 65%; top: -30px; }
  .bg-ic-hammer-left         { width: 100px; left: -20px; top: 35%; }
  .bg-ic-toolbox-right       { width: 110px; right: -30px; top: 48%; }
  .bg-ic-nails-right         { width: 100px; right: -30px; top: 73%; }
  .bg-ic-toolbox-bottom-left { width: 110px; left: -20px; bottom: -30px; }
  .bg-ic-hammer-bottom       { width: 100px; left: 30%; bottom: -30px; }
  .bg-ic-nails-bottom        { width: 110px; left: 65%; bottom: -25px; }

  .card-title    { font-size: clamp(18px, 4.5vw, 28px); }

  /* Privacy card: use border-image so the frame artwork doesn't stretch
     when the card is taller than its natural aspect ratio.
     Slice values are tuned to bg_mian_02.png (936 × 647):
       top~110px, right~45px, bottom~45px, left~70px (wavy teeth edge) */
  .card-privacy {
    min-height: 560px;
    margin-top: 8px;
    background-image: none;
    border: 0 solid transparent;
    border-image-source: url("img/bg_mian_02.png");
    border-image-slice: 110 45 45 70 fill;
    border-image-width:
      clamp(44px, 14vw, 100px)
      clamp(16px, 5vw,  32px)
      clamp(16px, 5vw,  32px)
      clamp(25px, 7.5vw,56px);
    border-image-repeat: stretch;
  }

  /* Switch absolutely-positioned children from % to px-clamp so they
     stay correct when the card is taller than its native ratio. */
  .privacy-header {
    top:  clamp(58px,  16.5vw, 108px);
    left: clamp(22px,  7vw,     50px);
    right: 8%;
  }
  .privacy-swoosh {
    top:  clamp(112px, 30vw,   185px);
    left: clamp(22px,  7vw,     50px);
  }
  .text-wrapper {
    top:    clamp(136px, 36vw,   215px);
    left:   clamp(22px,  7vw,    50px);
    right:  8%;
    bottom: 130px;
  }
  .privacy-body { font-size: 15px; line-height: 1.7; }
  .ic-bonus {
    width:  clamp(120px, 28vw, 170px);
    right:  -6%;
    bottom: -55px;
  }
}

/* =========================================================
   SMALL PHONES (≤480px)
   ========================================================= */
@media (max-width: 480px) {
  .page {
    width: calc(100% - 24px);
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(88px, env(safe-area-inset-bottom));
  }
  .card-icon     { width: 44px; flex-basis: 44px; max-width: 44px; }
  .card-title    { font-size: 19px; }
  .card-privacy  { min-height: 520px; }
  .text-wrapper  { right: 7%; bottom: 108px; }
  .privacy-body  { font-size: 14px; padding-right: 6px; }
}

/* =========================================================
   FALLBACK: browsers without aspect-ratio support
   ========================================================= */
@supports not (aspect-ratio: 1 / 1) {
  .card-contact::before {
    content: "";
    display: block;
    padding-top: 66.6%;
  }
}

/* =========================================================
   ACCESSIBILITY: reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
