/* Emoji Riddles (em-). Tokens only, so light and dark mode both work. */

.em {
  display: grid;
  gap: 16px;
  min-width: 0;
}
.em-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* emoji rows */
.em-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.08em;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  line-height: 1.15;
  user-select: none;
}
.em-lg {
  font-size: clamp(44px, 9vw, 80px);
}
.em-md {
  font-size: clamp(28px, 4vw, 38px);
}
.em-e {
  display: inline-block;
  animation: pop-in 0.35s var(--ease) both;
}
.em-gap {
  display: inline-block;
  width: 0.45em;
}

/* write phase */
.em-secret {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  /* always dark, so the lime answer stays readable in both themes */
  background: #16161b;
  color: #eef0e8;
}
.em-secret > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.em-secret-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.75;
}
.em-secret-answer {
  font-family: var(--meme);
  font-weight: 400;
  font-size: clamp(28px, 4.5vw, 40px);
  line-height: 1.1;
  color: var(--accent);
  overflow-wrap: anywhere;
}
.em-secret .btn {
  background: #fbfbf8;
  color: #16161b;
}
.em-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 20px 20px 28px;
}
.em-preview.empty {
  border-style: dashed;
  box-shadow: none;
  text-align: center;
}
.em-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.em-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.em-type {
  flex: 1;
  min-width: 160px;
  min-height: 40px;
  font-size: 16px;
}
.em-picker {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
}
.em-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.em-tabs button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: var(--bw) solid transparent;
  border-radius: 10px;
  background: transparent;
  font-weight: 750;
  font-size: 14px;
  cursor: pointer;
}
.em-tabs button.on {
  border-color: var(--line);
  background: var(--accent);
  color: var(--accent-ink);
}
.em-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 2px;
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.em-grid button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  transition: transform 0.12s var(--ease), background-color 0.12s;
}
.em-grid button:hover:not(:disabled) {
  background: var(--paper-2);
  transform: scale(1.12);
}
.em-grid button:active:not(:disabled) {
  transform: scale(0.92);
}
.em-grid button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* guess and reveal */
.em-stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
  text-align: center;
  animation: meme-in 0.45s var(--ease) both;
}
.em-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.em-by,
.em-credit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.em-by .av,
.em-credit .av {
  border-width: 1.5px;
  font-size: 13px;
}
.em-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ink-2);
}
.em-answer-small {
  font-weight: 800;
  font-size: 18px;
}
.em-answer {
  font-family: var(--meme);
  font-size: clamp(32px, 6vw, 58px);
  line-height: 1.05;
  animation: slam 0.55s var(--ease) both;
  overflow-wrap: anywhere;
}
.em-revealed {
  background: var(--accent);
  color: var(--accent-ink);
}
.em-revealed .muted {
  color: inherit;
  opacity: 0.75;
}
.em-guess-form {
  display: flex;
  gap: 10px;
}
.em-guess-form .input {
  flex: 1;
  min-width: 0;
  font-size: 19px;
}
.em-fb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.em-got {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  animation: pop-in 0.35s var(--ease) both;
}
.em-got .ic {
  width: 26px;
  height: 26px;
}
.em-solvers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.em-solver {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: var(--bw) solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: 14px;
  animation: pop-in 0.35s var(--ease) both;
}
.em-rank {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  font-size: 12px;
}
.em-solver .av {
  border-width: 1.5px;
  font-size: 15px;
}
.em-solver-name {
  font-weight: 750;
}

/* final gallery */
.em-final {
  display: grid;
  gap: 16px;
}
.em-final-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.em-final-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
}
.em-final-card strong {
  font-size: 17px;
}
.em-final-card .muted {
  font-size: 13px;
}

@media (max-width: 760px) {
  .em-guess-form {
    flex-direction: column;
  }
  .em-grid {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    max-height: 200px;
  }
  .em-tabs button span {
    display: none;
  }
}
