/* NineFavorites — standalone page, same old-web chrome as itemlabel world.
   Palette: #000000, #ffffff, #3a3a3a, #d9d9d9 (monochrome by design), except
   the visitor-picked background (colors/images from the editor, see main.js)
   and the editor's slot tint.
   #ff00ff is reserved for "missing image" placeholders only.
   #ff0000 marks a slot with a species picked but no character yet. */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: #3a3a3a;
}

body {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 15px;
  color: #000000;
  min-height: 100vh;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: #ffffff;
  border-left: 3px solid #000000;
  border-right: 3px solid #000000;
}

h1 {
  font-family: 'Trebuchet MS', Verdana, sans-serif;
  letter-spacing: 0.5px;
}

/* --nf-bg / --nf-ink / --nf-fx and the background image are set from the
   visitor's background pick; images tile from the top left (main.js sets the
   size). */
.nf {
  min-height: 100vh;
  padding: 12px 14px 40px;
  background-color: var(--nf-bg, #ffffff);
  background-repeat: repeat;
  background-position: 0 0;
  color: var(--nf-ink, #000000);
}

.nf-header img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  margin: 6px auto 0;
}

/* header image link is broken */
.nf-header.missing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  margin-top: 6px;
  background: #ff00ff;
  color: #ffffff;
  font: bold 34px 'Trebuchet MS', Verdana, sans-serif;
}

/* the background's text stroke/shadow (--nf-fx, set by main.js) */
.nf h1,
.nf-who > span:first-child {
  filter: var(--nf-fx, none);
}

.nf h1 {
  font-size: 24px;
  margin: 6px 0 10px;
  border-bottom: 3px double currentColor;
  padding-bottom: 6px;
  text-align: center;
}

.nf-who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nf-who > span:first-child {
  min-width: 96px;
}

.nf-who input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font: 15px Verdana, sans-serif;
  background: #ffffff;
  border: 2px inset #d9d9d9;
}

.nf-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.nf-swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  background-position: center;
  background-size: cover;
  border: 2px inset #d9d9d9;
  cursor: pointer;
}

.nf-swatch[aria-pressed='true'] {
  outline: 3px solid #000000;
  box-shadow: 0 0 0 5px #ffffff;
  position: relative;
}

/* ---- 3x3 grid ---- */

.nf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.nf-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.nf-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  color: inherit;
  /* see-through unless the editor sets a slot tint */
  background: var(--nf-slot, transparent);
  border: 3px ridge #3a3a3a;
  cursor: pointer;
  overflow: hidden;
}

.nf-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nf-slot-empty {
  font: bold 34px 'Trebuchet MS', Verdana, sans-serif;
  opacity: 0.6;
}

.nf-slot.missing {
  background: #ff00ff;
}

.nf-slot.missing .nf-slot-empty {
  color: #ffffff;
  opacity: 1;
}

.nf-cell select {
  width: 100%;
  min-height: 34px;
  padding: 4px;
  font: 12px Verdana, sans-serif;
  background: #ffffff;
  border: 2px inset #d9d9d9;
}

/* species picked, character not yet */
.nf-cell.unfinished .nf-slot {
  border: 3px solid #ff0000;
}

.nf-cell.unfinished .nf-sub {
  border: 2px solid #ff0000;
}

/* ---- actions ---- */

.nf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 6px;
}

.chunky-button {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 16px;
  min-height: 44px;
  font: bold 15px Verdana, sans-serif;
  color: #000000;
  background: #d9d9d9;
  border: 3px outset #d9d9d9;
  text-decoration: none;
  cursor: pointer;
}

.chunky-button:active {
  border-style: inset;
}

.chunky-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---- share preview ---- */

/* The dialog itself is see-through: its padding is room for the ✕, which
   floats past the frame's top right corner (straight above it on phones). */
.nf-dialog {
  width: min(664px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  padding: 52px;
  overflow: auto;
  background: transparent;
  border: 0;
}

.nf-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.nf-frame {
  padding: 12px;
  background: #ffffff;
  border: 3px outset #d9d9d9;
  outline: 3px solid #000000;
}

.nf-close {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
}

@media (max-width: 640px) {
  .nf-dialog {
    padding: 52px 3px;
  }
}

.nf-dialog img {
  display: block;
  width: 100%;
  border: 2px inset #d9d9d9;
}

.nf-status {
  margin: 10px 0 0;
  font-size: 13px;
  text-align: center;
}

.nf-status:empty {
  display: none;
}

/* Share, or what the hovered button does; keeps its height so the buttons
   don't jump */
.nf-hint {
  min-height: 1.3em;
  margin: 12px 0 -6px;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
}
