/* Top bar: give the creator code pill a visible border so it reads as clickable. */
/* Sticky top bar: body must not become a scroll container, or the bar scrolls away with the page on phones. */
body { overflow-x: clip; }
/* Tools page: preview images on the tool cards. */
/* Each preview keeps its own proportions and scales down with the card width, so nothing is cropped or stretched. */
.tool-shot { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: auto; border-radius: 10px; border: 1px solid var(--line); margin: 4px 0 10px; }


/* Home: tournament live banner between the logo and the title. */
.tourney-live { margin: 0; padding: 6px 12px; border-radius: 8px; background: rgba(255,43,61,.16); border: 1px solid rgba(255,43,61,.55); color: var(--text); font: 700 .85rem var(--font-body); }
.tourney-live[hidden] { display: none; }
.sub-pill { border: 1px solid rgba(255,255,255,.25); box-shadow: none; background: rgba(232,57,75,.72) !important; font-size: .66rem !important; padding: 4px 8px !important; gap: 4px !important; }
.sub-pill:hover { background: rgba(232,57,75,.9) !important; }
.sub-pill .pill-short { display: none; }

/* Phones: keep the full "Creator code" label. The top bar scrolls sideways, so it fits without shortening. */
@media (max-width: 480px) {
  .topbar-inner { gap: 6px; padding-inline: 10px; }
  .sub-pill { flex: none; }
  .sub-pill .pill-long { display: inline; }
  .sub-pill .pill-short { display: none; }
}

/* Phones: the top bar scrolls left to right so every button stays reachable.
   backdrop-filter is removed here because it traps fixed children (the brand menu and the copied toast) inside the scrolling bar, which hides them. */
@media (max-width: 899px) {
  html:not(.desk) .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(17,3,5,0.96); }
  html:not(.desk) .topbar-inner {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
  html:not(.desk) .topbar-inner::-webkit-scrollbar { display: none; }
  html:not(.desk) .topbar-inner > * { flex: none; }
  html:not(.desk) .topbar-inner .sub-pill { margin-left: 0; }
  /* The brand menu sits under the bar, not inside the scrolling strip, so it is not clipped. */
  html:not(.desk) .menu { position: fixed; top: 62px; left: 8px; right: 8px; min-width: 0; max-height: calc(100vh - 80px); overflow-y: auto; }
}

/* Desktop: the brand menu now sits in the header, so line it up under the brand button (same left edge as the top bar content). */
html.desk .topbar > .menu { position: absolute; top: calc(100% + 8px); left: max(24px, calc((100% - 1600px) / 2 + 24px)); min-width: 240px; }

/* Phones: tighter battle conditions so the list fits on one screen. */
@media (max-width: 640px) {
  #view-battle .view-title h2 { font-size: 1.3rem; }
  #view-battle .bc-card { padding: 6px 4px; }
  #view-battle .bc-chart { font-size: .68rem; }
  #view-battle .bc-chart th { padding: 2px 0 4px; }
  #view-battle .bc-chart th img { width: 22px; height: 22px; }
  #view-battle .bc-chart th span { font-size: .5rem; }
  #view-battle .bc-chart td { padding: 3px 1px; }
  #view-battle .bc-chart td.bn { min-width: 0; padding-left: 3px; font-size: .66rem; }
  #view-battle .bc-chart td.on { font-size: .8rem; }
  #view-battle .bc-lg-card { padding: 8px; }
  #view-battle .bc-lh img { width: 28px; height: 28px; }
  #view-battle .bc-lh b { font-size: .95rem; }
  #view-battle .bc-chips { gap: 4px; }
  #view-battle .bc-chips span { padding: 3px 6px; font-size: .68rem; }
  #view-battle .bc-h summary { font-size: .8rem; }
  #view-battle .bc-tabs button { font-size: .8rem; padding: 6px 8px; }
}

/* Phones: hide the top and bottom bars while scrolling down, show them again on scroll up. */
.topbar, .tabbar { transition: transform .25s ease; }
@media (max-width: 899px) {
  .nav-hide .topbar { transform: translateY(-100%); }
  .nav-hide .tabbar { transform: translateY(100%); }
}
@media (prefers-reduced-motion: reduce) { .topbar, .tabbar { transition: none; } }

/* Home quick links and the brand menu: same all-caps label style, with a brighter border on the quick links. */
.hero-btns .btn { text-transform: uppercase; letter-spacing: .04em; border: 2px solid #ff5a6a !important; }
.menu a, .menu button { text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; }

/* Back button at the top of each tab. Explicit colors and no native appearance, so it never falls back to the browser's grey button style on desktop. */
html .back-btn { -webkit-appearance: none; appearance: none; align-self: flex-start; min-height: 36px; padding: 6px 12px; border-radius: 8px; border: 1px solid #ff5a6a; background: #5a0f18; color: #fff; font: 700 .8rem var(--font-body); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
html .back-btn:hover, html .back-btn:focus-visible { border-color: #ff8a94; background: #7a1422; outline: none; }

/* News tab: layered background using the site's logo art */
#view-news {
  position: relative; isolation: isolate; padding: 18px; border-radius: 16px; overflow: hidden;
  background:
    linear-gradient(rgba(17,3,5,.88), rgba(17,3,5,.96)),
    url(/img/64991efe09.webp) center 18% / 85% no-repeat,
    url(/img/e5df2485c5.webp) right -70px bottom -70px / 240px no-repeat;
}

/* Battle conditions: league headers are tappable. */
.bc-th { cursor: pointer; }
.bc-th:hover, .bc-th:focus-visible { color: var(--hot); outline: none; }

/* Item detail images: the source art is small (about 104px), so show it at about 2x instead of stretching it larger. */
.sheet-pic img { width: min(208px, 100%) !important; height: auto !important; max-height: 260px; margin: 0 auto; object-fit: contain; image-rendering: auto; filter: contrast(1.08) saturate(1.06); }

/* Battle Conditions: rank button under the title. */
.bc-rank { display: inline-flex; margin-top: 8px; font-size: .9rem; padding: 10px 14px; }

/* Home subtitle: "News" in the site's accent color. */
.hero-news { color: var(--accent); font-weight: 700; }

/* Battle Conditions: league picker uses the same dropdown and scrolling list style as Tower Tea. */
.bc-dd { position: relative; margin-top: 10px; margin-bottom: 8px; }
.bc-dd-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 46vh; overflow-y: auto; padding: 6px; background: var(--panel, #1a0a0c); border: 1px solid rgba(255,43,61,.55); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.bc-dd-list[hidden] { display: none; }
.bc-dd-item { cursor: pointer; }
.bc-dd-item b { font-size: .9rem; }

/* Battle Conditions history: a tidy list with a Show more button instead of one long scroll. */
.bc-hlist { display: grid; gap: 6px; margin-top: 8px; }
.bc-h { border: 1px solid rgba(255,43,61,.25); border-radius: 10px; background: rgba(255,255,255,.03); padding: 8px 12px; }
.bc-h[open] { border-color: rgba(255,43,61,.55); background: rgba(255,43,61,.08); }
.bc-h summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.bc-h .chips, .bc-h .bc-chips { margin-top: 8px; }
.bc-more { margin-top: 10px; width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid rgba(255,43,61,.55); background: rgba(255,43,61,.14); color: var(--text, #fff); font: 700 .9rem var(--font-body); cursor: pointer; }
.bc-more:hover:not(:disabled) { background: rgba(255,43,61,.26); }
.bc-more:disabled { opacity: .6; cursor: default; }

/* Tower Tea and patch notes: the newest entry stands out. */
.news-list .news-item:first-child { border-color: var(--accent, #e8394b); border-left-width: 4px; background: rgba(255,43,61,.2); box-shadow: 0 0 0 1px rgba(255,43,61,.25) inset; }
.news-list .news-item:first-child b::after { content: "Newest"; margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: var(--accent, #e8394b); color: #fff; font-size: .62rem; font-weight: 700; vertical-align: middle; }

/* More page: about card */
.more-about { margin-top: 4px; }

/* About: game description card */
.game-desc p { margin: 0 0 10px; }
.game-desc p:last-child { margin-bottom: 0; }


/* Collection modules: substat dropdowns per module type. */
.modsubs { margin: 10px 0 16px; }
.modsubs > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.modchart-wrap { overflow-x: auto; }
.modchart { width: 100%; border-collapse: collapse; font-size: .78rem; }
.modchart th, .modchart td { padding: 5px 6px; border: 1px solid var(--line); text-align: right; white-space: nowrap; }
.modchart tbody th { text-align: left; font-weight: 600; }
.modchart thead th { background: var(--panel-2); }

/* Module substat dropdowns: match the purple of the module shapes. */
.modsubs { border: 1px solid #b066ff; border-radius: 10px; padding: 0 12px; background: rgba(176,102,255,.06); }
.modsubs > summary { color: #b066ff; text-transform: uppercase; letter-spacing: .04em; font-size: .85rem; }
.modchart thead th { color: #d7b3ff; border-color: #b066ff; }
.modchart th, .modchart td { border-color: rgba(176,102,255,.35); }

/* Phones: module grids use smaller tiles so they fit the screen. */
@media (max-width: 480px) {
  .cgrid, .cgrid.tall { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
  .citem { padding: 8px 4px 6px; font-size: .78rem; }
  .citem .pic { width: 60px; height: 60px; }
  .cgrid.tall .pic { width: 66px; height: 84px; }
  /* Substat charts: smaller type, names wrap, and the rarity columns share the remaining width. */
  .modchart { font-size: .6rem; table-layout: fixed; white-space: normal; }
  .modchart th, .modchart td { padding: 3px 2px; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  .modchart tbody th { width: 30%; }
  .modchart thead th { font-size: .56rem; }
  .modchart td { font-weight: 700; }
}

/* Substat charts: rarity-tinted headers and cells so each column reads by color. */
.modchart thead th.rar-Common { background: rgba(255,255,255,.12); }
.modchart thead th.rar-Rare { background: rgba(74,163,255,.28); color: #cfe6ff; }
.modchart thead th.rar-Epic { background: rgba(176,102,255,.28); color: #ecdcff; }
.modchart thead th.rar-Legendary { background: rgba(245,197,66,.28); color: #fff3c4; }
.modchart thead th.rar-Mythic { background: rgba(255,43,61,.30); color: #ffd6da; }
.modchart thead th.rar-Ancestral { background: rgba(60,255,90,.22); color: #d4ffdc; }
.modchart tbody td.rar-Common { background: rgba(255,255,255,.04); }
.modchart tbody td.rar-Rare { background: rgba(74,163,255,.12); }
.modchart tbody td.rar-Epic { background: rgba(176,102,255,.14); }
.modchart tbody td.rar-Legendary { background: rgba(245,197,66,.14); }
.modchart tbody td.rar-Mythic { background: rgba(255,43,61,.16); }
.modchart tbody td.rar-Ancestral { background: rgba(60,255,90,.12); }

/* Module substat charts: black and red, with rarity colors like the game. */
.modsubs { border: 1px solid #ff2b3d; background: #000; }
.modsubs > summary { color: #ff2b3d; }
.modchart { background: #000; }
.modchart th, .modchart td { border-color: #5a0f18; color: #fff; background: #000; }
.modchart thead th { background: #140000; color: #fff; }
.modchart tbody th { color: #fff; }
.modchart .rar-Common { color: #fff; }
.modchart .rar-Rare { color: #4aa3ff; }
.modchart .rar-Epic { color: #b066ff; }
.modchart .rar-Legendary { color: #f5c542; }
.modchart .rar-Mythic { color: #ff2b3d; }
.modchart .rar-Ancestral { color: #3cff5a; }

/* Substat names colored by tier, as in the module screenshots. */
.modchart tbody th.sn-w { color: #fff; }
.modchart tbody th.sn-b { color: #4aa3ff; }
.modchart tbody th.sn-p { color: #b066ff; }
.modchart tbody th.sn-o { color: #ff9f1a; }
.modchart tbody th.sn-r { color: #ff2b3d; }

/* Module substat charts: roll chances under each table, and a hard caps card on the Modules screen. */
.modchance { margin: 8px 0 4px; padding: 6px 8px; font-size: .78rem; line-height: 1.5; border-radius: 8px; background: #140000; border: 1px solid #5a0f18; color: #fff; }
.modchance b { color: #fff; }
.modchance span { font-weight: 700; white-space: nowrap; }
.modcaps { margin: 12px 0; }
.modcaps .kicker { margin: 0 0 6px; }
.modcaps .list li b { color: var(--hot); }
.modchance .rar-Common { color: #fff; }
.modchance .rar-Rare { color: #4aa3ff; }
.modchance .rar-Epic { color: #b066ff; }
.modchance .rar-Legendary { color: #f5c542; }
.modchance .rar-Mythic { color: #ff2b3d; }
.modchance .rar-Ancestral { color: #3cff5a; }
