/* ==========================================================================
   Telegram sign-in + meme upload.

   Sits inside the search block on the memes page, closed by default: only a
   handful of accounts can upload, so it stays out of everyone else's way.
   ========================================================================== */

/* ------------------------------------------------- coming back from Telegram --- */

#mu-returning {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 3, 8, 0.94);
}

.mu-returning-box {
  text-align: center;
  color: #fff;
  font-family: 'Space Grotesk', system-ui, sans-serif;
}

.mu-returning-box p {
  margin: 1rem 0 0.3rem;
  font-size: 1.1rem;
}

.mu-returning-box small {
  color: #8b889b;
  font-size: 0.85rem;
}

.mu-returning-spin {
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--sk-accent, #ff3df0);
  border-radius: 50%;
  animation: mu-spin 0.8s linear infinite;
}

@keyframes mu-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .mu-returning-spin { animation-duration: 2.4s; }
}

/* --------------------------------------------------------------- panel --- */

.mu-ok {
  color: #19e3ff;
}

.mu-idrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.9rem;
}

.mu-idrow code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.2);
  color: #fff;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.95rem;
  text-overflow: ellipsis;
}

.mu-open {
  margin-top: 0.9rem;
  margin-left: 0.5rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(127, 127, 127, 0.35);
  border-radius: 999px;
  background: var(--mt-field, #000);
  color: var(--text-secondary, #808080);
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.mu-open:hover {
  color: var(--mt-accent, #ff3df0);
  border-color: var(--mt-accent, #ff3df0);
}

.mu-panel {
  margin-top: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--mt-accent, #ff3df0);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.6);
}

.mu-panel[hidden] {
  display: none;
}

.mu-note {
  margin: 0 0 0.75rem;
  color: var(--text-primary, #fff);
  font-size: 0.9rem;
}

.mu-note b {
  color: var(--mt-accent, #ff3df0);
}

.mu-id {
  margin: 0 0 0.75rem;
  color: var(--text-secondary, #808080);
  font-size: 0.82rem;
  line-height: 1.6;
}

.mu-id code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.2);
  color: var(--text-primary, #fff);
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.85em;
}

.mu-error {
  color: #ff5c5c;
}

.mu-steps {
  margin: 0 0 0.9rem;
  padding-left: 1.3rem;
  color: var(--text-secondary, #808080);
  font-size: 0.86rem;
  line-height: 1.7;
}

.mu-steps li::marker {
  color: var(--mt-accent, #ff3df0);
}

.mu-steps b {
  color: var(--text-primary, #fff);
}

/* The step nobody expects: the button comes back and needs pressing again. */
.mu-step-watch {
  color: var(--text-primary, #fff);
}

/* ------------------------------------------------------------- drop zone --- */

.mu-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.5rem 1rem;
  border: 2px dashed rgba(127, 127, 127, 0.4);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-secondary, #808080);
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.mu-drop:hover,
.mu-drop.is-over {
  border-color: var(--mt-accent, #ff3df0);
  color: var(--text-primary, #fff);
  background: rgba(0, 0, 0, 0.6);
}

.mu-drop-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.mu-drop-text {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- form --- */

.mu-tags {
  width: 100%;
  margin-top: 0.7rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 8px;
  outline: none;
  background: #000;
  color: var(--text-primary, #fff);
  font: inherit;
  font-size: 0.9rem;
}

.mu-tags:focus {
  border-color: var(--mt-accent, #ff3df0);
}

.mu-tags::placeholder {
  color: var(--text-secondary, #808080);
}

.mu-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.mu-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--mt-accent, #ff3df0);
  border-radius: 999px;
  background: var(--mt-accent, #ff3df0);
  color: #000;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mu-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.mu-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mu-ghost {
  background: transparent;
  border-color: rgba(127, 127, 127, 0.35);
  color: var(--text-secondary, #808080);
  font-weight: 400;
}

.mu-ghost:hover {
  color: var(--text-primary, #fff);
  border-color: var(--text-secondary, #808080);
}

/* -------------------------------------------------------------- progress --- */

.mu-progress {
  overflow: hidden;
  height: 6px;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.2);
}

.mu-progress[hidden] {
  display: none;
}

.mu-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--mt-accent, #ff3df0);
  transition: width 0.2s ease;
}

/* The bytes are all sent and the server is resizing. Nothing left to measure,
   so the bar sweeps rather than sitting at a fake 100%. */
.mu-progress.is-working .mu-progress-fill {
  animation: mu-sweep 1.1s ease-in-out infinite;
}

@keyframes mu-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .mu-progress.is-working .mu-progress-fill {
    animation: none;
    opacity: 0.6;
  }
}

.mu-msg {
  min-height: 1.1rem;
  margin-top: 0.6rem;
  color: var(--text-secondary, #808080);
  font-size: 0.85rem;
}

.mu-msg.mu-error {
  color: #ff5c5c;
}

/* ------------------------------------------------------- who can upload --- */

.mu-who {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(127, 127, 127, 0.25);
}

.mu-who summary {
  color: var(--text-secondary, #808080);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.mu-who summary:hover {
  color: var(--mt-accent, #ff3df0);
}

.mu-people {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.7rem;
}

.mu-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid rgba(127, 127, 127, 0.25);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
}

.mu-person.role-uploader {
  border-color: rgba(25, 227, 255, 0.45);
}

.mu-person.role-superadmin {
  border-color: rgba(255, 198, 26, 0.5);
}

.mu-person-who {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.mu-person-name {
  overflow: hidden;
  color: var(--text-primary, #fff);
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mu-person-note {
  color: var(--text-secondary, #808080);
  font-size: 0.72rem;
}

.mu-person-note:empty {
  display: none;
}

.mu-person-role {
  flex: none;
  padding: 0.3rem 0.5rem;
  border: 1px solid rgba(127, 127, 127, 0.4);
  border-radius: 6px;
  background: #000;
  color: var(--text-primary, #fff);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.mu-person-role:focus {
  outline: none;
  border-color: var(--mt-accent, #ff3df0);
}

.mu-person-role:disabled {
  opacity: 0.5;
  cursor: wait;
}

.role-uploader .mu-person-role {
  border-color: rgba(25, 227, 255, 0.5);
  color: #19e3ff;
}

.role-superadmin .mu-person-role {
  border-color: rgba(255, 198, 26, 0.55);
  color: #ffc61a;
}

.mu-person-fixed {
  flex: none;
  color: #19e3ff;
  font-size: 0.72rem;
  opacity: 0.7;
}

.mu-byid {
  margin-top: 0.8rem;
}

.mu-byid summary {
  color: var(--text-secondary, #808080);
  font-size: 0.75rem;
  cursor: pointer;
}

.mu-add {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.mu-add input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 6px;
  outline: none;
  background: #000;
  color: var(--text-primary, #fff);
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.85rem;
}

.mu-add input:focus {
  border-color: var(--mt-accent, #ff3df0);
}

@media (max-width: 640px) {
  .mu-row {
    flex-wrap: wrap;
  }

  .mu-btn {
    flex: 1;
  }
}
