/* CrypMine — ระบบขุดคริปโตแบบเลือกพัดลม (ต้นแบบ)
   ธีม 3D โทนม่วงฟ้า: อวกาศสีครามเข้ม พื้นตารางมุมมอง 3D การ์ดกระจกที่เอียงตามเมาส์
   ปุ่มนูนกดยุบได้ และการ์ดจอวางบนแท่นเรืองแสงในมุมมอง 3D */

:root {
  color-scheme: dark;
  --bg: #0A0A0B;
  --bg-2: #120C33;
  --surface: rgba(255, 255, 255, .05);
  --surface-2: rgba(255, 255, 255, .08);
  --surface-base: rgba(10, 10, 12, .9);
  --line: rgba(255, 255, 255, .09);
  --line-soft: rgba(255, 255, 255, .06);
  --line-card: rgba(255, 255, 255, .16);   /* outer edge of cards, the rig and the panel */
  --ink: #F4F4F7;
  --ink-2: #D6D6E0;
  --muted: #9E9EB2;
  --faint: #5E5E74;

  --violet: #8B5CF6;
  --violet-hi: #A78BFA;
  --violet-lo: #6D3FE6;
  --violet-deep: #3B1D8F;
  --indigo: #6366F1;
  --cyan: #22D3EE;
  --cyan-hi: #67E8F9;
  --pink: #F472B6;
  --accent: var(--violet);
  --accent-soft: rgba(139, 92, 246, .18);
  --glow: var(--cyan);
  --focus: #67E8F9;
  --grad: linear-gradient(135deg, #8B5CF6 0%, #6366F1 52%, #22D3EE 100%);
  --grad-btn: linear-gradient(180deg, #A07CFF 0%, #8B5CF6 45%, #6D3FE6 100%);
  --glass: linear-gradient(to bottom right, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));

  /* แท่นขุด */
  --chassis: #09090C;
  --chassis-2: #121218;
  --chassis-line: rgba(255, 255, 255, .09);
  --chassis-text: #9E9EB2;
  --chassis-ink: #F4F4F7;

  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .11), 0 30px 60px -32px rgba(0, 0, 0, .95);
  --shadow-rig: inset 0 1px 0 rgba(255, 255, 255, .07), 0 9px 0 -1px #0F0F16, 0 9px 0 0 rgba(124, 58, 237, .3), 0 50px 90px -40px rgba(0, 0, 0, .95), 0 0 70px -30px rgba(0, 102, 255, .35);
  --extrude: 0 1px 0 #B9A6FF, 0 2px 0 #8F74F0, 0 3px 0 #6D4FD6, 0 4px 0 #5638B8, 0 5px 0 #43299A, 0 9px 16px rgba(20, 8, 70, .65), 0 0 34px rgba(139, 92, 246, .35);

  /* Inter ทั้งหน้า — ตัวเลขใช้แบบความกว้างเท่ากัน (tabular) เพื่อไม่ให้ค่าที่วิ่งอยู่สั่น */
  --f-display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- พื้นฐาน ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* พื้นหลังแบบ dancore.io: ดำ + ตาราง 32px + แสงฟุ้งน้ำเงิน/ม่วง/มิ้นต์ (ตรึงไว้หลังทุกหน้าจอ) */
.bgfx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bgfx i { position: absolute; display: block; }
.bgfx__grid {
  inset: 0; opacity: .6;
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 32px 32px;
}
.bgfx__glow {
  top: -300px; left: 50%; width: 1200px; height: 800px; margin-left: -600px;
  border-radius: 50%;
  background: linear-gradient(to bottom right, rgba(0, 102, 255, .3), rgba(124, 58, 237, .2), rgba(0, 255, 209, .2));
  filter: blur(120px);
  animation: pulseGlow 4s ease-in-out infinite;
  will-change: opacity;
}
.bgfx__blob { border-radius: 50%; filter: blur(80px); }
.bgfx__blob--blue { top: 20%; right: 15%; width: 400px; height: 400px; background: rgba(0, 102, 255, .2); }
.bgfx__blob--teal { bottom: 10%; left: 10%; width: 300px; height: 300px; background: rgba(0, 255, 209, .15); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
p { margin: 0; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 3px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.nw { white-space: nowrap; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: 16px; }
@media (min-width: 720px) { .wrap { padding-inline: 28px; } }

/* ---------- ปุ่มนูน 3D ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  color: var(--ink);
  font-weight: 600; font-size: 15px; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 0 #060609, 0 10px 20px -12px rgba(0, 0, 0, .8);
  transition: background-color .2s, border-color .2s, color .2s, transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { border-color: var(--violet-hi); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 #060609; }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn--primary {
  border-color: rgba(196, 181, 253, .55);
  background: var(--grad-btn);
  color: #FFFFFF; text-shadow: 0 1px 0 rgba(40, 10, 110, .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -2px 0 rgba(40, 10, 110, .35), 0 4px 0 var(--violet-deep), 0 14px 26px -10px rgba(124, 58, 237, .75);
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--primary:active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 0 var(--violet-deep), 0 6px 14px -8px rgba(124, 58, 237, .7); }
.btn--outline {
  border-color: rgba(167, 139, 250, .5);
  background: rgba(139, 92, 246, .1); color: #DCD3FF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 0 #1E0F55, 0 10px 20px -12px rgba(0, 0, 0, .8);
}
.btn--outline:hover { background: rgba(139, 92, 246, .2); border-color: var(--violet-hi); }
.btn--ghost { border-color: transparent; background: transparent; color: var(--muted); box-shadow: none; }
.btn--ghost:hover { color: var(--ink); border-color: var(--line); }
.btn--block { width: 100%; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}

/* ---------- แถบบน ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: rgba(10, 10, 11, .7);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 12px 30px -22px rgba(0, 0, 0, .9);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand__mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: var(--grad); color: #FFFFFF;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -3px 0 rgba(30, 10, 90, .35), 0 4px 0 #2A1676, 0 10px 18px -6px rgba(99, 102, 241, .65);
}
.brand__mark svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 0 rgba(30, 10, 90, .5)); }
.is-mining .brand__mark svg { animation: spin .8s linear infinite; }
.brand__name {
  font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: .005em;
  text-shadow: 0 1px 0 #8F74F0, 0 2px 0 #5638B8, 0 6px 12px rgba(20, 8, 70, .6);
}
.brand__tag { font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); line-height: 1.3; white-space: nowrap; }
/* Uploaded logos (Admin → Brand & text) replace the fan mark: one for computers, one for phones */
.brand__logo { display: block; flex: none; width: auto; height: 40px; max-width: 240px; object-fit: contain; }
.brand__logo[hidden], .brand__logo--phone { display: none; }
.brand.has-logo .brand__mark { display: none; }
.brand.no-name .brand__name { display: none; }
.topbar__meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.chip--demo { border-style: dashed; background: transparent; color: var(--muted); }

/* Telegram check before the free trial */
.tgcard { max-width: 470px; }
.tgcard__lede { margin: 0; font-size: 14px; color: var(--muted); }
.tgsteps { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tgstep { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.tgstep__no { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #2AABEE, #229ED9); color: #FFFFFF; font-size: 13px; font-weight: 700; box-shadow: 0 0 14px -2px rgba(42, 171, 238, .6); }
.tgstep__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.tgstep__text b { font-size: 14.5px; color: var(--ink); }
.tgstep__text span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tgstatus { min-height: 20px; margin: 0; font-size: 13.5px; color: var(--muted); }
.tgstatus.is-ok { color: var(--cyan); }
.tgstatus.is-warn { color: #FBBF24; }
a.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Network picker: which chain Connect Wallet uses */
.chain { position: relative; flex: none; }
.chain__btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 10px 0 5px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 500 13px/1 var(--f-body); white-space: nowrap; cursor: pointer;
  transition: border-color .15s, background-color .15s, color .15s;
}
.chain__btn:hover, .chain__btn[aria-expanded="true"] { border-color: rgba(255, 255, 255, .24); background: var(--surface-2); color: var(--ink); }
.chain__btn:disabled { cursor: default; }
.chain__btn:disabled .chain__caret { display: none; }
.chain__mark { width: 20px; height: 20px; flex: none; }
.chain__caret { width: 10px; height: 7px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.chain__btn[aria-expanded="true"] .chain__caret { transform: rotate(180deg); }
.chain__menu {
  position: absolute; z-index: 70; top: calc(100% + 8px); right: 0;
  min-width: 220px; padding: 6px;
  border: 1px solid var(--line-card); border-radius: 14px;
  background: rgba(14, 14, 18, .97);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .4);
}
.chain__label { margin: 4px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.chain__opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); font: 500 14px/1.2 var(--f-body); text-align: left; cursor: pointer;
}
.chain__opt:hover, .chain__opt:focus-visible { background: rgba(255, 255, 255, .07); color: var(--ink); outline: none; }
.chain__opt .chain__mark { width: 22px; height: 22px; }
.chain__opt .icon { width: 16px; height: 16px; margin-left: auto; color: var(--cyan); visibility: hidden; }
.chain__opt[aria-checked="true"] { color: var(--ink); }
.chain__opt[aria-checked="true"] .icon { visibility: visible; }
@media (max-width: 420px) {
  .chain__name { display: none; }
  .chain__btn { padding: 0 8px 0 5px; }
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; transition: background-color .3s, box-shadow .3s; }
.is-mining .chip__dot { background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .22), 0 0 10px rgba(34, 211, 238, .8); }

/* ปุ่ม Connect Wallet — เมื่อเชื่อมต่อแล้วแสดงที่อยู่กระเป๋าแบบย่อ */
.wbtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px 0 11px; border-radius: 999px;
  border: 1px solid rgba(196, 181, 253, .55);
  background: linear-gradient(135deg, #9B76FF, #6366F1);
  color: #FFFFFF; text-shadow: 0 1px 0 rgba(30, 10, 90, .5);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 3px 0 var(--violet-deep), 0 10px 20px -8px rgba(99, 102, 241, .7);
  transition: transform .12s, box-shadow .12s, filter .2s, background-color .2s;
}
.wbtn:hover { filter: brightness(1.08); }
.wbtn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 1px 0 var(--violet-deep); }
.wbtn .icon { width: 17px; height: 17px; }
.wbtn__dot { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .22), 0 0 10px rgba(34, 211, 238, .8); }
.wbtn[data-connected] {
  border-color: var(--line); background: var(--surface-2); color: var(--ink); text-shadow: none;
  font-family: var(--f-mono); font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 0 #060609;
}
.wbtn[data-connected] .icon { display: none; }
.wbtn[data-connected] .wbtn__dot { display: block; }
.wbtn[data-busy] { opacity: .75; cursor: progress; }

@media (max-width: 900px) { .brand__tag { display: none; } }
@media (max-width: 760px) { .chip--demo { display: none; } }
@media (max-width: 520px) { .chip--pkg { display: none; } }

/* ---------- การ์ด 3D แบบ dancore.io (ใช้ร่วมกัน) ----------
   หน้าการ์ดดำโปร่งขอบขาวจาง + แผ่นหลังสีตาม --accent ลอยอยู่ด้านหลัง (เห็นเป็นความหนา)
   การ์ดเอียงตามเมาส์ (--rx/--ry/--mx/--my จาก app.js) และเนื้อหาแต่ละชั้นลอยออกจากหน้าการ์ด */
.ov-card, .plan, .panel {
  --accent: #7C3AED;
  border: 1px solid var(--line-card);
  background: var(--glass), var(--surface-base);
  box-shadow: var(--shadow-card);
}
.panel {
  box-shadow: var(--shadow-card), 0 9px 0 -1px #0E0E14, 0 9px 0 0 color-mix(in srgb, var(--accent) 35%, transparent),
    0 28px 54px -26px color-mix(in srgb, var(--accent) 45%, transparent);
}
.ov-card, .plan {
  --lift: 1;
  position: relative;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2, .9, .25, 1), box-shadow .5s ease, border-color .4s ease;
}
.ov-card.is-tracking, .plan.is-tracking { transition: transform .15s ease-out, box-shadow .5s ease, border-color .4s ease; }
/* แผ่นหลัง: ให้การ์ดมีความหนาและขยับตามมุมเอียง */
.ov-card::before, .plan::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  transform: translateZ(-18px) translateY(9px);
  border: 1px solid transparent;
  border-bottom-color: color-mix(in srgb, var(--accent) 70%, transparent);
  background: linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--accent) 38%, #0A0A0D));
  box-shadow: 0 20px 40px -18px color-mix(in srgb, var(--accent) 50%, transparent);
}
/* แสงสะท้อนตามเมาส์ */
.ov-card::after, .plan::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .09), transparent 55%);
  opacity: var(--glare, 0); transition: opacity .45s ease;
}
.ov-card:hover, .plan:hover, .ov-card.is-tracking, .plan.is-tracking {
  --lift: 2;
  z-index: 5;
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: var(--shadow-card), 0 38px 70px -28px rgba(0, 0, 0, .9), 0 0 46px -14px color-mix(in srgb, var(--accent) 55%, transparent);
}
/* ชั้นเนื้อหาลอยออกจากหน้าการ์ด — ชี้แล้วลอยสูงขึ้นอีกเท่าตัว */
.ov-card__head, .ov-card__sub, .ov-card__foot, .plan__top, .plan__specs,
.ov-card__value, .spark, .ov-gpus, .ov-bar, .plan__fans, .plan__price, .plan__coin,
.plan__map, .plan__note { transition: transform .7s cubic-bezier(.2, .9, .25, 1); }
.ov-card__head, .ov-card__sub, .ov-card__foot, .plan__top, .plan__specs { transform: translateZ(calc(var(--lift) * 8px)); }
.ov-card__value, .spark, .ov-gpus, .ov-bar, .plan__fans, .plan__price, .plan__coin { transform: translateZ(calc(var(--lift) * 16px)); }
.ov-cta, .plan__map, .plan > .btn, .plan__note { transform: translateZ(calc(var(--lift) * 26px)); }
/* ปุ่มที่ลอยอยู่ยังยุบได้เวลากด โดยไม่หลุดลงไปติดหน้าการ์ด */
.ov-cta:active, .plan > .btn:active { transform: translateZ(calc(var(--lift) * 26px)) translateY(2px); }
.ov-cta.btn--primary:active, .plan > .btn--primary:active { transform: translateZ(calc(var(--lift) * 26px)) translateY(3px); }
.ov-cta:disabled, .plan > .btn:disabled { transform: translateZ(calc(var(--lift) * 26px)); }
/* แพ็กเกจปัจจุบันใช้ขอบไล่สี — ไม่ให้สีขอบตอนชี้ทับ */
.plan--current:hover, .plan--current.is-tracking { border-color: transparent; }

/* หัวข้อแบบตัวอักษรนูน 3D */
.overview__title, .plans__title { color: #F5F3FF; text-shadow: var(--extrude); }

/* ---------- การ์ดสรุปของผู้ใช้ ---------- */
.overview { padding: 30px 0 26px; }
.overview__title {
  margin: 0 0 18px;
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(25px, 3.1vw, 34px); line-height: 1.2; letter-spacing: -.01em;
}
/* Referral link (Admin → Referrals): a lit strip above the overview cards */
.refbar {
  --accent: #D946EF;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 16px;
  margin: 0 0 16px; padding: 14px 16px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line-card));
  background: radial-gradient(130% 160% at 0% 0%, color-mix(in srgb, var(--accent) 17%, transparent), transparent 55%), var(--glass), var(--surface-base);
  box-shadow: var(--shadow-card), 0 0 44px -20px color-mix(in srgb, var(--accent) 75%, transparent);
}
.refbar[hidden], .refbar [hidden] { display: none; }
/* What friends' plans add to the rig, under the Hashrate card's number */
.ov-boost { margin: -4px 0 0; font-weight: 600; color: #F0ABFC; }
.ov-boost[hidden] { display: none; }
.refbar__icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: color-mix(in srgb, var(--accent) 55%, #FFFFFF);
  background: radial-gradient(100% 90% at 28% 0%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%), linear-gradient(155deg, color-mix(in srgb, var(--accent) 20%, #15151D), #0A0A0F 85%);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 6px rgba(0, 0, 0, .45), 0 3px 0 #050508, 0 10px 20px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.refbar__icon svg { width: 21px; height: 21px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 65%, transparent)); }
.refbar__text { min-width: 0; }
.refbar__title { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 16px; line-height: 1.3; color: #F5F3FF; }
.refbar__sub { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.refbar__sub b { font-weight: 600; color: var(--ink); }
.refbar__link { display: flex; gap: 8px; min-width: 0; }
.refbar__input {
  width: clamp(220px, 26vw, 360px); min-width: 0; height: 40px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .38);
  color: var(--ink-2); font: 500 12.5px/1 var(--f-mono); text-overflow: ellipsis;
}
.refbar__input:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.refbar .btn { min-height: 40px; padding: 0 16px; font-size: 14px; white-space: nowrap; }
@media (max-width: 760px) {
  .refbar { grid-template-columns: auto minmax(0, 1fr); padding: 12px; border-radius: 16px; margin-bottom: 12px; }
  .refbar__link, .refbar__connect { grid-column: 1 / -1; }
  .refbar__input { flex: 1; width: auto; }
}
.ov-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .ov-grid { gap: 10px; } }
.ov-card {
  min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px;
  border-radius: 20px;
}
@media (max-width: 560px) { .ov-card { padding: 14px; border-radius: 16px; } }
/* Head: icon tile top-left, status pill top-right, the label under them */
.ov-card__head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 8px;
  grid-template-areas: "icon . pill" "label label label";
}
.ov-card__label { grid-area: label; margin: 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.ov-card__head .ov-pill { grid-area: pill; }
/* Icon tile in the card's own colour: a small lit glass block */
.ov-card__icon {
  grid-area: icon; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  color: color-mix(in srgb, var(--accent) 55%, #FFFFFF);
  background:
    radial-gradient(100% 90% at 28% 0%, color-mix(in srgb, var(--accent) 42%, transparent), transparent 70%),
    linear-gradient(155deg, color-mix(in srgb, var(--accent) 20%, #15151D), #0A0A0F 85%);
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -2px 6px rgba(0, 0, 0, .45),
    0 3px 0 #050508, 0 10px 20px -10px color-mix(in srgb, var(--accent) 80%, transparent);
}
.ov-card__icon svg { width: 20px; height: 20px; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 65%, transparent)); }
.is-mining .ov-card__icon--fan svg { animation: spin 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { .is-mining .ov-card__icon--fan svg { animation: none; } }
@media (max-width: 560px) {
  .ov-card__head { gap: 10px 6px; }
  .ov-card__icon { width: 34px; height: 34px; border-radius: 11px; }
  .ov-card__icon svg { width: 18px; height: 18px; }
}
.ov-card__value {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px;
  font-size: clamp(23px, 2.3vw, 30px); font-weight: 500; line-height: 1.15; letter-spacing: -.01em;
  color: #FFFFFF; text-shadow: 0 2px 0 rgba(60, 30, 150, .55), 0 8px 18px rgba(99, 102, 241, .35);
}
.ov-card__value small { font-family: var(--f-display); font-size: 14px; font-weight: 600; letter-spacing: 0; color: var(--muted); text-shadow: none; }
.ov-card__value--name { font-family: var(--f-display); font-weight: 700; letter-spacing: 0; }
.ov-card__sub { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.ov-card__foot {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px 12px;
  margin: auto 0 0; padding-top: 10px; border-top: 1px dashed var(--line);
}
.ov-card__foot dt { font-size: 11.5px; color: var(--muted); }
.ov-card__foot dd { margin: 0; font-size: 14px; color: var(--ink); }
/* Overview: each figure on one line, label left and number right */
.overview .ov-card__foot { grid-template-columns: minmax(0, 1fr); gap: 7px; }
.overview .ov-card__foot div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.overview .ov-card__foot dd { margin-left: auto; text-align: right; }
.ov-card__sub--foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }

/* สถานะการขุด */
.ov-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap;
}
.ov-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.is-mining .ov-pill { border-color: rgba(34, 211, 238, .45); color: var(--cyan-hi); background: rgba(34, 211, 238, .08); }
.is-mining .ov-pill i { background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .22), 0 0 10px rgba(34, 211, 238, .8); }

/* กราฟแรงขุด 60 วินาทีล่าสุด */
.spark { display: block; width: 100%; height: 34px; overflow: visible; }
.spark__area { fill: url(#g-spark-area); }
.spark__line { fill: none; stroke: url(#g-spark); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 4px rgba(34, 211, 238, .55)); }

/* พัดลมรายการ์ด — แตะเพื่อเปิดแท็บการ์ดใบนั้น */
.ov-gpus { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ov-gpu {
  min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 7px 2px 5px; border-radius: 10px;
  border: 1px solid var(--line-soft); background: rgba(0, 0, 0, .35); color: var(--muted);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 3px 0 rgba(0, 0, 0, .9);
  transition: border-color .2s, color .2s, transform .12s, box-shadow .12s;
}
.ov-gpu:hover { border-color: var(--violet-hi); color: var(--ink); }
.ov-gpu:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 0 rgba(0, 0, 0, .9); }
.ov-gpu__fans { display: flex; gap: 3px; }
.ov-gpu__fans i { width: 7px; height: 15px; border-radius: 2px; border: 1.5px solid rgba(167, 139, 250, .3); }
.ov-gpu__fans i[data-s="installed"] { border-color: transparent; background: linear-gradient(180deg, var(--cyan), var(--violet)); }
.ov-gpu__fans i[data-s="empty"] { border-color: rgba(167, 139, 250, .65); }
.ov-gpu__fans i[data-s="locked"] { border-color: transparent; background: repeating-linear-gradient(135deg, rgba(167, 139, 250, .3) 0 2px, transparent 2px 4px); }
.is-mining .ov-gpu__fans i[data-s="installed"] { box-shadow: 0 0 8px rgba(34, 211, 238, .7); }
.ov-gpu__name { font-family: var(--f-mono); font-size: 10.5px; white-space: nowrap; }
@media (max-width: 560px) {
  .ov-gpu__pre { display: none; }
  .ov-gpu__fans { gap: 2px; }
  .ov-gpu__fans i { width: 6px; height: 13px; }
}

/* แพ็กเกจ */
.ov-bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.ov-bar i { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--grad); box-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.ov-cta { margin-top: auto; min-height: 40px; padding: 0 12px; font-size: 14px; }
.ov-cta__short { display: none; }
@media (max-width: 560px) {
  .ov-cta__long { display: none; }
  .ov-cta__short { display: inline; }
}

/* ---------- พื้นที่หลัก: แท่นขุด + แผงควบคุม ---------- */
.station { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.station > * { min-width: 0; }
@media (min-width: 1040px) { .station { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; } }

/* ---------- แท่นขุด ---------- */
.rig {
  position: relative;
  padding: 14px 12px 8px;
  border-radius: 26px;
  border: 1px solid var(--line-card);
  background: var(--glass), linear-gradient(180deg, var(--chassis-2), var(--chassis));
  box-shadow: var(--shadow-rig);
  color: var(--chassis-ink);
}
@media (min-width: 720px) { .rig { padding: 20px 22px 12px; } }
.rig :focus-visible { outline-color: var(--cyan); }
.rig__screw {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #E4E4EE, #4A4A5C 70%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(0, 0, 0, .3);
}
.rig__screw::after {
  content: ""; position: absolute; left: 1.5px; right: 1.5px; top: 50%;
  height: 1.2px; margin-top: -.6px; background: #16161E; transform: rotate(35deg);
}
.rig__screw--tl { top: 8px; left: 8px; }
.rig__screw--tr { top: 8px; right: 8px; }
.rig__screw--bl { bottom: 8px; left: 8px; }
.rig__screw--br { bottom: 8px; right: 8px; }

.rig__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 8px 14px; }
.rig__plate {
  font-family: var(--f-display); font-weight: 600; font-size: 12.5px; letter-spacing: .22em;
  color: var(--ink-2);
  padding: 3px 6px 3px 9px; border-radius: 6px;
  border: 1px solid var(--chassis-line); background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .05);
}
.rig__status { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; }
.led { width: 8px; height: 8px; border-radius: 50%; background: #3A3A4A; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .4); transition: background-color .3s, box-shadow .3s; }
.rig[data-phase="spinup"] .led,
.rig[data-phase="spindown"] .led { background: var(--violet-hi); box-shadow: 0 0 10px rgba(167, 139, 250, .8); animation: blink .7s steps(2, jump-none) infinite; }
.rig[data-phase="mining"] .led { background: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .2), 0 0 12px rgba(34, 211, 238, .9); }
.rig__count { margin-left: auto; font-size: 13px; color: var(--chassis-text); }
.rig__count b { color: var(--chassis-ink); font-weight: 500; }

/* การ์ดจอ 4 ใบ ใบละ 3 พัดลม = 12 พัดลม — เลือกดูทีละใบด้วยแท็บ */
.gpu-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px;
  margin-bottom: 12px; padding: 4px;
  border-radius: 14px; background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .05);
}
.gtab {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 8px 4px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--chassis-text); cursor: pointer;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s;
}
.gtab:hover { color: var(--chassis-ink); background: rgba(255, 255, 255, .04); }
.gtab[aria-selected="true"] {
  border-color: rgba(0, 102, 255, .45);
  background: linear-gradient(180deg, rgba(0, 102, 255, .22), rgba(124, 58, 237, .14));
  color: var(--chassis-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 3px 0 #08080C, 0 10px 18px -8px rgba(0, 102, 255, .5);
}
.gtab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 8px rgba(34, 211, 238, .7);
}
.gtab__chip { display: flex; gap: 3px; padding: 3px 5px; border-radius: 4px; background: #050507; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.gtab__chip i { width: 8px; height: 8px; border-radius: 50%; background: #1C1C26; transition: background-color .3s, box-shadow .3s; }
.gtab__chip i[data-s="installed"] { background: var(--cyan); }
.gtab__chip i[data-s="empty"] { background: transparent; box-shadow: inset 0 0 0 1.5px #7C6FD1; }
.is-mining .gtab__chip i[data-s="installed"] { box-shadow: 0 0 7px rgba(34, 211, 238, .95); }
.gtab__name { font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
.gtab__state { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; white-space: nowrap; }
.gtab__state .icon { width: 12px; height: 12px; }
.gtab[data-state="ghost"] .gtab__chip,
.gtab[data-state="ghost"] .gtab__name { opacity: .55; }
/* แท็บที่ยังล็อก: กรอบจางๆ สีของแพ็กเกจที่ปลดล็อกการ์ดใบนั้น (สีเดียวกับการ์ดแพ็กเกจ) */
.gtab[data-state="ghost"]:not([aria-selected="true"]) { border-color: color-mix(in srgb, var(--accent) 32%, transparent); }
.gtab[data-state="ghost"]:not([aria-selected="true"]):hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
/* Tabs of GPUs in the chosen plan: a faint frame in that plan's colour */
.gtab[data-owned]:not([aria-selected="true"]) { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.gtab[data-owned]:not([aria-selected="true"]):hover { border-color: color-mix(in srgb, var(--accent) 58%, transparent); }
@media (min-width: 720px) {
  .gtab { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 12px; }
  .gtab__state { margin-left: auto; }
}

/* เวทีแสดงการ์ดใบที่เลือก: แท่นเรืองแสง + พื้นตาราง 3D */
.stage {
  position: relative; overflow: hidden; isolation: isolate;
  padding: 26px 14px 14px; border-radius: 18px;
  background:
    radial-gradient(ellipse 60% 55% at 50% 40%, rgba(0, 102, 255, .3) 0%, rgba(124, 58, 237, .16) 45%, transparent 72%),
    linear-gradient(180deg, #0D0D14 0%, #060608 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), inset 0 2px 12px rgba(0, 0, 0, .6);
}
.stage::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: -40%; right: -40%; bottom: -8%; height: 62%;
  background-image:
    linear-gradient(rgba(0, 255, 209, .28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 102, 255, .32) 1px, transparent 1px);
  background-size: 38px 38px;
  transform: perspective(420px) rotateX(66deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  mask-image: linear-gradient(to top, #000 0%, transparent 88%);
}
@media (min-width: 720px) { .stage { padding: 38px 34px 16px; } }
.gpanel:not([hidden]) { animation: card-in .45s cubic-bezier(.2, .8, .2, 1); }

/* การ์ดจอแสดงตรง ไม่เอียง (ตามที่ผู้ใช้ขอ) */
.card3 {
  --g: 0;
  position: relative; max-width: 760px; margin: 0 auto; aspect-ratio: var(--ar, 1933 / 813);   /* --ar etc. come from the chosen card (app.js) */
}
.card3::before {
  content: ""; position: absolute; left: 6%; right: 4%; bottom: -7%; height: 11%;
  border-radius: 50%; background: rgba(4, 2, 16, .75); filter: blur(12px);
}
/* แสงสะท้อนใต้การ์ด สว่างขึ้นตามรอบพัดลม */
.card3::after {
  content: ""; position: absolute; left: 12%; right: 10%; bottom: -10%; height: 7%;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(34, 211, 238, .6), rgba(168, 85, 247, .4) 55%, rgba(244, 114, 182, .2) 75%, transparent);
  filter: blur(6px);
  opacity: calc(.2 + var(--g) * .8);
}
/* The card itself: the chosen picture, used as it is. The frame shows the part of it that makes every
   card the same size (its position and size come from app.js) */
.card3__frame { position: absolute; inset: 0; overflow: hidden; pointer-events: none; background: #000; border-radius: clamp(10px, 1.6vw, 16px); }   /* the pictures sit on black, with round corners */
.card3__img {
  position: absolute; display: block; max-width: none;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
  transition: opacity .4s ease, filter .4s ease;
}
/* A locked card goes dark but stays solid, so the cards behind it don't show through */
.gpanel[data-state="ghost"] .card3__frame > .card3__img,
.gpanel[data-state="ghost"] .card3 > .card3__plate,
.gpanel[data-state="ghost"] .fan { filter: grayscale(.85) brightness(.27); }
/* The cards behind (CPU 02 has CPU 01 behind it, CPU 03 two…): raised, smaller and darker (app.js) */
.card3__behind { position: absolute; inset: 0; transform-origin: 0 0; filter: brightness(var(--light, .5)); transition: filter .4s ease; }
.card3__behind[data-state="ghost"] { filter: grayscale(.85) brightness(calc(var(--light, .5) * .55)); }
/* The site name on the card's plate, where the picture printed its own name */
.card3__plate { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity .4s ease, filter .4s ease; }
.card3__plate-name { font-family: var(--f-display); }   /* size, weight and spacing: per card, in app.js */
.gpanel__stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px;
  margin-top: 24px; font-family: var(--f-mono); font-size: 12px; color: var(--chassis-text);
}
.gpanel__stats b { font-weight: 500; color: var(--chassis-ink); }

/* การ์ดที่ยังล็อกทั้งใบ */
.card3__lock {
  position: absolute; inset: 0; z-index: 2;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 0 10%; text-align: center;
}
.gpanel[data-state="ghost"] .card3__lock { display: flex; }
.card3__lock-icon {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(167, 139, 250, .45); background: rgba(12, 12, 16, .9); color: var(--chassis-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 3px 0 #060609, 0 0 20px rgba(139, 92, 246, .4);
}
.card3__lock-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(15px, 2vw, 20px); line-height: 1.3; color: #F5F3FF; text-shadow: 0 2px 0 #43299A, 0 6px 14px rgba(20, 8, 70, .8); }
.card3__lock-text { max-width: 36ch; font-size: clamp(12px, 1.4vw, 14px); color: var(--ink-2); }
.card3__lock .btn { margin-top: 6px; min-height: 40px; }
@media (max-width: 560px) {
  .card3__lock { gap: 4px; }
  .card3__lock-icon { width: 30px; height: 30px; }
  .card3__lock-text { display: none; }
  .card3__lock .btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
}

/* ช่องพัดลม 3 ช่องบนการ์ด: ตำแหน่งและขนาดมาจาก app.js (วัดจากภาพ 1933×813) */
.sock { --s: 0; position: absolute; z-index: 1; }

/* ตัวพัดลม: วงกลมที่ตัดจากภาพเดียวกัน หมุนรอบดุมตอนขุด */
.fan {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  transition: opacity .35s ease, transform .55s cubic-bezier(.2, .8, .2, 1), filter .4s ease;
}
.fan__spin { position: absolute; inset: 0; border-radius: 50%; will-change: transform; }
.fan__spin > img { position: absolute; display: block; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.fan__spin > .fan__hub {
  left: calc((100% - var(--hub, 32%)) / 2); top: calc((100% - var(--hub, 32%)) / 2); width: var(--hub, 32%); height: var(--hub, 32%);
  border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}
/* ยังไม่ได้ติดตั้ง: ซ่อนพัดลมที่หมุนได้ (ภาพการ์ดด้านล่างจางลงด้วยแผ่น Install / ล็อก) */
.sock:not([data-state="installed"]) .fan { opacity: 0; transform: scale(.9); }
/* เรืองแสงรอบพัดลมตามรอบ */
.fan__glow {
  position: absolute; inset: -2%; border-radius: 50%; pointer-events: none;
  opacity: var(--s);
  box-shadow: 0 0 calc(var(--s) * 30px) calc(var(--s) * 3px) rgba(124, 58, 237, .5), inset 0 0 calc(var(--s) * 22px) rgba(34, 211, 238, .28);
}
.sock:not([data-state="installed"]) .fan__glow { opacity: 0; }
/* On the picture card the plate covers the whole fan and greys it out, so a missing fan reads as missing */
.card3 .sock__plate { inset: 0; -webkit-backdrop-filter: grayscale(.9) brightness(.7); backdrop-filter: grayscale(.9) brightness(.7); }
.card3 .sock[data-state="empty"] .sock__plate { background: rgba(6, 4, 20, .7); }
/* A fan whose package isn't active yet: its glowing ring turns grey (the ring sits just outside the plate) */
.card3 .sock::before {
  content: ""; position: absolute; inset: var(--ring, -6%); border-radius: 50%; pointer-events: none;
  -webkit-backdrop-filter: grayscale(1) brightness(.8); backdrop-filter: grayscale(1) brightness(.8);
  opacity: 0; transition: opacity .35s ease;
}
.card3 .sock[data-state="locked"]::before { opacity: 1; }
.card3 .sock[data-state="locked"] .sock__plate { background: rgba(6, 4, 20, .86); }
.card3 .sock[data-state="installed"] .sock__plate { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* แผ่นบนช่องพัดลม: ว่าง (ติดตั้งได้) / ล็อก (ต้องอัปเกรด) / รับฟรี */
.sock__plate {
  position: absolute; inset: 2%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 0; border: 0; border-radius: 50%; background: transparent;
  color: var(--chassis-text); cursor: pointer;
  font-family: var(--f-display); font-weight: 600; font-size: clamp(9px, 1.25vw, 14px); letter-spacing: .08em;
  transition: opacity .3s ease, color .2s, background-color .2s, box-shadow .2s, visibility 0s linear 0s;
}
.sock__plate .icon { width: clamp(14px, 2.2vw, 26px); height: clamp(14px, 2.2vw, 26px); }
.sock[data-state="installed"] .sock__plate,
.gpanel[data-state="ghost"] .sock__plate { opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }
.sock[data-state="empty"] .sock__plate { background: rgba(9, 6, 28, .6); box-shadow: inset 0 0 0 1.5px rgba(167, 139, 250, .6); color: #DCD3FF; }
.sock[data-state="empty"] .sock__plate:hover { color: var(--cyan-hi); background: rgba(9, 6, 28, .4); box-shadow: inset 0 0 0 1.5px var(--cyan), 0 0 18px rgba(34, 211, 238, .35); }
.sock[data-state="locked"] .sock__plate { background: rgba(9, 6, 28, .82); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, .32); color: var(--chassis-text); }
.sock[data-state="locked"] .sock__plate:hover { color: var(--chassis-ink); box-shadow: inset 0 0 0 1px var(--violet-hi); }
.sock[data-free] .sock__plate { background: rgba(9, 6, 28, .6); box-shadow: inset 0 0 0 2px rgba(34, 211, 238, .75), 0 0 22px rgba(34, 211, 238, .3); color: var(--cyan-hi); }
.sock[data-free] .sock__plate:hover { color: #FFFFFF; box-shadow: inset 0 0 0 2px var(--cyan), 0 0 26px rgba(34, 211, 238, .5); }
@media (max-width: 560px) { .sock__plate { letter-spacing: .02em; } }

/* วงแหวนพัดลมกะพริบเป็นสีขาวม่วงเมื่อพัดลมตัวนั้นส่ง share สำเร็จ */
.sock.is-share .fan__glow { animation: share .7s ease-out; }

/* ค่าที่วัดได้ */
.readouts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 14px 0 0;
  border-top: 1px solid var(--chassis-line); border-bottom: 1px solid var(--chassis-line);
}
.readout { padding: 12px 12px 12px 14px; border-left: 1px solid var(--chassis-line); min-width: 0; }
.readout:first-child { border-left: 0; }
.readout dt { font-size: 12px; color: var(--chassis-text); white-space: nowrap; }
.readout dd {
  margin: 2px 0 0; white-space: nowrap;
  font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-weight: 500;
  font-size: clamp(18px, 1.9vw, 24px); color: var(--chassis-ink);
}
.readout small { margin-left: 5px; font-size: 12px; font-weight: 400; color: var(--chassis-text); }
.rig[data-phase="mining"] #roHash { color: var(--cyan-hi); text-shadow: 0 0 14px rgba(34, 211, 238, .55); }
@media (max-width: 640px) {
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout:nth-child(3) { border-left: 0; }
  .readout:nth-child(n+3) { border-top: 1px solid var(--chassis-line); }
}

/* บันทึกการทำงาน (หน้าจอเล็กบนแท่น) */
.console {
  list-style: none; margin: 0; padding: 10px 8px 6px;
  min-height: calc(4 * 1.8em + 16px);
  overflow: hidden;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.8; color: var(--chassis-text);
}
.console li { display: flex; gap: 12px; min-width: 0; }
.console li:last-child { color: var(--chassis-ink); }
.console time { flex: none; color: var(--faint); }
.console span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console .ok span { color: var(--cyan-hi); }
.console .warn span { color: var(--pink); }

/* ---------- แผงควบคุม ---------- */
.panel {
  border-radius: 24px;
  overflow: hidden;
}
@media (min-width: 1040px) { .panel { position: sticky; top: 84px; } }
.panel__section { padding: 20px; }
.panel__section + .panel__section { border-top: 1px solid var(--line-soft); }
.label { font-size: 13px; font-weight: 500; color: var(--muted); }

/* ปุ่ม Mining — ปุ่มนูน 3D กดแล้วยุบ */
.power {
  width: 100%; min-height: 90px;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px 14px 14px;
  border-radius: 20px; border: 1px solid rgba(196, 181, 253, .55);
  background: linear-gradient(180deg, #9F7BFF 0%, #8452F5 45%, #6A3BE0 100%);
  color: #FFFFFF; text-align: left; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), inset 0 -3px 0 rgba(40, 10, 110, .35), 0 6px 0 var(--violet-deep), 0 20px 36px -12px rgba(124, 58, 237, .8);
  transition: background .3s, box-shadow .15s, border-color .3s, color .3s, transform .15s, filter .2s;
}
.power:hover:not(:disabled) { filter: brightness(1.07); }
.power:active:not(:disabled) { transform: translateY(4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 0 var(--violet-deep), 0 8px 18px -10px rgba(124, 58, 237, .7); }
.power[aria-pressed="true"] {
  border-color: rgba(34, 211, 238, .45);
  background: linear-gradient(180deg, #1F1757 0%, #120C34 100%);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 6px 0 #06041A, 0 0 0 1px rgba(34, 211, 238, .12), 0 20px 36px -14px rgba(34, 211, 238, .45);
}
.power[aria-pressed="true"]:active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 2px 0 #06041A; }
.power:disabled { cursor: not-allowed; border-color: var(--line); background: rgba(255, 255, 255, .05); color: var(--muted); box-shadow: 0 4px 0 #060609; }
.power__key {
  position: relative; flex: none;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #4B3F9E, #160F3D 72%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .18), inset 0 -2px 4px rgba(0, 0, 0, .4);
  color: #CFC8F6;
  transition: color .3s;
}
.power__key svg { width: 24px; height: 24px; }
.power__key::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.power[aria-pressed="true"] .power__key { color: var(--cyan); }
.power[aria-pressed="true"] .power__key::after {
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(34, 211, 238, .7);
  animation: breathe 2.4s ease-in-out infinite;
}
.power:disabled .power__key { background: rgba(255, 255, 255, .06); box-shadow: none; color: var(--muted); }
/* The free fan pops up on the button and turns while it mines */
.power__key svg { transition: opacity .2s ease; }
.power__fan {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  opacity: 0; transform: scale(.55);
  transition: opacity .3s ease, transform .45s cubic-bezier(.2, .9, .3, 1.2);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .4);
}
.power__fan-spin { position: absolute; inset: 0; will-change: transform; }
.power__fan-spin img { position: absolute; display: block; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; }
.power[data-fan] .power__fan { opacity: 1; transform: none; }
.power[data-fan] .power__key svg { opacity: 0; }
/* While the free trial mines, the button offers the next plan: bright again, the fan still turning in its ring */
.power[data-upsell] .power__key { color: var(--cyan); }
.power[data-upsell] .power__key::after { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 211, 238, .7); animation: breathe 2.4s ease-in-out infinite; }
.power__sub b { font-weight: 800; color: #FFFFFF; }
.power__text { min-width: 0; }
.power__label { display: block; font-family: var(--f-display); font-weight: 700; font-size: 23px; line-height: 1.2; text-shadow: 0 2px 0 rgba(40, 10, 110, .45); }
.power__sub { display: block; margin-top: 3px; font-size: 13.5px; opacity: .9; }
.power.is-nudge { animation: nudge 1.1s ease-out 2; }

/* ปุ่ม Mining แบบติดขอบล่าง (จอเล็ก) */
.dock { display: none; }
.power--dock { min-height: 64px; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 18px; }
.power--dock .power__key { width: 46px; height: 46px; }
.power--dock .power__key svg { width: 20px; height: 20px; }
.power--dock .power__label { font-size: 18px; }
.power--dock .power__sub { margin-top: 1px; font-size: 12.5px; }
@media (max-width: 1039.98px) {
  .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: block;
    padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(10, 10, 11, .94) 40%);
    transform: translateY(110%); visibility: hidden;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .3s;
  }
  .show-dock .dock { transform: none; visibility: visible; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
  .show-dock .toasts { bottom: 108px; }
  .foot { padding-bottom: 116px; }
}

/* ตัวเลือกจำนวนพัดลม */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.field-head__aside { font-size: 13px; color: var(--muted); text-align: right; }
.stepper { display: grid; grid-template-columns: 54px 1fr 54px; align-items: center; gap: 10px; }
.stepper__btn {
  position: relative; height: 54px;
  display: grid; place-items: center;
  border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03));
  color: var(--ink);
  font-size: 20px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 4px 0 #060609, 0 12px 20px -12px rgba(0, 0, 0, .8);
  transition: border-color .2s, transform .12s, box-shadow .12s;
}
.stepper__btn:hover:not(:disabled) { border-color: var(--violet-hi); }
.stepper__btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 0 #060609; }
.stepper__btn:disabled { opacity: .4; cursor: not-allowed; }
.stepper__lock {
  position: absolute; top: -7px; right: -7px;
  width: 22px; height: 22px; border-radius: 50%;
  display: none; place-items: center;
  background: var(--grad); color: #FFFFFF; font-size: 11px;
  box-shadow: 0 0 0 2px #140E3A, 0 0 12px rgba(139, 92, 246, .6);
}
.stepper__btn[data-locked] .stepper__lock { display: grid; }
.stepper__value {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  font-family: var(--f-display); font-weight: 700; font-size: 42px; line-height: 1;
  color: #F5F3FF; text-shadow: 0 1px 0 #B9A6FF, 0 2px 0 #8F74F0, 0 3px 0 #6D4FD6, 0 4px 0 #43299A, 0 8px 14px rgba(20, 8, 70, .6);
}
.stepper__value small { font-family: var(--f-mono); font-size: 14px; font-weight: 400; color: var(--muted); text-shadow: none; }

.meter { display: flex; gap: 4px; margin-top: 18px; }
.meter__seg { flex: 1; height: 10px; border-radius: 3px; border: 1.5px solid rgba(167, 139, 250, .25); transition: background .3s, border-color .3s, box-shadow .3s; }
.meter__seg[data-break] { margin-left: 6px; }
.meter__seg[data-s="installed"] { border-color: transparent; background: var(--grad); background-size: 1200% 100%; box-shadow: 0 0 8px rgba(99, 102, 241, .5); }
.meter__seg[data-s="empty"] { border-color: rgba(167, 139, 250, .7); }
.meter__seg[data-s="locked"] { border-color: transparent; background: repeating-linear-gradient(135deg, rgba(167, 139, 250, .28) 0 2px, transparent 2px 4px); }
.hint { margin-top: 12px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.hint b { color: var(--ink); font-weight: 600; }
.linkbtn {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--cyan-hi); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

/* ผลการขุดรอบนี้ */
.earn { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 4px; }
.earn__value { font-size: clamp(30px, 3vw, 36px); font-weight: 500; letter-spacing: -.02em; line-height: 1.2; color: #FFFFFF; text-shadow: 0 2px 0 rgba(60, 30, 150, .55), 0 8px 18px rgba(99, 102, 241, .35); }
.earn__unit { font-family: var(--f-display); font-weight: 600; color: var(--muted); }
.earn__sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-size: 15px; }
.trial { margin-top: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-soft); background: rgba(0, 0, 0, .3); }
.trial__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13.5px; }
.trial__row b { font-size: 16px; font-weight: 500; }
.trial__bar { height: 6px; margin-top: 8px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.trial__fill { height: 100%; width: 100%; border-radius: inherit; background: var(--grad); box-shadow: 0 0 10px rgba(34, 211, 238, .5); }
.trial__cta { margin-top: 12px; }
.trial[data-expired] .trial__row b { color: var(--pink); }

/* ---------- แพ็กเกจ ---------- */
.plans { padding: 76px 0 8px; }

/* ---------- Wallet: earnings counted by the server, history, withdraw ---------- */
.wallet { padding: 64px 0 8px; }
.wl-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.wl-main .ov-cta { margin-top: 6px; }
.wl-note { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--muted); }
.wl-note.is-warn { color: #FBBF24; }
.wl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 0; padding-top: 0; margin-top: 4px; }
.wl-pill { border-color: rgba(34, 211, 238, .45); color: var(--cyan-hi); background: rgba(34, 211, 238, .08); }
.wl-pill i { background: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, .8); }
.wl-h { margin: 28px 0 10px; font-family: var(--f-display); font-size: 17px; font-weight: 700; color: var(--ink); }
.wl-history { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.wl-history li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 12px;
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .025);
  font-size: 13.5px;
}
.wl-history .wl-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(34, 211, 238, .12); color: var(--cyan); }
.wl-history .wl-ic--out { background: rgba(139, 92, 246, .16); color: var(--violet-hi); }
.wl-history .wl-ic .icon { width: 16px; height: 16px; }
.wl-history b { font-weight: 600; color: var(--ink); }
.wl-history small { display: block; color: var(--muted); font-size: 12px; }
.wl-history .wl-amt { font-family: var(--f-mono); font-size: 13px; color: var(--ink); text-align: right; white-space: nowrap; }
.wl-history .wl-amt--in { color: var(--cyan-hi); }
.wl-history .wl-amt--void { color: var(--faint); text-decoration: line-through; }
.wl-history a { color: var(--violet-hi); }
.wl-history li.wl-empty { display: block; color: var(--muted); border-style: dashed; }
.wl-status { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; vertical-align: 1px; }
.wl-status--pending { color: #FDE68A; background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .35); }
.wl-status--paid { color: #A7F3D0; background: rgba(52, 211, 153, .12); border: 1px solid rgba(52, 211, 153, .35); }
.wl-status--rejected { color: #FCA5A5; background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .35); }
@media (max-width: 760px) { .wl-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; } }

/* Withdraw dialog */
.wd-field { display: grid; gap: 8px; min-width: 0; }
.wd-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.wd-input { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-radius: 14px; border: 1px solid var(--line-card); background: rgba(0, 0, 0, .35); }
.wd-input:focus-within { border-color: var(--violet-hi); box-shadow: 0 0 0 3px rgba(139, 92, 246, .28); }
.wd-input input { flex: 1 1 auto; width: 0; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 600 20px/1.3 var(--f-mono); outline: none; }
.wd-max { padding: 6px 10px; border-radius: 9px; border: 1px solid rgba(167, 139, 250, .45); background: rgba(139, 92, 246, .14); color: #DCD3FF; font: 600 12px/1 var(--f-body); cursor: pointer; }
.wd-unit { font-size: 13px; color: var(--muted); }
.wd-to { margin: 0; font-size: 13.5px; color: var(--muted); }
.wd-to b { color: var(--ink); font-weight: 500; }
.plans__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 32px; margin-bottom: 24px; }
.plans__title { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: clamp(27px, 3vw, 36px); line-height: 1.2; }
.plans__lede { max-width: 52ch; color: var(--muted); }
.plans__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
/* --plan-cols comes from app.js: one column per plan, at most 5 a row */
@media (min-width: 1100px) { .plans__grid { grid-template-columns: repeat(var(--plan-cols, 5), minmax(0, 1fr)); } }
.plan {
  min-width: 0;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px;
  border-radius: 22px;
}
.plan--current {
  border-color: transparent;
  background:
    var(--glass) padding-box,
    linear-gradient(rgba(12, 12, 16, .94), rgba(12, 12, 16, .94)) padding-box,
    var(--grad) border-box;
  box-shadow: var(--shadow-card), 0 0 44px -12px rgba(99, 102, 241, .7);
}
.plan__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.plan__name { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 20px; line-height: 1.3; color: #F5F3FF; text-shadow: 0 2px 0 #43299A, 0 6px 12px rgba(20, 8, 70, .6); }
.plan__badge { padding: 3px 10px; border-radius: 999px; background: var(--grad); color: #FFFFFF; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 0 var(--violet-deep), 0 0 14px rgba(99, 102, 241, .6); }
/* แผนผังย่อ: การ์ดจอ 4 ใบ ใบละ 3 พัดลม เรียงตามลำดับบนแท่นขุด */
.plan__map {
  display: grid; grid-template-columns: repeat(2, auto); gap: 5px 6px;
  width: max-content; padding: 9px;
  border-radius: 12px; background: #050507;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .08);
}
.pm { display: flex; gap: 4px; padding: 3px 6px; border-radius: 4px; background: #15151D; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.pm i { width: 10px; height: 10px; border-radius: 50%; background: #0A0A0E; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.pm i[data-s="base"] { background: #6D5BD0; }
.pm i[data-s="new"] { background: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, .8); }
.plan__map--lg { gap: 7px 8px; padding: 12px; }
.plan__map--lg .pm { gap: 5px; padding: 4px 8px; }
.plan__map--lg .pm i { width: 13px; height: 13px; }
.plan__fans { color: var(--ink-2); font-size: 15px; }
.plan__fans b { margin-right: 6px; font-family: var(--f-display); font-size: 30px; line-height: 1; color: #FFFFFF; text-shadow: 0 2px 0 #43299A, 0 8px 14px rgba(20, 8, 70, .55); }
.plan__gpus { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.plan__specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
/* One fact a row: the label on the left never breaks; the number sits right, in even-width digits (a
   number too long for the card drops under its label, still on the right) */
.plan__specs li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; padding-top: 6px; border-top: 1px dashed var(--line-soft); color: var(--muted); }
.plan__specs span { white-space: nowrap; }
.plan__specs b { margin-left: auto; font-family: var(--f-mono); font-weight: 500; color: var(--ink); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.plan__specs .plan__up { font-weight: 600; color: color-mix(in srgb, var(--accent) 50%, #FFFFFF); }
.plan__price { margin-top: auto; display: flex; align-items: baseline; gap: 4px; }
.plan__price b { font-family: var(--f-display); font-size: 27px; line-height: 1.1; color: #FFFFFF; text-shadow: 0 2px 0 #43299A, 0 8px 14px rgba(20, 8, 70, .55); }
.plan__price span { font-size: 13.5px; color: var(--muted); }
/* The same price in a crypto coin, at the live price from the settings API */
.plan__coin { margin: -8px 0 0; font-size: 13px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan__coin span { font-weight: 400; color: var(--faint); }
.plan__note {
  min-height: 46px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px dashed var(--line);
  font-size: 13.5px; color: var(--muted); text-align: center; padding: 6px 10px;
}
.plan--current .plan__note { border-style: solid; border-color: rgba(34, 211, 238, .45); color: var(--cyan-hi); font-weight: 600; background: rgba(34, 211, 238, .06); }
@media (max-width: 560px) {
  .plans__grid { grid-template-columns: minmax(0, 1fr); }
  .plan { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; padding: 16px; }
  .plan__top, .plan__price, .plan__coin, .plan > .btn, .plan__note { grid-column: 1 / -1; }
  .plan__map { grid-row: span 2; align-self: start; }
  .plan__fans { align-self: end; }
  .plan__price { margin-top: 2px; }
}

/* ---------- หน้าต่างอัปเกรด ---------- */
.modal {
  width: 100%; max-width: min(540px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0; border: 0; background: transparent; color: var(--ink);
  overflow-x: hidden;   /* the opening animation must not flash a sideways scrollbar */
}
/* Dialogs with a narrower card (Telegram check, free trial offer) are that narrow too, so the card stays centred */
.modal--narrow { max-width: min(470px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: modal-in .3s cubic-bezier(.2, .8, .2, 1); }
.modal__card {
  display: grid; gap: 18px; margin: 0; padding: 22px;
  border-radius: 24px; border: 1px solid rgba(255, 255, 255, .1);
  background: var(--glass), rgba(12, 12, 16, .97);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 40px 90px -28px rgba(0, 0, 0, .9), 0 0 60px -20px rgba(139, 92, 246, .55);
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal__title { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 25px; line-height: 1.25; color: #F5F3FF; text-shadow: 0 2px 0 #43299A, 0 8px 16px rgba(20, 8, 70, .6); }
.modal__close {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 0 #060609;
  cursor: pointer;
}
.modal__close:hover { border-color: var(--violet-hi); }
.modal__reason {
  padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, .35);
  background: rgba(139, 92, 246, .14);
  color: var(--ink-2); font-size: 14.5px;
}
.modal__reason[hidden] { display: none; }
.choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.choices[hidden] { display: none; }
.choices legend { padding: 0; margin-bottom: 8px; }
/* Plan choices: two equal columns, so four plans sit as two even rows */
.choices__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice { position: relative; min-width: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14.5px; cursor: pointer;
  box-shadow: 0 3px 0 #060609;
  transition: background .2s, border-color .2s, color .2s;
}
.choice span small { font-weight: 500; font-size: 12.5px; opacity: .8; }
.choice span:hover { border-color: var(--violet-hi); }
.choice input:checked + span { border-color: rgba(196, 181, 253, .55); background: var(--grad-btn); color: #FFFFFF; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 0 var(--violet-deep); }
.choice input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.modal__body { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { padding: 9px 6px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.compare thead th { padding-top: 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.compare tbody th { font-weight: 500; color: var(--muted); white-space: nowrap; }
.compare td { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare td.up { color: var(--cyan-hi); font-weight: 600; }
.compare td.wrap { white-space: normal; }
.compare__sub { display: block; margin-top: 3px; font-size: 12px; font-weight: 500; opacity: .75; white-space: nowrap; }
.modal__note { font-size: 12.5px; color: var(--muted); }
/* What the crypto checkout is doing: getting the price, waiting for the wallet, confirming */
.modal__pay { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.modal__pay.is-warn { color: #FBBF24; }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
@media (max-width: 520px) {
  .modal__card { padding: 18px; }
  .modal__body { grid-template-columns: 1fr; }
  .modal__body .plan__map { justify-self: center; }
  .modal__actions { flex-direction: column-reverse; }
  .modal__actions .btn { width: 100%; }
}

/* ---------- แจ้งเตือน ---------- */
.toasts {
  position: fixed; left: 50%; bottom: 20px; z-index: 60;
  width: min(440px, calc(100vw - 32px)); transform: translateX(-50%);
  display: grid; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: var(--glass), rgba(12, 12, 16, .97); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 20px 44px -16px rgba(0, 0, 0, .85), 0 0 30px -12px rgba(139, 92, 246, .6);
  font-size: 14.5px; line-height: 1.5;
  animation: toast-in .32s cubic-bezier(.2, .8, .2, 1);
}
.toast.is-leaving { animation: toast-out .25s ease forwards; }
.toast__icon {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad); color: #FFFFFF; font-size: 13px;
  box-shadow: 0 0 12px rgba(99, 102, 241, .7);
}

/* ---------- ท้ายหน้า ---------- */
.foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px;
  margin-top: 56px; padding-top: 22px; padding-bottom: 40px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px; color: var(--muted);
}
/* Facebook, X and Telegram: small 3D tiles that light up in their own colour */
.social { display: flex; gap: 10px; }
.social__btn {
  --brand: #8B5CF6;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none;
  border: 1px solid var(--line); background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 0 #060609;
  transition: color .2s, border-color .2s, background-color .2s, box-shadow .2s, transform .12s;
}
.social__btn svg { width: 19px; height: 19px; }
.social__btn--facebook { --brand: #1877F2; }
.social__btn--x { --brand: #E7E9EA; }
.social__btn--telegram { --brand: #29A9EB; }
.social__btn:hover, .social__btn:focus-visible {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 55%, transparent);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 0 #060609, 0 10px 22px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
.social__btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 0 #060609; }

/* ---------- โหมดแอปบนมือถือ: ทีละหน้าจอ + แถบแท็บด้านล่าง ---------- */
.appnav { display: none; }
@media (max-width: 760px) {
  .topbar__meta .wbtn { height: 32px; padding: 0 12px 0 10px; font-size: 12.5px; }   /* Connect Wallet อยู่แถบบนแทนป้ายแพ็กเกจ */
  .brand__name { display: none; }                     /* บนมือถือแสดงแค่โลโก้ ไม่แสดงชื่อเว็บ */
  .brand__logo--wide { display: none; }
  .brand__logo--phone:not([hidden]) { display: block; height: 36px; max-width: 132px; }
  .chip--pkg { display: inline-flex; }

  /* แสดงทีละหน้าจอตาม body[data-screen] */
  body[data-screen="home"] .screen:not(#home),
  body[data-screen="mine"] .screen:not(#mine),
  body[data-screen="plans"] .screen:not(#plans),
  body[data-screen="wallet"] .screen:not(#wallet) { display: none; }
  body:not([data-screen="plans"]) .foot { display: none; }
  .screen { animation: screen-in .35s cubic-bezier(.2, .8, .2, 1); }
  /* เว้นที่ด้านล่างไว้ให้แถบควบคุมการขุดและแถบแท็บ (หน้า Plans ให้ท้ายหน้าเป็นคนเว้นแทน) */
  main.wrap { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  body[data-screen="plans"] main.wrap { padding-bottom: 0; }
  .overview { padding-top: 18px; }
  .station { padding-top: 16px; }
  .plans { padding-top: 20px; }
  .wallet { padding-top: 20px; }
  .foot { margin-top: 32px; padding-bottom: calc(170px + env(safe-area-inset-bottom)); }

  .appnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 16, .88);
    -webkit-backdrop-filter: saturate(1.4) blur(16px);
    backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line-soft);
    box-shadow: 0 -14px 30px -18px rgba(0, 0, 0, .9);
  }
  .appnav__item {
    position: relative; isolation: isolate; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px 5px; border: 0; border-radius: 14px;
    background: none; color: var(--muted);
    font-size: 11px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .appnav__item .icon { width: 23px; height: 23px; }
  .appnav__item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .appnav__item[aria-current="page"] { color: #FFFFFF; }
  .appnav__item[aria-current="page"] .icon { color: var(--cyan-hi); filter: drop-shadow(0 0 6px rgba(34, 211, 238, .7)); }
  .appnav__item[aria-current="page"]::before {
    content: ""; position: absolute; z-index: -1; inset: 1px 14%;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(139, 92, 246, .32), rgba(99, 102, 241, .1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
  }
  .appnav__live { display: none; position: absolute; top: 5px; right: calc(50% - 17px); width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, .9); }
  .is-mining .appnav__live:not(.appnav__live--wallet) { display: block; }
  .appnav__item[data-connected] .appnav__live--wallet { display: block; }
  .appnav__item[data-busy] { opacity: .7; }

  /* แถบควบคุมการขุดลอยอยู่เหนือแถบแท็บ */
  .dock {
    bottom: calc(64px + env(safe-area-inset-bottom));
    padding: 10px 12px 8px;
    background: none;
    transform: translateY(calc(100% + 90px));
  }
  .toasts { bottom: calc(82px + env(safe-area-inset-bottom)); }
  .show-dock .toasts { bottom: calc(158px + env(safe-area-inset-bottom)); }
}

/* ---------- แอนิเมชัน ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes pulseGlow { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes breathe { 50% { box-shadow: 0 0 30px rgba(34, 211, 238, .95); } }
@keyframes share {
  0%, 25% { opacity: 1; box-shadow: 0 0 34px 6px rgba(243, 232, 255, .75), inset 0 0 24px rgba(243, 232, 255, .45); }
}
@keyframes nudge {
  0% { box-shadow: 0 0 0 0 rgba(167, 139, 250, .6), 0 6px 0 var(--violet-deep), 0 20px 36px -12px rgba(124, 58, 237, .8); }
  100% { box-shadow: 0 0 0 18px rgba(167, 139, 250, 0), 0 6px 0 var(--violet-deep), 0 20px 36px -12px rgba(124, 58, 237, .8); }
}
@keyframes card-in { from { opacity: 0; transform: translateX(16px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .is-mining .brand__mark svg,
  .power[aria-pressed="true"] .power__key::after,
  .power[data-upsell] .power__key::after,
  .power.is-nudge,
  .sock.is-share .fan__glow,
  .rig[data-phase] .led { animation: none; }
  .fan, .card3, .card3__img, .sock__plate, .dock, .show-dock .dock, .ov-card, .plan { transition: none; }
  .gpanel:not([hidden]), .screen, .bgfx__glow { animation: none; }
  .modal[open], .toast, .toast.is-leaving { animation: none; }
}
