/* =============== Shared tokens =============== */
:root{
  --radius:16px;

  /* Card colors (keep dark on both themes) */
  --panel:#171e27;
  --panel-2:#111821;
  --text:#e8eef6;
  --muted:#9fb0c4;
  --chip:#222b36;
  --red:#ff4d4f;
  --orange:#ff9f43;
  --green:#2ecc71;
}

/* ===== Day theme variables ===== */
.theme-day{
  --page-fg:#1a1f29;
  --page-bg1:#fff7e0;
  --page-bg2:#ffe9bd;
  --bgPattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' fill-opacity='0.18'%3E%3Ccircle cx='40' cy='40' r='28' fill='%23FFC84A'/%3E%3Ccircle cx='160' cy='120' r='36' fill='%23FFB23B'/%3E%3Ccircle cx='100' cy='200' r='24' fill='%23FFD46A'/%3E%3C/g%3E%3C/svg%3E");
  --pattern-opacity:.22;
  --header-grad:linear-gradient(180deg,rgba(15,20,27,.95),rgba(15,20,27,.82));
}

/* ===== Night theme variables ===== */
.theme-night{
  --page-fg:#e8eef6;
  --page-bg1:#0f141b;
  --page-bg2:#0b1118;
  --bgPattern:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Ccircle cx='20' cy='30' r='1.6'/%3E%3Ccircle cx='120' cy='140' r='1.2'/%3E%3Ccircle cx='200' cy='80' r='1.4'/%3E%3Ccircle cx='80' cy='200' r='1.1'/%3E%3C/g%3E%3C/svg%3E");
  --pattern-opacity:.35;
  --header-grad:linear-gradient(180deg,rgba(11,17,24,.98),rgba(11,17,24,.9));
}

/* =============== Base styles =============== */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  color:var(--page-fg);
  background: linear-gradient(180deg, var(--page-bg1), var(--page-bg2));
  position:relative;
}
body::before{
  content:"";
  position:fixed; inset:0;
  background-image: var(--bgPattern);
  background-repeat: repeat;
  background-size: 900px auto;
  opacity: var(--pattern-opacity);
  pointer-events:none;
  z-index:-1;
}
/* Global reset & container */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { height: 100%; }
img { display:block; max-width:100%; height:auto; }

.container{
  width: clamp(320px, 92vw, 1280px);   /* phone → desktop */
  margin: 0 auto;
  padding-inline: 8px;
}

/* Header */
.app-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 4px;
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand .logo{ width:28px; height:28px; object-fit:contain; }

/* ---------- HERO SLIDER (responsive) ---------- */
.hero{
  position: relative;
  width: 100%;
  /* height နေရာမှာ aspect-ratio + clamp ကိုသုံး → phone/tablet/pc မှာ လိုက်လျော */
  aspect-ratio: 21 / 9;
  height: auto;
  margin: 10px 0 16px;
  border-radius: 14px;
  overflow: hidden;
  background: #111821;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}

/* Tablet */
@media (max-width: 1024px){
  .hero{ aspect-ratio: 16 / 7; }
}

/* Phone */
@media (max-width: 600px){
  .container{ width: 100%; padding-inline: 10px; }
  .hero{ aspect-ratio: 16 / 9; border-radius: 10px; }
  .hero .nav{ display:none; }          /* phone မှာ arrows မလို */
}

/* ---------- GAME GRID (fully responsive) ---------- */
.grid{
  display:grid;
  gap: 14px;
  /* auto-fit + minmax → column count auto adjust */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

/* Card */
.card{
  background: #121a24;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  display:flex;
  flex-direction: column;
  
}
.card .thumb{ width:100%; aspect-ratio: 16 / 11; object-fit: cover; }
.card .content{ padding:10px; }
.card .row{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.badge{
  padding:4px 8px; border-radius:10px; color:#111; font-weight:700; background:#fff;
}
.badge.green{ background:#2ecc71; } .badge.orange{ background:#f39c12; } .badge.red{ background:#e74c3c; }

.bar{ position:relative; width:100%; height:8px; border-radius:6px; background:#233042; margin-top:8px; overflow:hidden; }
.bar > i{ position:absolute; inset:0 auto 0 0; width:0%; background:#2ecc71; }

/* Narrow phones */
@media (max-width: 380px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; }
  .card .thumb{ aspect-ratio: 4 / 3; }
}

/* ===== stacked floating buttons (always visible) ===== */
.fab-stack{
  position: fixed;
  right: clamp(12px, 2vw, 18px);
  bottom: calc(16px + env(safe-area-inset-bottom)); /* iOS safe area */
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vw, 12px);
  z-index: 9999;                       /* above everything */
}

/* Button panel */
.fab{
  width: clamp(52px, 7.5vw, 64px);
  height: clamp(52px, 7.5vw, 64px);
  border-radius: 14px;                 /* rounded square */
  background: #ffffff;                 /* panel bg */
  box-shadow: 0 10px 24px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.18);
  display: grid; place-items: center;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
  isolation: isolate;                  /* keep ::after under the icon */
  --ring: #3ba9ff;                     /* default pulse ring color */
  animation: fab-attention 5.2s ease-in-out infinite; /* wiggle loop */
}
.fab:hover{
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(0,0,0,.32), 0 4px 10px rgba(0,0,0,.2);
  /* pause animation on hover (optional) */
  animation-play-state: paused;
}
.fab img{
  width: 68%; height: 68%;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.15));
  animation: fab-tilt 5.2s ease-in-out infinite; /* sync wiggle for icon */
  animation-delay: inherit;
}
/* pulsing ring under button */
.fab::after{
  content:"";
  position:absolute; inset:0;
  border-radius: 14px;
  z-index: -1;
  box-shadow: 0 0 0 0 var(--ring);
  opacity: 0;
  animation: fab-pulse 5.2s ease-out infinite;
  animation-delay: inherit;
}

/* Stagger timing for multiple buttons */
.fab-stack .fab:nth-child(1){ animation-delay: 0s; }
.fab-stack .fab:nth-child(2){ animation-delay: .8s; }
.fab-stack .fab:nth-child(3){ animation-delay: 1.6s; }

/* Brand ring colors (optional) */
.fab.tg    { --ring:#2AABEE; }  /* Telegram */
.fab.viber { --ring:#7360F2; }  /* Viber   */

/* Keyframes */
@keyframes fab-attention{
  0%,68%,100% { transform: translateY(0) rotate(0); }
  72% { transform: translateY(-3px) rotate(3deg); }
  74% { transform: translateY( 2px) rotate(-3deg); }
  76% { transform: translateY(-2px) rotate(2deg); }
  78% { transform: translateY( 0) rotate(0); }
}
@keyframes fab-tilt{
  0%,68%,100% { transform: rotate(0); }
  72% { transform: rotate(6deg); }
  74% { transform: rotate(-6deg); }
  76% { transform: rotate(4deg); }
  78% { transform: rotate(0); }
}
@keyframes fab-pulse{
  0%,68% { box-shadow: 0 0 0 0 var(--ring); opacity:0; }
  72%    { box-shadow: 0 0 0 0 var(--ring); opacity:.35; }
  100%   { box-shadow: 0 0 0 22px rgba(0,0,0,0); opacity:0; }
}

/* optional: show only on mobile (remove if you want PC too) */
@media (min-width: 1024px){
  /* .fab-stack{ display:none; } */
}

/* accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .fab, .fab img, .fab::after { animation: none !important; }
}
/* container width ထိန်းပြီး အလယ်တည် */
.top-banner{
  width: min(1280px, 96vw);
  margin: 12px auto 16px;
}

/* ပုံကို မဖြတ်ဘဲ တင် (အမြင့် auto) */
.top-banner img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  background:#0e1722;          /* load ချာချာအချိန် letterbox color */
}

/* အပြည့်ဖြစ်ချင် (crop လိုက်ရင် OK) -> အောက်က ၃ကြောင်းကို ပွင့်ချင်ရင်ပွင့် */
 /* .top-banner img{ height: clamp(140px, 26vw, 260px); object-fit: cover; object-position: center; } */

/* header */
.app-header{
  position:sticky; top:0; z-index:10;
  background: var(--header-grad);
  backdrop-filter: blur(8px);
  border-bottom:1px solid #223140;
  padding:12px clamp(12px, 2vw, 24px);
  color:#e8eef6;
  display:flex; align-items:center; gap:12px; justify-content:space-between;
}
.brand{ display:flex; align-items:center; gap:10px; }
.brand .logo{
  width:50px; height:50px; 
}
.app-header h1{ margin:0; font-size:20px; letter-spacing:.2px; color: #ff8c00; }

/* theme toggle button */
.theme-btn{
  appearance:none; border:1px solid #2e3b4c; border-radius:999px;
  background:#1c2532; color:#e8eef6; font-weight:700; font-size:13px;
  padding:6px 10px; cursor:pointer;
}
.theme-btn:hover{ filter: brightness(1.05); }

.wrap{ padding:18px clamp(12px, 2vw, 24px) 28px; }

/* ====== Hero slider ====== */
.hero{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  margin:8px 0 18px;
  background:#0e1520;
  border:1px solid #223140;
  box-shadow: 0 16px 32px rgba(0,0,0,.18);
}
.hero .viewport{ overflow:hidden; width:100%; }
.hero .track{
  display:flex; transition: transform .6s cubic-bezier(.2,.9,.3,1);
  will-change: transform;
}
.hero .slide{
  position:relative; flex:0 0 100%; height:180px;
}
.hero .slide img{
  width:100%; height:100%; object-fit:cover; display:block;
}
.hero .dots{
  position:absolute; left:0; right:0; bottom:10px; display:flex; justify-content:center; gap:6px;
}
.hero .dot{
  width:9px; height:9px; border-radius:50%; background:#a4b1c3; opacity:.6; cursor:pointer;
  border:1px solid rgba(0,0,0,.2);
}
.hero .dot.active{ opacity:1; background:#fff; }
.hero:hover .dot{ transform:scale(1.05); }

/* ===== Cards ===== */
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap:18px;
}

.card{
  background:var(--panel);
  border-radius:var(--radius);
  border:1px solid #243244;
  overflow:hidden;
  box-shadow: 0 10px 22px rgba(163, 159, 159, 0.18);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover{ transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.25); }

.thumb{
  aspect-ratio:16/11;
  width:100%;
  background:var(--panel-2);
  display:block;
  object-fit:cover;
}

.content{ padding:12px; color:var(--text); }
.title{
  font-weight:700; font-size:15px; line-height:1.15; margin:0 0 8px;
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
}
.subtitle{
  margin:0 8px 10px 0; font-size:12px; color:var(--muted);
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
  display:inline-block;
}

.row{ display:flex; align-items:center; gap:8px; }
.badge{
  margin-left:auto;
  background:var(--chip); color:#fff; font-weight:800;
  padding:4px 10px; border-radius:999px; font-size:12px; min-width:46px; text-align:center;
  border:1px solid #2e3b4c;
}
.badge.red{ background: linear-gradient(180deg, #3a1114, #2b0b0d); color:#ffd9db; border-color:#4d1c22; }
.badge.orange{ background: linear-gradient(180deg, #3a2a10, #2b1d0b); color:#ffe6bf; border-color:#4a3716; }
.badge.green{ background: linear-gradient(180deg, #10341f, #0b2416); color:#d9ffe8; border-color:#1d5b36; }

.bar{
  height:8px; background:#243244; border-radius:999px; overflow:hidden; margin-top:8px;
  border:1px solid #2e3b4c;
}
.bar > i{
  display:block; height:100%; width:0%; background:var(--red);
  transition: width .6s cubic-bezier(.2,.9,.3,1), background .3s;
}

.meta{
  display: none;
  margin-top:18px; color:#3a4150; font-size:12px; opacity:.9; text-align:center;
}

/* responsive: 2-cols on small phones */
@media (max-width:480px){
  .wrap{ padding:14px 10px 22px; }
  .hero .slide{ height:140px; }
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); gap:12px; }
  .title{ font-size:13px; }
  .badge{ min-width:40px; padding:3px 8px; font-size:11px; }
  .bar{ height:7px; }
}
.card .title { 
  display: none !important;
}
/* ====== Side-by-side card (thumb left, info right, meter bottom) ====== */
.card.card--side{
  display: grid;
  grid-template-columns: 88px 1fr;      /* 左側thumb + 右側content */
  align-items: stretch;
}

.card.card--side .thumb{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel-2);
}

.card.card--side .content{
  padding: 10px 12px 8px 10px;
  display: grid;
  grid-template-rows: auto auto 1fr auto; /* provider row / subtitle / spacer / meter */
}

.card.card--side .title{ display:none !important; } /* title မပြ */

.card.card--side .subtitle{
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.card.card--side .row{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

/* percent badge (single) */
.card.card--side .badge{
  margin-left: 0;
  font-weight: 800;
  min-width: 46px;
}

/* meter = bottom bar (full width under both columns) */
.card.card--side .bar{
  grid-column: 1 / -1;
  height: 10px;
  margin: 10px 12px 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #243244;
  border: 1px solid #2e3b4c;
}
.card.card--side .bar > i{
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width .5s cubic-bezier(.2,.9,.3,1), background .25s;
}

/* grid column width ကို card side layout အလိုက် အနည်းငယ်တုတ် */
.grid{
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
@media (max-width:480px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* title/provider မထင်အောင် ချုပ်ပိတ် */
.card.card--side .title,
.card.card--side .provider { display: none !important; }

/* row alignment + label style */
.card.card--side .row{ display:flex; align-items:center; gap:10px; }
.card.card--side .only-label{
  font-size: 12px;
  color: var(--muted); /* သင့် theme variable */
}
/* ===== Side card – label on top, percent under it, responsive meter ===== */
.card.card--side{
  --pad-x: 12px;
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: stretch;
  overflow: hidden;               /* bar can't spill out */
  border-radius: var(--radius);
}

.card.card--side .thumb{
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel-2);
}

.card.card--side .content{
  padding: 10px var(--pad-x) 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;                       /* label ↕ percent spacing */
}

/* Title/Provider မလိုတော့ */
.card.card--side .title,
.card.card--side .provider{ display:none !important; }

/* 🅰️ အပေါ် — label */
.card.card--side .only-label{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

/* 🅱️ အောက် — percent row */
.card.card--side .row{
  display: flex;
  align-items: center;
  gap: 10px;
}

.card.card--side .badge{
  font-weight: 800;
  min-width: 46px;
}

/* ✅ Responsive meter at bottom (inside card width) */
.card.card--side .bar{
  grid-column: 1 / -1;           /* span full card */
  height: 10px;
  margin: 8px var(--pad-x) 12px; /* left/right = card padding so it aligns */
  border-radius: 999px;
  overflow: hidden;
  background: #243244;
  border: 1px solid #2e3b4c;
  box-sizing: border-box;        /* border doesn't make it overflow */
}
.card.card--side .bar > i{
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width .5s cubic-bezier(.2,.9,.3,1), background .25s;
}

/* Grid responsive tweak so card width များလာရင် meter မလွှဲ */
.grid{
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
@media (max-width: 480px){
  .grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* Card ကို clip-able အဖြစ် သတ်မှတ် (border-radius အတူ clip) */
.card{
  position: relative;
  border-radius: var(--radius, 12px);
  overflow: clip;
  box-sizing: border-box;
  --card-pad-x: 12px;
  --card-pad-y: 10px;
}
/* older browser fallback */
@supports not (overflow: clip){
  .card{ overflow: hidden; }
}

/* side layout content */
.card.card--side .content{
  padding: var(--card-pad-y) var(--card-pad-x) 8px 10px;
}

/* ✅ meter bar is always inside the card box */
.card .bar{
  display:block;
  grid-column: 1 / -1;
  height: 10px;
  /* left/right = card padding; bottom = card padding */
  margin: 8px var(--card-pad-x) var(--card-pad-y);
  /* ensure width never exceeds card inner width */
  max-width: calc(100% - (var(--card-pad-x) * 2));
  background: #243244;
  border: 1px solid #2e3b4c;
  border-radius: 999px;
  box-sizing: border-box;
  overflow: hidden;           /* clip the fill */
}

/* bar fill */
.card .bar > i{
  display:block;
  height: 100%;
  width: 0%;
  background: var(--green);
  border-radius: inherit;
  transition: width .45s cubic-bezier(.2,.9,.3,1), background .25s ease;
}

/* small phones: tighter padding so it never touches edges */
@media (max-width: 380px){
  .card{ --card-pad-x: 10px; --card-pad-y: 8px; }
}
