/* Tint launcher, Mods and Discover tabs (/play/#mods, #discover; play/mods.js): layout only;
   components are in tint.css. Its own file so a launcher kept by the app's service worker gets it fresh. */

/* a search field with the glyph inside (no placeholder: the glyph says what it is) */
.search { position: relative; display: block; min-width: 0; max-width: 520px; }
.search .i { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); pointer-events: none; }
.search .field { padding-left: 44px; }
.search .field::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

/* the two tabs are grids: they take the wide-grid width on big screens */
#library.pane, #discover.pane { max-width: var(--t-grid-w); }
.mods-view { display: flex; flex-direction: column; gap: var(--t-4); }
.contents:not([hidden]) { display: contents; }

/* ---------------- Mods: a mod tile (.mod-tile): its name (opens the sheet) and its switch (one tap) ---------------- */
.mod-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.mod-tile { position: relative; display: flex; align-items: center; gap: var(--t-2); min-width: 0; min-height: 64px; padding: 0 12px 0 0; }
.mod-open { flex: 1; min-width: 0; align-self: stretch; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 4px 10px 16px; font: inherit; color: inherit; text-align: left;
  background: none; border: 0; border-radius: inherit; cursor: pointer; }
.mod-name { font: 600 16px/1.25 var(--t-font); letter-spacing: -0.01em; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.mod-tile > .chip { flex: none; }
/* what the mod does: one line, cut with an ellipsis. The only grey text in Tint (--t-ink-dim). */
.mod-desc { display: block; width: 100%; min-width: 0; font: 400 13px/1.35 var(--t-font); color: var(--t-ink-dim, #a9aeb8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-desc:empty { display: none; }
/* ---------------- a mod's page (the sheet): wider on desktop, for the README ---------------- */
@media (min-width: 861px) { #sheet:has(.mod-page) { width: min(760px, calc(100vw - 32px)); max-height: min(900px, calc(100dvh - 48px)); } }
.mod-page { display: flex; flex-direction: column; gap: var(--t-4); min-width: 0; }
.mod-summary { font: var(--t-body); letter-spacing: var(--t-body-track); }
.mod-page .sheet-acts { margin-top: 0; justify-content: flex-start; }
/* Made by, Licence, Source */
.mod-facts { display: grid; margin: 0; border-top: var(--t-hair); }
.mod-facts > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--t-3); padding: 10px 0; border-bottom: var(--t-hair); font: var(--t-ui); }
.mod-facts dt { font-weight: 600; }
.mod-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* the author's README, as safe markdown (play/md.js) */
.mod-readme { display: flex; flex-direction: column; gap: var(--t-3); min-width: 0; padding-top: var(--t-2); }
.mod-readme-h { font: var(--t-subhead); letter-spacing: var(--t-subhead-track); }
.mod-readme-by { font: var(--t-small); }
.md { display: flex; flex-direction: column; gap: var(--t-3); min-width: 0; font: 400 16px/1.55 var(--t-font); letter-spacing: var(--t-body-track); overflow-wrap: anywhere; }
.md > *, .md li > * { margin: 0; }
.md .md-h { font: 600 17px/1.35 var(--t-font); margin-top: var(--t-2); }
.md h4.md-h { font-size: 16px; }
.md-list { display: grid; gap: 6px; padding-left: 22px; list-style: disc; }
ol.md-list { list-style: decimal; }
.md-list .md-list:not(ol) { list-style: circle; }
.md-list .md-list { margin-top: 6px; }
.md li { padding-left: 2px; }
.md li::marker { color: var(--t-accent); }
.md code { font: var(--t-code); font-size: 14px; padding: 1px 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; background: var(--t-sunken); border: var(--t-hair); border-radius: 6px; }
.md-pre { overflow-x: auto; padding: 12px 14px; background: var(--t-sunken); border: var(--t-hair); border-radius: var(--t-r-control); corner-shape: squircle; }
.md-pre code { padding: 0; background: none; border: 0; white-space: pre; }
.md img { display: block; max-width: 100%; height: auto; margin: var(--t-1) 0; border-radius: var(--t-r-field); corner-shape: squircle; }
.md .md-img { display: inline-block; vertical-align: middle; max-width: 100%; height: auto; margin: 2px 4px 2px 0; object-fit: contain; border-radius: 6px; }
.md p > .md-img:only-child, .md > .md-img { display: block; margin: var(--t-1) 0; border-radius: var(--t-r-field); }
.md .md-center { text-align: center; }
.md .md-center > .md-img, .md .md-center p > .md-img { display: inline-block; margin-inline: 4px; }
.md :is(div, details, td, th) > * { margin: 0; }
.md :is(div, details) > * + * { margin-top: var(--t-3); }
.md-details { padding: 10px 14px; background: var(--t-sunken); border: var(--t-hair); border-radius: var(--t-r-control); corner-shape: squircle; }
.md-details > summary { cursor: pointer; font-weight: 600; }
.md-details:not([open]) > summary ~ * { display: none; }
.md-details > summary .md-img { display: inline-block; margin: 0 6px 0 0; }
.md-quote { display: flex; flex-direction: column; gap: var(--t-2); margin: 0; padding-left: 14px; border-left: 3px solid var(--t-line-strong); }
.md-hr { width: 100%; height: 0; margin: var(--t-1) 0; border: 0; border-top: var(--t-hair); }
.md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font: var(--t-ui); }
.md th, .md td { padding: 8px 12px 8px 0; text-align: left; vertical-align: top; border-bottom: var(--t-hair); }
.md th { font-weight: 600; }
/* add tiles: Install .hmod, the example mod */
.add-tile { display: flex; align-items: center; gap: var(--t-3); min-height: 64px; padding: 10px 16px; font: var(--t-ui); font-size: 16px; color: var(--t-ink); text-align: left; cursor: pointer; }
.add-tile .i { flex: none; color: var(--t-accent); }
@media (hover: hover) { .mod-tile:hover, .add-tile:hover, .st:hover, .dc:hover { background: var(--t-raised); } }
.mod-tile, .add-tile, .st, .dc { transition: background-color var(--t-quick); }
/* touch: the switch keeps its size and gets a bigger hit area */
@media (pointer: coarse) { .mod-tile .switch::before { content: ""; position: absolute; inset: -14px -12px; } }

/* ---------------- Discover ---------------- */
.dc-controls { display: grid; gap: var(--t-3); }
.dc-segs { display: flex; gap: var(--t-3); min-width: 0; }
.dc-segs .seg { flex: none; }
.dc-segs .seg button { flex: none; white-space: nowrap; }
#dc-loading[hidden], #dc-none[hidden], .dc-controls[hidden] { display: none; }

/* a project tile (.dc): icon, name, downloads (a button: opens the sheet), then its action */
.dc { display: flex; flex-direction: column; gap: var(--t-3); min-width: 0; padding: 12px; }
.dc-open { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; margin: -12px -12px 0; padding: 12px 12px 0; font: inherit; color: inherit; text-align: left;
  background: none; border: 0; border-radius: inherit; cursor: pointer; }
/* the project's own icon, in a slot like the servers' */
.dc-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; overflow: hidden;
  background: var(--t-sunken); border: var(--t-hair); border-radius: var(--t-r-control); corner-shape: squircle; }
.dc-icon img { width: 100%; height: 100%; object-fit: cover; }
.dc-icon.none { background: var(--t-sunken) url(/tex/crafting_table_front.png) center / 28px no-repeat; image-rendering: pixelated; }
.sheet-top .dc-icon { width: 64px; height: 64px; margin: 0; }
.dc-open .mod-desc { margin-top: -2px; }
.dc-name { width: 100%; font: 600 16px/1.3 var(--t-font); letter-spacing: -0.01em; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.dc-stat { display: inline-flex; align-items: center; gap: 4px; font: var(--t-ui); font-size: 14px; font-variant-numeric: tabular-nums; }
.dc-stat .i { width: 16px; height: 16px; }
.dc-stat .dc-src::before { content: "·"; margin-right: 4px; }
.dc-stat .dc-src.alone::before { content: none; } /* nothing before it (HoriMods counts no downloads) */
.dc-act { margin-top: auto; display: flex; align-items: center; min-height: var(--t-h-sm); }
.dc-act .btn { width: 100%; }
.dc-act .chip { width: 100%; justify-content: center; height: var(--t-h-sm); }
@media (pointer: coarse) { .dc-act { min-height: 44px; } .dc-act .btn, .dc-act .chip { height: 44px; } .dc-act .switch::before { content: ""; position: absolute; inset: -10px -12px; } }

/* the install dialog */
.dc-steps { display: grid; gap: var(--t-3); }
.dc-file { font: var(--t-code); overflow-wrap: anywhere; padding: 10px 12px; background: var(--t-sunken); border: var(--t-hair); border-radius: var(--t-r-control); corner-shape: squircle; }
.dc-steps [hidden] { display: none; }
.dc-steps .t-danger { font: var(--t-ui); color: var(--t-danger); }
#dc-dialog { width: min(600px, calc(100vw - 32px)); }
.dialog .dc-dialog-btns { flex-wrap: wrap; }

@media (max-width: 860px) {
  #dc-dialog { width: 100%; }
  /* the two segmented rows scroll sideways together, off the screen edge */
  .dc-segs { overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .dc-segs::-webkit-scrollbar { display: none; }
  .search { max-width: none; }
  /* Mods: the two views as a full-width segmented control */
  #inst-content > .seg, .inst-tabs { display: flex; width: 100%; }
  #inst-content > .seg button, .inst-tabs button { flex: 1; padding-inline: 4px; white-space: nowrap; font-size: 14px; }
  .mod-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }
  .mod-tile { min-height: 60px; gap: 4px; padding-right: 10px; }
  .mod-open { padding: 8px 0 8px 14px; }
  .mod-name { font-size: 15px; }
  .mod-tile .switch { width: 46px; height: 28px; }
  .mod-tile .switch::after { width: 20px; height: 20px; }
  .mod-tile .switch[aria-checked="true"]::after { transform: translateX(18px); }
}
/* the launcher's toast sits above the phone tab bar, not on it */
@media (max-width: 860px) { .launcher .toast { bottom: calc(82px + env(safe-area-inset-bottom)); } }
.dc-act:has(.dc-built) { justify-content: space-between; gap: var(--t-2); }
.dc-built { font: var(--t-ui); }

/* Discover, Modrinth's part: a pack's screenshot on its page, the line under Install, More */
.mod-shot { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--t-r-card); corner-shape: squircle; background: var(--t-sunken); }
.mod-note { font: var(--t-ui); }
.dc-more-row { justify-content: center; margin-top: var(--t-4); }
.dc-more-row[hidden], #dc-az[hidden], #dc-mr-error[hidden] { display: none; }
#dc-az { margin-top: var(--t-3); font: var(--t-ui); text-align: center; }
#dc-mr-error { margin-top: var(--t-4); }

/* ---------------- Library (library.js): instance tiles, an instance's page, its worlds ---------------- */
.lib-list, .inst-page { display: flex; flex-direction: column; gap: var(--t-4); }
.lib-list[hidden], .inst-page[hidden], .inst-view[hidden], .mods-view[hidden] { display: none; }
.lib-lead { font: var(--t-body); letter-spacing: var(--t-body-track); }
/* an instance's picture: Tint's art or the player's own, cut to fit */
.inst-pic { flex: none; display: block; overflow: hidden; width: 32px; height: 32px; background: var(--t-sunken); border-radius: var(--t-r-control); corner-shape: squircle; }
.inst-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.inst-pic-card { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: calc(var(--t-r-field) - 2px); }
.inst-pic-lg { width: 160px; height: 90px; border-radius: var(--t-r-field); }
.inst-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.inst-tile { display: flex; flex-direction: column; gap: var(--t-3); min-width: 0; padding: 10px 10px 12px; }
.inst-open { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; margin: -10px -10px 0; padding: 10px 10px 0; font: inherit; color: inherit; text-align: left;
  background: none; border: 0; border-radius: inherit; cursor: pointer; }
.inst-open .inst-pic { margin-bottom: 8px; }
.inst-tile-name { width: 100%; padding: 0 4px; font: 600 17px/1.3 var(--t-font); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.inst-tile-line { padding: 0 4px; font: var(--t-ui); font-variant-numeric: tabular-nums; }
.inst-add { flex-direction: column; justify-content: center; gap: var(--t-2); min-height: 180px; text-align: center; }
.inst-add .i { width: 28px; height: 28px; }
@media (hover: hover) { .inst-tile:hover, .world-tile:hover { background: var(--t-raised); } }
.inst-tile, .world-tile { transition: background-color var(--t-quick); }
/* back to the Library */
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 36px; margin-left: -6px; padding: 0 10px 0 4px; font: var(--t-ui); color: var(--t-ink);
  background: none; border: 0; border-radius: var(--t-r-control); cursor: pointer; }
.back-link .i { width: 20px; height: 20px; }
@media (hover: hover) { .back-link:hover { color: var(--t-accent); } }
.inst-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--t-4) var(--t-5); }
.inst-id { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.inst-id .pane-title { overflow-wrap: anywhere; }
.inst-line { font: var(--t-ui); font-size: 16px; }
.inst-acts { display: flex; align-items: center; gap: var(--t-3); }
.inst-acts .btn-lg { min-width: 200px; }
.inst-view { display: flex; flex-direction: column; gap: var(--t-4); min-width: 0; }
.inst-view > .seg, .inst-tabs { align-self: flex-start; }
/* worlds: a picture (the game's own of the world, else plain), name, mode and when, Play */
.world-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.world-tiles[hidden], #world-none[hidden] { display: none; }
.world-tile { display: flex; flex-direction: column; gap: var(--t-3); min-width: 0; padding: 10px 10px 12px; }
.world-open { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; margin: -10px -10px 0; padding: 10px 10px 0; font: inherit; color: inherit; text-align: left;
  background: none; border: 0; border-radius: inherit; cursor: pointer; }
.world-pic { display: block; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 8px; overflow: hidden; border-radius: calc(var(--t-r-field) - 2px); corner-shape: squircle;
  background: var(--t-sunken) url(/tex/grass_side_t.png) center / 48px no-repeat; image-rendering: pixelated; }
.world-pic img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.world-name { width: 100%; padding: 0 4px; font: 600 16px/1.3 var(--t-font); overflow-wrap: anywhere; }
.world-line { padding: 0 4px; font: var(--t-ui); font-size: 14px; }
.world-tile .btn { width: 100%; }
/* Home and Discover: which instance (with two or more) */
.banner-inst { gap: 10px; max-width: 100%; padding-inline: 12px 16px; }
.banner-inst .inst-pic, .dc-into .inst-pic { width: 36px; height: 24px; border-radius: 6px; }
.inst-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner-inst .i, .dc-into .i { margin: 0 -4px 0 0; }
.dc-into { gap: 10px; max-width: 100%; padding-inline: 12px 16px; }
#home-inst[hidden], #dc-into[hidden] { display: none; }
/* the picker sheet */
.inst-picker { display: flex; flex-direction: column; gap: var(--t-3); }
.inst-pick-list li { padding: 0; }
.inst-pick-row { display: flex; align-items: center; gap: var(--t-3); width: 100%; min-height: 64px; padding: 8px 4px; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer; }
.inst-pick-row .inst-pic { width: 64px; height: 36px; }
.inst-pick-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inst-pick-line { font: var(--t-ui); font-size: 14px; }
@media (hover: hover) { .inst-pick-row:hover .row-name { color: var(--t-accent); } }
/* the edit sheet: name, picture, Duplicate / Delete */
.inst-name-row { display: flex; align-items: flex-end; gap: var(--t-3); }
.inst-name-row .form-row { flex: 1; min-width: 0; }
.inst-sub { font: var(--t-ui); font-weight: 600; }
.inst-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--t-2); }
.inst-pic-choice { position: relative; display: grid; place-items: center; gap: 4px; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; font: var(--t-ui); font-size: 13px; color: var(--t-ink);
  background: var(--t-sunken); border: 2px solid transparent; border-radius: var(--t-r-control); corner-shape: squircle; cursor: pointer; }
.inst-pic-choice img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.inst-pic-choice[aria-pressed="true"] { border-color: var(--t-accent); }
.inst-pic-own { align-content: center; }
.inst-pic-own .i { width: 20px; height: 20px; color: var(--t-accent); }
.inst-edit-acts { justify-content: flex-start; }
@media (max-width: 860px) {
  .inst-pic-lg { width: 112px; height: 63px; }
  .inst-acts { width: 100%; }
  .inst-acts .btn-lg { flex: 1; min-width: 0; }
  .banner-inst { width: 100%; justify-content: center; }
  .inst-tiles, .world-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
}
/* an instance's tabs: underlined, apart from the segmented control under them */
.inst-tabs { align-self: stretch; display: flex; gap: 4px; padding: 0; background: none; border: 0; border-bottom: var(--t-hair); border-radius: 0; }
.inst-tabs button { height: 44px; padding: 0 14px; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.inst-tabs button[aria-pressed="true"] { background: none; border-bottom-color: var(--t-accent); }
@media (hover: hover) { .inst-tabs button:hover { color: var(--t-accent); } }
.sheet .inst-edit-acts { justify-content: flex-start; }
/* Featured (Create, Physics): a picture over the mod's name, line and switch */
.feat-tiles { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); max-width: 940px; }
.feat-tiles[hidden] { display: none; }
.feat-tile { display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; }
.feat-pic { display: block; width: 100%; aspect-ratio: 21 / 9; padding: 0; overflow: hidden; background: var(--t-sunken); border: 0; cursor: pointer; }
.feat-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.feat-body { min-height: 72px; }
.feat-top { display: flex; align-items: center; gap: var(--t-2); min-width: 0; }
.feat-top .mod-name { min-width: 0; }
.feat-top .chip { flex: none; height: 22px; padding: 0 9px; font-size: 12px; }
@media (hover: hover) { .feat-tile:hover { background: var(--t-raised); } }
.feat-tile { transition: background-color var(--t-quick); }
@media (pointer: coarse) { .feat-body .switch::before { content: ""; position: absolute; inset: -14px -12px; } }
