/* ============================================================
   MTTHAI เซียมซีไม่โอ๋
   Theme: มืด เข้ม จริงจัง ไม่โอ๋ — ม่วงเข้ม + เทา + สีแฉะๆ
   ============================================================ */

.mtthai-rls, .mtthai-rls * { box-sizing: border-box; }

.mtthai-rls {
    --rls-font: "Itim", "Noto Sans Thai", "Tahoma", sans-serif;

    /* Base palette — bright pink-purple "ไม่โอ๋แต่สวย" */
    --tp:     #d946a8;   /* hot pink-purple primary */
    --td:     #a21880;   /* dark */
    --tl:     #fff0fa;   /* light tint */
    --tb:     #f0b8e0;   /* border */
    --tring:  #f0b8e0;
    --tbar:   linear-gradient(90deg, #f472d0, #a855f7);
    --tcup:   linear-gradient(150deg, #ec4899 0%, #a855f7 100%);
    --tcard:  linear-gradient(135deg, #fff0fa, #f5d0fe);
    --tchip:  #fce7f8;
    --tchipc: #a21880;
    --shadow: 0 20px 44px rgba(168,24,128,.13);

    --cream:  #fdf4ff;
    --text:   #3b0764;
    --muted:  #9333a0;
    --card:   #ffffff;
    --surface:#fdf4ff;

    font-family: var(--rls-font);
    color: var(--text);
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
    padding: 0 16px 48px;
    line-height: 1.55;
    isolation: isolate;
    background: transparent;
}

/* ── Bright bg for the whole widget ── */
.mtthai-rls { background: #fdf4ff; border-radius: 28px; border: 1.5px solid #f0b8e0; }

/* Per-type overrides */
.mtthai-rls[data-active-type="mt"] {
    --tp: #d946a8; --td: #a21880; --tl: #fff0fa; --tb: #f0b8e0;
    --tring: #f0b8e0; --tbar: linear-gradient(90deg, #f472d0, #a855f7);
    --tcup: linear-gradient(150deg, #ec4899 0%, #a855f7 100%);
    --tcard: linear-gradient(135deg, #fff0fa, #f5d0fe);
    --tchip: #fce7f8; --tchipc: #a21880;
    --shadow: 0 20px 44px rgba(168,24,128,.14);
}
.mtthai-rls[data-active-type="sales"] {
    --tp: #7c3aed; --td: #5b21b6; --tl: #f5f0ff; --tb: #d8b4fe;
    --tring: #d8b4fe; --tbar: linear-gradient(90deg, #a78bfa, #7c3aed);
    --tcup: linear-gradient(150deg, #8b5cf6 0%, #4c1d95 100%);
    --tcard: linear-gradient(135deg, #f5f0ff, #ede9fe);
    --tchip: #f0ebff; --tchipc: #5b21b6;
    --shadow: 0 20px 44px rgba(124,58,237,.14);
}
.mtthai-rls[data-active-type="specialist"] {
    --tp: #db2777; --td: #9d174d; --tl: #fff1f8; --tb: #fbcfe8;
    --tring: #fbcfe8; --tbar: linear-gradient(90deg, #f472b6, #db2777);
    --tcup: linear-gradient(150deg, #ec4899 0%, #be185d 100%);
    --tcard: linear-gradient(135deg, #fff1f8, #fce7f3);
    --tchip: #fce7f3; --tchipc: #9d174d;
    --shadow: 0 20px 44px rgba(219,39,119,.14);
}

.mtthai-rls :where(h1,h2,h3,p,blockquote) { overflow-wrap: break-word; }
.mtthai-rls button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; font-family: inherit; }

/* ══════════════════════════════════
   STEP 1 — SELECTOR
══════════════════════════════════ */
.rls-selector {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 0 0;
}

.rls-selector-inner {
    position: relative;
    overflow: hidden;
    border: 1.5px solid #f0b8e0;
    border-radius: 26px;
    padding: clamp(28px, 5vw, 48px);
    background: #fff;
    box-shadow: 0 0 0 1px #fce7f8 inset, 0 24px 48px rgba(168,24,128,.10);
    animation: rlsFadeUp .4s ease;
}

/* Scanline texture overlay */
.rls-selector-inner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(236,72,153,.04) 3px,
        rgba(236,72,153,.04) 4px
    );
    pointer-events: none;
    z-index: 0;
}

.rls-selector-header {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 32px;
}

.rls-header-badge {
    display: inline-block;
    padding: 5px 16px;
    border-radius: 20px;
    border: 1.5px solid #f472d0;
    color: #a21880;
    font-weight: 900;
    font-size: 12px;
    letter-spacing: .08em;
    margin-bottom: 16px;
    background: rgba(236,72,153,.10);
}

.rls-title {
    margin: 0;
    font-size: clamp(40px, 8vw, 64px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.04em;
    color: #a21880;
    text-shadow: 0 0 30px rgba(236,72,153,.25);
}
.rls-title span {
    display: block;
    font-size: clamp(52px, 10vw, 80px);
    color: #7c3aed;
    text-shadow: 0 4px 16px rgba(124,58,237,.18);
}

.rls-sub {
    margin: 12px 0 0;
    font-size: clamp(15px, 2.2vw, 18px);
    color: #9333a0;
    font-weight: 600;
}

/* Job cards */
.rls-job-cards {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rls-job-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    border-radius: 16px;
    border: 1.5px solid #f0b8e0;
    background: #fdf4ff;
    cursor: pointer;
    text-align: left;
    transition: transform .22s, box-shadow .22s, border-color .22s, background .22s;
    color: var(--text);
}

.rls-jmt  { --cp: #c026d3; }
.rls-jsales { --cp: #3b82f6; }
.rls-jspec  { --cp: #22c55e; }

.rls-job-card:hover {
    border-color: var(--cp);
    background: rgba(255,255,255,.08);
    transform: translateY(-3px);
    box-shadow: 0 0 20px color-mix(in srgb, var(--cp) 30%, transparent);
}

.rls-job-icon-wrap {
    width: 58px; height: 58px; flex: 0 0 58px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--cp) 20%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--cp) 50%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    transition: transform .2s;
}
.rls-job-card:hover .rls-job-icon-wrap { transform: scale(1.08) rotate(-4deg); }

.rls-job-info { flex: 1; }
.rls-job-info strong {
    display: block;
    font-size: clamp(16px, 2.2vw, 19px);
    font-weight: 900;
    color: var(--cp);
    line-height: 1.2;
}
.rls-job-info span { font-size: 13px; color: var(--muted); font-weight: 600; }

.rls-job-arr {
    font-size: 20px; font-weight: 900;
    color: var(--cp);
    opacity: 0; transform: translateX(-6px);
    transition: opacity .2s, transform .2s;
}
.rls-job-card:hover .rls-job-arr { opacity: 1; transform: translateX(0); }

.rls-selector-footer {
    position: relative; z-index: 1;
    text-align: center;
    margin: 24px 0 0;
    color: #c084a0;
    font-size: 13px;
    font-weight: 700;
}

/* ══════════════════════════════════
   STEP 2 — GAME
══════════════════════════════════ */
.rls-game {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: rlsFadeUp .38s ease;
}

.rls-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 18px;
    background: #fff;
    border: 1px solid var(--tb);
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(168,24,128,.08);
    transition: border-color .4s;
}

.rls-back-btn, .rls-snd-btn {
    border: 1.5px solid var(--tb);
    border-radius: 10px;
    background: transparent;
    color: var(--tp);
    cursor: pointer;
    font-weight: 700;
    transition: all .15s;
}
.rls-back-btn { padding: 8px 14px; font-size: 13px; color: #9333a0; }
.rls-back-btn:hover { color: var(--tp); border-color: var(--tp); transform: translateX(-2px); }
.rls-snd-btn { padding: 7px 11px; font-size: 17px; }
.rls-snd-btn:hover { border-color: var(--tp); transform: scale(1.1); }
.rls-snd-btn.muted { opacity: .45; }

.rls-type-lbl {
    display: flex; align-items: center; gap: 8px;
    font-weight: 900; font-size: clamp(15px, 2.2vw, 19px);
    color: var(--tp);
    transition: color .4s;
}
.rls-type-icon { font-size: 22px; }

/* Game body */
.rls-game-body {
    display: grid;
    grid-template-columns: minmax(200px, .85fr) 1fr .75fr;
    gap: 22px;
    padding: clamp(18px, 3vw, 30px);
    background: #fff;
    border: 1px solid var(--tb);
    border-radius: 22px;
    box-shadow: var(--shadow);
    align-items: start;
    transition: border-color .4s, box-shadow .4s;
}

/* ── Cup visual ── */
.rls-visual {
    position: relative;
    min-height: 220px;
    display: flex; align-items: center; justify-content: center;
}

.rls-cup {
    position: relative;
    width: min(200px, 68vw);
    height: 148px;
    border-radius: 18px 18px 44px 44px;
    background: var(--tcup);
    box-shadow:
        0 16px 32px rgba(0,0,0,.5),
        inset 0 1px 0 rgba(255,255,255,.12),
        0 0 0 1px rgba(255,255,255,.06);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background .5s;
    overflow: visible;
}

/* Crack lines on cup */
.rls-cup::before,
.rls-cup::after {
    content: '';
    position: absolute;
    background: rgba(255,255,255,.18);
}
.rls-cup::before {
    width: 2px; height: 36px;
    top: 24px; left: 40%;
    transform: rotate(12deg);
    border-radius: 2px;
}
.rls-cup::after {
    width: 1.5px; height: 22px;
    top: 36px; left: calc(40% + 8px);
    transform: rotate(-8deg);
    border-radius: 2px;
}

.rls-cup-label {
    font-size: clamp(18px, 3vw, 22px);
    font-weight: 900;
    letter-spacing: -.02em;
}
.rls-cup-sub {
    font-size: 14px;
    font-weight: 700;
    opacity: .75;
    margin-top: 2px;
}

.rls-sticks {
    position: absolute;
    left: 26px; right: 26px;
    top: -72px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 5px;
}
.rls-sticks span {
    width: 30px; height: 100px;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12px;
    border: 1.5px solid rgba(255,255,255,.2);
    border-radius: 12px 12px 6px 6px;
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0,0,0,.3);
    font-size: 14px;
    transform-origin: bottom center;
}
.rls-sticks span:nth-child(1) { transform: rotate(-13deg); }
.rls-sticks span:nth-child(2) { transform: rotate(-6deg); }
.rls-sticks span:nth-child(4) { transform: rotate(7deg); }
.rls-sticks span:nth-child(5) { transform: rotate(14deg); }

.rls-crack-l { position: absolute; left: 4%; bottom: 14%; font-size: 32px; opacity: .6; }
.rls-crack-r { position: absolute; right: 4%; top: 16%; font-size: 28px; opacity: .6; }

/* ── Controls ── */
.rls-controls { display: flex; flex-direction: column; gap: 16px; }

.rls-ctrl-title {
    font-size: clamp(18px, 2.2vw, 23px);
    font-weight: 900;
    color: var(--tp);
    line-height: 1.2;
    transition: color .4s;
}
.rls-ctrl-sub { font-size: 14px; color: var(--muted); font-weight: 600; margin-top: 4px; }

.rls-draw-btn {
    width: 100%;
    min-height: 54px;
    border: 0;
    border-radius: 14px;
    background: var(--tp);
    color: #fff;
    font-size: clamp(16px, 2vw, 19px);
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.08) inset;
    transition: transform .18s, opacity .18s, background .45s;
}
.rls-draw-btn:hover { transform: translateY(-2px); opacity: .9; }
.rls-draw-btn:active { transform: translateY(0); }
.rls-draw-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.rls-note-box {
    display: flex; gap: 9px;
    padding: 12px;
    border-radius: 12px;
    background: #fce7f8;
    border: 1px solid var(--tb);
    font-size: 13px; font-weight: 600;
    color: #9333a0;
    transition: border-color .4s;
}
.rls-note-box p { margin: 0; line-height: 1.5; }

/* ── Timer ── */
.rls-timer-zone {
    text-align: center;
    padding: 0 12px;
    border-left: 1px solid var(--tb);
    transition: border-color .4s;
}

.rls-status {
    margin: 0 0 16px;
    font-size: clamp(15px, 1.8vw, 19px);
    font-weight: 900;
    color: var(--tp);
    line-height: 1.3;
    transition: color .4s;
}

.rls-ring {
    --rprog: 0deg;
    width: clamp(120px, 14vw, 148px);
    height: clamp(120px, 14vw, 148px);
    margin: 0 auto;
    display: grid; place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--tp) var(--rprog), var(--tring) 0deg);
    transition: background .3s;
}
.rls-ring-inner {
    width: 76%; height: 76%;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 4px 12px rgba(168,24,128,.08);
}
.rls-count {
    font-size: clamp(40px, 5.5vw, 48px);
    line-height: .9;
    color: var(--tp);
    font-weight: 900;
    transition: color .4s;
}
.rls-count-lbl { color: var(--muted); font-weight: 700; font-size: 13px; }

.rls-bar-track {
    height: 9px; margin-top: 16px;
    overflow: hidden; border-radius: 999px;
    background: rgba(255,255,255,.08);
    transition: background .4s;
}
.rls-bar-fill {
    display: block; width: 0%; height: 100%;
    border-radius: 999px;
    background: var(--tbar);
    transition: width .3s, background .4s;
}
.rls-wait-txt { margin-top: 8px; color: var(--muted); font-weight: 700; font-size: 12px; }

/* ── Result ── */
.rls-result-area { padding: 0 4px; }

.rls-result-card {
    border-radius: 22px;
    padding: clamp(18px, 3vw, 24px);
    background: var(--tcard);
    border: 1px solid var(--tb);
    box-shadow: var(--shadow);
    transition: background .5s, border-color .4s;
}

.rls-result-badge {
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--tp);
    color: #fff;
    font-weight: 900;
    font-size: 12px;
    transition: background .4s;
}

.rls-fortune-txt {
    margin: 14px 0 0;
    min-height: 100px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--tb);
    border-radius: 16px;
    background: rgba(255,255,255,.9);
    padding: clamp(14px, 2.5vw, 20px);
    text-align: center;
    font-size: clamp(17px, 2.2vw, 22px);
    line-height: 1.6;
    font-weight: 900;
    color: #3b0764;
    transition: border-color .4s;
}

.rls-disclaimer {
    margin-top: 12px;
    border-radius: 12px;
    background: #fce7f8;
    border: 1px solid #f0b8e0;
    padding: 10px 12px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    line-height: 1.5;
}

/* ── Chips ── */
.rls-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 0 4px;
}
.rls-chips span {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--tchip);
    color: var(--tchipc);
    font-weight: 800;
    font-size: 13px;
    border: 1px solid var(--tb);
    transition: all .4s;
}

/* ══════════════════════════════════
   ANIMATIONS
══════════════════════════════════ */
@keyframes rlsFadeUp {
    from { opacity:0; transform:translateY(14px); }
    to   { opacity:1; transform:translateY(0); }
}
@keyframes rlsShake {
    0%,100% { transform:rotate(0) translateY(0); }
    20% { transform:rotate(-4deg) translateY(-4px); }
    40% { transform:rotate(4deg) translateY(3px); }
    60% { transform:rotate(-3deg) translateY(-3px); }
    80% { transform:rotate(3deg) translateY(2px); }
}
@keyframes rlsPop {
    0%   { opacity:0; transform:scale(.85) translateY(14px); }
    100% { opacity:1; transform:scale(1)   translateY(0); }
}
@keyframes rlsGlitch {
    0%  { text-shadow: 2px 0 #e879f9, -2px 0 #60a5fa; }
    20% { text-shadow: -2px 0 #e879f9, 2px 0 #60a5fa; }
    40% { text-shadow: 2px 2px #e879f9, -2px -2px #60a5fa; }
    60% { text-shadow: -1px 0 #e879f9, 1px 0 #60a5fa; }
    100%{ text-shadow: none; }
}

.rls-is-shaking .rls-cup { animation: rlsShake .6s linear infinite; }
.rls-pop-anim { animation: rlsPop .44s cubic-bezier(.34,1.56,.64,1); }
.rls-glitch   { animation: rlsGlitch .4s steps(1) 3; }

/* Entrance stagger */
.rls-selector-inner { animation: rlsFadeUp .4s ease; }
.rls-job-card { animation: rlsFadeUp .4s ease both; }
.rls-job-card:nth-child(1) { animation-delay: .05s; }
.rls-job-card:nth-child(2) { animation-delay: .12s; }
.rls-job-card:nth-child(3) { animation-delay: .19s; }

/* ══════════════════════════════════
   RESPONSIVE
══════════════════════════════════ */
@media (max-width: 860px) {
    .rls-game-body { grid-template-columns: 1fr; }
    .rls-visual { min-height: 180px; order: -1; }
    .rls-timer-zone { border-left:0; border-top:1px solid var(--tb); padding:18px 0 0; }
}

@media (max-width: 580px) {
    .mtthai-rls { padding: 0 8px 32px; border-radius: 20px; }
    .rls-selector-inner { padding: 22px 16px; border-radius: 20px; }
    .rls-title { font-size: 34px; }
    .rls-title span { font-size: 46px; }
    .rls-job-card { padding: 14px 16px; gap: 12px; }
    .rls-job-icon-wrap { width: 48px; height: 48px; flex-basis: 48px; border-radius: 12px; }
    .rls-cup { width: min(180px, 70vw); height: 128px; }
    .rls-sticks { top: -60px; left: 20px; right: 20px; }
    .rls-sticks span { width: 26px; height: 84px; }
    .rls-game-body { padding: 16px; border-radius: 18px; }
    .rls-ring { width: 130px; height: 130px; }
    .rls-count { font-size: 40px; }
    .rls-draw-btn { min-height: 50px; font-size: 16px; }
    .rls-fortune-txt { font-size: 16px; min-height: 80px; }
    .rls-crack-l, .rls-crack-r { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .rls-is-shaking .rls-cup,
    .rls-pop-anim,
    .rls-glitch,
    .rls-selector-inner,
    .rls-job-card,
    .rls-game { animation: none; }
    .rls-draw-btn, .rls-bar-fill { transition: none; }
}

/* ── Live user counter ── */
.rls-live-users {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 16px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1.5px solid #f0b8e0;
    background: linear-gradient(135deg, #fff7fc, #fce7f8);
    color: #a21880;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(168,24,128,.10);
    transition: transform .25s ease, box-shadow .25s ease;
}
.rls-live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,.48);
    animation: rlsLiveDot 1.7s infinite;
    flex: 0 0 9px;
}
.rls-live-label,
.rls-live-unit { font-size: 13px; }
.rls-live-count {
    min-width: 2ch;
    padding: 1px 7px;
    border-radius: 999px;
    background: #a21880;
    color: #fff;
    font-size: 16px;
    line-height: 1.35;
}
.rls-live-users-mini {
    margin-top: 0;
    padding: 7px 10px;
    box-shadow: none;
    white-space: nowrap;
}
.rls-live-users-mini .rls-live-label,
.rls-live-users-mini .rls-live-unit { font-size: 12px; }
.rls-live-users-mini .rls-live-count { font-size: 14px; }
.rls-live-pulse { transform: scale(1.035); box-shadow: 0 10px 24px rgba(168,24,128,.16); }

@keyframes rlsLiveDot {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.48); }
    70%  { box-shadow: 0 0 0 9px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

@media (max-width: 700px) {
    .rls-game-header { flex-wrap: wrap; justify-content: center; }
    .rls-live-users-mini { order: 3; width: 100%; }
}

@media (max-width: 420px) {
    .rls-live-users { flex-wrap: wrap; border-radius: 18px; }
    .rls-live-users-mini { white-space: normal; }
}
