/*
 DPBOSS RATAN LANDING MOBILE FINAL
 FRONTEND RESPONSIVE CSS ONLY
 Desktop >= 901px unchanged
*/

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

@media (max-width: 900px) {

  html {
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

  body {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
    overflow-x: hidden !important;
  }

  img,
  video,
  iframe {
    max-width: 100% !important;
    height: auto;
  }

  /* =================================
     MAIN LANDING SECTIONS
     ================================= */

  .m-icon,
  .brand-header-box,
  .text2,
  .nav-bar-box,
  .ticker-box,
  .text3,
  .f-pti,
  .promo-box-red,
  .seo-keywords-box,
  .market-master-section,
  #markets,
  .sta-div,
  .sun-col,
  .my-table,
  .eml-us {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* =================================
     WELCOME / BRAND
     ================================= */

  .m-icon {
    padding: 7px 8px !important;
    border-radius: 8px !important;
  }

  .m-icon p {
    margin: 0 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    text-align: center !important;
  }

  .brand-header-box {
    padding: 10px 6px !important;
    text-align: center !important;
  }

  .brand-title {
    font-size: clamp(27px, 9vw, 38px) !important;
    line-height: 1.05 !important;
    white-space: normal !important;
  }

  .brand-badge {
    font-size: 11px !important;
    vertical-align: middle !important;
  }

  /* =================================
     INTRO TEXT
     ================================= */

  .text2,
  .text3 {
    padding: 10px 9px !important;
  }

  .text2 h1 {
    font-size: 18px !important;
    line-height: 1.3 !important;
    margin: 3px 0 7px !important;
  }

  .text2 h2,
  .text3 h2 {
    font-size: 13px !important;
    line-height: 1.45 !important;
  }

  .text3 p {
    font-size: 12px !important;
    line-height: 1.45 !important;
  }

  /* =================================
     TOP NAV - MOBILE SWIPE BAR
     ================================= */

  .nav-bar-box {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 5px !important;

    padding: 6px !important;

    overflow-x: auto !important;
    overflow-y: hidden !important;

    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-bar-box::-webkit-scrollbar {
    display: none;
  }

  .nav-item-btn {
    flex: 0 0 auto !important;
    min-width: 76px !important;
    min-height: 40px !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 7px 10px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;

    border-radius: 7px !important;
    white-space: nowrap !important;

    touch-action: manipulation;
  }

  /* =================================
     NOTICE TICKER
     ================================= */

  .ticker-box {
    display: grid !important;
    grid-template-columns: auto minmax(0,1fr) !important;
    align-items: center !important;

    min-height: 42px !important;
    padding: 4px 6px !important;

    overflow: hidden !important;
  }

  .ticker-tag {
    position: static !important;
    min-width: auto !important;
    padding: 6px 7px !important;
    font-size: 10px !important;
    white-space: nowrap !important;
  }

  .ticker-scroll {
    min-width: 0 !important;
    font-size: 11px !important;
  }

  /* =================================
     GOLDEN / FINAL ANK
     ================================= */

  .dflex {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }

  .j52g4 {
    width: 100% !important;
    max-width: 100% !important;

    border-right: 0 !important;
    border-left: 0 !important;

    padding: 10px !important;
  }

  .j52g4 + .j52g4 {
    border-top: 1px solid #ff233d !important;
  }

  .f-pti h3,
  .j52g4 h4 {
    font-size: 14px !important;
  }

  .j52g4 p {
    font-size: 15px !important;
    overflow-wrap: anywhere !important;
  }

  /* =================================
     PROMO / SEO
     ================================= */

  .promo-box-red,
  .seo-keywords-box {
    padding: 10px !important;
  }

  .promo-box-red p {
    font-size: 12px !important;
    line-height: 1.5 !important;
  }

  .download-app-btn {
    display: inline-flex !important;
    min-height: 42px !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
  }

  .seo-keywords-box {
    font-size: 10px !important;
    line-height: 1.55 !important;
    overflow-wrap: anywhere !important;
  }

  /* =================================
     MARKET TITLE
     ================================= */

  .sm-ttle,
  .full-market-title {
    width: 100% !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-wrap: wrap !important;

    gap: 6px !important;
    padding: 8px !important;

    text-align: center !important;
  }

  .sm-ttle span,
  .full-market-title span {
    flex: 1 1 100% !important;
    font-size: 14px !important;
    line-height: 1.25 !important;
  }

  .clk1-rld {
    position: static !important;
    transform: none !important;

    min-height: 36px !important;
    padding: 6px 13px !important;

    font-size: 11px !important;
    line-height: 1 !important;

    margin: 0 auto !important;
  }

  /* =================================
     MAIN MARKET GRID
     ================================= */

  #allMarketsGrid {
    width: 100% !important;
    max-width: 100% !important;

    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;

    gap: 8px !important;
    padding: 5px !important;
  }

  /*
    Mobile card:
    MARKET NAME
    RESULT
    TIME

    JODI | CHART | PANEL
  */

  #allMarketsGrid .full-market-row {
    position: relative !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    min-height: 145px !important;
    height: auto !important;

    display: grid !important;

    grid-template-columns:
      repeat(3, minmax(0,1fr)) !important;

    grid-template-areas:
      "info info info"
      "jodi chart panel" !important;

    align-items: center !important;

    gap: 8px !important;

    padding:
      12px 10px 10px !important;

    overflow: hidden !important;
  }

  #allMarketsGrid .center-info {
    grid-area: info !important;

    position: static !important;
    transform: none !important;

    width: 100% !important;
    max-width: 100% !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 0 !important;
    margin: 0 !important;

    text-align: center !important;
  }

  #allMarketsGrid .h8 {
    display: block !important;

    margin: 0 0 4px !important;

    font-size: clamp(15px,5vw,20px) !important;
    line-height: 1.1 !important;

    text-align: center !important;
    overflow-wrap: anywhere !important;
  }

  #allMarketsGrid .h9 {
    display: block !important;

    margin: 0 !important;

    font-size: clamp(21px,7vw,28px) !important;
    line-height: 1.1 !important;

    text-align: center !important;
    overflow-wrap: anywhere !important;
  }

  #allMarketsGrid .time {
    margin: 7px 0 0 !important;

    font-size: 10px !important;
    line-height: 1.25 !important;

    text-align: center !important;
    white-space: normal !important;
  }

  /* JODI */

  #allMarketsGrid .btn-jodi-action {
    grid-area: jodi !important;
  }

  /* CHART */

  #allMarketsGrid .btn-chart-action {
    grid-area: chart !important;
  }

  /* PANEL */

  #allMarketsGrid .btn-panel-action {
    grid-area: panel !important;
  }

  /* Reset old absolute positioning */

  #allMarketsGrid .btn-side-action,
  #allMarketsGrid .btn-chart-action {
    position: static !important;

    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;

    transform: none !important;

    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;

    min-height: 39px !important;
    height: auto !important;

    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    padding: 7px 4px !important;

    border-radius: 8px !important;

    font-size: 10px !important;
    line-height: 1 !important;

    white-space: nowrap !important;

    text-align: center !important;

    touch-action: manipulation;
  }

  /*
   Ensure CHART remains visible on mobile.
  */
  #allMarketsGrid .btn-chart-action {
    display: inline-flex !important;
  }

  /* =================================
     LIVE HIGHLIGHT
     ================================= */

  #liveHighlightContent {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  #liveHighlightContent .h8 {
    font-size: 16px !important;
  }

  #liveHighlightContent .h9 {
    font-size: 24px !important;
  }

  /* =================================
     OLD GENERAL MARKET ROWS, IF ANY
     ================================= */

  .market-row-split {
    max-width: 100% !important;
  }

  /* =================================
     CHART LINK SECTIONS
     ================================= */

  .sta-div {
    padding: 8px !important;
  }

  .sta-div a {
    display: block !important;

    width: 100% !important;
    max-width: 100% !important;

    margin: 5px 0 !important;
    padding: 9px 8px !important;

    overflow-wrap: anywhere !important;
  }

  .sun-col {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 8px !important;
  }

  /* =================================
     TABLES
     ================================= */

  .my-table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .my-table table {
    width: 100% !important;
    min-width: 560px;
  }

  /* =================================
     FORM / BUTTON SAFETY
     ================================= */

  input,
  select,
  textarea {
    max-width: 100% !important;
  }

  button,
  a {
    touch-action: manipulation;
  }

  /* =================================
     PREVENT RANDOM PAGE OVERFLOW
     ================================= */

  pre,
  code,
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}


/* =====================================
   SMALL PHONE: 480px
   ===================================== */

@media (max-width: 480px) {

  body {
    padding-left: 3px !important;
    padding-right: 3px !important;
  }

  .brand-title {
    font-size: 29px !important;
  }

  .nav-item-btn {
    min-width: 68px !important;
    min-height: 38px !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
  }

  #allMarketsGrid {
    padding: 3px !important;
    gap: 6px !important;
  }

  #allMarketsGrid .full-market-row {
    min-height: 136px !important;
    padding: 10px 7px 8px !important;
    gap: 6px !important;
  }

  #allMarketsGrid .h8 {
    font-size: 16px !important;
  }

  #allMarketsGrid .h9 {
    font-size: 23px !important;
  }

  #allMarketsGrid .time {
    font-size: 9px !important;
  }

  #allMarketsGrid .btn-side-action,
  #allMarketsGrid .btn-chart-action {
    min-height: 37px !important;
    font-size: 9px !important;
  }
}


/* =====================================
   EXTRA SMALL: 360px
   ===================================== */

@media (max-width: 360px) {

  .brand-title {
    font-size: 26px !important;
  }

  .sm-ttle span,
  .full-market-title span {
    font-size: 12px !important;
  }

  #allMarketsGrid .h8 {
    font-size: 14px !important;
  }

  #allMarketsGrid .h9 {
    font-size: 20px !important;
  }

  #allMarketsGrid .full-market-row {
    min-height: 130px !important;
  }

  #allMarketsGrid .btn-side-action,
  #allMarketsGrid .btn-chart-action {
    padding-left: 2px !important;
    padding-right: 2px !important;
    font-size: 8px !important;
  }
}

/* =====================================================
   DPBOSS RATAN MOBILE MARKET BUTTON ORDER FIX
   CHART = LEFT
   JODI  = CENTER IF PRESENT
   PANEL = RIGHT
   UI ONLY - NO FUNCTION/API CHANGE
   ===================================================== */

@media (max-width: 900px) {

  #allMarketsGrid .full-market-row {
    grid-template-columns:
      repeat(3, minmax(0, 1fr)) !important;

    grid-template-areas:
      "info info info"
      "chart jodi panel" !important;
  }

  /* CHART LEFT */
  #allMarketsGrid .btn-chart-action {
    grid-area: chart !important;

    position: static !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;

    transform: none !important;

    width: 100% !important;
    min-width: 0 !important;

    justify-self: stretch !important;
    display: inline-flex !important;
  }

  /* JODI keeps its function; only moves to middle if visible */
  #allMarketsGrid .btn-jodi-action {
    grid-area: jodi !important;

    position: static !important;
    left: auto !important;
    right: auto !important;

    transform: none !important;

    width: 100% !important;
    min-width: 0 !important;

    justify-self: stretch !important;
  }

  /* PANEL RIGHT */
  #allMarketsGrid .btn-panel-action {
    grid-area: panel !important;

    position: static !important;
    left: auto !important;
    right: auto !important;

    transform: none !important;

    width: 100% !important;
    min-width: 0 !important;

    justify-self: stretch !important;
  }
}
