/* Item Rarity Generator: only the layout. Colors, type and every piece come from the FileFortress kit (ff-kit/), so the tool
   follows the visitor's site theme. */
[hidden] { display: none !important; }
.app { padding: 14px 16px 24px; }
.app-top { display: flex; align-items: center; gap: 12px; padding: 4px 4px 12px; }
.app-logo { width: 28px; height: 28px; color: var(--ff-brand); flex: none; }
.app-top p { margin: 2px 0 0; }
/* two columns: the picture | the settings. Phones: one column, the picture first. */
/* the picture column is as wide as the picture; the two columns sit together in the middle */
/* item and rarity | the picture | background, glow and outline. Narrower: both setting columns on the right; phones: one
   column, the picture first */
.app-grid { display: grid; gap: 14px; align-items: start; justify-content: center;
  grid-template-columns: minmax(270px, 340px) auto minmax(270px, 340px); grid-template-areas: "left main right"; }
.app-left { grid-area: left; } .app-main { grid-area: main; } .app-right { grid-area: right; }
@media (max-width: 1180px) { .app-grid { grid-template-columns: auto minmax(260px, 320px); grid-template-areas: "main left" "main right"; } }
@media (max-width: 860px) { .app-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "left" "right"; } }
.app-col-title { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.app-col-title:not(:first-child) { margin-top: 6px; }
.app-hint-tight { margin-top: -8px; }
.app-two { grid-template-columns: 1fr 1fr; }
.app-view-bar { flex-wrap: wrap; gap: 6px; }
/* the picture over a checkerboard, so a see-through background shows as one; sized to the window */
/* the stage has the picture's own shape (--ar, set by the tool), as big as the window allows; no empty sides */
.app-stage { --ar: 1; position: relative; display: block; border-radius: var(--ff-radius); border: 1px solid var(--ff-line); overflow: hidden;
  aspect-ratio: var(--ar); width: min(calc(100vw - 740px), calc((100vh - 230px) * var(--ar)), 1100px); min-width: 280px;
  background-color: #1b1720;
  background-image: linear-gradient(45deg, #26212c 25%, transparent 25%), linear-gradient(-45deg, #26212c 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #26212c 75%), linear-gradient(-45deg, transparent 75%, #26212c 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
@media (max-width: 860px) { .app-stage { width: 100%; max-width: calc((100vh - 120px) * var(--ar)); margin-inline: auto; } }
.app-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.app-canvas.is-dragging { cursor: grabbing; }
.app-drop-over { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; background: rgba(10, 6, 14, .72);
  border: 2px dashed var(--ff-brand); border-radius: inherit; font-size: 15px; pointer-events: none; }
.app-drop-over .ff-icon { width: 32px; height: 32px; color: var(--ff-brand); }
.app-export { flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.app-size { min-width: 190px; }
/* the item drop as one compact row: icon, then name and hint */
.app-drop { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; text-align: left; min-height: 0; }
.app-drop > .ff-icon { position: static; flex: none; }
.app-drop-text { display: grid; gap: 2px; min-width: 0; }
.app-drop-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* items used this visit (not remembered: web tools may not keep anything on the device) */
.app-recent { flex-wrap: wrap; gap: 6px; }
.app-recent button { width: 46px; height: 46px; padding: 3px; border-radius: 9px; border: 1px solid var(--ff-line); background: rgba(255, 255, 255, .04); cursor: pointer; }
.app-recent button:hover, .app-recent button.is-on { border-color: var(--ff-brand); }
.app-recent img { width: 100%; height: 100%; object-fit: contain; }
/* the rarity and background cards: a live preview (drawn by the tool) over the name */
.app-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.app-card { position: relative; display: grid; gap: 5px; padding: 4px 4px 7px; border-radius: 10px; border: 1px solid var(--ff-line);
  background: rgba(255, 255, 255, .03); color: inherit; font: 600 11.5px/1.15 var(--ff-font); cursor: pointer; text-align: center; }
.app-card:hover { background: rgba(255, 255, 255, .07); }
.app-card canvas, .app-card-none { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 7px; }
.app-card-none { background-color: #1b1720;
  background-image: linear-gradient(45deg, #2b2531 25%, transparent 25%), linear-gradient(-45deg, #2b2531 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2b2531 75%), linear-gradient(-45deg, transparent 75%, #2b2531 75%);
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0; }
.app-card > span:last-child { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 14px; }
.app-card.is-on { border-color: var(--ff-brand); box-shadow: inset 0 0 0 1px var(--ff-brand); }
.app-rarity.is-on { border-color: var(--rc); box-shadow: inset 0 0 0 1px var(--rc), 0 0 16px -6px var(--rc); }
.app-card.is-on::after { content: ''; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .35); }
.app-rarity i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 6px var(--rc); }
.app-rarity i.is-rainbow { background: conic-gradient(#ff3b3b, #ffe33b, #4fe06a, #3bc8ff, #c34bff, #ff3b3b); box-shadow: none; }
.app-cards-bg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-tabs { display: flex; flex-wrap: wrap; }
.app-help { margin-top: 14px; }
.app-foot { margin-top: 10px; text-align: center; }
/* our color picker (js/color.js): a swatch button with the hex, and a panel under it */
.app-cp { position: relative; }
.app-cp-swatch { display: flex; align-items: center; gap: 8px; width: 100%; height: 38px; padding: 0 10px 0 5px; cursor: pointer; text-align: left;
  font: 600 12px/1 var(--ff-mono); color: inherit; }
.app-cp-swatch i { flex: none; width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 0 0 1px rgba(0, 0, 0, .25); }
.app-cp-swatch span { overflow: hidden; text-overflow: ellipsis; }
.app-cp.is-open .app-cp-swatch { border-color: var(--ff-brand); }
.app-cp-panel { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: 244px; padding: 10px; border-radius: 12px;
  background: var(--ff-card-bg, #1d1520); border: 1px solid var(--ff-line-strong); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); }
.app-cp.to-left .app-cp-panel { left: auto; right: 0; }
.app-cp-sv { position: relative; height: 150px; border-radius: 9px; cursor: crosshair; touch-action: none;
  background-image: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent); }
.app-cp-hue { position: relative; height: 14px; margin-top: 10px; border-radius: 99px; cursor: pointer; touch-action: none;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.app-cp-sv b, .app-cp-hue b { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .5); pointer-events: none; }
.app-cp-hue b { top: 50%; }
.app-cp-row { display: flex; gap: 6px; margin-top: 10px; }
.app-cp-hex { flex: 1; min-width: 0; height: 32px; font: 600 13px/1 var(--ff-mono); text-transform: lowercase; }
.app-cp-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-top: 10px; }
.app-cp-presets button { aspect-ratio: 1; border-radius: 7px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.app-cp-presets button:hover { transform: scale(1.1); }

/* slider labels: the name on the left, the value on the right, on one line; pairs line up at the bottom */
.ff-field > .ff-label:has(> b[data-out]) { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; white-space: nowrap; }
.ff-label > b[data-out] { font-variant-numeric: tabular-nums; }
.app-two:has(.ff-range) { align-items: end; }

/* a slider's number can be clicked to type a value (js/value-edit.js) */
.ff-label b.ff-value { cursor: text; border-radius: 4px; padding: 0 2px; margin: 0 -2px; }
.ff-label b.ff-value:hover { background: rgba(255, 255, 255, .08); box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .35); }
.ff-value-edit { width: 6ch; height: 20px; padding: 0 4px; border: 1px solid var(--ff-brand); border-radius: 5px; background: rgba(0, 0, 0, .35);
  color: inherit; font: inherit; text-align: right; -moz-appearance: textfield; }
.ff-value-edit::-webkit-outer-spin-button, .ff-value-edit::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ff-value-edit:focus { outline: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }
@media (max-width: 1180px) { .app-stage { width: min(calc(100vw - 440px), calc((100vh - 230px) * var(--ar)), 1100px); } }
@media (max-width: 860px) { .app-stage { width: 100%; max-width: calc((100vh - 120px) * var(--ar)); margin-inline: auto; } }

/* Side by side (wide windows): the whole tool fits the window, no page scrolling. The picture takes the height that's
   left; a setting column that's still too tall scrolls inside itself, never the page. Hints become tooltips. */
@media (min-width: 1181px) {
  html, body { height: 100%; overflow: hidden; }
  .app { height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; padding: 10px 16px 12px; }
  .app-top { flex: none; padding: 0 4px 8px; }
  .app-grid { flex: 1; min-height: 0; align-items: stretch; }
  .app-main { align-self: start; }
  .app-side { min-height: 0; max-height: 100%; overflow-y: auto; gap: 10px; scrollbar-width: thin; }
  .app-side .ff-hint { display: none; }
  .app-side .app-two .ff-label { font-size: 12px; gap: 4px; }
  .app-stage { width: min(calc(100vw - 740px), calc((100vh - 255px) * var(--ar)), 1100px); }
  .app-cards, .app-cards-bg { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .app-card { padding: 3px 3px 5px; gap: 3px; font-size: 10.5px; }
  .app-card.is-on::after { top: 6px; right: 6px; width: 7px; height: 7px; }
  .app-main .app-foot { margin: 0; text-align: left; font-size: 11px; line-height: 1.35; }
  .app-view-bar { flex-wrap: nowrap; }
  .app-view-bar > [data-hint] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-view-bar > .ff-btn { flex: none; }
  .app-left .app-help { margin-top: 2px; }
}
/* every card the same size: equal columns, names on one line (cut with "..." if ever too long) */
.app-card { min-width: 0; }
.app-card > span:last-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-card > span:last-child i { flex: none; }
@media (min-width: 1181px) {
  .app-card > span:last-child { gap: 4px; font-size: 10px; letter-spacing: -.01em; }
  .app-rarity i { width: 7px; height: 7px; }
}
/* wide windows: one continuous panel, a divider line between its parts (item and rarity | picture | background) */
@media (min-width: 1181px) {
  .app-grid { gap: 0; width: fit-content; max-width: 100%; margin-inline: auto; border: 1px solid var(--ff-card-border, var(--ff-line));
    border-radius: var(--ff-card-radius, var(--ff-radius)); background: var(--ff-card-bg, var(--ff-panel)); overflow: hidden; }
  .app-grid > .ff-card { border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .app-grid > .app-left { border-right: 1px solid var(--ff-line); }
  .app-grid > .app-right { border-left: 1px solid var(--ff-line); }
}
