/* ชิ้นส่วนหน้าแรก (/all) และหน้าสถานะเซิร์ฟ — สไตล์เดียวกับ UI ในเซิร์ฟ (แผงเทา มุมมน ชมพูอ่อน)
   ทุกคลาสขึ้นต้นด้วย sm- จะได้ไม่ชนกับ style.css / portal.css */
:root {
  --sm-pink: var(--accent, #ff8fc1);
  --sm-pink-soft: rgba(var(--accent-rgb, 255, 143, 193), 0.16);
  --sm-pink-line: rgba(var(--accent-rgb, 255, 143, 193), 0.4);
  --sm-head: 'Fredoka', 'Mitr', 'IBM Plex Sans Thai', system-ui, sans-serif;
  --sm-slot: var(--surface-2, #2b2a31);
}

/* ---------- แผง (เหมือนหน้าต่างกระเป๋าในเกม) ---------- */
.sm-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  position: relative;
  box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.7);
}

.sm-phead {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0 16px;
  flex-wrap: wrap;
}

.sm-ptitle {
  font: 600 22px/1 var(--sm-head);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.sm-ptitle .sm-pic {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--sm-pink-soft);
  color: var(--sm-pink);
}

.sm-ptitle .sm-pic svg {
  width: 18px;
  height: 18px;
}

.sm-psub {
  color: var(--faint);
  font-size: 13.5px;
}

.sm-pright {
  margin-left: auto;
  color: var(--faint);
  font-size: 13px;
  font-family: var(--sm-head);
}

/* ---------- ปุ่ม ---------- */
.sm-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-content: center;
  padding: 11px 20px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font: 500 15.5px/1.2 var(--sm-head);
  text-decoration: none;
  white-space: nowrap;
  background: var(--sm-pink);
  color: var(--accent-ink, #2a1320);
  transition: transform 0.15s, filter 0.15s, background 0.15s;
}

.sm-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.sm-btn:active {
  transform: translateY(0) scale(0.98);
}

.sm-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sm-btn.sm-discord {
  background: #5865f2;
  color: #fff;
}

.sm-btn.sm-ghost {
  background: var(--sm-slot);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.sm-btn.sm-ghost:hover {
  box-shadow: inset 0 0 0 1px var(--sm-pink-line);
}

.sm-ico {
  display: inline-flex;
}

.sm-ico svg {
  width: 100%;
  height: 100%;
}

/* ---------- ส่วนหัว: โลโก้ + ผลไม้ลากเล่น ---------- */
.sm-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  margin-bottom: 14px;
  min-height: clamp(460px, 62vh, 580px);
  display: grid;
  place-items: center;
  padding: 30px 18px 76px;
  background: radial-gradient(520px 320px at 50% 30%, rgba(var(--accent-rgb), 0.13), transparent 70%), var(--surface);
  border: 1px solid var(--line);
}

.sm-toy {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
}

.sm-fruit {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
}

.sm-fruit:active {
  cursor: grabbing;
}

.sm-fruit svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.sm-hero-in {
  position: relative;
  z-index: 1;
  text-align: center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sm-hero-in>* {
  pointer-events: auto;
}

.sm-hello {
  font: 500 14.5px var(--sm-head);
  color: var(--muted);
  background: var(--sm-slot);
  border: 1px solid var(--line);
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sm-hello img,
.sm-hello .ph {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.sm-biglogo {
  width: min(500px, 84vw);
  margin-top: 6px;
  transition: transform 0.15s ease-out;
  animation: smBob 5s ease-in-out infinite;
  cursor: pointer;
}

.sm-biglogo img {
  width: 100%;
  height: auto;
  display: block;
}

@keyframes smBob {
  50% {
    translate: 0 -8px;
  }
}

.sm-tag {
  font: 500 clamp(19px, 2.6vw, 25px)/1.35 var(--sm-head);
  margin: 0;
  color: var(--text);
}

.sm-tag b {
  color: var(--sm-pink);
  font-weight: 500;
}

.sm-sub {
  color: var(--muted);
  font-size: 15px;
  max-width: 500px;
  margin: 6px auto 0;
  line-height: 1.7;
}

.sm-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.sm-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  translate: -50% 0;
  font-size: 12.5px;
  color: var(--faint);
  background: rgba(var(--bg-rgb), 0.7);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

@media (max-width: 520px) {
  .sm-hint {
    white-space: normal;
    width: calc(100% - 36px);
    text-align: center;
  }

  .sm-btn {
    padding: 10px 16px;
    font-size: 14.5px;
  }
}

/* ---------- ตัวเลขสด (เหมือนช่องสถิติบนการ์ดผู้เล่นในเกม) ---------- */
.sm-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.sm-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}

.sm-chip:hover {
  border-color: var(--sm-pink-line);
  transform: translateY(-2px);
}

.sm-chip .sm-ico {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--sm-pink-soft);
  color: var(--sm-pink);
}

.sm-chip .sm-ico svg {
  width: 21px;
  height: 21px;
}

.sm-chip b {
  display: block;
  font: 600 22px/1.15 var(--sm-head);
}

.sm-chip b small {
  font: 400 13px var(--sm-head);
  color: var(--faint);
  margin-left: 3px;
}

.sm-chip span.sm-l {
  font-size: 13px;
  color: var(--faint);
}

@media (max-width: 820px) {
  .sm-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .sm-chip {
    padding: 12px;
    gap: 10px;
  }

  .sm-chip b {
    font-size: 19px;
  }

  .sm-chip .sm-ico {
    width: 38px;
    height: 38px;
  }
}

/* ---------- แกลเลอรี = ช่องเก็บของแบบในกระเป๋า ---------- */
.sm-galwrap {
  margin-top: 14px;
}

.sm-gal {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.sm-slot {
  margin: 0;
  background: var(--sm-slot);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 7px 7px 9px;
  cursor: zoom-in;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.sm-slot:hover {
  border-color: var(--sm-pink-line);
  box-shadow: 0 0 0 3px var(--sm-pink-soft);
  transform: translateY(-2px);
}

.sm-slot img,
.sm-slot .sm-empty-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  border-radius: 10px;
  background: rgba(var(--fg-rgb), 0.04);
}

.sm-slot .sm-empty-art {
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 13px;
}

.sm-slot .sm-empty-art svg {
  width: 44px;
  height: 44px;
  opacity: 0.55;
}

.sm-slot figcaption {
  font-size: 13px;
  color: var(--muted);
  padding: 7px 3px 0;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-slot.sm-blank {
  cursor: default;
}

.sm-slot.sm-blank:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

@media (max-width: 600px) {
  .sm-gal {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

/* ดูรูปเต็มจอ */
.sm-lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 14, 18, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sm-lb.open {
  display: flex;
  animation: smFade 0.2s;
}

@keyframes smFade {
  from {
    opacity: 0;
  }
}

.sm-lb img {
  max-width: min(1200px, 100%);
  max-height: 82vh;
  border-radius: 16px;
  border: 1px solid #34333b;
  animation: smPop 0.25s ease-out;
}

@keyframes smPop {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
}

.sm-lb .sm-lbcap {
  position: absolute;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--sm-head);
  color: #d9d4e0;
}

.sm-lb button {
  position: absolute;
  background: #2b2a31;
  border: 1px solid #424049;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.sm-lb button:hover {
  border-color: #ff8fc1;
  color: #ff8fc1;
}

.sm-lb button svg {
  width: 22px;
  height: 22px;
}

.sm-lb .sm-x {
  top: 18px;
  right: 18px;
}

.sm-lb .sm-prev {
  left: 18px;
  top: 50%;
  translate: 0 -50%;
}

.sm-lb .sm-next {
  right: 18px;
  top: 50%;
  translate: 0 -50%;
}

.sm-confetti {
  position: fixed;
  pointer-events: none;
  z-index: 2000;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

/* ---------- หน้าสถานะเซิร์ฟ ---------- */
.sm-st-hero {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
}

.sm-ringbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
}

.sm-ring {
  width: 230px;
  height: 230px;
  position: relative;
}

.sm-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.sm-ring-track {
  stroke: var(--sm-slot);
}

.sm-ring-bar {
  stroke: var(--sm-pink);
  transition: stroke-dashoffset 1s cubic-bezier(.3, 1, .4, 1);
}

.sm-ring-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
}

.sm-ring-num {
  font: 600 60px/1 var(--sm-head);
}

.sm-ring-of {
  color: var(--faint);
  font-size: 14px;
  margin-top: 6px;
}

.sm-cup {
  position: absolute;
  width: 52px;
  left: 50%;
  translate: -50% 0;
  top: -12px;
  animation: smBob 3s ease-in-out infinite;
  cursor: pointer;
}

.sm-st-name {
  font: 500 18px var(--sm-head);
  margin-top: 12px;
  word-break: break-word;
}

.sm-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  font: 500 14px var(--sm-head);
  background: var(--ok-soft);
  color: var(--ok);
}

.sm-badge.off {
  background: var(--danger-soft);
  color: var(--danger);
}

.sm-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: smPulse 1.8s infinite;
  flex-shrink: 0;
}

.sm-badge.off .sm-dot {
  animation: none;
}

@keyframes smPulse {
  70% {
    box-shadow: 0 0 0 7px transparent;
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.sm-st-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 16px;
}

.sm-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.sm-tile {
  background: var(--sm-slot);
  border-radius: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
}

.sm-tile .sm-k {
  font-size: 12.5px;
  color: var(--faint);
  display: flex;
  gap: 6px;
  align-items: center;
}

.sm-tile .sm-k .sm-ico {
  width: 15px;
  height: 15px;
  color: var(--sm-pink);
}

.sm-tile .sm-v {
  font: 600 23px/1.2 var(--sm-head);
  margin-top: 6px;
}

.sm-tile .sm-v small {
  font: 400 13px var(--sm-head);
  color: var(--faint);
  margin-left: 3px;
}

.sm-seg {
  display: inline-flex;
  background: var(--sm-slot);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}

.sm-seg button {
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 13px var(--sm-head);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.sm-seg button.on {
  background: var(--sm-pink-soft);
  color: var(--sm-pink);
  box-shadow: inset 0 0 0 1px var(--sm-pink-line);
}

.sm-chart {
  position: relative;
  height: 230px;
}

.sm-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.sm-chart .sm-gl {
  stroke: var(--line);
}

.sm-chart .sm-lbl {
  fill: var(--faint);
  font-size: 11px;
}

.sm-tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  padding: 5px 10px;
  border-radius: 10px;
  font: 500 13px var(--sm-head);
  white-space: nowrap;
  transform: translate(-50%, -125%);
  display: none;
}

.sm-chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  text-align: center;
  padding: 0 20px;
}

.sm-st-foot {
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  margin-top: 14px;
}

@media (max-width: 960px) {
  .sm-st-hero {
    grid-template-columns: 1fr;
  }

  .sm-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .sm-ring {
    width: 200px;
    height: 200px;
  }

  .sm-ring-num {
    font-size: 50px;
  }

  .sm-panel {
    padding: 16px;
  }

  .sm-tile .sm-v {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .sm-hero *,
  .sm-panel * {
    animation: none !important;
    transition: none !important;
  }
}