#auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at center, #16100c 0%, #060403 70%, #000 100%);
  display: none;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #d8c8a8;
  padding: 24px;
}

#auth-overlay.open { display: flex; }
#auth-overlay [hidden] { display: none !important; }

#auth-overlay .auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 24px 24px;
  background: rgba(20, 14, 11, 0.9);
  border: 1px solid rgba(204, 106, 64, 0.28);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.62),
              inset 0 1px 0 rgba(255, 220, 180, 0.04);
}

#auth-overlay .auth-wordmark {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.42em;
  text-align: center;
  color: #d8c8a8;
  text-shadow: 0 0 24px rgba(204, 106, 64, 0.35);
  padding-left: 0.42em;
}

#auth-overlay .auth-tag {
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.58;
  margin: 8px 0 24px;
}

#auth-overlay .auth-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#auth-overlay button,
#auth-overlay .auth-input {
  box-sizing: border-box;
  min-height: 44px;
  width: 100%;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}

#auth-overlay textarea.auth-input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

#auth-overlay button {
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.05s ease;
}

#auth-overlay button:active { transform: scale(0.98); }

#auth-overlay button:focus-visible,
#auth-overlay .auth-input:focus-visible {
  outline: 2px solid rgba(255, 126, 72, 0.85);
  outline-offset: 2px;
}

#auth-overlay .auth-google-btn,
#auth-overlay .auth-link-google-btn {
  background: #e34b18;
  color: #fff;
  font-weight: 650;
}

#auth-overlay .auth-google-btn:hover,
#auth-overlay .auth-link-google-btn:hover { background: #f05b25; }

#auth-overlay .auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.42;
  margin: 6px 0;
}

#auth-overlay .auth-divider::before,
#auth-overlay .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(216, 200, 168, 0.18);
}

#auth-overlay .auth-input {
  color: #f1dfbd;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(216, 200, 168, 0.22);
  padding: 11px 14px;
  outline: none;
}

#auth-overlay .auth-input:focus { border-color: rgba(204, 106, 64, 0.75); }
#auth-overlay .auth-input::placeholder { color: rgba(216, 200, 168, 0.38); }

#auth-overlay .auth-email-btn,
#auth-overlay .auth-resend-btn {
  background: rgba(216, 200, 168, 0.09);
  border: 1px solid rgba(216, 200, 168, 0.23);
  color: #e4d2b2;
  font-weight: 600;
}

#auth-overlay .auth-email-btn:hover,
#auth-overlay .auth-resend-btn:hover { background: rgba(216, 200, 168, 0.15); }

#auth-overlay .auth-secondary-btn {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(216, 200, 168, 0.72);
}

#auth-overlay .auth-secondary-btn:hover {
  background: rgba(216, 200, 168, 0.06);
  color: #e4d2b2;
}

#auth-overlay button:disabled,
#auth-overlay .auth-input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#auth-overlay .auth-message {
  text-align: center;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(232, 218, 190, 0.8);
  margin: 0 0 4px;
}

#auth-overlay .auth-check-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 6px;
  border: 1px solid rgba(166, 255, 0, 0.5);
  border-radius: 50%;
  color: #a6ff00;
  display: grid;
  place-items: center;
  font-size: 24px;
}

#auth-overlay .auth-status {
  min-height: 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  color: #ef9a79;
  margin-top: 14px;
}

#auth-overlay .auth-status.success { color: #a6ff00; }

#auth-overlay .auth-spinner {
  width: 18px;
  height: 18px;
  margin: 14px auto 0;
  border: 2px solid rgba(216, 200, 168, 0.2);
  border-top-color: #ef7b4b;
  border-radius: 50%;
  animation: veil-auth-spin 0.75s linear infinite;
}

@keyframes veil-auth-spin { to { transform: rotate(360deg); } }

#auth-overlay .auth-foot {
  text-align: center;
  font-size: 11px;
  opacity: 0.48;
  margin-top: 14px;
  line-height: 1.5;
}

#auth-overlay .access-card { max-width: 440px; }
#auth-overlay .access-message { margin-bottom: 14px; }
#auth-overlay .access-identity {
  padding: 9px 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(216, 200, 168, 0.16);
  border-radius: 8px;
  color: rgba(240, 216, 176, 0.76);
  font-size: 12px;
  text-align: center;
  word-break: break-all;
}
#auth-overlay .access-note-label,
#auth-overlay .mcc-label {
  color: rgba(240, 216, 176, 0.78);
  font-size: 12px;
  line-height: 1.4;
}
#auth-overlay .access-actions { margin-top: 14px; }
#auth-overlay .note-editor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
#auth-overlay .note-editor-header .auth-wordmark,
#auth-overlay .note-editor-header .auth-tag { text-align: left; padding-left: 0; }
#auth-overlay .note-editor-header .auth-tag { margin-bottom: 16px; }

#auth-overlay .mcc-card {
  width: min(920px, 100%);
  max-height: min(840px, calc(100vh - 32px));
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(204, 106, 64, 0.3);
  border-radius: 14px;
  background: rgba(20, 14, 11, 0.97);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.72);
}
#auth-overlay .mcc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
#auth-overlay .mcc-header .auth-wordmark { text-align: left; font-size: 20px; padding-left: 0; }
#auth-overlay .mcc-header h1 {
  margin-top: 6px;
  color: #f0d8b0;
  font-size: 20px;
  letter-spacing: 0.06em;
}
#auth-overlay .mcc-close {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border: 1px solid rgba(216, 200, 168, 0.25);
  background: rgba(216, 200, 168, 0.06);
  font-size: 26px;
}
#auth-overlay .mcc-summary,
#auth-overlay .mcc-status {
  margin-top: 12px;
  color: rgba(216, 200, 168, 0.66);
  font-size: 12px;
  line-height: 1.5;
}
#auth-overlay .mcc-status.error { color: #ef9a79; }
#auth-overlay .mcc-list { display: grid; gap: 14px; margin-top: 18px; }
#auth-overlay .mcc-player {
  padding: 16px;
  border: 1px solid rgba(216, 200, 168, 0.17);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
#auth-overlay .mcc-player-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
#auth-overlay .mcc-player-heading > div { display: grid; gap: 3px; min-width: 0; }
#auth-overlay .mcc-player-heading strong,
#auth-overlay .mcc-player-heading span { overflow-wrap: anywhere; }
#auth-overlay .mcc-player-heading strong { color: #f0d8b0; font-size: 14px; }
#auth-overlay .mcc-player-heading div span { color: rgba(216, 200, 168, 0.6); font-size: 11px; }
#auth-overlay .mcc-badge {
  flex: none;
  padding: 5px 8px;
  border: 1px solid rgba(216, 200, 168, 0.25);
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
}
#auth-overlay .mcc-badge.approved { color: #a6ff00; border-color: rgba(166, 255, 0, 0.35); }
#auth-overlay .mcc-badge.rejected,
#auth-overlay .mcc-badge.suspended { color: #ef9a79; border-color: rgba(239, 154, 121, 0.4); }
#auth-overlay .mcc-meta { margin: 9px 0 13px; color: rgba(216, 200, 168, 0.45); font-size: 10px; overflow-wrap: anywhere; }
#auth-overlay .mcc-label { display: grid; gap: 6px; margin-top: 12px; }
#auth-overlay .mcc-player-note {
  margin-top: 6px;
  padding: 10px 12px;
  border-left: 2px solid rgba(204, 106, 64, 0.5);
  color: rgba(232, 218, 190, 0.84);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}
#auth-overlay .mcc-note {
  box-sizing: border-box;
  width: 100%;
  min-height: 76px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid rgba(216, 200, 168, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: #f1dfbd;
  font: 12px/1.45 inherit;
}
#auth-overlay .mcc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#auth-overlay .mcc-button {
  width: auto;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(216, 200, 168, 0.22);
  background: rgba(216, 200, 168, 0.08);
  font-size: 12px;
}
#auth-overlay .mcc-button.primary { background: #a6401f; color: #fff; border-color: #c85b32; }
#auth-overlay .mcc-audit { margin-top: 26px; }
#auth-overlay .mcc-audit h2 {
  margin: 0 0 12px;
  color: #f0d8b0;
  font-size: 16px;
  letter-spacing: 0.05em;
}
#auth-overlay .mcc-audit-list { display: grid; gap: 8px; }
#auth-overlay .mcc-audit-event {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(180px, 1fr);
  gap: 4px 12px;
  padding: 11px 12px;
  border: 1px solid rgba(216, 200, 168, 0.13);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  overflow-wrap: anywhere;
}
#auth-overlay .mcc-audit-event strong {
  color: #f0d8b0;
  font-size: 12px;
  text-transform: capitalize;
}
#auth-overlay .mcc-audit-event span { color: rgba(232, 218, 190, 0.8); font-size: 12px; }
#auth-overlay .mcc-audit-event small {
  grid-column: 1 / -1;
  color: rgba(216, 200, 168, 0.45);
  font-size: 10px;
}
#auth-overlay .mcc-audit-empty { color: rgba(216, 200, 168, 0.55); font-size: 12px; }

@media (max-width: 480px) {
  #auth-overlay { padding: 16px; }
  #auth-overlay .auth-card { padding: 28px 18px 20px; }
  #auth-overlay .mcc-card { max-height: calc(100vh - 20px); padding: 18px 14px; }
  #auth-overlay .mcc-actions { display: grid; grid-template-columns: 1fr 1fr; }
  #auth-overlay .mcc-button { width: 100%; }
  #auth-overlay .mcc-audit-event { grid-template-columns: 1fr; }
  #auth-overlay .mcc-audit-event small { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  #auth-overlay button { transition: none; }
}
