/* News parchment + Download panel (Bamboo-inspired) */

.page-news .main,
.page-download .main {
  max-width: none !important;
  width: calc(100% - var(--sidebar-w) - var(--shell-inset) - var(--shell-gap) * 2) !important;
  margin-left: calc(var(--sidebar-w) + var(--shell-inset) + var(--shell-gap)) !important;
  margin-right: var(--shell-gap) !important;
  display: flex;
  justify-content: stretch;
  align-items: stretch;
  min-height: 100vh;
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
  padding-left: clamp(0.35rem, 1vw, 0.85rem);
  padding-right: clamp(0.75rem, 1.5vw, 1.25rem);
  box-sizing: border-box;
}

.page-news .main {
  padding-top: clamp(1.5rem, 3.5vh, 2.75rem);
}

.page-download .main {
  padding-top: clamp(1.5rem, 3vh, 2.5rem);
  padding-bottom: clamp(2rem, 4vh, 3rem);
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
  min-height: auto;
}

.page-news .wallpaper,
.page-download .wallpaper {
  background-image: url("../img/bg.png");
  background-position: center 35%;
  filter: saturate(1.05) brightness(1.05);
  opacity: 0.95;
}

.page-news .atmosphere,
.page-download .atmosphere {
  opacity: 0.25;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(20, 40, 70, 0.18));
}

/* —— News paper sheet —— */
.paper-page {
  width: 100%;
  max-width: none;
  margin: 0;
  flex: 1 1 auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.paper-sheet {
  position: relative;
  width: 100%;
  max-width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: clamp(0.85rem, 1.4vw, 1.15rem) clamp(0.85rem, 1.5vw, 1.25rem) 1.15rem;
  border-radius: 0 14px 18px 0;
  background:
    linear-gradient(165deg, #f7f1e6 0%, #f3ebdc 48%, #efe5d4 100%);
  border: 1px solid rgba(180, 150, 110, 0.28);
  border-left: none;
  box-shadow:
    0 18px 48px rgba(40, 60, 90, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  box-sizing: border-box;
  overflow: hidden;
}

.paper-sheet::before,
.paper-sheet::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), transparent 60%);
  opacity: 0.55;
  pointer-events: none;
}
.paper-sheet::before { top: 10px; left: 12px; }
.paper-sheet::after { top: 18px; right: 40px; }

.paper-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  flex: 0 0 auto;
}

.paper-tab {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(160, 140, 110, 0.28);
  background: rgba(255, 255, 255, 0.55);
  color: #6a5a48;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.paper-tab:hover {
  background: rgba(255, 255, 255, 0.85);
}

.paper-tab.is-active {
  background: #5aa8d4;
  border-color: transparent;
  color: #fff;
}

.paper-tab[data-news-tab="WARS"].is-active {
  background: #b85a5a;
}

.paper-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(0.75rem, 1.4vw, 1.1rem);
  align-items: stretch;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}

.paper-lists {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  height: 100%;
  width: 100%;
  padding: 0.7rem 0.65rem 0.75rem;
  border-radius: 12px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.82) 0%, rgba(250, 244, 232, 0.92) 100%);
  border: 1px solid rgba(180, 150, 110, 0.32);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 22px rgba(60, 80, 110, 0.08);
  box-sizing: border-box;
  overflow: hidden;
}

.paper-lists::before {
  content: "ประกาศล่าสุด";
  display: block;
  margin: 0 0.2rem 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(180, 150, 110, 0.22);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #3d8fbe;
}

.paper-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.28rem;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  scrollbar-width: thin;
}

.paper-list li[hidden] {
  display: none;
}

.paper-list a {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.55rem 0.5rem;
  border-radius: 10px;
  text-decoration: none;
  color: #3a322a;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.paper-list a:hover {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(90, 168, 212, 0.28);
  transform: translateX(2px);
}

.paper-list__dot {
  width: 7px;
  height: 7px;
  margin-top: 0.42rem;
  border-radius: 50%;
  background: linear-gradient(180deg, #6bb8e0, #3d92c0);
  box-shadow: 0 0 0 3px rgba(90, 168, 212, 0.16);
}

.paper-list__title {
  font-size: clamp(0.82rem, 0.95vw, 0.95rem);
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}

.paper-list time {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7a6a58;
  white-space: nowrap;
  padding-top: 0.18rem;
  letter-spacing: 0.02em;
}

.paper-slider {
  position: relative;
  border-radius: 4px 14px 14px 4px;
  overflow: hidden;
  background: #152433;
  border: 1px solid rgba(180, 150, 110, 0.25);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 280px;
  height: 100%;
  align-self: stretch;
  box-sizing: border-box;
}

.paper-slider__frame {
  position: absolute;
  inset: 0;
}

.paper-slider__slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  background: #152433;
}

.paper-slider__slide.is-active {
  opacity: 1;
  z-index: 1;
}

.paper-slider__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.paper-slider__btn {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: #4a4036;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(40, 50, 70, 0.18);
}

.paper-slider__btn--prev { left: 0.45rem; }
.paper-slider__btn--next { right: 0.45rem; }

.paper-foot {
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding-top: 1rem;
  flex: 0 0 auto;
}

.paper-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 160px;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #5eb0db, #3d92c0);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(61, 146, 192, 0.28);
}

.paper-more:hover {
  filter: brightness(1.04);
}

/* —— Download page (redesign) —— */
.page-download .main {
  align-items: flex-start;
  justify-content: center;
  min-height: 0;
  height: auto;
  overflow: visible;
}

.dl-page {
  width: 100%;
  max-width: min(100%, max(1320px, var(--content-max, 1320px)));
  margin: 0 auto;
  display: flex;
  flex: 0 1 auto;
  min-height: 0;
  height: auto;
  align-self: stretch;
}

.dl-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(1.1rem, 2.2vh, 1.75rem);
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: clamp(1.35rem, 2.4vh, 2rem) clamp(1.1rem, 2vw, 1.85rem) clamp(1.5rem, 2.5vh, 2.25rem);
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.94) 0%, rgba(242, 248, 255, 0.9) 55%, rgba(255, 255, 255, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 20px 52px rgba(40, 70, 110, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-sizing: border-box;
  overflow: visible;
}

.dl-hero {
  text-align: center;
  flex: 0 0 auto;
  padding: 0.35rem 0.5rem 0.15rem;
}

.dl-hero__kicker {
  margin: 0 0 0.35rem;
  font-size: clamp(0.72rem, 0.9vw, 0.82rem);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #3d8fbe;
}

.dl-hero h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.55rem, 2.6vw, 2.35rem);
  font-weight: 800;
  color: #24384c;
  letter-spacing: 0.01em;
}

.dl-hero__lead {
  margin: 0 auto;
  max-width: 42rem;
  font-size: clamp(0.92rem, 1.15vw, 1.08rem);
  line-height: 1.55;
  color: #5a7088;
}

.dl-packs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(0.75rem, 1.4vw, 1.1rem);
  flex: 0 0 auto;
}

.dl-packs--row4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dl-pack {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.75rem;
  padding: clamp(1rem, 1.6vh, 1.25rem);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(148, 190, 215, 0.32);
  box-shadow: 0 10px 24px rgba(60, 100, 140, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dl-pack__badge {
  display: inline-flex;
  align-self: start;
  width: max-content;
  margin: 0;
  padding: 0.18rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #2f5f78;
  background: rgba(217, 236, 248, 0.9);
  border: 1px solid rgba(109, 179, 212, 0.35);
  border-radius: 999px;
}

.dl-pack:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(60, 100, 140, 0.14);
}

.dl-pack--primary {
  background: linear-gradient(155deg, rgba(217, 236, 248, 0.95), rgba(255, 255, 255, 0.88));
  border-color: rgba(90, 168, 212, 0.45);
}

.dl-pack__icon {
  width: clamp(52px, 4.5vw, 64px);
  height: clamp(52px, 4.5vw, 64px);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(148, 190, 215, 0.35);
  background: #eef6fb;
}

.dl-pack__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dl-pack__body {
  min-width: 0;
}

.dl-pack__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.dl-pack__top h2 {
  margin: 0;
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  font-weight: 800;
  color: #2f5068;
}

.dl-pack__size {
  flex-shrink: 0;
  font-size: clamp(0.72rem, 0.95vw, 0.85rem);
  font-weight: 700;
  color: #3d8fbe;
}

.dl-pack__body p {
  margin: 0;
  font-size: clamp(0.82rem, 1.05vw, 0.95rem);
  line-height: 1.45;
  color: #5a7088;
}

.dl-pack__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: clamp(0.65rem, 1.2vh, 0.85rem) 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #63b7e0, #3d92c0);
  color: #fff;
  font-size: clamp(0.82rem, 1.05vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(61, 146, 192, 0.28);
}

.dl-pack__btn:hover {
  filter: brightness(1.05);
}

.dl-pack--primary .dl-pack__btn {
  background: linear-gradient(180deg, #5aa8d4, #2f7eaa);
}

.dl-guide {
  flex: 0 0 auto;
  padding: clamp(1rem, 1.8vh, 1.35rem);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(148, 190, 215, 0.28);
}

.dl-guide__head {
  text-align: center;
  margin-bottom: clamp(0.85rem, 1.6vh, 1.2rem);
}

.dl-guide__head h2 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem);
  color: #24384c;
}

.dl-guide__head p {
  margin: 0;
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  color: #6a8094;
}

.dl-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.65rem, 1.2vw, 1rem);
}

.dl-timeline__item {
  position: relative;
  display: grid;
  gap: 0.45rem;
  justify-items: start;
  padding: clamp(0.9rem, 1.5vh, 1.2rem);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 190, 215, 0.3);
  box-shadow: 0 8px 20px rgba(60, 100, 140, 0.07);
}

.dl-timeline__num {
  display: grid;
  place-items: center;
  width: clamp(2rem, 2.4vw, 2.5rem);
  height: clamp(2rem, 2.4vw, 2.5rem);
  border-radius: 50%;
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  font-weight: 800;
  color: #fff;
  background: linear-gradient(180deg, #63b7e0, #3d92c0);
  box-shadow: 0 6px 14px rgba(61, 146, 192, 0.28);
}

.dl-timeline__item strong {
  font-size: clamp(0.92rem, 1.15vw, 1.08rem);
  color: #2f5068;
  line-height: 1.3;
}

.dl-timeline__item p {
  margin: 0;
  font-size: clamp(0.8rem, 1.05vw, 0.95rem);
  line-height: 1.5;
  color: #5a7088;
}

.dl-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(0.75rem, 1.4vw, 1.15rem);
  flex: 0 0 auto;
  align-items: stretch;
  min-height: 0;
}

.dl-meta__card {
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 1.8vh, 1.35rem) clamp(1rem, 1.6vw, 1.35rem);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(148, 190, 215, 0.3);
  box-shadow: 0 8px 20px rgba(60, 100, 140, 0.07);
}

.dl-meta__card--tips {
  background: linear-gradient(145deg, rgba(247, 221, 230, 0.7), rgba(253, 232, 218, 0.65));
  border-color: rgba(220, 170, 160, 0.4);
}

.dl-meta__card h3 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  color: #2f5068;
}

.dl-meta__card--tips h3 {
  color: #8a4050;
}

.dl-meta__reqs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(0.45rem, 1vh, 0.7rem);
  flex: 1;
  align-content: start;
}

.dl-meta__reqs li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.65rem;
  align-items: baseline;
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed rgba(148, 190, 215, 0.35);
}

.dl-meta__reqs li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dl-meta__reqs span {
  font-weight: 800;
  color: #3d8fbe;
  letter-spacing: 0.04em;
}

.dl-meta__reqs strong {
  font-weight: 600;
  color: #3a5068;
}

.dl-meta__tips {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: clamp(0.45rem, 1vh, 0.7rem);
  flex: 1;
  align-content: start;
}

.dl-meta__tips li {
  font-size: clamp(0.85rem, 1.1vw, 1rem);
  line-height: 1.5;
  color: #5a4050;
}

@media (min-width: 1600px) {
  .dl-page {
    max-width: min(100%, var(--content-max, 1480px));
  }

  .dl-packs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .dl-packs--row4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .dl-shell {
    gap: 1.5rem;
    padding: 2rem 2rem 2.25rem;
  }
}

@media (min-width: 2000px) {
  .dl-page {
    max-width: min(100%, var(--content-max, 1680px));
  }
}

@media (max-width: 1100px) {
  .dl-timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dl-packs--row4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dl-timeline {
    grid-template-columns: 1fr;
  }

  .dl-meta {
    grid-template-columns: 1fr;
  }

  .dl-packs,
  .dl-packs--row4 {
    grid-template-columns: 1fr;
  }
}

/* Mid desktops: still two columns, but prevent squeeze overflow */
@media (max-width: 1400px) and (min-width: 1201px) {
  .paper-page {
    max-width: 100%;
  }

  .paper-body {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
  }

  .paper-list {
    max-height: none;
  }
}

/* Small / laptop windows: stack slider above list — avoids overlap */
@media (max-width: 1200px) {
  .paper-page,
  .dl-page {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
    min-height: 0;
  }

  .paper-sheet,
  .dl-shell {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
  }

  .page-news .main,
  .page-download .main {
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .paper-sheet {
    border-radius: 14px;
    border-left: 1px solid rgba(180, 150, 110, 0.28);
    padding: 0.9rem 0.85rem 1.1rem;
  }

  .paper-body {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .paper-slider {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 5;
    max-height: min(58vh, 520px);
    border-radius: 12px;
    align-self: stretch;
  }

  .paper-lists {
    padding: 0.75rem 0.7rem 0.8rem;
    height: auto;
  }

  .paper-list {
    max-height: min(50vh, 380px);
  }

  .paper-list a {
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 0.45rem 0.55rem;
  }

  .paper-list time {
    grid-column: 2;
    padding-top: 0;
    font-size: 0.66rem;
  }

  .paper-list__title {
    font-size: 0.88rem;
  }

  .dl-page {
    min-height: 0;
  }

  .page-download .main {
    align-items: stretch;
    padding-top: 4.25rem;
  }
}

/* Large / 32" monitors — fill available main width (no empty right gap) */
@media (min-width: 1600px) {
  .paper-page {
    max-width: none;
    width: 100%;
  }

  .paper-list__title {
    font-size: 0.98rem;
  }

  .paper-lists::before {
    font-size: 0.78rem;
  }
}

@media (min-width: 2200px) {
  .paper-page {
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .paper-tab {
    font-size: 0.62rem;
    padding: 0.32rem 0.55rem;
  }

  .paper-slider {
    aspect-ratio: 3 / 4;
    max-height: min(52vh, 420px);
  }

  .paper-slider__btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .paper-more {
    min-width: 0;
    width: 100%;
  }
}

/* —— Top-up (Air Time) in site shell —— */
.page-topup .main {
  max-width: none !important;
  width: calc(100% - var(--sidebar-w) - var(--shell-inset) - var(--shell-gap) * 2) !important;
  margin-left: calc(var(--sidebar-w) + var(--shell-inset) + var(--shell-gap)) !important;
  margin-right: var(--shell-gap) !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  height: auto;
  padding-top: clamp(1.25rem, 2.5vh, 2rem);
  padding-bottom: clamp(1.25rem, 2.5vh, 2rem);
  padding-left: clamp(0.85rem, 1.5vw, 1.35rem);
  padding-right: clamp(0.85rem, 1.5vw, 1.35rem);
  box-sizing: border-box;
}

.page-topup .wallpaper {
  background-image: url("../img/bg.png");
  background-position: center 35%;
  filter: saturate(1.05) brightness(1.05);
  opacity: 0.95;
}

.page-topup .atmosphere {
  opacity: 0.28;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(20, 40, 70, 0.2));
}

.topup-page {
  --topup-max: 820px;
  width: 100%;
  max-width: min(100%, var(--topup-max));
  margin: 0 auto;
  flex: 0 0 auto;
  display: block;
  min-height: 0;
  height: auto;
  align-self: center;
  transform: none;
}

.topup-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(245, 250, 255, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(60, 100, 140, 0.14);
  overflow: hidden;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex: 0 0 auto;
  display: block;
  height: auto;
  min-height: 0;
  width: 100%;
}

.topup-card--login {
  width: min(92vw, 480px);
  max-width: 480px;
  margin: 0 auto;
}

.topup-card--panel {
  width: 100%;
  max-width: 100%;
}

.topup-card__head {
  padding: 1.25rem 1.35rem 1rem;
  text-align: center;
  background: linear-gradient(90deg, rgba(217, 236, 248, 0.65), rgba(228, 221, 245, 0.45));
  border-bottom: 1px solid rgba(109, 179, 212, 0.2);
}

.topup-card__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
}

.topup-card__head h1 {
  margin: 0.2rem 0 0.35rem;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  color: var(--ink);
  line-height: 1.2;
}

.topup-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent-deep);
}

.topup-lead {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.topup-warn {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: #c0392b;
}

.topup-card__body {
  padding: 1.1rem 1.25rem 1.25rem;
}

.topup-card__foot {
  padding: 0.5rem 1.25rem 1.35rem;
}

.topup-field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.05rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.topup-field input {
  width: 100%;
  border: 1px solid rgba(109, 179, 212, 0.35);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
}

.topup-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 179, 212, 0.2);
}

.topup-btn {
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 1.35rem;
  width: 100%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #5aa8d4, #4a93b5);
  box-shadow: 0 8px 20px rgba(74, 147, 181, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.topup-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(74, 147, 181, 0.35);
}

.topup-btn--ghost {
  width: auto;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  border: 1px solid rgba(109, 179, 212, 0.35);
  box-shadow: none;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
}

.topup-btn--sm {
  width: auto;
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  border-radius: 10px;
}

.topup-btn--pack {
  width: auto;
  min-width: 7.25rem;
  padding: 0.6rem 1.15rem;
  font-size: 0.88rem;
  box-shadow: 0 6px 14px rgba(74, 147, 181, 0.22);
}

.topup-tabs {
  display: flex;
  justify-content: center;
  padding: 0.85rem 1.15rem 0.75rem;
  border-bottom: 1px solid rgba(109, 179, 212, 0.18);
  background: rgba(255, 255, 255, 0.35);
}

.topup-tabs__track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: min(100%, 420px);
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: rgba(217, 236, 248, 0.55);
  border: 1px solid rgba(109, 179, 212, 0.22);
}

.topup-tab {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.topup-tab:hover {
  color: var(--accent-deep);
}

.topup-tab.is-active {
  background: #fff;
  color: var(--accent-deep);
  box-shadow: 0 4px 12px rgba(60, 100, 140, 0.12);
}

.topup-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.topup-status__item {
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(217, 236, 248, 0.7), rgba(228, 221, 245, 0.45));
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.topup-status__item small {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
}

.topup-status__item strong {
  font-size: 0.95rem;
  color: var(--ink);
  word-break: break-word;
}

.topup-packs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.95rem;
}

.topup-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 100%;
  padding: 1.15rem 1.1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(109, 179, 212, 0.28);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.92), rgba(240, 248, 255, 0.78));
  box-shadow: 0 8px 22px rgba(60, 100, 140, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.topup-pack:hover {
  border-color: rgba(74, 147, 181, 0.55);
  box-shadow: 0 12px 28px rgba(60, 100, 140, 0.12);
  transform: translateY(-2px);
}

.topup-pack--featured {
  border-color: rgba(74, 147, 181, 0.55);
  background:
    linear-gradient(165deg, rgba(232, 245, 252, 0.95), rgba(255, 255, 255, 0.9));
  box-shadow: 0 12px 28px rgba(74, 147, 181, 0.14);
}

.topup-pack__badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, #5aa8d4, #3f8fba);
}

.topup-pack__days {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  color: var(--accent-deep);
}

.topup-pack__days strong {
  font-size: clamp(1.85rem, 3vw, 2.25rem);
  font-weight: 800;
  line-height: 1;
}

.topup-pack__days span {
  font-size: 0.92rem;
  font-weight: 700;
}

.topup-pack__main {
  flex: 1 1 auto;
}

.topup-pack__name {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.topup-pack__time {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.topup-pack__bonuses {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.topup-pack__bonuses li {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  color: #3d6f8f;
  background: rgba(109, 179, 212, 0.16);
  border: 1px solid rgba(109, 179, 212, 0.22);
}

.topup-pack__bonus--empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.topup-pack__action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(109, 179, 212, 0.18);
}

.topup-pack__price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent-deep);
  line-height: 1;
}

.topup-pack__price small {
  font-size: 0.75rem;
  font-weight: 700;
}

.topup-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.85rem;
  border-radius: 14px;
  border: 1px solid rgba(109, 179, 212, 0.22);
  background: rgba(255, 255, 255, 0.55);
}

.topup-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.topup-table th,
.topup-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(109, 179, 212, 0.16);
  vertical-align: middle;
}

.topup-table th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: rgba(217, 236, 248, 0.45);
  white-space: nowrap;
}

.topup-table tbody tr:hover td {
  background: rgba(109, 179, 212, 0.08);
}

.topup-table tbody tr:last-child td {
  border-bottom: none;
}

.topup-note {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(247, 221, 230, 0.75), rgba(253, 232, 218, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-size: 0.82rem;
}

.topup-note ul {
  margin: 0;
  padding-left: 1.1rem;
}

.topup-note li {
  margin-bottom: 0.3rem;
  line-height: 1.45;
}

.topup-note li:last-child {
  margin-bottom: 0;
}

.topup-ok {
  color: var(--ok);
  font-weight: 700;
}

@media (min-width: 1600px) {
  .topup-page {
    --topup-max: 880px;
  }

  .topup-card--login {
    width: min(100%, 520px);
    max-width: 520px;
  }
}

@media (min-width: 2000px) {
  .topup-page {
    --topup-max: 920px;
  }

  .topup-card--login {
    width: min(100%, 560px);
    max-width: 560px;
  }
}

@media (max-width: 980px) {
  .page-topup .main {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-height: 0;
    justify-content: flex-start;
    padding-top: 4.5rem;
  }

  .topup-page {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .topup-card__head--row {
    flex-direction: column;
    align-items: stretch;
  }

  .topup-btn--ghost {
    align-self: flex-start;
  }

  .topup-tabs {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .topup-tabs__track {
    width: 100%;
  }

  .topup-tab {
    text-align: center;
    padding: 0.55rem 0.5rem;
  }

  .topup-status {
    grid-template-columns: 1fr;
  }

  .topup-packs {
    grid-template-columns: 1fr;
  }

  .topup-pack__action {
    flex-wrap: wrap;
  }

  .topup-card__head,
  .topup-card__body,
  .topup-card__foot {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}


/* —— Ranking stage (sheet art) —— */
.page-ranking .wallpaper {
  background-image: url("../img/bg.png");
  background-position: center 28%;
  filter: saturate(1.08) brightness(1.08);
  opacity: 0.92;
}

.page-ranking .atmosphere {
  opacity: 0.2;
  background:
    linear-gradient(180deg, rgba(180, 220, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 42%, rgba(40, 60, 80, 0.18) 100%);
}

.page-ranking .main {
  max-width: none !important;
  width: calc(100% - var(--sidebar-w) - var(--shell-inset) - var(--shell-gap) * 2) !important;
  margin-left: calc(var(--sidebar-w) + var(--shell-inset) + var(--shell-gap)) !important;
  margin-right: var(--shell-gap) !important;
  padding: clamp(1rem, 2.5vh, 1.75rem) clamp(0.5rem, 1.2vw, 1rem) 2rem !important;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  flex: 1 1 auto;
}

.rank-stage {
  width: 100%;
  max-width: min(100%, var(--content-max, 1180px));
  margin: 0 auto;
  display: grid;
  gap: clamp(1.25rem, 3.5vh, 2.25rem);
  justify-items: center;
  align-content: center;
  flex: 1 1 auto;
}

.rank-stage__tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(0.45rem, 1.2vw, 1rem);
  width: 100%;
  padding-top: clamp(0.35rem, 1.5vh, 1rem);
}

.rank-stage__tab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: transform 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
  opacity: 0.72;
  filter: grayscale(0.15) brightness(0.96);
}

.rank-stage__tab img {
  display: block;
  width: clamp(148px, 18vw, 251px);
  height: auto;
}

.rank-stage__tab:hover {
  opacity: 0.95;
  transform: translateY(-2px);
  filter: none;
}

.rank-stage__tab.is-active {
  opacity: 1;
  filter: drop-shadow(0 8px 16px rgba(80, 50, 20, 0.28));
  transform: translateY(-1px) scale(1.04);
}

.rank-stage__panel {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 2.2vh, 1.5rem);
}

.rank-stage__panel.is-active {
  display: flex;
}

.rank-flags {
  position: relative;
  width: min(100%, 960px);
  margin: 0 auto;
}

.rank-flags__sheet {
  display: block;
  width: 100%;
  height: auto;
  mix-blend-mode: screen;
  pointer-events: none;
  user-select: none;
}

.rank-flags__slots {
  position: absolute;
  left: 1.5%;
  right: 1.5%;
  top: 18%;
  bottom: 14%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2%;
  align-items: end;
  pointer-events: none;
}

.rank-flag {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
  text-align: center;
  padding: 0 0.35rem 8%;
  min-width: 0;
  color: #4a3420;
  text-shadow: 0 1px 0 rgba(255, 250, 240, 0.65);
}

.rank-flag__place {
  font-size: clamp(0.72rem, 1.1vw, 0.9rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #7a4a22;
}

.rank-flag__name {
  font-size: clamp(0.72rem, 1.15vw, 0.95rem);
  font-weight: 800;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-flag__sub {
  font-size: clamp(0.58rem, 0.9vw, 0.72rem);
  font-weight: 600;
  color: #6a5340;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 1600px) {
  .rank-stage {
    max-width: min(100%, var(--content-max, 1480px));
  }

  .rank-flags {
    width: min(100%, 1200px);
  }

  .rank-stage__tab img {
    width: clamp(200px, 16vw, 300px);
  }
}

@media (min-width: 2200px) {
  .rank-stage {
    max-width: min(100%, var(--content-max, 1840px));
  }

  .rank-flags {
    width: min(100%, 1400px);
  }

  .rank-stage__tab img {
    width: clamp(240px, 14vw, 340px);
  }
}

@media (max-width: 980px) {
  .page-ranking .main {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 4.25rem 0.85rem 2rem !important;
    align-items: flex-start;
  }

  .rank-stage__tabs {
    gap: 0.35rem;
  }

  .rank-stage__tab img {
    width: clamp(120px, 28vw, 180px);
  }

  .rank-flag__name {
    font-size: 0.68rem;
  }

  .rank-flag__sub {
    font-size: 0.55rem;
  }
}

@media (max-width: 720px) {
  .rank-flags__slots {
    top: 16%;
    bottom: 12%;
  }

  .rank-flag {
    padding-bottom: 6%;
  }
}

@media (max-width: 520px) {
  .rank-stage__tabs {
    gap: 0.45rem;
  }

  .rank-stage__tab img {
    width: min(42vw, 160px);
  }

  .rank-flags__slots {
    left: 1%;
    right: 1%;
    top: 14%;
    bottom: 10%;
    gap: 0.5%;
  }

  .rank-flag {
    padding: 0 0.15rem 6%;
  }

  .rank-flag__place {
    font-size: 0.62rem;
  }

  .rank-flag__name {
    font-size: 0.58rem;
  }

  .rank-flag__sub {
    display: none;
  }
}

