/* เปลี่ยนขนาดคอลัมน์และสีหลักได้ที่นี่ */
:root {
  color-scheme: dark;
  --page-background: #2d283e;
  --text-color: #fff;
  --content-width: 480px;
  --purple: #8727b0;
  --green: #48ad00;
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 280px;
  background: var(--page-background);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text-color);
  background: var(--page-background);
  font-family: Arial, Tahoma, sans-serif;
}

button,
a,
.carousel__viewport {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button[hidden] {
  display: none;
}

.page {
  width: min(var(--content-width), calc(100% - 32px));
  margin-inline: auto;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand {
  display: block;
  width: calc(100% + 24px);
  max-width: calc(100vw - 12px);
  height: auto;
}

.avatar {
  display: block;
  width: 48px;
  height: auto;
  margin-top: -24px;
  object-fit: contain;
}

.profile h1 {
  margin: 24px 0 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.profile__handle {
  margin: 1px 0 0;
  font-size: 13px;
  line-height: 1.2;
}

.introduction {
  margin: 18px 0 16px;
  font-family: "Courier New", Tahoma, monospace;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* แต่ละกลุ่มจัดเป็น grid หนึ่งคอลัมน์เหมือนภาพอ้างอิง */
.promotion-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.promotion {
  min-width: 0;
  --action-color: var(--purple);
}

.promotion--green {
  --action-color: var(--green);
}

.carousel {
  position: relative;
  min-width: 0;
}

/* CSS Grid แบบแนวนอน + scroll snap รองรับการปัดบนมือถือ */
.carousel__viewport {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--radius);
  cursor: grab;
}

.carousel__viewport::-webkit-scrollbar {
  display: none;
}

.carousel__viewport.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  user-select: none;
}

.carousel__slide {
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #21192f;
}

.carousel__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.carousel__dots {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin: 0 0 10px;
}

.carousel__dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.carousel__dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #615a70;
  transition: background-color 160ms ease, transform 160ms ease;
}

.carousel__dot[aria-current="true"]::before {
  background: #fff;
  transform: scale(1.08);
}

.carousel__arrow {
  position: absolute;
  top: calc((100% - 40px) / 2);
  display: grid;
  place-items: center;
  width: 38px;
  height: 44px;
  padding: 0 0 4px;
  border: 1px solid #ffffff30;
  border-radius: 10px;
  color: #fff;
  background: #160b2ab3;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 160ms ease, background-color 160ms ease;
}

.carousel__arrow--previous { left: 10px; }
.carousel__arrow--next { right: 10px; }

.carousel:hover .carousel__arrow,
.carousel:focus-within .carousel__arrow {
  opacity: 1;
}

.actions {
  display: grid;
  gap: 7px;
}

.action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 47px;
  padding: 12px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--action-color);
  font-family: "Courier New", Tahoma, monospace;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: filter 160ms ease, transform 160ms ease;
}

.action:hover { filter: brightness(1.12); }
.action:active { transform: scale(0.985); }

:where(a, button, .carousel__viewport):focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.footer {
  margin-top: 18px;
  text-align: center;
  font-family: "Courier New", Tahoma, monospace;
  font-size: 20px;
  line-height: 1.4;
}

.footer span { margin-left: 6px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.setup-dialog {
  width: min(400px, calc(100% - 40px));
  padding: 28px;
  border: 1px solid #8a739f;
  border-radius: 18px;
  color: #fff;
  background: #2d233d;
}

.setup-dialog::backdrop { background: #110c1dcc; }
.setup-dialog h2 { margin: 8px 0 12px; font-size: 22px; }
.setup-dialog p { font-size: 14px; line-height: 1.8; }
.setup-dialog__eyebrow { margin: 0; color: #d3b0ea; }
.setup-dialog__close {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--purple);
  cursor: pointer;
}

.no-script { font-size: 13px; text-align: center; }

@media (max-width: 520px) {
  .brand { width: 100%; }
  .avatar { margin-top: -16px; width: 44px; }
  .profile h1 { margin-top: 20px; }
  .introduction { font-size: 13px; line-height: 1.65; }
  .footer { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
