/* =========================================================
   mobile.css - responsive layer for Pinoy Talisman Online
   Loaded AFTER style19.css. Desktop (wider than 1040px) is untouched.
   ========================================================= */

/* Text labels for the nav; hidden on desktop where the sprite image is used */
.navigation .navtxt { display: none; }

@media (max-width: 1040px) {

  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 11pt; background-size: auto; overflow-x: hidden; }
  img, iframe, video { max-width: 100%; }

  /* ---------- page frame ---------- */
  #wrapper { width: 100%; }
  #main {
    width: 100%; max-width: 640px; margin: 0 auto;
    display: flex; flex-direction: column; align-items: stretch;
    background-size: min(520px, 100%) auto;
  }
  #main > .clear { display: none; }

  /* ---------- header + floating widgets ---------- */
  #header { order: 1; height: auto; padding: 16px 0 4px; text-align: center; }
  #header a img { position: static; width: 200px; height: auto; margin: 0 auto; }

  .navigation { order: 2; }
  .servertime, .blood_palace, .blood_palace2 {
    position: static; margin: 8px auto 0;
  }
  .servertime { order: 3; }
  .blood_palace, .blood_palace2 { order: 4; }
  .container { order: 5; }
  #footer { order: 6; }

  /* ---------- navigation: text buttons instead of the sprite ---------- */
  .navigation { width: auto; height: auto; margin: 8px 8px 4px; }
  .navigation ul { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .navigation li, .navigation li:nth-child(n) {
    width: auto; height: auto; overflow: visible; flex: 1 1 28%; display: block;
  }
  .navigation li img { display: none; }
  .navigation .navtxt {
    display: block; text-align: center; text-transform: uppercase;
    font-family: "Oswald", "MyriadProRegular", sans-serif; font-size: 11pt;
    padding: 12px 6px; color: #b98762;
    background: linear-gradient(#24130e, #0b0807);
    border: 1px solid #4a3830; border-radius: 3px;
  }
  .navigation a:active .navtxt, .navigation a:hover .navtxt { color: #e0a56f; border-color: #6b4332; }

  /* ---------- columns -> one stack (display:contents lets us reorder widgets) ---------- */
  .container { display: flex; flex-direction: column; align-items: center; width: 100%; }
  .container_left, .container_right, .container_right2 { display: contents; }

  .login_panel, .my_account          { order: 1; margin-top: 12px; }
  .quicklinks2                       { order: 2; margin-top: 12px; }
  .container_middle, .container_middle2 { order: 3; }
  .quicklinks                        { order: 4; margin-top: 12px; }
  .server_status                     { order: 5; }
  .ranking                           { order: 6; margin-top: 10px; }
  .facebook-frame                    { order: 7; }
  .itemshop, .facebook               { order: 8; }

  /* ---------- middle content panel ---------- */
  .container_middle, .container_middle2 { float: none; width: 100%; margin: 12px 0 0; }
  .container_middle_top, .container_middle_top2,
  .container_middle_bottom, .container_middle_bottom2 { width: 100%; background-size: 100% 100%; }
  .container_middle_center, .container_middle_center2 {
    width: 100%; min-height: 200px; background-size: 100% auto;
    overflow-wrap: break-word; -webkit-box-sizing: border-box; box-sizing: border-box;
  }
  .container_middle_center img, .container_middle_center2 img { max-width: 100%; height: auto; }

  .page, .pagepanel, .undopagepanel, .buypage, .referfriendpage, .luckywheelpage {
    padding: 10px 14px;
  }
  .header, .page .page-header, .pagepanel .page-header, .undopagepanel .page-header,
  .buypage .page-header, .referfriendpage .page-header, .luckywheelpage .page-header {
    width: 100%; max-width: 526px; margin-left: 0; margin-right: 0;
    background-position: left center; background-size: 526px 35px;
  }
  .page .page-table, .pagepanel .page-table, .undopagepanel .page-table,
  .buypage .page-table, .referfriendpage .page-table, .luckywheelpage .page-table {
    width: 100%;
  }
  /* wide data tables (rankings, logs...) scroll sideways instead of overflowing */
  .page .page-table.table, .pagepanel .page-table.table, .buypage .page-table.table,
  .referfriendpage .page-table.table, .luckywheelpage .page-table.table,
  .news_content table, .cpanel_content table {
    display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  }

  /* ---------- home page blocks ---------- */
  .slider { width: 100%; height: auto; aspect-ratio: 520 / 149; }
  .slider .cycle-slideshow, .slider .cycle-slideshow img { width: 100% !important; height: auto; }

  .news, .cpanel, .server_info { width: 100%; }
  .news_content, .cpanel_content { width: 100%; }
  .news_content table, .cpanel_content table { width: 100%; }
  .news_content tr>td:nth-child(1), .cpanel_content tr>td:nth-child(1) { width: auto; }
  .news_content tr>td:nth-child(2) { width: 105px; font-size: 9pt; }

  /* class showcase: keeps its artwork, scrolls sideways on narrow phones */
  #peopleArea { width: 100%; height: auto; margin: 20px 0; }
  #peopleCon { width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  #peopleCon > div { min-width: 520px; }

  .welcome_area { width: 100%; height: auto; min-height: 234px; background-size: cover; }
  .welcome_area p { width: auto; }
  canvas.tutCanvas { max-width: 100%; height: auto; }

  /* ---------- forms: 16px stops iOS from zooming on focus, bigger tap targets ---------- */
  input[type="text"], input[type="password"], input[type="email"],
  input[type="number"], select, textarea { font-size: 16px !important; min-height: 36px; }
  .page .page-table input[type="submit"], .pagepanel .page-table input[type="submit"],
  .buypage .page-table input[type="submit"], .referfriendpage .page-table input[type="submit"],
  .page .page-table input[type="button"], .pagepanel .page-table input[type="button"] {
    min-height: 40px; font-size: 11pt;
  }
  .page-table td, .page-table th { overflow-wrap: anywhere; }

  /* ---------- footer ---------- */
  #footer { height: auto; padding: 20px 8px 30px; }
  #footer_box {
    width: auto; height: auto; top: 0; padding: 10px; text-align: center;
  }
  #footer_box .logo, #footer_box .developer { display: none; }
  #footer_box .copyright { width: auto; float: none; padding-top: 0; }

  /* ---------- popup message ---------- */
  .popmodalconent { margin: 30vh 16px 0; max-width: calc(100% - 32px); }
}

/* Small phones */
@media (max-width: 420px) {
  #header a img { width: 170px; }
  .navigation li, .navigation li:nth-child(n) { flex-basis: 44%; }
  .page, .pagepanel, .undopagepanel, .buypage, .referfriendpage, .luckywheelpage { padding: 10px 10px; }
}
