  [hidden] { display: none !important; } /* bullframe doesn't enforce this; the page toggles hidden a lot */
  body {
    min-height: 100vh;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: var(--bf-color-bg);
  }
  .app-card {
    width: 768px; /* bullframe --bf-breakpoint-md */
    max-width: calc(100% - 2rem);
    margin: auto;
    padding: 2rem;
    box-sizing: border-box;
    background: var(--bf-color-surface);
    border: 1px solid var(--bf-color-border);
    border-radius: .75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .08);
  }
  .app-card .step:first-child { margin-top: 0; }
  .step { margin-top: 1.5rem; }
  .battle-list { margin-top: .75rem; }
  .list-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .list-head h3 { margin: 0; }
  .refresh-btn { margin: 0; padding: .4rem; line-height: 0; background: none; border: 1px solid var(--bf-color-border); border-radius: .5rem; color: inherit; cursor: pointer; }
  .refresh-btn svg { width: 2rem; height: 2rem; }
  .refresh-btn:disabled { opacity: .4; cursor: default; }
  .refresh-btn:not(:disabled):hover { border-color: var(--bf-color-primary); color: var(--bf-color-primary); }
  .zip-card {
    display: block;
    overflow: hidden;
    padding: 0;
    color: inherit;
    text-decoration: none;
    border: 1px solid var(--bf-color-border);
    border-radius: .75rem;
    background: var(--bf-color-surface);
  }
  .zip-card:hover, .zip-card:focus-visible { border-color: var(--bf-color-primary); }
  .zip-banner {
    padding: .75rem 1.5rem;
    font-family: var(--bf-font-monospace, monospace);
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--bf-color-on-primary);
    background: var(--bf-color-primary);
    word-break: break-all;
  }
  .zip-body { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; padding: 2rem; }
  .zip-card:not([href]) { opacity: .5; pointer-events: none; }
  .zip-card .zip-icon { width: 4.8rem; height: 4.8rem; color: var(--bf-color-primary); }
  .zip-card .zip-files { margin: 0; padding: 0; list-style: none; font-size: 2rem; }
  .zip-card .zip-files li { font-family: var(--bf-font-monospace, monospace); }
  @keyframes battle-pop {
    0%   { opacity: 0; transform: translateX(-40%); }
    60%  { opacity: 1; transform: translateX(4px); }    /* gentle overshoot */
    80%  { transform: translateX(-1.5px); }              /* springs back */
    100% { opacity: 1; transform: translateX(0); }
  }
  .battle-list .battle-enter { animation: battle-pop .8s cubic-bezier(.25, .8, .35, 1) both; }
  @media (prefers-reduced-motion: reduce) {
    .battle-list .battle-enter { animation: none; }
  }
  .ext-icon { width: 1.4rem; height: 1.4rem; margin-left: .4rem; vertical-align: -.2rem; }
  .fmt-icon {
    display: inline-block;
    width: 1.8rem;
    height: 1.8rem;
    margin-right: .4rem;
    vertical-align: -.4rem;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
  }
    display: block;
    padding: 1.2rem 1.5rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--bf-color-border);
  }
  .nowrap { white-space: nowrap; } /* keep each icon with its label */
  /* BotB's sprite sheet: 16px icons at fixed offsets. */
  .sub-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: .4rem;
    vertical-align: -3px;
    background-image: url("https://battleofthebits.com/styles/spriteshit/1790316470.png");
    background-repeat: no-repeat;
  }
  .sub-2hb { background-position: 0 0; }
  .sub-4hb { background-position: -17px 0; }
  .sub-ohb { background-position: -85px 0; }
  .sub-xhb { background-position: -187px 0; }
  /* Shared by the URL slot and the battle buttons so they look identical. */
  .slot {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 .5rem;
    padding: .6rem .8rem;
    font: inherit;
    font-size: 2.8rem; /* 28px: bullframe sets the root to 62.5%, so 1rem = 10px */
    line-height: 1.25;
    text-align: left;
    color: inherit;
    background: var(--bf-color-surface);
    border: 1px solid var(--bf-color-border);
    border-radius: .5rem;
    cursor: pointer;
  }
  input.slot { cursor: text; }
  input.slot:focus { outline: 2px solid var(--bf-color-focus-ring); outline-offset: 0; }
  /* The paste slot is a fallback, so its label is faded. Typed text stays full strength. */
  .battle-btn { display: flex; align-items: center; gap: 1.2rem; }
  .battle-btn .thumb { width: 6rem; height: 6rem; flex: none; object-fit: cover; border-radius: .4rem; }
  .battle-btn .meta { display: block; flex: 1; min-width: 0; } /* grow to fill the button, so the paste input runs full width */
  .battle-btn .battle-title { display: block; overflow-wrap: anywhere; }
  .battle-btn small { display: block; color: var(--bf-color-text-muted); font-size: 1.4rem; margin-top: .25rem; }
  .muted { color: var(--bf-color-text-muted); font-size: 1.4rem; }
  .error { color: var(--bf-color-danger); }
  code { word-break: break-all; }

/* Selected mode: the chosen battle is the header; everything else steps aside. */
#selectedSlot { margin-bottom: .75rem; }
.selected-wrap { position: relative; }
.selected-btn { margin: 0; pointer-events: none; cursor: default; }
.selected-btn a { pointer-events: auto; }
.selected-btn a.battle-title { color: var(--bf-color-primary); text-decoration: none; }
.selected-btn a.battle-title:hover { text-decoration: underline; }
.selected-btn small a { color: inherit; }
.selected-btn small a:hover { text-decoration: underline; }
.close-btn {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translate(50%, -50%); /* straddles the right edge, centred vertically */
  width: 3.2rem;
  height: 3.2rem;
  padding: .4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: var(--bf-color-danger);
  background: var(--bf-color-surface);
  border: 1px solid var(--bf-color-border);
  border-radius: 50%;
  cursor: pointer;
}
.close-btn svg { width: 1.6rem; height: 1.6rem; }
.close-btn:hover { background: var(--bf-color-danger); color: var(--bf-color-surface); }
body.battle-selected #urlSlot,
body.battle-selected .list-head,
body.battle-selected #battleList,
body.battle-selected #status { display: none; }

/* Credits tag, bottom centre. */
.credits {
  position: fixed;
  bottom: .75rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: .4rem 1rem;
  font-size: 1.2rem;
  line-height: 1.5;
  text-align: center;
  color: var(--bf-color-text-muted);
  background: var(--bf-color-surface);
  border: 1px solid var(--bf-color-border);
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}
.credits a { color: inherit; }

/* Loading placeholder: a dashed battle button with a question block that bonks out coins. */
.placeholder { border-style: dashed; color: var(--bf-color-text-muted); cursor: default; pointer-events: none; }
.qblock {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5b400;
  /* corner screw holes: solid dark dots */
  background-image:
    radial-gradient(circle, #8a4b00 0 70%, transparent 72%),
    radial-gradient(circle, #8a4b00 0 70%, transparent 72%),
    radial-gradient(circle, #8a4b00 0 70%, transparent 72%),
    radial-gradient(circle, #8a4b00 0 70%, transparent 72%);
  background-size: .9rem .9rem;
  background-repeat: no-repeat;
  background-position: top .5rem left .5rem, top .5rem right .5rem, bottom .5rem left .5rem, bottom .5rem right .5rem;
  border: .3rem solid #8a4b00;
  border-radius: .3rem;
  box-shadow: inset -.4rem -.4rem 0 #c07a00;
  animation: bonk 1.2s ease-out infinite;
}
.qblock .q {
  font: bold 3.2rem/1 monospace;
  color: #fff3c4;
  text-shadow: .2rem .2rem 0 #8a4b00;
}
.qblock .coin {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1.6rem;
  height: 2.2rem;
  margin-left: -.8rem;
  background: #ffd800;
  border: .2rem solid #8a4b00;
  border-radius: 50%;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: coin 1.2s ease-out infinite;
}
/* BotB's boon icon, cut from the site sprite sheet (icons-boons). */
.boon-icon {
  width: 12px;
  height: 12px;
  background: url("https://battleofthebits.com/styles/spriteshit/1790316470.png") -221px -974px no-repeat;
  image-rendering: pixelated;
}
@keyframes bonk {
  0%, 60%, 100% { transform: translateY(0); }
  70%           { transform: translateY(-.8rem); }   /* the hit */
  80%           { transform: translateY(0); }
}
@keyframes coin {
  0%, 69%  { opacity: 0; transform: translateY(0); }
  70%      { opacity: 1; transform: translateY(0); }
  95%      { opacity: 1; transform: translateY(-7rem); }
  100%     { opacity: 0; transform: translateY(-7.5rem); }
}
@media (prefers-reduced-motion: reduce) {
  .qblock, .qblock .coin { animation-duration: 3s; }
}

/* Hover: entries lift off the page, pick up a shadow and a primary border.
   Uses the separate `translate` property so it doesn't fight the fly-in animation's transform. */
.battle-list .battle-btn {
  transition: translate .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.battle-list .battle-btn:hover,
.battle-list .battle-btn:focus-visible {
  translate: 0 -3px;
  border-color: var(--bf-color-primary);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .18);
}


/* Paste dialog: a modal over the page with the URL input. */
.paste-dialog {
  width: min(92vw, 56rem);
  padding: 0;
  color: inherit;
  background: var(--bf-color-surface);
  border: 1px solid var(--bf-color-border);
  border-radius: .75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.paste-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.paste-body { padding: 2rem; }
.paste-dialog .url-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: .8rem 1rem;
  font: inherit;
  font-size: 1.8rem;
  color: inherit;
  background: var(--bf-color-field-bg, var(--bf-color-surface));
  border: 1px solid var(--bf-color-border);
  border-radius: .5rem;
}
.paste-dialog .url-input:focus { outline: 2px solid var(--bf-color-focus-ring); outline-offset: 0; }
.paste-dialog .url-input::placeholder { color: var(--bf-color-text-muted); opacity: 1; }
.paste-dialog #pasteStatus { min-height: 2rem; margin: .8rem 0 1.2rem; }
.paste-dialog #pasteStatus.error { color: var(--bf-color-danger); }
